Data pump export and import data

Goal: Use oracle data pump to export the source data and then import it into the target database.


 

Operation in the source database, expdp data export

1. Log in with an administrator role

sqlplus / as sysdba

2. Create an export directory

--\ora\data数据库导出文件存放路径(路径必须存在)
--data_dir逻辑路径名称,自定义命名
create directory data_dir as '\ora\data';

3. Grant access to the data directory for the oracle user

--dbuser使用那个用户导出数据,需要授权
Grant read,write on directory data_dir to dbuser;


--可查询用户创建目录。
select * from dba_directories;

4. Import and export authorization

grant exp_full_database,imp_full_database to dbuser;

5. Data export, execute command

--directory(导出路径名称-数据库逻辑路径)
--dumpfile导出文件名称
expdp gaofeng/gaofeng@orcl directory=data_dir  dumpfile=EXPDP.DUMP

Operation in the source database, expdp data export

1. Log in with an administrator role

sqlplus / as sysdba

2. Create a directory path

--
create directory data_dir as '\ora\data';

--data_dir为路径名称,可自命名
--\ora\data为数据库导出文件存放路径(路径必须存在)

--查询用户创建目录是否存在
select * from dba_directories;

3. Grant access to the data directory for the oracle user

--dbuser 导入数据使用的用户名
Grant read,write on directory data_dir to dbuser;

 

4. Export the file \ora\datafrom the .dmp data pump in the directory of the source database server and copy it to the directory ( E:\ora\data) created by the target server

7. Data Import

--directory导入数据库逻辑路径名称
--dumpfile导入文件名称


impdp sys/sys directory=DATA_IMP dumpfile=EXPDP.DUMP

 

Guess you like

Origin blog.csdn.net/weixin_41086692/article/details/102980598