時(shí)間:2015-06-28 00:00:00 來源:IT貓撲網(wǎng) 作者:網(wǎng)管聯(lián)盟 我要評(píng)論(0)
1.T表數(shù)據(jù)內(nèi)容如下
sec@secooler> select * from t;
X Y
---------- ---------------------------------
1 sec1
2 sec2
3 sec3
4 sec4
2.創(chuàng)建另外一張關(guān)聯(lián)表T_REL,并初始化兩條記錄
sec@secooler> create table t_rel (x int);
Table created.
sec@secooler> insert into t_rel values (2);
1 row created.
sec@secooler> insert into t_rel values (3);
1 row created.
sec@secooler> commit;
Commit complete.
sec@secooler> select * From t_rel;
X
----------
2
3
3.我們的目標(biāo)是使用EXP獲取如下數(shù)據(jù)
sec@secooler> select t.* from t, t_rel where t.x=t_rel.x;
X Y
---------- -------------------------------
2 sec2
3 sec3
4.方法如下,注意QUERY子句的書寫方法
secooler@secDB /exp$ exp sec/sec file=sec.dmp log=sec.log tables=t query=\"t,t_rel where t.x=t_rel.x\"
Export: Release 11.2.0.1.0 - Production on Mon Mar 8 23:20:00 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates.? All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing option
Export done in AL32UTF8 character set and AL16UTF16 NCHAR character set
server uses ZHS16GBK character set (possible charset conversion)
About to export specified tables via Conventional Path ...
. . exporting table????? T??? 2 rows exported
Export terminated successfully without warnings.
5.使用PARFILE參數(shù)完成方法如下
1)編輯參數(shù)文件
secooler@secDB /exp$ vi sec.par
userid=sec/sec
file=sec.dmp
log=sec.log
tables=t
query="t,t_rel where t.x=t_rel.x"
~
~
2)使用參數(shù)文件完成數(shù)據(jù)導(dǎo)出
secooler@secDB /exp$ exp parfile=sec.par
Export: Release 11.2.0.1.0 - Production on Mon Mar 8 23:27:24 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates.? All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing option
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
. . exporting table????? T??? 2 rows exported
Export terminated successfully without warnings.
6.導(dǎo)入驗(yàn)證
sys@secooler> conn sec/sec
Connected.
sec@secooler> delete from t;
4 rows deleted.
sec@secooler> commit;
Commit complete.
sec@secooler> exit
secooler@secDB /exp$ imp sec/sec file=sec.dmp ignore=y full=y
Import: Release 11.2.0.1.0 - Production on Mon Mar 8 23:30:30 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates.? All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing option
Export file created by EXPORT:V11.02.00 via conventional path
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
. importing SEC's objects into SEC
. importing SEC's objects into SEC
. . importing table??? "T"??? 2 rows imported
Import terminated successfully without warnings.
secooler@secDB /exp$ sqlplus sec/sec
SQL*Plus: Release 11.2.0.1.0 Production on Mon Mar 8 23:31:53 2010
Copyright (c) 1982, 2009, Oracle.? All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
sec@secooler> select * from t;
X Y
---------- --------------------
2 sec2
3 sec3
成功,驗(yàn)證完畢
7.小結(jié)
在使用EXP完成復(fù)雜關(guān)系條件下數(shù)據(jù)導(dǎo)出時(shí),尤其要注意在不同操作系統(tǒng)平臺(tái)上的轉(zhuǎn)義方法。建議使用參數(shù)文件(結(jié)合PARFILE參數(shù)使用)規(guī)避這個(gè)不大不小的問題。
關(guān)鍵詞標(biāo)簽:oracle備份
相關(guān)閱讀
熱門文章 Oracle中使用alter table來增加,刪除,修改列的語(yǔ)法 oracle中使用SQL語(yǔ)句修改字段類型-oracle修改SQL語(yǔ)句案例 誤刪Oracle數(shù)據(jù)庫(kù)實(shí)例的控制文件 為UNIX服務(wù)器設(shè)置Oracle全文檢索
人氣排行 oracle中使用SQL語(yǔ)句修改字段類型-oracle修改SQL語(yǔ)句案例 Oracle中使用alter table來增加,刪除,修改列的語(yǔ)法 ORACLE SQL 判斷字符串是否為數(shù)字的語(yǔ)句 ORACLE和SQL語(yǔ)法區(qū)別歸納(1) oracle grant 授權(quán)語(yǔ)句 ORACLE修改IP地址后如何能夠使用 如何加速Oracle大批量數(shù)據(jù)處理 Oracle刪除表的幾種方法