exp+parfile導出符合條件的記錄

exp parfile=d:\test.par file=d:\back.dmp filesize=2000M log=d:\**.log


filesize的作用是爲了防止有的os不支持2G以上容量的文件,而且大文件的I/O性能不好。

 


exp parfile=d:\test.par 
>>>test.par的內容
a)scott用戶連接導出自己的所有對象
userid=scott/tiger------連接的用戶scott
file=d:\back.dmp------導出的文件的名字

 

b)用system用戶連接來導出scott下的所有對象
userid=system/manager
file=d:\back.dmp
owner=(scott) -------導出scott用戶的所有對象


c)用system用戶連接導出scott和test下的所有對象

userid=system/manager
file=d:\back.dmp
owner=(scott,test)

 

d)用system用戶連接導出scott下的emp,dept表、test用戶下的student表

userid=system/manager
file=d:\back.dmp
tables=(scott.emp,scott.dept,test.student)

 

e)導出整個數據庫(備份整個數據庫)--------必須用超級用戶 system ,sys
userid=system/manager
file=d:\back.dmp
full=y

以下是比較全的一個導出整個數據庫的參數文件
userid=system/manager
file=d:\back.dmp
buffer=1024000 ---------緩衝
rows=y ----------是否導出記錄
compress=y ---------extent是否壓縮
grants=y ----------grant語句是否導出
indexes=y ----------導出索引
full=y ----------全庫導出
feedback=3 ----------顯示導出進度每3行

 

f)導出表scott.dept中部門編號是40的記錄
userid=system/manager
file=d:\back.dmp
tables=(scott.emp)
query="where deptno=10"

 

g)導出表scott.emp中的記錄
userid=system/manager
file=d:\back.dmp
tables=(scott.emp)
feedback=3 ---------每3行記錄顯示一個點進度

 

如何把導出的數據導入到數據庫中進行恢復
imp import縮寫形式
dos命令
imp help=y 查看幫助

<1>把scott下的表emp導出 ,

然後刪除表中的內容(truncate table emp),
利用導出的文件來恢復
a)導出
exp parfile=d:\test.par
>>> test.par
userid=system/manager
file=d:\back.dmp
tables=(scott.emp)
b)刪除
truncate table emp; ---------刪數據
或者
drop table emp; ----------刪除結構

( delete from emp; -----------刪數據可以恢復)

c)恢復
imp parfile=d:\test.par;
>>>test.par
userid=system/manager
file=d:\back.dmp
fromuser=scott -----------從哪個用戶來恢復
show=y -----------顯示導入文件中的SQL語句

 

<2>scott下的對象全部複製到test用戶下
(克隆用戶scott)
a)導出scott用戶
exp parfile=d:\test.par
>>>test.par
userid=system/manager
file=d:\back.dmp
owner=(scott)

b)導入d:\back.dmp文件中的內容到test用戶下
imp parfile=d:\test.par
>>>test.par
userid=system/manager
file=d:\back.dmp
fromuser=scott
touser=test

 

<3>如何進行全庫導入
imp system/manager
file=d:\back.dmp full=y ignore=y
full ----------全庫
ignore ----------忽略導入過程中的錯誤


本文來自CSDN博客,轉載請標明出處:http://blog.csdn.net/ttonegrames/archive/2008/11/03/3208283.aspx

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章