欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

oracle导入导出(impdb+expdb)教程

程序员文章站 2022-07-09 22:16:52
数据泵导出: 0:su - oracle 1:sqlplus /nolog 2:connect / as sysdba 3:create directory data_dp...

数据泵导出:

0:su - oracle

1:sqlplus /nolog

2:connect / as sysdba

3:create directory data_dp as '/home/oracle/data_dp'; #/home/oracle/data_dp 要真实存在(oracle用户下)

4:grant read,write on directory data_dp to DZCMS; #DZCMS为要导出的用户数据

5:select * from dba_directories;#查看目录是否创建成功

6:进入bin目录下,执行:

./expdp YIJIACHEDU/YIJIACHEDU@orcl11g schemas=YIJIACHEDU DIRECTORY=data_dp dumpfile=YJCD20160918.DMP compression=all

如果遇到Metadata processing is not available的错误,在sysdba下执行:

execute sys.dbms_metadata_util.load_stylesheets;即可

数据泵导入:

0:su - oracle

1:sqlplus /nolog

2:connect / as sysdba

3:create directory data_dp as '/home/oracle/data_dp'; #/home/oracle/data_dp 要真实存在(oracle用户下)

4:grant read,write on directory data_dp to DZCMSXC; #DZCMS为要导入的用户数据

5:select * from dba_directories;#查看目录是否创建成功

6:进入bin目录下,执行:

./impdp DZCMSXC/DZCMSXC@orcl11g DIRECTORY=DZCMS_DP dumpfile=dzcms20160616.dmp REMAP_SCHEMA=DZCMS:DZCMSXC REMAP_TABLESPACE=DZCMSDATA:DZCMSXC

#REMAP_SCHEMA=DZCMS:DZCMSXC :表示要替换的用户

#REMAP_TABLESPACE=DZCMSDATA:DZCMSXC表示要替换的表空间

最后可用以下语句校验表数量是否一致:

select count(*) from dba_tables t where t.owner='DZCMSXC';