查询默认的DATA_PUMP_DIR路径
select * from dba_directories where DIRECTORY_name='DATA_PUMP_DIR'
导出test用户下所有的表
expdp test/123@192.168.0.177:1521/hisyb tables=MAO.% directory= DATA_PUMP_DIR dumpfile=hisyb.dmp logfile=hisyb_export_20200831.log
导出用户test的全部资源
expdp test/123@192.168.0.177:1521/hisyb schemas=test dumpfile=hisyb.dmp logfile=hisyb_export.log directory=DATA_PUMP_DIR
导出用户test下的table01,table02,table03表
expdp test/123@192.168.0.177:1521/hisyb directory=DATA_PUMP_DIR dumpfile=hisyb.dmp logfile=hisyb_export.log tables=test.table01,test.table02,test.table03
查询test用户下的所有表
值用单引号括起来再用,分隔
select ''''||LISTAGG(table_name,''',''') within group (order by table_name)||'''' from dba_tables where owner='TEST';
值仅用,分隔
select LISTAGG(table_name,',') within group (order by table_name) from dba_tables where owner='TEST';
从dmp文件导入数据
table_exists_action参数说明
使用impdp完成数据库导入时,若表已经存在,有四种的处理方式:
1) skip:默认操作
2) replace:先drop表,然后创建表,最后插入数据
3) append:在原来数据的基础上增加数据
4) truncate:先truncate,然后再插入数据
impdp test/123@192.168.0.177:1521/hisyb table_exists_action=replace directory=DATA_PUMP_DIR dumpfile=hisyb.dmp logfile=hisyb_import.log
发表评论