expdp使用方法:
1.先在服务器上建立一个目录如:/u01/oracle/backup
2.登录到数据库,执行语句:
SQL>create directory dumpdir as '/u01/oracle/backup';
3.可查询一下,此步骤可选:
SQL> col DIRECTORY_PATH format a50
select directory_name,directory_path from dba_directories;
4.退出sqlplus ,进入到上述建立的目录,并运行命令:
expdp fm/fm1234 DUMPFILE=omc20210322.dmp DIRECTORY=dumpdir SCHEMAS=omc;(用fm用户导出omc的数据)
expdp fm/fm1234 dumpfile=common.dmp directory=dumpdir schemas=common;
impdp使用方法:
1.先在服务器上建立一个目录如:/home/oracle/backup
2.登录到数据库,执行语句:
SQL> conn / as sysdba
create directory impdir as '/home/oracle/backup'; --所建的目录是属于SYS用户的,注意要将传入的文件的权限要做更改
3.可查询一下,此步骤可选:
SQL> col DIRECTORY_PATH format a50
select directory_name, directory_path from dba_directories;
4.导入时需给目录授权,执行此语句:
SQL>grant read,write on directory impdir to ipnet; (导出时不需要授权)
5.退出sqlplus ,进入到上述建立的目录,并运行命令:
impdp ipnet/ipnet1234 directory=impdir dumpfile=ipnet20220322.dmp SCHEMAS=ipnet; (用ipnet用户导入ipnet的数据)
impdp rm/rm1234 directory=impdir dumpfile=rm20220506.dmp SCHEMAS=rm;