export file을 split하여 받는 방법
=================================
이 자료는 export시 2GB이상의 export dump file을 만들지 못하는 제약사항에 대하여 여러 export file로 나누어 받는 방법을 설명한다.
!!! IMPORTANT: 이 방법은 반드시 KORN SHELL (KSH) 에서 작업해야 한다. !!!
만일 ksh을 쓰지 않을 경우는 unix prompt에서 ksh라고 치면 변경이 된다.
unix pipe와 split command를 사용하여 disk에 1024m(약1GB)씩 export file이 생기면서 export된다.
export나 import시 제공되는 모든 parameter의 추가적인 사용이 가능하다.
Export command:
echo|exp file=>(split -b 1024m - expdmp-) userid=scott/tiger tables=X
사용예> echo|exp file=>(split -b 1024m - expdmp-) userid=scott/tiger log=scott.log
위와 같이 split하여 export를 받을 경우 file name은 expdmp-aa, expdmp-ab...expdmp-az, expdmp-ba... 으로 생성된다.
Import command:
echo|imp file=<(cat expdmp-*) userid=scott/tiger tables=X
사용예>echo|imp file=<(cat expdmp-*) userid=scott/tiger ignore=y commit=y
split와 compress를 같이 사용해도 가능하다.
Export command:
echo|exp file=>(compress|split -b 1024m - expdmp-) userid=scott/tiger tables=X
Import command:
echo|imp file=<(cat expdmp-*|uncompress) userid=scott/tiger tables=X
*** 위의 작업을 solaris에서 test가 되었다. os종류에 따라서 shall command는 달라질 수 있다.
이외에도 split command를 사용하지 않고 unix pipe와 compress를 사용하여 3-step의 작업으로 export file size limit의 회피를 위한 방법도 가능하다.
Export command:
1) Make the pipe
mknod /tmp/exp_pipe p
2) Compress in background
compress < /tmp/exp_pipe > export.dmp.Z &
-or-
cat p | compress > output.Z &
-or-
cat p > output.file & )
3) Export to the pipe
exp file=/tmp/exp_pipe userid=scott/tiger tables=X
Import command:
1) Make the pipe
mknod /tmp/imp_pipe p
2) uncompress in background
uncompress < export.dmp.Z > /tmp/imp_pipe &
-or-
cat output_file > /tmp/imp_pipe &
3) Import thru the pipe
imp file=/tmp/imp_pipe userid=scott/tiger tables=X
원본 출처 : http://211.47.158.189/unit/mysql/board/viewbody.php3?code=board3&page=1&number=166&keyfield=&key=
|