Oracle数据库数据泵导入导出
由于開發(fā)過程中有時候無法直接連數(shù)據(jù)庫,這時候需要將數(shù)據(jù)庫導(dǎo)入開發(fā)環(huán)境中,故此總結(jié)一個完整的數(shù)據(jù)庫導(dǎo)入導(dǎo)出過程。
注意expdp和impdp命令末尾都不能加分號
-
1 導(dǎo)出某個用戶的所有數(shù)據(jù)庫對象
-
1.1 Linux導(dǎo)出
su - oracle
授權(quán)用戶grant exp_full_database to <源數(shù)據(jù)庫用戶名>;
exp <源數(shù)據(jù)庫用戶名>/<源數(shù)據(jù)庫用戶密碼>@<實例名> file=/srv/db/temp.dmp
-
1.2 Windows機(jī)器導(dǎo)出
進(jìn)入sqlplus命令行sqlplus /nolog
用dba用戶登錄 conn system/a123@localhost/orcl as sysdba
創(chuàng)建目錄create or replace directory dump_dir as 'D:\oracle\datafile\';
授權(quán)grant read,write on directory dump_dir to <源數(shù)據(jù)庫用戶名>;
授權(quán) grant exp_full_database to <源數(shù)據(jù)庫用戶名>;
退出sqlplus exit
導(dǎo)出expdp <源數(shù)據(jù)庫用戶名>/<源數(shù)據(jù)庫用戶密碼> directory=dump_dir dumpfile=<數(shù)據(jù)庫文件名dmp后綴> logfile=<日志文件名> schemas=<源數(shù)據(jù)庫用戶名>
?
-
2 導(dǎo)入(以Windows機(jī)器為例)
進(jìn)入命令行sqlplus /nolog
用dba用戶登錄 conn system/a123@localhost/orcl as sysdba
創(chuàng)建表空間 create tablespace orcltbs datafile 'e:\orcltbs1.dbf' size 50M autoextend on next 5M maxsize 1024M
?extent management local autoallocate segment space management auto;
創(chuàng)建用戶create user <目標(biāo)用戶名>?identified by <目標(biāo)用戶密碼>?default tablespace?<表空間名>
授權(quán) grant dba to <目標(biāo)用戶名>
創(chuàng)建目錄create or replace directory dump_dir as 'D:\oracle\datafile\';
退出sqlplus exit
導(dǎo)入數(shù)據(jù)庫impdp <目標(biāo)用戶名>/<目標(biāo)用戶密碼>@<目標(biāo)數(shù)據(jù)庫機(jī)器ip>/<目標(biāo)實例名>?directory=dump_dir dumpfile=<數(shù)據(jù)庫文件名>?remap_schema=<源用戶名>:<目標(biāo)用戶名> remap_tablespace=<源表空間>:<目標(biāo)表空間>
?
總結(jié)
以上是生活随笔為你收集整理的Oracle数据库数据泵导入导出的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: u盘有读写保护怎么办 怎样解除U盘的读写
- 下一篇: 惠普本怎么安装xp系统 “惠普电脑XP系