database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
PostgreSQL
Firebird
Oracle
ㆍInformix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
Informix Q&A 491 게시물 읽기
No. 491
dbload 유틸리티 사용시 필요한 command 생성 스크립트
작성자
shell script
작성일
2001-02-06 10:49
조회수
5,834

dbload 유틸리티를 사용할때 필요한 command file을 생성하여 주는 스크립트입니다. 해당 데이타베이스에 있는 모든 테이블에 대하여 만들어 줍니다. 또, dbexport 로 받은 데이타를 로드할때도 사용할수 있어요. (dbloadcmd.sh, dbloadcmd2.sh 두개의 파일이 있습니다.)

 

 

dbloadcmd.sh

========================

 

#!/bin/sh

#name: dbloadcmd.sh

#desc: Generates dbload cmd file for all tables in Database

#parameters: database name

#default u/load file name is the same as table name ( ex, tabname.unl )

#default delimiter is "|"

#pls run this output in directory of backed-up

 

 

if [ $# -gt 0 ] ; then

db=$1

else

echo Usage: dbloadcmd.sh database

exit 1

fi

 

dbaccess $db 2>/dev/null <<EOT!!! | awk '

BEGIN { first = 1 }

/^$/ { next }

{ tbl = $1;

colno=$2;

printf("file %s.unl delimiter "|" %s ; insert into %s;\n",tbl,colno,tbl);

next;

}

'

output to pipe cat without headings

select distinct tabname, ncols

from systables

where systables.tabid > 99

and systables.tabtype = "T"

EOT!!!

 

 

 

dbloadcmd2.sh

====================

 

#!/bin/sh

#name: dbloadcmd.sh

#desc: Generates dbload cmd file for all tables in Database

#parameters: database name

#default u/load file name is the same as table name ( ex, tabname.unl )

#default delimiter is "|"

#pls run this output in directory of backed-up

 

 

if [ $# -gt 0 ] ; then

db=$1

else

echo Usage: dbloadcmd.sh database

exit 1

fi

 

dbaccess $db 2>/dev/null <<EOT!!! | awk '

BEGIN { first = 1 }

/^$/ { next }

{ tbl = $1;

colno=$2;

tabid=$3;

printf("file %5.5s%5.5d.unl delimiter "|" %s ; insert into %s;\n",tbl,tabid,colno,tbl);

next;

}

'

output to pipe cat without headings

select distinct tabname, ncols, tabid

from systables

where systables.tabid > 99

and systables.tabtype = "T"

EOT!!!

[Top]
No.
제목
작성자
작성일
조회
495Solaris 8 Intel 에 IFS 2000 9.x 버전 설치하는법 ..
곽여송
2001-02-07
5058
503┕>Re: Solaris 8 Intel 에 IFS 2000 9.x 버전 설치하는법 ..
박영길
2001-02-08 23:30:29
5580
511┕>Re: Solaris 8 Intel 에 IFS 2000 9.x 버전 설치하는법 ..
딧세
2001-02-12 13:46:58
5194
493text 형에서의 like 검색하는 방법이 정말 없는지요.
2001-02-06
5062
494┕>Re: text 형에서의 like 검색하는 방법이 정말 없는지요.
박영길
2001-02-06 21:33:34
6197
496 ┕>웹데이터 블레이드를 설치하는데 문제가....
2001-02-07 21:48:49
5206
500  ┕>Re: 웹데이터 블레이드를 설치하는데 문제가....
박영길
2001-02-08 23:09:34
5318
492IIF2000,IDS2000(LINUX) DOWNLOAD
정재익
2001-02-06
5552
491dbload 유틸리티 사용시 필요한 command 생성 스크립트
shell script
2001-02-06
5834
489디비단위의 권한 제어 shell script
shell script
2001-02-06
5318
487두시간의 시간차이를 구하는 함수
SPLtip
2001-02-06
5904
485이미지 데이터가 담긴 MS_SQL 디비를 INFORMIX로 IMPORT 할 수 없나여?
man02
2001-02-04
5113
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.026초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다