銆恊xp/imp銆�灏哢S7ASCII瀛楃闆嗙殑dmp鏂囦欢瀵煎叆鍒癦HS16GBK瀛楃闆嗙殑鏁版嵁搴撲腑
1.1BLOG鏂囨。缁撴瀯鍥�
1.2鍓嶈█閮ㄥ垎
1.2.1瀵艰鍜屾敞鎰忎簨椤�
鍚勪綅鎶�鏈埍濂借�咃紝鐪嬪畬鏈枃鍚庯紝浣犲彲浠ユ帉鎻″涓嬬殑鎶�鑳斤紝涔熷彲浠ュ鍒颁竴浜涘叾瀹冧綘鎵�涓嶇煡閬撶殑鐭ヨ瘑锛寏O(鈭鈭�)O~锛�
鈶犲浣曞皢US7ASCII瀛楃闆嗙殑dmp鏂囦欢瀵煎叆鍒癦HS16GBK瀛楃闆嗙殑鏁版嵁搴撲腑锛堥噸鐐癸紝2绉嶆柟娉曪級锛�
鈶′粠dmp鏂囦欢鍙互鑾峰彇鍒板摢浜涗俊鎭紵濡備綍浠巇mp鏂囦欢鑾峰彇鍒癲mp鏂囦欢鐨勫瓧绗﹂泦锛堥噸鐐癸紝N绉嶆柟娉曪級锛�
鈶㈠浣曚粠dmp鏂囦欢涓幏鍙栧埌鍏朵腑鐨凞DL璇彞锛屼緥濡傚缓琛ㄣ�佸缓绱㈠紩璇彞绛夛紙2绉嶆柟娉曪級
鈶mp鏂囦欢瀵煎叆鐨勪竴鑸楠�
鈶mp宸ュ叿鐨刬ndexfile閫夐」鐨勪綔鐢�
鈶ヨ蒋浠禪E銆丒ditPlus銆丳ilotedit杞欢鐨勪娇鐢�
Tips锛�
鈶犳湰鏂囧湪itpub锛�http://blog.itpub.net/26736162锛夈�佸崥瀹㈠洯(http://www.cnblogs.com/lhrbest)鍜屽井淇″叕浼楀彿锛坸iaomaimiaolhr锛変笂鏈夊悓姝ユ洿鏂般��
鈶℃枃绔犱腑鐢ㄥ埌鐨勬墍鏈変唬鐮併�佺浉鍏宠蒋浠躲�佺浉鍏宠祫鏂欏強鏈枃鐨刾df鐗堟湰閮借鍓嶅線灏忛害鑻楃殑浜戠洏涓嬭浇锛屽皬楹﹁嫍鐨勪簯鐩樺湴鍧�瑙侊細http://blog.itpub.net/26736162/viewspace-1624453/銆�
鈶㈣嫢缃戦〉鏂囩珷浠g爜鏍煎紡鏈夐敊涔憋紝璇蜂笅杞絧df鏍煎紡鐨勬枃妗f潵闃呰銆�
鈶e湪鏈瘒BLOG涓紝浠g爜杈撳嚭閮ㄥ垎涓�鑸斁鍦ㄤ竴琛屼竴鍒楃殑琛ㄦ牸涓��
鈶� 鏈枃閫傚悎浜嶰racle鍒濅腑绾т汉鍛橀槄璇伙紝Oracle澶у笀璇风暐杩囨湰鏂囥��
鏈枃鑻�鏈夐敊璇垨涓嶅畬鍠勭殑鍦版柟璇峰ぇ瀹跺澶氭寚姝o紝鎮ㄧ殑鎵硅瘎鎸囨鏄垜鍐欎綔鐨勬渶澶у姩鍔涖��
1.3鏈枃鐩稿叧鐭ヨ瘑鐐�
1.3.1鍙互浠�dmp鏂囦欢鑾峰彇鍝簺淇℃伅锛�
鍦ㄥ紑鍙戜腑甯稿父纰板埌锛岄渶瑕佸鍏mp鏂囦欢鍒扮幇鏈夋暟鎹簱銆傝繖閲岀殑dmp鏂囦欢鍙兘鏉ヨ嚜浜庡叾瀹冪郴缁燂紝鎵�浠ワ紝涓�鑸儏鍐典笅鏄笉鐭ラ亾瀵煎嚭绋嬪簭锛坋xp锛夌殑鐗堟湰銆佸鍑烘椂闂存垨鑰呭鍑烘ā寮忕瓑淇℃伅鐨勩�傞偅涔堝浣曚粠鐜版湁鐨刣mp鏂囦欢涓幏鍙栧埌杩欎簺淇℃伅鍛紵涓嬮潰浣滆�呭皢涓�涓�璁茶В銆�
1.3.1.1鑾峰彇鍩烘湰淇℃伅锛氬鍑虹殑鐗堟湰銆佹椂闂淬�佸鍑虹殑鐢ㄦ埛
涓嬮潰鐨勭ず渚嬩腑exp_ddl_lhr_02.dmp鏄敓鎴愮殑dmp鏂囦欢锛�
[ZFZHLHRDB1:oracle]:/tmp>strings exp_ddl_lhr_02.dmp | head -10
TEXPORT:V11.02.00====銆嬬増鏈彿
DSYS====銆嬩娇鐢⊿YS鐢ㄦ埛瀵煎嚭
RTABLES====銆嬪熀浜庤〃妯″紡瀵煎嚭锛孯USERS琛ㄧず鍩轰簬鐢ㄦ埛妯″紡,RENTIRE琛ㄧず鍩轰簬鍏ㄥ簱妯″紡
4096
Tue Aug 2 16:8:8 2016/tmp/exp_ddl_lhr_02.dmp====銆嬬敓鎴愮殑鏃堕棿鍜屾枃浠跺湴鍧�
#C#G
#C#G
+00:00
BYTE
UNUSED
1.3.1.2鑾峰彇dmp鏂囦欢涓殑琛ㄤ俊鎭�
涓嬮潰鐨勭ず渚嬩腑锛宔xp_ddl_lhr_02.dmp鏄敓鎴愮殑dmp鏂囦欢锛�
[ZFZHLHRDB1:oracle]:/tmp>strings exp_ddl_lhr_02.dmp | grep "CREATE TABLE"|awk '{print $3}'|sed 's/"//g'
EMP====銆嬭鏄巈xp_ddl_lhr_02.dmp涓彧鏈変竴涓猠mp琛�
1.3.1.3瑙f瀽dmp鏂囦欢鐢熸垚parfile鏂囦欢
涓嬮潰鐨勭ず渚嬩腑锛宔xp_ddl_lhr_03.dmp鏄敓鎴愮殑dmp鏂囦欢锛�
[ZFZHLHRDB1:oracle]:/tmp>strings聽 exp_ddl_lhr_03.dmp | grep "CREATE TABLE"|awk '{print $3}'|sed 's/"//g'|awk '{ if (FNR==1) print "tables="$1 ; else print ","$1 }'
tables=DEF$_AQCALL
,DEF$_AQERROR
,DEF$_CALLDEST
,DEF$_DEFAULTDEST
,DEF$_DESTINATION
,DEF$_ERROR
,DEF$_LOB
,DEF$_ORIGIN
,DEF$_PROPAGATOR
,DEF$_PUSHED_TRANSACTIONS
,MVIEW$_ADV_INDEX
[ZFZHLHRDB1:oracle]:/tmp>
1.3.1.4濡備綍鏌ョ湅dmp鏂囦欢鐨勫瓧绗﹂泦
涓�銆�imp瀵煎叆鍛戒护鏌ョ湅
鏈�2绉嶅姙娉曞彲浠ユ煡鐪媎mp鏂囦欢鐨勫瓧绗﹂泦锛岀涓�绉嶅姙娉曚负imp瀵煎叆鍛戒护鏌ョ湅锛岀ず渚嬪涓嬫墍绀猴細
[ZFLHRZHDB1:oracle]:/oracle>ORACLE_SID=lhrdb
[ZFLHRZHDB1:oracle]:/oracle>export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
[ZFLHRZHDB1:oracle]:/oracle>exp聽 \'/ AS SYSDBA\'聽 tables=scott.emp聽 file=/tmp/exp_ddl_lhr_03.dmp聽 log=/tmp/exp_table.log聽 buffer=41943040 rows=n compress=n
Export: Release 11.2.0.4.0 - Production on Tue Oct 25 17:14:49 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates.聽 All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Tes
Export doneinAL32UTF8character set and AL16UTF16 NCHAR character set<<<--褰撳墠鐨�NLS_LANG鐜鍙橀噺鐨勫��锛�鍗崇敓鎴愮殑dmp鏂囦欢鐨勫瓧绗﹂泦
serverusesZHS16GBKcharacter set (possible charset conversion)<<<<<<<--褰撳墠鏁版嵁搴撶殑瀛楃闆�
Note: table data (rows) will not be exported
About to export specified tables via Conventional Path ...
Current user changed to SCOTT
. . exporting table聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 EMP
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
Export terminated successfully with warnings.
[ZFLHRZHDB1:oracle]:/oracle>ORACLE_SID=mydb<<---鏇存崲鏁版嵁搴�
[ZFLHRZHDB1:oracle]:/oracle>export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
[ZFLHRZHDB1:oracle]:/oracle>imp聽 \'/ AS SYSDBA\'聽 tables=xxx.xx聽 file=/tmp/exp_ddl_lhr_03.dmp
Import: Release 11.2.0.4.0 - Production on Tue Oct 25 16:27:15 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates.聽 All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Tes
Export file created by EXPORT:V11.02.00 via conventional path<<<<<<<<<----dmp鏂囦欢鐨勫鍑虹増鏈彿
import doneinZHS16GBKcharacter set and AL16UTF16 NCHAR character set<<<<<<--褰撳墠鐨凬LS_LANG鐜鍙橀噺鐨勫��
import serverusesWE8ISO8859P1character set (possible charset conversion)<<<<<<---褰撳墠鏁版嵁搴撶殑瀛楃闆�
export clientusesAL32UTF8character set (possible charset conversion)<<<<<<--dmp鏂囦欢鐨勫瓧绗﹂泦
IMP-00029: cannot qualify table name by owner (xxx.xx), use FROMUSER parameter
IMP-00000: Import terminated unsuccessfully
濡傛灉NLS_LANG鐨勫�煎拰褰撳墠鏁版嵁搴撶殑瀛楃闆嗙浉鍚岋紝閭d箞灏嗕笉鏄剧ず鈥渟erver uses鈥濆拰鈥渋mport server uses鈥濊銆傚鏋滄病鏈夋樉绀衡�渆xport client鈥濊锛岄偅涔堣鏄庡綋鍓峝mp鏂囦欢鐨勫瓧绗﹂泦鍜屽綋鍓嶇殑NLS_LANG鐜鍙橀噺鐨勫�肩浉鍚屻�傛棤璁烘槸浣跨敤exp杩樻槸imp宸ュ叿閮戒細鏄剧ず褰撳墠鐨凬LS_LANG鐜鍙橀噺鐨勫�硷紙琛ㄧ幇涓衡�淓xport done鈥濄�佲�渋mport done鈥濓級銆�
浜屻��鍗佸叚杩涘埗鐨勭2鍜岀3涓瓧鑺�
绗簩绉嶆煡鐪媎mp鏂囦欢瀛楃闆嗙殑鍔炴硶鏄紝浠ュ崄鍏繘鍒剁殑鏂瑰紡鎵撳紑dmp鏂囦欢锛岀劧鍚庢煡鐪嬬2鍜岀3涓瓧鑺傘�傚涓嬫墍绀猴細
[ZFLHRZHDB1:oracle]:/oracle>cat /tmp/exp_ddl_lhr_03.dmp |od -x|head -1|awk '{print $2 $3}'|cut -c1-2,7-8
0369
[ZFLHRZHDB1:oracle]:/oracle>cat /tmp/exp_ddl_lhr_03.dmp |od -x|head -1
0000000 030345695058 524f 3a54 3156 2e30 3230
[oracle@rhel6lhr env_oracle]$
鐒跺悗鍦ㄦ暟鎹簱涓彲浠ユ煡鍒板崄鍏繘鍒�0369浠h〃鐨勫瓧绗﹂泦锛�
SYS@lhrdb>SELECT NLS_CHARSET_NAME(TO_NUMBER('0369','XXXX')) FROM DUAL;
NLS_CHARSET_NAME(TO_NUMBER('0369','XXXX'
----------------------------------------
AL32UTF8
浠ヤ笂缁撴灉璇存槑dmp鏂囦欢鐨勫瓧绗﹂泦鏄疷TF8銆傝嫢dmp鏂囦欢鍦╓indows骞冲彴涓嬶紝鍒欏彲浠ヤ娇鐢ㄨ蒋浠禪ltraEdit锛圲E锛夈�丒ditPlus鎴朠ilotedit绛夋枃鏈紪杈戝伐鍏蜂互鍗佸叚杩涘埗鐨勬柟寮忔墦寮�dmp鏂囦欢鏌ョ湅銆傚叾涓紝杞欢Pilotedit鍙互杞绘澗鎵撳紑涓奊鐨勬枃浠躲�傜ず渚嬪涓嬶細
闇�瑕佹敞鎰忕殑鏄紝鍗佸叚杩涘埗鍦↙inux鍜學indows涓嬮『搴忎笉鍚屻��
SELECTNLS_CHARSET_NAME(TO_NUMBER('0001','XXXX'))US7ASCII,
NLS_CHARSET_NAME(TO_NUMBER('0354','XXXX'))ZHS16GBK,
NLS_CHARSET_NAME(TO_NUMBER('0369','XXXX'))AL32UTF8,
TO_CHAR(NLS_CHARSET_ID('US7ASCII'),'XXXX')US7ASCII_ID,
TO_CHAR(NLS_CHARSET_ID('ZHS16GBK'),'XXXX')ZHS16GBK_ID,
TO_CHAR(NLS_CHARSET_ID('AL32UTF8'),'XXXX')AL32UTF8_ID
FROMDUAL;
SYS@ora10g> SELECT NLS_CHARSET_NAME(TO_NUMBER('0001', 'XXXX')) US7ASCII,
2聽聽聽聽聽聽聽聽 NLS_CHARSET_NAME(TO_NUMBER('0354', 'XXXX')) ZHS16GBK,
3聽聽聽聽聽聽聽聽 NLS_CHARSET_NAME(TO_NUMBER('0369', 'XXXX')) AL32UTF8,
4聽聽聽聽聽聽聽聽 TO_CHAR(NLS_CHARSET_ID('US7ASCII'), 'XXXX') ,
5聽聽聽聽聽聽聽聽 TO_CHAR(NLS_CHARSET_ID('ZHS16GBK'), 'XXXX') ,
6聽聽聽聽聽聽聽聽 TO_CHAR(NLS_CHARSET_ID('AL32UTF8'), 'XXXX')
7聽聽聽 FROM DUAL;
US7ASCII聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 ZHS16GBK聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 AL32UTF8聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 TO_CH TO_CH TO_CH
---------------------------------------- ---------------------------------------- ---------------------------------------- ----- ----- -----
US7ASCII聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 ZHS16GBK聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 AL32UTF8聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 1聽聽 354聽聽 369
SYS@ora10g>
1.3.2濡備綍鑾峰彇鏁版嵁搴揇DL鐨勫垱寤鸿鍙�
鏁版嵁娉靛伐鍏凤紙impdp锛夊伐鍏风粰鎴戜滑鎻愪緵浜哠QLFILE鐨勫懡浠よ閫夐」锛屽彧鑾峰彇DDL璇彞锛屽苟鏈湡姝g殑鎵ц鏁版嵁瀵煎叆銆傚彟澶栵紝鑻ュ崟绾负浜嗗鍑篋DL璇彞鍒欏彲浠ュ湪浣跨敤expdp瀵煎嚭鐨勬椂鍊欎娇鐢–ONTENT=METADATA_ONLY鍜孍XCLUDE=STATISTICS閫夐」锛岃繖鏍峰鍑虹殑DMP鏂囦欢姣旇緝灏忋�傚涓嬫墍绀猴細
expdp \'/ AS SYSDBA\' DIRECTORY=DATA_PUMP_DIR DUMPFILE=lhrsql20161215.dmp LOGFILE=lhrsql20161215.log CONTENT=METADATA_ONLY SCHEMAS=SCOTT聽 EXCLUDE=STATISTICS
impdp聽 \'/ AS SYSDBA\'聽 DIRECTORY=DATA_PUMP_DIR DUMPFILE=lhrsql20161215.dmp聽 LOGFILE=imp_exptest.log SQLFILE=expddl_lhr.sql
鏌ョ湅expddl_lhr.sql鏂囦欢鍗冲彲鑾峰彇DDL璇彞銆�
imp宸ュ叿浣跨敤SHOW=Y LOG=GET_DDL.sql鐨勬柟寮忥紝鍙互鐪嬪埌娓呮櫚鐨凞DL鑴氭湰锛屽悓鏃朵篃涓嶄細鐪熸鐨勬墽琛屾暟鎹鍏ャ�傚彟澶栵紝鑻ュ崟绾负浜嗗鍑篋DL璇彞鍒欏彲浠ュ湪浣跨敤exp瀵煎嚭鐨勬椂鍊欎娇鐢≧OWS=N閫夐」锛岃繖鏍峰鍑虹殑DMP鏂囦欢姣旇緝灏忋�傚涓嬫墍绀猴細
exp聽 \'/ AS SYSDBA\'聽 TABLES=SCOTT.EMP聽 FILE=/tmp/exp_ddl_lhr_01.dmp聽 LOG=/tmp/exp_table.log聽 BUFFER=41943040 ROWS=N COMPRESS=N
imp \'/ AS SYSDBA\' FILE=/tmp/exp_ddl_lhr_01.dmp SHOW=Y LOG=/tmp/get_ddl.sql BUFFER=20480000聽 FULL=Y
鏌ョ湅get_ddl.sql鏂囦欢鍗冲彲鑾峰彇DDL璇彞銆�
---- 鐢熸垚DDL璇彞涓嶄細瀵煎叆鏁版嵁
--expdp \'/ AS SYSDBA\' tables=lhr.exptest聽 directory=DATA_PUMP_DIR聽 dumpfile=exptest.dmp logfile=exp_exptest.dmp聽 EXCLUDE=STATISTICS
--expdp \'/ AS SYSDBA\' directory=DATA_PUMP_DIR dumpfile=lhrsql20161215.dmp logfile=lhrsql20161215.logcontent=metadata_onlyschemas=SCOTTEXCLUDE=STATISTICS
impdp聽 \'/ AS SYSDBA\'聽 directory=DATA_PUMP_DIR dumpfile=lhrsql20161215.dmp聽 logfile=imp_exptest.logsqlfile=exptest.sql
exp聽 \'/ AS SYSDBA\'聽 tables=scott.emp聽 file=/tmp/exp_ddl_lhr_01.dmp聽 log=/tmp/exp_table.log聽 buffer=41943040rows=ncompress=n
imp \'/ AS SYSDBA\' file=/tmp/exp_ddl_lhr_01.dmp show=y log=/tmp/get_ddl.sql buffer=20480000聽 full=y
1.3.2.1imp绀轰緥锛�
[ZFZHLHRDB1:oracle]:/oracle>exp聽 \'/ AS SYSDBA\'聽 tables=scott.emp聽 file=/tmp/exp_ddl_lhr_01.dmp聽 log=/tmp/exp_table.log聽 buffer=41943040 rows=n compress=n
Export: Release 11.2.0.4.0 - Production on Tue Aug 2 15:42:11 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates.聽 All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Tes
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
Note: table data (rows) will not be exported
About to export specified tables via Conventional Path ...
Current user changed to SCOTT
. . exporting table聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 EMP
Export terminated successfully without warnings.
[ZFZHLHRDB1:oracle]:/oracle>imp \'/ AS SYSDBA\' file=/tmp/exp_ddl_lhr_01.dmp show=y log=/tmp/get_ddl.sql buffer=20480000聽 full=y
Import: Release 11.2.0.4.0 - Production on Tue Aug 2 15:42:44 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates.聽 All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Tes
Export file created by EXPORT:V11.02.00 via conventional path
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
. importing SYS's objects into SYS
. importing SCOTT's objects into SCOTT
"ALTER SESSION SET CURRENT_SCHEMA= "SCOTT""
"CREATE TABLE "EMP" ("EMPNO" NUMBER(4, 0), "ENAME" VARCHAR2(10), "JOB" VARCH"
"AR2(9), "MGR" NUMBER(4, 0), "HIREDATE" DATE, "SAL" NUMBER(7, 2), "COMM" NUM"
"BER(7, 2), "DEPTNO" NUMBER(2, 0))聽 PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRAN"
"S 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 FREELISTS 1 FREELIST "
"GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING NOCOMPRESS"
"CREATE UNIQUE INDEX "PK_EMP" ON "EMP" ("EMPNO" )聽 PCTFREE 10 INITRANS 2 MAX"
"TRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 FREELISTS 1 FREEL"
"IST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING"
"ALTER SESSION SET CURRENT_SCHEMA= "SCOTT""
"ALTER TABLE "EMP" ADD聽 CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO") USING INDE"
"X PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MIN"
"EXTENTS 1 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "US"
"ERS" LOGGING ENABLE "
"ALTER TABLE "EMP" ADD CONSTRAINT "FK_DEPTNO" FOREIGN KEY ("DEPTNO") REFEREN"
"CES "DEPT" ("DEPTNO") ENABLE NOVALIDATE"
"ALTER TABLE "EMP" ENABLE CONSTRAINT "FK_DEPTNO""
Import terminated successfully without warnings.
[ZFZHLHRDB1:oracle]:/oracle>
鐢变簬鏍煎紡姣旇緝娣蜂贡锛岀洿鎺ヨ繍琛屼細鎶ラ敊锛屽缓鑽g殑涔︿腑缁欎簡涓�娈典唬鐮佹潵鏍煎紡鍖栵細
[ZFZHLHRDB1:oracle]:/tmp>more /tmp/get_ddl.sql
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Tes
Export file created by EXPORT:V11.02.00 via conventional path
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
. importing SYS's objects into SYS
. importing SCOTT's objects into SCOTT
"ALTER SESSION SET CURRENT_SCHEMA= "SCOTT""
"CREATE TABLE "EMP" ("EMPNO" NUMBER(4, 0), "ENAME" VARCHAR2(10), "JOB" VARCH"
"AR2(9), "MGR" NUMBER(4, 0), "HIREDATE" DATE, "SAL" NUMBER(7, 2), "COMM" NUM"
"BER(7, 2), "DEPTNO" NUMBER(2, 0))聽 PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRAN"
"S 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 FREELISTS 1 FREELIST "
"GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING NOCOMPRESS"
"CREATE UNIQUE INDEX "PK_EMP" ON "EMP" ("EMPNO" )聽 PCTFREE 10 INITRANS 2 MAX"
"TRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 FREELISTS 1 FREEL"
"IST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING"
"ALTER SESSION SET CURRENT_SCHEMA= "SCOTT""
"ALTER TABLE "EMP" ADD聽 CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO") USING INDE"
"X PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MIN"
"EXTENTS 1 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "US"
"ERS" LOGGING ENABLE "
"ALTER TABLE "EMP" ADD CONSTRAINT "FK_DEPTNO" FOREIGN KEY ("DEPTNO") REFEREN"
"CES "DEPT" ("DEPTNO") ENABLE NOVALIDATE"
"ALTER TABLE "EMP" ENABLE CONSTRAINT "FK_DEPTNO""
Import terminated successfully without warnings.
[ZFZHLHRDB1:oracle]:/tmp>more /tmp/gettabddl.sh
awk '
/ \"BEGIN /聽聽 { N=1; }
/ \"CREATE /聽聽 { N=1; }
/ \"CREATE INDEX/聽聽 { N=1; }
/ \"CREATE UNIQUE INDEX/聽 { N=1; }
/ \"ALTER /聽聽 { N=1; }
/ \" ALTER /聽聽 { N=1; }
/ \"ANALYZE /聽聽 { N=1; }
/ \"GRANT /聽聽聽 { N=1; }
/ \"COMMENT /聽聽 { N=1; }
/ \"AUDIT /聽聽聽聽 { N=1; }
N==1 { printf "\n/\n"; N++ }
/\"$/ {
if (N==0) next;
s=index( $0, "\"" );
ln0=length( $0 )
if ( s!=0 ) {
lcnt++
if ( lcnt >= 30 ) {
ln=substr( $0,s+1,length( substr($0,s+1))-1)
t=index( ln, ")," )
if ( t==0 ) { t=index( ln, ", " ) }
if ( t==0 ) { t=index( ln, ") " ) }
if ( t > 0 ) {
printf "%s\n%s",substr( ln,1,t+1), substr(ln, t+2)
lcnt=0
}
else {
printf "%s", ln
if ( ln0 < 78 ) { printf "\n" ; lcnt=0 }
}
}
else {
printf "%s",substr( $0,s+1,length( substr($0,s+1))-1 )
if ( ln0 < 78 ) { printf "\n" ; lcnt=0 }
}
}
}
END { printf "\n/\n"}
' $* |sed '1,2d; /^$/ d;
s/STORAGE *(INI/~聽聽聽 STORAGE (INI/g;
s/, "/,~聽聽聽 "/g;
s/ (\"/~聽聽 &/g;
s/PCT[FI]/~聽聽聽 &/g;
s/[( ]PARTITION /~&/g;
s/) TABLESPACE/)~聽聽聽 TABLESPACE/g;
s/聽聽 , / ,~/g;
s/ DATAFILE聽 /&~/' | tr "~" "\n"
[ZFZHLHRDB1:oracle]:/tmp>
[ZFZHLHRDB1:oracle]:/tmp>ksh /tmp/gettabddl.sh聽 /tmp/get_ddl.sql > /tmp/gen_tabddl.sql
[ZFZHLHRDB1:oracle]:/tmp>more /tmp/gen_tabddl.sql
ALTER SESSION SET CURRENT_SCHEMA= "SCOTT"
/
CREATE TABLE "EMP"
("EMPNO" NUMBER(4, 0),
"ENAME" VARCHAR2(10),
"JOB" VARCHAR2(9),
"MGR" NUMBER(4, 0),
"HIREDATE" DATE,
"SAL" NUMBER(7, 2),
"COMM" NUMBER(7, 2),
"DEPTNO" NUMBER(2, 0))
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" LOGGING NOCOMPRESS
/
CREATE UNIQUE INDEX "PK_EMP" ON "EMP"
("EMPNO" )
PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" LOGGING
/
ALTER SESSION SET CURRENT_SCHEMA= "SCOTT"
/
ALTER TABLE "EMP" ADD聽 CONSTRAINT "PK_EMP" PRIMARY KEY
("EMPNO") USING INDEX
PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" LOGGING ENABLE
/
ALTER TABLE "EMP" ADD CONSTRAINT "FK_DEPTNO" FOREIGN KEY
("DEPTNO") REFERENCES "DEPT"
("DEPTNO") ENABLE NOVALIDATE
/
ALTER TABLE "EMP" ENABLE CONSTRAINT "FK_DEPTNO"
/
[ZFZHLHRDB1:oracle]:/tmp>
杩欐牱杩愯璧锋潵灏辨柟渚垮浜嗐��
1.3.2.2imp鐨刬ndexfile閫夐」锛坕ndexfile瀵煎嚭琛ㄥ拰绱㈠紩鐨刣dl璇彞锛�
exp鍜宨mp宸ュ叿涓彲鑳藉瓨鍦ㄦ妸table浠庝竴涓簱exp鐒跺悗imp鍒板彟涓�涓暟鎹簱鍑虹幇娌℃湁鎸囧畾tablespace鑰屾棤娉昳mp锛宨mp鐨刬ndexfile鍙傛暟涓彲浠ヨВ鍐崇殑銆�
Oracle鐨刬mp宸ュ叿鎸囧畾indexfile鍙傛暟鍚庯紝鍙互涓嶅鍏ヤ换浣曞璞★紝鑰屽彧鎶婇渶瑕佸垱寤虹殑index浠ql璇彞鐨勫舰寮忓啓鍏ユ枃鏈枃浠躲�傚垱寤哄簱琛ㄧ瓑sql璇彞涔熶細鍐欏叆锛屼絾鐢╮em娉ㄩ噴灞忚斀銆�
涓�銆佹煡鐪嬪苟淇敼瀵煎叆瀵硅薄鐨勫瓨鍌ㄥ弬鏁�
濡傛灉鍘熷搴撲腑鏈変簺琛ㄦ瘮杈冨ぇ锛宔xp瀵煎嚭瀵硅薄鐨勫垵濮嬪瓨鍌ㄧ┖闂磋缃彲鑳芥瘮杈冮珮锛屽鍏ユ椂闇�瑕佸厛鐢宠鍒嗛厤杈冨ぇ鐨勫瓨鍌ㄧ┖闂达紝濡傛灉鍙繘琛岄�昏緫缁撴瀯鐨勮縼绉昏�楁椂杈冮暱銆傝繖鏃跺彲浠ョ敤indexfile鍙傛暟瀵煎嚭sql璇彞锛岀瓫閫夊嚭鍒濆绌洪棿杈冮珮鐨勫缓琛ㄨ鍙ワ紝鎵嬪伐鍒涘缓銆傚啀娆″鍏ユ椂浣跨敤ignore閫夐」蹇界暐瀵硅薄鍒涘缓閿欒銆�
濡備綍瑙f瀽inexfile鏂囦欢锛氬彲浠ヨ�冭檻鐢╯ed缂栬緫鍣ㄨ繘琛屾鍒欒〃杈惧紡鏇挎崲锛屼篃鍙互鍐欎釜绋嬪簭瑙f瀽鍑篿nitial瓒呭嚭涓�瀹氶槇鍊肩殑搴撹〃鍙婂叾sql銆�
绀轰緥濡備笅鎵�绀猴細
[oracle@rhel6lhr tmp]$ exp聽 \'/ AS SYSDBA\'聽 TABLES=SCOTT.EMP聽 FILE=/tmp/exp_ddl_lhr_01.dmp聽 LOG=/tmp/exp_table.log聽 BUFFER=41943040 ROWS=N COMPRESS=N
Export: Release 11.2.0.3.0 - Production on Wed May 3 21:36:47 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates.聽 All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
Note: table data (rows) will not be exported
About to export specified tables via Conventional Path ...
Current user changed to SCOTT
. . exporting table聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 EMP
Export terminated successfully without warnings.
[oracle@rhel6lhr tmp]$imp聽 \'/ AS SYSDBA\' file=/tmp/exp_ddl_lhr_01.dmp FULL=Y indexfile=/tmp/get_ti_ddl.sql rows=n
Import: Release 11.2.0.3.0 - Production on Wed May 3 21:38:10 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates.聽 All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
Export file created by EXPORT:V11.02.00 via conventional path
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
Import terminated successfully without warnings.
[oracle@rhel6lhr tmp]$ more /tmp/get_ti_ddl.sql
REM聽 CREATE TABLE "SCOTT"."EMP" ("EMPNO" NUMBER(4, 0), "ENAME"
REM聽 VARCHAR2(10), "JOB" VARCHAR2(9), "MGR" NUMBER(4, 0), "HIREDATE" DATE,
REM聽 "SAL" NUMBER(7, 2), "COMM" NUMBER(7, 2), "DEPTNO" NUMBER(2, 0))
REM聽 PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536
REM聽 NEXT 1048576 MINEXTENTS 1 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL
REM聽 DEFAULT) TABLESPACE "USERS" LOGGING NOCOMPRESS ;
CONNECT SCOTT;
CREATE UNIQUE INDEX "SCOTT"."PK_EMP" ON "EMP" ("EMPNO" ) PCTFREE 10
INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1
FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS"
LOGGING ;
REM聽 ALTER TABLE "SCOTT"."EMP" ADD CONSTRAINT "PK_EMP" PRIMARY KEY
REM聽 ("EMPNO") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
REM聽 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 FREELISTS 1 FREELIST
REM聽 GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING ENABLE ;
REM聽 ALTER TABLE "SCOTT"."EMP" ADD CONSTRAINT "FK_DEPTNO" FOREIGN KEY
REM聽 ("DEPTNO") REFERENCES "DEPT" ("DEPTNO") ENABLE NOVALIDATE ;
REM聽 ALTER TABLE "SCOTT"."EMP" ENABLE CONSTRAINT "FK_DEPTNO" ;
[oracle@rhel6lhr tmp]$
鍙互鐪嬪埌鍏朵腑鐨勫垱寤鸿〃鐨凷QL璇彞琚敞閲婃帀浜嗭紝杩欎釜鍙互鐢╲i鍛戒护鎴栬�呮枃鏈伐鍏锋潵澶勭悊锛屽鐞嗕箣鍚庡氨鍙互鐩存帴浣跨敤浜嗐��
1.3.2.3impdp绀轰緥锛�
--expdp \'/ AS SYSDBA\' directory=DATA_PUMP_DIR schemas=SCOTT聽 dumpfile=exptest_sql.dmp logfile=exp_exptest.dmp
impdp聽 \'/ AS SYSDBA\'聽 directory=DATA_PUMP_DIR dumpfile=exptest_sql.dmp聽 logfile=imp_exptest.log sqlfile=exptest.sql
[ZFZHLHRDB1:oracle]:/oracle>expdp \'/ AS SYSDBA\' directory=DATA_PUMP_DIR schemas=SCOTT聽 dumpfile=exptest_sql.dmp logfile=exp_exptest.dmp
Export: Release 11.2.0.4.0 - Production on Wed Aug 3 15:14:55 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates.聽 All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
Starting "SYS"."SYS_EXPORT_SCHEMA_01":聽 "/******** AS SYSDBA" directory=DATA_PUMP_DIR schemas=SCOTT dumpfile=exptest_sql.dmp logfile=exp_exptest.dmp
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 256 KB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "SCOTT"."DEPT"聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 5.929 KB聽聽聽聽聽聽 4 rows
. . exported "SCOTT"."EMP"聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 8.562 KB聽聽聽聽聽 14 rows
. . exported "SCOTT"."SALGRADE"聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 5.859 KB聽聽聽聽聽聽 5 rows
. . exported "SCOTT"."TEST"聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 5.007 KB聽聽聽聽聽聽 1 rows
. . exported "SCOTT"."BONUS"聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 0 KB聽聽聽聽聽聽 0 rows
Master table "SYS"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYS.SYS_EXPORT_SCHEMA_01 is:
/oracle/app/oracle/admin/lhrdb/dpdump/exptest_sql.dmp
Job "SYS"."SYS_EXPORT_SCHEMA_01" successfully completed at Wed Aug 3 15:15:16 2016 elapsed 0 00:00:20
[ZFZHLHRDB1:oracle]:/oracle>impdp聽 \'/ AS SYSDBA\'聽 directory=DATA_PUMP_DIR dumpfile=exptest_sql.dmp聽 logfile=imp_exptest.log sqlfile=exptest.sql
Import: Release 11.2.0.4.0 - Production on Wed Aug 3 15:16:06 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates.聽 All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
Master table "SYS"."SYS_SQL_FILE_FULL_01" successfully loaded/unloaded
Starting "SYS"."SYS_SQL_FILE_FULL_01":聽 "/******** AS SYSDBA" directory=DATA_PUMP_DIR dumpfile=exptest_sql.dmp logfile=imp_exptest.log sqlfile=exptest.sql
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "SYS"."SYS_SQL_FILE_FULL_01" successfully completed at Wed Aug 3 15:16:09 2016 elapsed 0 00:00:02
[ZFZHLHRDB1:oracle]:/oracle>cd /oracle/app/oracle/admin/lhrdb/dpdump/
[ZFZHLHRDB1:oracle]:/oracle/app/oracle/admin/lhrdb/dpdump>more exptest.sql
-- CONNECT SYS
ALTER SESSION SET EVENTS '10150 TRACE NAME CONTEXT FOREVER, LEVEL 1';
ALTER SESSION SET EVENTS '10904 TRACE NAME CONTEXT FOREVER, LEVEL 1';
ALTER SESSION SET EVENTS '25475 TRACE NAME CONTEXT FOREVER, LEVEL 1';
ALTER SESSION SET EVENTS '10407 TRACE NAME CONTEXT FOREVER, LEVEL 1';
ALTER SESSION SET EVENTS '10851 TRACE NAME CONTEXT FOREVER, LEVEL 1';
ALTER SESSION SET EVENTS '22830 TRACE NAME CONTEXT FOREVER, LEVEL 192 ';
-- new object type path: SCHEMA_EXPORT/USER
-- CONNECT SYSTEM
CREATE USER "SCOTT" IDENTIFIED BY VALUES 'S:268AB71B15071D81F19C6FC5041FA8F8E49397470FFE05458B8C90D9E7F8;F894844C34402B67'
DEFAULT TABLESPACE "USERS"
TEMPORARY TABLESPACE "TEMP"
PASSWORD EXPIRE
ACCOUNT LOCK;
-- new object type path: SCHEMA_EXPORT/SYSTEM_GRANT
GRANT UNLIMITED TABLESPACE TO "SCOTT";
-- new object type path: SCHEMA_EXPORT/ROLE_GRANT
GRANT "CONNECT" TO "SCOTT";
GRANT "RESOURCE" TO "SCOTT";
-- new object type path: SCHEMA_EXPORT/DEFAULT_ROLE
ALTER USER "SCOTT" DEFAULT ROLE ALL;
-- new object type path: SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
-- CONNECT SCOTT
BEGIN
sys.dbms_logrep_imp.instantiate_schema(schema_name=>SYS_CONTEXT('USERENV','CURRENT_SCHEMA'), export_db_name=>'LHRDB', inst_scn=>'4225469');
COMMIT;
END;
/
-- new object type path: SCHEMA_EXPORT/TABLE/TABLE
-- CONNECT SYS
CREATE TABLE "SCOTT"."DEPT"
(聽聽聽 "DEPTNO" NUMBER(2,0),
"DNAME" VARCHAR2(14 BYTE),
"LOC" VARCHAR2(13 BYTE)
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "USERS" ;
CREATE TABLE "SCOTT"."EMP"
(聽聽聽 "EMPNO" NUMBER(4,0),
"ENAME" VARCHAR2(10 BYTE),
"JOB" VARCHAR2(9 BYTE),
"MGR" NUMBER(4,0),
"HIREDATE" DATE,
"SAL" NUMBER(7,2),
"COMM" NUMBER(7,2),
"DEPTNO" NUMBER(2,0)
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "USERS" ;
CREATE TABLE "SCOTT"."BONUS"
(聽聽聽 "ENAME" VARCHAR2(10 BYTE),
"JOB" VARCHAR2(9 BYTE),
"SAL" NUMBER,
"COMM" NUMBER
) SEGMENT CREATION DEFERRED
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
TABLESPACE "USERS" ;
CREATE TABLE "SCOTT"."SALGRADE"
(聽聽聽 "GRADE" NUMBER,
"LOSAL" NUMBER,
"HISAL" NUMBER
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "USERS" ;
CREATE TABLE "SCOTT"."TEST"
(聽聽聽 "DUMMY" VARCHAR2(1 BYTE)
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "USERS" ;
-- new object type path: SCHEMA_EXPORT/TABLE/INDEX/INDEX
-- CONNECT SCOTT
CREATE UNIQUE INDEX "SCOTT"."PK_DEPT" ON "SCOTT"."DEPT" ("DEPTNO")
PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "USERS" PARALLEL 1 ;
ALTER INDEX "SCOTT"."PK_DEPT" NOPARALLEL;
CREATE UNIQUE INDEX "SCOTT"."PK_EMP" ON "SCOTT"."EMP" ("EMPNO")
PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "USERS" PARALLEL 1 ;
ALTER INDEX "SCOTT"."PK_EMP" NOPARALLEL;
-- new object type path: SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
-- CONNECT SYS
ALTER TABLE "SCOTT"."DEPT" ADD CONSTRAINT "PK_DEPT" PRIMARY KEY ("DEPTNO")
USING INDEX "SCOTT"."PK_DEPT"聽 ENABLE;
ALTER TABLE "SCOTT"."EMP" ADD CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO")
USING INDEX "SCOTT"."PK_EMP"聽 ENABLE;
-- new object type path: SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
DECLARE I_N VARCHAR2(60);
I_O VARCHAR2(60);
NV VARCHAR2(1);
c DBMS_METADATA.T_VAR_COLL;
df varchar2(21) := 'YYYY-MM-DD:HH24:MI:SS';
stmt varchar2(300) := ' INSERT INTO "SYS"."IMPDP_STATS" (type,version,flags,c1,c2,c3,c5,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,d1,cl1) VALUES (''I'',6,:1,:2,:3,:4,:5,
:6,:7,:8,:9,:10,:11,:12,:13,NULL,:14,:15,NULL,:16,:17)';
BEGIN
DELETE FROM "SYS"."IMPDP_STATS";
i_n := 'PK_DEPT';
i_o := 'SCOTT';
EXECUTE IMMEDIATE stmt USING 2,I_N,NV,NV,I_O,4,1,4,1,1,1,0,4,NV,NV,TO_DATE('2016-07-07 22:00:11',df),NV;
DBMS_STATS.IMPORT_INDEX_STATS('"' || i_o || '"','"' || i_n || '"',NULL,'"IMPDP_STATS"',NULL,'"SYS"');
DELETE FROM "SYS"."IMPDP_STATS";
END;
/
銆娿�娿�娿�娿�傘�傘�傘�傘�傘�傘�傘�傜瘒骞呭師鍥狅紝鏈夌渷鐣�,鍓╀笅鐨勯兘鏄粺璁′俊鎭紝鐢熸垚sqlfile鐨勬椂鍊欎篃鍙互涓嶇敤鐢熸垚銆傘�傘�傘�傘�傘�傘�傘�傘�嬨�嬨�嬨��
-------------------------------------------------------------------------
1.4鏈枃绠�浠�
涓�涓綉鍙嬫壘鍒版垜璇达紝涓�涓猟mp鏂囦欢瀵煎叆鏁版嵁搴撲腑锛屼腑鏂囦竴鐩存槸涔辩爜锛岀湅鎴戣兘鍚﹀府蹇欒В鍐充竴涓嬨�傝鐪熷績璇濓紝涓�鑸儏鍐典笅锛屼贡鐮侀棶棰樺拰瀹夎闂锛屾垜涓�鑸笉鎯虫帴鎵嬶紝鍥犱负鍙兘寰堢畝鍗曠殑闂锛屾湁鐨勪汉鎳掔殑鍔ㄨ剳锛岀鍒伴棶棰樺氨闂�傚挨鍏跺浜庡畨瑁呯被闂锛岀収鐫�瀹夎鏂囨。锛屼竴姝ヤ竴姝ユ潵锛屼竴鑸兘娌℃湁闂銆傚湪杩欓噷鎶婁竴寮犵綉鍙嬪垎浜殑鍥剧墖鍐嶅垎浜竴涓嬶細
鍙槸锛岄棶瀛楃闆嗙殑鐨勫摜浠紝鎴戣兘鎰熻鍒颁粬鑷繁鏄笅浜嗗姛澶殑锛岄兘鏄嚜宸辨懜绱簡锛屽疄鍦ㄨВ鍐充笉浜嗭紝鎵嶆壘鍒扮殑鎴戙�傝繖绉嶆儏鍐典笅锛屾垜鏋滄柇鏄甯姪鐨勩�傚ソ浜嗭紝搴熻瘽涓嶅璇翠簡锛屼笖鐪嬫暣涓鐞嗚繃绋嬪惂銆�
1.4.1鏈枃瀹為獙鐜浠嬬粛
椤圭洰
source db
target db
db绫诲瀷
db version
10.2.0.1.0
10.2.0.1.0
db瀛樺偍
OS鐗堟湰鍙妅ernel鐗堟湰
瀛楃闆�
US7ASCII
GBK
dmp鏂囦欢瀛楃闆�
US7ASCII
US7ASCII
1.5寮�濮嬪鍏�
1.5.1棣栧厛鑾峰彇dmp鏂囦欢鐨勭浉鍏充俊鎭�
缃戝弸缁欑殑dmp鏂囦欢锛�
澶х害30M锛岃В鍘嬪悗鏈�282M宸﹀彸锛�
[oracle@rhel6lhr ~]$ strings /tmp/hhris.dmp | head -10
EXPORT:V10.02.01
DHHRIS
RUSERS
8192
Wed Oct 16 5:0:14 2013/data/dbbackup/expdata/hhris.dmp
#G#G
#G#G
+08:00
BYTE
UNUSED
[oracle@rhel6lhr ~]$ strings /tmp/hhris.dmp聽 | grep "CREATE TABLE"|awk '{print $3}'|sed 's/"//g'
ADDTOHIS
APPOINT
APPOINTDETAIL
APPOINTMASTER
BACKUP_HISAPPOINT
BACKUP_R_DIAGNOSES
BACKUP_R_SERIES
BACKUP_R_STUDIES
DICT_CAPTION
DICT_CITY
DICT_CLASS
DICT_CLASSRULE
銆娿�娿�娿�娿�傘�傘�傘�傘�傘�傘�傘�傜瘒骞呭師鍥狅紝鏈夌渷鐣ャ�傘�傘�傘�傘�傘�傘�傘�傘�嬨�嬨�嬨��
USER_PARAM
USER_RIS
USER_WEB
WEB_LOG
WEB_USER
WORK_FLOW
WORK_NODE
[oracle@rhel6lhr ~]$
[oracle@rhel6lhr ~]$ cat /tmp/hhris.dmp |od -x|head -1|awk '{print $2 $3}'|cut -c 1-2,7-8
0001
SYS@ora10g> SELECT NLS_CHARSET_NAME(TO_NUMBER('0001','XXXX')) FROM DUAL;
NLS_CHARSET_NAME(TO_NUMBER('0001','XXXX'))
------------------------------------------------------------------------------------------------------------------------
US7ASCII
鍙互寰楀嚭浠ヤ笅缁撹锛�
1銆乨mp鏂囦欢鏄敱10.02.01鐨勫鎴风瀵煎嚭鐨�
2銆佸熀浜嶩HRIS鐢ㄦ埛瀵煎嚭
3銆佽鐢ㄦ埛涓嬫湁寰堝琛�
4銆乨mp鏂囦欢鐨勫瓧绗﹂泦鏄疷S7ASCII
1.5.2鎵惧嚭dmp鏂囦欢鐨凞DL璇彞
涓昏鏌ョ湅鏄惁鏈夊叾瀹冭〃绌洪棿瀵艰嚧涓嶈兘瀵煎叆鐨勯棶棰樸��
[oracle@rhel6lhr env_oracle]$ imp \'/ AS SYSDBA\' file=/tmp/hhris.dmp show=y log=/tmp/get_ddl.sql buffer=20480000聽 full=y
Import: Release 10.2.0.1.0 - Production on Tue May 9 14:06:22 2017
Copyright (c) 1982, 2005, Oracle.聽 All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
Export file created by EXPORT:V10.02.01 via direct path
Warning: the objects were exported by HHRIS, not by you
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
export client uses US7ASCII character set (possible charset conversion)
. importing HHRIS's objects into SYS
"BEGIN聽 "
"sys.dbms_logrep_imp.instantiate_schema(schema_name=>SYS_CONTEXT('USERENV','"
銆娿�娿�娿�娿�傘�傘�傘�傘�傘�傘�傘�傜瘒骞呭師鍥狅紝鏈夌渷鐣ャ�傘�傘�傘�傘�傘�傘�傘�傘�嬨�嬨�嬨��
[oracle@rhel6lhr env_oracle]$ sh gettabdd.sh /tmp/get_ddl.sql > /tmp/gen_tabddl.sql
[oracle@rhel6lhr env_oracle]$ more聽 /tmp/gen_tabddl.sql
BEGIN
sys.dbms_logrep_imp.instantiate_schema(schema_name=>SYS_CONTEXT('USERENV','CURRENT_SCHEMA'), export_db_name=>'ORACLE', inst_scn=>'59161085');
COMMIT; END;
/
CREATE SEQUENCE "MICROSOFTSEQDTPROPERTIES" MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 50 NOORDER NOCYCLE
/
CREATE SEQUENCE "R_REPORTLOG_LOGID" MINVALUE 1 MAXVALUE 100000 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER CYCLE
/
銆傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘��
銆娿�娿�娿�娿�傘�傘�傘�傘�傘�傘�傘�傜瘒骞呭師鍥狅紝鏈夌渷鐣ャ�傘�傘�傘�傘�傘�傘�傘�傘�嬨�嬨�嬨��
鏌ユ壘鍏抽敭瀛梩ablespace锛屽彂鐜板彧鏈�1涓〃绌洪棿HHRIS銆�
1.5.3鏁版嵁搴撳噯澶�
dbca -silent -createDatabase -templateName General_Purpose.dbc -responseFile NO_VALUE \
-gdbname lhrdb聽 -sid lhrdb \
-sysPassword lhr -systemPassword lhr \
-datafileDestination '/cds/oradata' -recoveryAreaDestination '/cds/oradata' \
-storageType FS \
-characterset ZHS16GBK -nationalCharacterSet AL16UTF16 \
-sampleSchema false \
-memoryPercentage 20 \
-databaseType OLTP聽 \
-emConfiguration NONE
ORACLE_SID=lhrdb
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
sqlplus / as sysdba
CREATE TABLESPACE HHRIS DATAFILE '/cds/oradata/mydg/HHRIS01.dbf' size 1G;
create user hhris identified by lhr;
grant dba to hhris;
exit
imp聽 hhris/lhr聽聽 file=/tmp/hhris.dmp full=Y log=/tmp/log_imp_hhrisgbk.dmp
[oracle@rhel6lhr mydg]$ imp聽 hhris/lhr聽聽 file=/tmp/hhris.dmp full=Y log=/tmp/log_imp_hhrisgbk.dmp
Import: Release 10.2.0.1.0 - Production on Tue May 9 14:17:55 2017
Copyright (c) 1982, 2005, Oracle.聽 All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
Export file created by EXPORT:V10.02.01 via direct path
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
export client uses US7ASCII character set (possible charset conversion)
. importing HHRIS's objects into HHRIS
. . importing table聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 "ADDTOHIS"聽聽聽聽聽聽聽聽聽 0 rows imported
. . importing table聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 "APPOINT"聽聽聽聽聽聽聽聽聽 0 rows imported
. . importing table聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 "APPOINTDETAIL"聽聽聽聽聽聽聽聽聽 0 rows imported
. . importing table聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 "APPOINTMASTER"聽聽聽聽聽聽聽聽聽 0 rows imported
銆娿�娿�娿�娿�傘�傘�傘�傘�傘�傘�傘�傜瘒骞呭師鍥狅紝鏈夌渷鐣ャ�傘�傘�傘�傘�傘�傘�傘�傘�嬨�嬨�嬨��
Import terminated successfully with warnings.
[oracle@rhel6lhr mydg]$
[oracle@rhel6lhr mydg]$
鍙互鎴愬姛瀵煎叆锛屼絾鏄煡璇㈢殑鏃跺�欙紝鏈変腑鏂囦贡鐮併��
1.5.4瑙e喅涔辩爜
浣跨敤UE鎴朠ilotedit杞欢锛屼互16杩涘埗鐨勬牸寮忔墦寮�dmp鏂囦欢锛屼慨鏀筪mp鏂囦欢鐨勭4琛岀殑绗�1-4涓瓧鑺傘��
淇敼鍓嶏細
淇敼鍚庯細
鍏跺疄锛屼篃鏈夎祫鏂欐樉绀洪渶瑕佹妸绗竴琛岀殑绗�2鍜岀3瀛楄妭锛岀4琛岀殑绗�1-4瀛楄妭鍏ㄩ儴淇敼鎺夛紝濡備笅鎵�绀猴細
缁忚繃灏忛害鑻楃殑娴嬭瘯锛屽彂鐜拌繖3涓湴鏂瑰叏閮ㄤ慨鏀规帀锛屼篃鍙互鎴愬姛瀵煎叆銆�
淇敼鍚庝繚瀛樻枃浠讹紝涓婁紶鏈嶅姟鍣紝閲嶆柊瀵煎叆锛屽鍏ュ悗鏌ヨ锛屽彂鐜颁腑鏂囧凡缁忓彲浠ユ甯告樉绀轰簡銆�
1.5.5杩樻湁涓�绉嶄笉鏄剧ず涔辩爜鐨勬柟寮�
杩樻湁涓�绉嶄笉鏄剧ず涔辩爜鐨勬柟寮忥紝閭e氨鏄皢US7ASCII瀛楃闆嗙殑dmp鏂囦欢瀵煎叆鍒癠S7ASCII瀛楃闆嗙殑鏁版嵁搴撲腑銆�
dbca -silent -createDatabase -templateName General_Purpose.dbc -responseFile NO_VALUE \
-gdbname lhrdb聽 -sid lhrdb \
-sysPassword lhr -systemPassword lhr \
-datafileDestination '/cds/oradata' -recoveryAreaDestination '/cds/oradata' \
-storageType FS \
-charactersetUS7ASCII-nationalCharacterSet AL16UTF16 \
-sampleSchema false \
-memoryPercentage 20 \
-databaseType OLTP聽 \
-emConfiguration NONE
export NLS_LANG=AMERICAN_AMERICA.US7ASCII
imp聽 hhris/lhr聽聽 file=/tmp/hhris.dmp full=Y log=/tmp/log_imp_hhrisgbk.dmp
瀵煎叆鍚庯紝鍦╓indows涓婅缃鎴风鐜鍙橀噺NLS_LANG涓篈MERICAN_AMERICA.US7ASCII锛岀劧鍚庨噸鍚疨L/SQL DEVELOPER杞欢鍚庡氨鍙互姝e父鏄剧ず涓枃浜嗐��
鏈潵鎯崇潃锛岃繖鏍峰啀閲囩敤GBK鐨勫瓧绗﹂泦瀵煎嚭锛岀劧鍚庡鍏BK鐨勬暟鎹簱涓紝缁撴灉鍙戠幇杩欑鏂规硶琛屼笉閫氾紝濮嬬粓鏈変贡鐮併�傚叾瀹烇紝璧板埌杩欎竴姝ワ紝杩樺彲浠ュ皢鏁版嵁瀵煎嚭鎴愭枃鏈牸寮忕殑鏂囦欢锛岀劧鍚庡皢鏂囨湰鏍煎紡鐨勬枃浠跺啀瀵煎叆GBK瀛楃闆嗙殑鏁版嵁搴撲腑浠嶇劧鏄彲琛岀殑銆�
1.6鏈枃鎬荤粨
鏈夌鍔炴硶澶勭悊灏哢S7ASCII瀛楃闆嗙殑dmp鏂囦欢瀵煎叆鍒癦HS16GBK瀛楃闆嗙殑鏁版嵁搴撲腑鐨勪腑鏂囦贡鐮侀棶棰樸�傜涓�锛屼慨鏀筪mp鏂囦欢涓唬琛ㄥ瓧绗﹂泦鐨勫瓧绗︺�傜浜岋紝瀵煎叆US7ASCII瀛楃闆嗙殑搴撲腑锛岀劧鍚庡鍑烘垚鏂囨湰鏍煎紡锛屽啀瀵煎叆鍒癎BK鐨勫簱涓��
1.7鍙傝��
1.7.1鍗氬
鈼�http://www.doc88.com/p-0863578397263.html
鈼�http://www.eygle.com/archives/2004/09/nls_character_set_05.html
鈼�http://www.itpub.net/thread-1129133-2-1.html
鈼�http://www.itpub.net/thread-1014160-2-1.html
鈼�http://blog.itpub.net/26736162/viewspace-2137132/
鈼�http://blog.itpub.net/26736162/viewspace-1760580/
鈼�http://blog.itpub.net/26736162/viewspace-1686082/
鈼忋�愭暟鎹车銆慐XPDP瀵煎嚭琛ㄧ粨鏋�(鐪熷疄妗堜緥)http://blog.itpub.net/26736162/viewspace-1657828/銆乭ttp://blog.itpub.net/26736162/viewspace-1662344/
About Me
...............................................................................................................................
鈼� 鏈枃浣滆�咃細灏忛害鑻楋紝鍙笓娉ㄤ簬鏁版嵁搴撶殑鎶�鏈紝鏇存敞閲嶆妧鏈殑杩愮敤
鈼� 鏈枃鍦╥tpub锛�http://blog.itpub.net/26736162锛夈�佸崥瀹㈠洯锛�http://www.cnblogs.com/lhrbest锛夊拰涓汉寰俊鍏紬鍙凤紙xiaomaimiaolhr锛変笂鏈夊悓姝ユ洿鏂�
鈼� 鏈枃itpub鍦板潃锛�http://blog.itpub.net/26736162/abstract/1/
鈼� 鏈枃鍗氬鍥湴鍧�锛�http://www.cnblogs.com/lhrbest
鈼� 鏈枃pdf鐗堝強灏忛害鑻椾簯鐩樺湴鍧�锛�http://blog.itpub.net/26736162/viewspace-1624453/
鈼� 鏁版嵁搴撶瑪璇曢潰璇曢搴撳強瑙g瓟锛�http://blog.itpub.net/26736162/viewspace-2134706/
鈼� QQ缇わ細230161599寰俊缇わ細绉佽亰
鈼� 鑱旂郴鎴戣鍔燪Q濂藉弸(646634621)锛屾敞鏄庢坊鍔犵紭鐢�
鈼� 浜� 2017-05-09 09:00 ~ 2017-05-30 22:00 鍦ㄩ瓟閮藉畬鎴�
鈼� 鏂囩珷鍐呭鏉ユ簮浜庡皬楹﹁嫍鐨勫涔犵瑪璁帮紝閮ㄥ垎鏁寸悊鑷綉缁滐紝鑻ユ湁渚垫潈鎴栦笉褰撲箣澶勮繕璇疯皡瑙�
鈼� 鐗堟潈鎵�鏈夛紝娆㈣繋鍒嗕韩鏈枃锛岃浆杞借淇濈暀鍑哄
...............................................................................................................................
鎷胯捣鎵嬫満浣跨敤寰俊瀹㈡埛绔�鎵弿涓嬭竟鐨�宸﹁竟鍥剧墖鏉ュ叧娉ㄥ皬楹﹁嫍鐨勫井淇″叕浼楀彿锛歺iaomaimiaolhr锛屾壂鎻�鍙宠竟鐨勪簩缁寸爜鍔犲叆灏忛害鑻楃殑QQ缇わ紝瀛︿範鏈�瀹炵敤鐨勬暟鎹簱鎶�鏈��