expdp, impdp Data Pump export and import data

1. Create a logical directory, the command does not create directories are (Please create a real directory) to system administrators to create logical directory.

sql>sqlplus system/system@tfds as sysdba

sql>create directory dump_dir as 'd:\expdb';

2. Check the directory administrator (at the same time to see whether the operating system to create the directory, oracle does not care whether the creation of the directory, if the directory does not exist, an error occurs)

sql>select * from dba_directories;

3. The user needs to operate a data import, export designation operation to that directory, preferably to impart system administrator.

sql>grant read,write on directory dump_dir to tfds;

sql>grant read,write on directory dump_dir to tfdspub;

Note: tfds, tfdspub is the need to import, export data, operating data dump_dir user directory

4.expdp export data

1) Export user
expdp scott / tiger @ orcl schemas = scott dumpfile = expdp.dmp directory = dump_dir;

2)导出表
expdp scott/tiger@orcl tables=emp,dept dumpfile=expdp.dmp directory=dump_dir;

3) Press query guide
expdp scott / tiger @ orcl directory = dump_dir dumpfile = expdp.dmp tables = empquery = 'where deptno = 20';

4) Table spatial derivative
expdp system / manager @ orcl directory = dump_dir dumpfile = tablespace.dmptablespaces = temp, example;

5) guiding the entire database
expdp system / manager @ orcl directory = dump_dir dumpfile = full.dmp full = y;

To tfds, tfdspub user, for example, two users export data

expdp system/system@tfds dirrctory=dump_dir dumpfile=tfds.dmp schemas=(tfds,tfdspub);

The import data impdp

1) into the user (from the user into the user scott scott)
the impdp scott / Tiger @ ORCL = dump_dir the dumpfile = expdp.dmp Directory schemas = scott;

2) Import table (from the user scott dept and emp tables into user system)
the impdp system / Directory Manager @ ORCL dump_dir the dumpfile = = = expdp.dmptables scott.dept, scott.emp remap_schema = scott: system;

3) into the tablespace
impdp system / manager @ orcl directory = dump_dir dumpfile = tablespace.dmp tablespaces = example;

4) into the database
impdb system / manager @ orcl directory = dump_dir dumpfile = full.dmp full = y;

5)追加数据
impdp system/manager@orcl directory=dump_dir dumpfile=expdp.dmp schemas=systemtable_exists_action

In tfds, tfdspub an example, two users to import data

impdp system/system@tfds directory=dump_dir dumpfile=tfds.dmp schemas=(tfds,tfdspub);

 

Guess you like

Origin www.cnblogs.com/zhangshuaihui/p/11441713.html
Recommended