一、导出
expdp n2admin/n2admin@172.16.16.53:1521/mesdb schemas=n2admin dumpfile=20220621.dmp directory=dump_dir rows=n statistics=none version=12.2.0
expdp n2admin/n2admin@172.16.16.53:1521/mesdb schemas=n2admin dumpfile=20220620.dmp directory=dump_dir logfile=0109.log exclude=table:\"in\(\'ccd_mid_info\',\'ccd_mid_info2\', \'ccd_mid_info3\', \'ccd_mid_info4\', \'ccd_mid_info_detail\', \'ccd_mid_info_detail2\', \'ccd_mid_info_detail3\', \'ccd_mid_info_detail4\',\'T_OPC_DATA\', \'SY_LOGIN_LOG\',\'T_OPC_DATA\',\'CHY_MID_INFO\',\'SY_MSG\'\)\" version=12.2.0
二、导入
1、导入数据,分两步
1.1 把带数据的dmp文件导入
[oracle@mcdb1 ~]$ impdp n2admin/nf389154@192.168.1.105:9991/lBUCcC directory=dmpdir file=20220621.dmp statistics=none TRANSFORM=STORAGE:n:table logfile=a.log
1.2 把仅含结构的dmp文件导入,仅导入表结构且跳过已存在的表,相当于补充不存在的空表
[oracle@mcdb1 ~]$ impdp n2admin/nf389154@192.168.1.105:9991/lBUCcC directory=dmpdir file=20220621_metadata.dmp statistics=none TRANSFORM=STORAGE:n:table logfile=a.log include=table table_exists_action=skip
三、恢复数据
1、创建同名表空间、用户;
2、创建dmpdir指向dmp路径
create directory dmpdir as '/home/oracle/datapump';
grant read,write on directory dmpdir to N2ADMIN;
3、导入数据,分两步
3.1 把带数据的dmp文件导入
[oracle@mcdb1 ~]$ impdp n2admin/nf389154@192.168.1.105:9991/lBUCcC directory=dmpdir file=20220621.dmp statistics=none TRANSFORM=STORAGE:n:table logfile=a.log
3.2 把仅含结构的dmp文件导入,仅导入表结构且跳过已存在的表,相当于补充不存在的空表
[oracle@mcdb1 ~]$ impdp n2admin/nf389154@192.168.1.105:9991/lBUCcC directory=dmpdir file=20220621_metadata.dmp statistics=none TRANSFORM=STORAGE:n:table logfile=a.log include=table table_exists_action=skip