数据泵导出:
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 要真实存在(oracleoracle账号用户下)
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';