时间:2021-07-01 10:21:17 帮助过:38人阅读
首先创建导出目录: --更详细命令及参数,见:http://blog.csdn.net/haibusuanyun/article/details/12584727 BYS@ bys3create directory dir_dp as /home/oracle/; Directory created. BYS@ bys3grant read,write on directory dir_dp to public; Grant succ
首先创建导出目录: --更详细命令及参数,见:http://blog.csdn.net/haibusuanyun/article/details/12584727
BYS@ bys3>create directory dir_dp as '/home/oracle/';
Directory created.
BYS@ bys3>grant read,write on directory dir_dp to public;
Grant succeeded.
col privilege for a15
col directory_name for a15
col directory_path for a30
SELECT privilege, directory_name, DIRECTORY_PATH FROM user_tab_privs t, all_directories d WHERE t.table_name(+) = d.directory_name ORDER BY 2, 1; --可以使用此语句验证配置。
#######################################################
导出用户某个表测试:
只BYS用户下表定义不导出数据:
expdp bys/bys tables=bys.test1 directory=dir_dp dumpfile=bys1.dmp logfile=bys1.log content=metadata_only
只BYS用户下数据不导出表定义:
expdp bys/bys tables=bys.test1 directory=dir_dp dumpfile=bys2.dmp logfile=bys2.log content=data_only
导出BYS用户下所有对象--content不写,默认是ALL.
expdp bys/bys tables=bys.test1 directory=dir_dp file=bys3.dmp logfile=bys3.log
####################################################
导出整个用户下对象测试:
导出整个用户下对象的元数据:
expdp bys/bys schemas=bys directory=dir_dp file=bys4.dmp logfile=bys4.log content=metadata_only
导出整个用户下的对象
expdp bys/bys schemas=bys directory=dir_dp file=bys5.dmp logfile=bys5.log
####################################################
导入用户某个表测试:
1.删除整个表,
drop table test1 purge;
导入整个表含数据:
impdp bys/bys tables=test1 directory=dir_dp dumpfile=bys3.dmp logfile=impdp3.log
导入表定义
impdp bys/bys tables=test1 directory=dir_dp dumpfile=bys3.dmp logfile=impdp2.log content=metadata_only
导入表中数据:
impdp bys/bys tables=test1 directory=dir_dp dumpfile=bys3.dmp logfile=impdp1.log content=data_only
导入用户下所有对象测试:
删除BYS用户下所有表--不删除用户
BYS@ bys3>select * from cat;
no rows selected
##
只导入用户下对象的元数据
impdp bys/bys schemas=bys directory=dir_dp file=bys5.dmp logfile=bys6.log content=metadata_only
只导入用户下对象的数据
impdp bys/bys schemas=bys directory=dir_dp file=bys5.dmp logfile=bys7.log content=data_only
导入用户下所有对象及数据: --不写content=,默认就是ALL
impdp bys/bys schemas=bys directory=dir_dp file=bys5.dmp logfile=bys8.log