Oracle Data Pump import and export

Create an authorization directory

create directory DUMP as 'D:\dump'; 

Authorize

Grant read,write on directory DUMP to 用户;

 

 

 SELECT privilege, directory_name, DIRECTORY_PATH FROM user_tab_privs t, all_directories d WHERE t.table_name(+) = d.directory_name ORDER BY 2, 1;

   --tkzc3_aim/********@192.168.1.83/orcl directory=dpdump dumpfile=nfjj_sirm.dmp remap_schema=nfjj_sirm:nfjj_sirm   logfile=nfjj_sirm.log 

 

 

 

 

 --------Database import and export --------------------------------------- -------

Switch 11G database cd /d D:\app\Administrator\product\11.2.0\dbhome_1\BIN

tnsping orcl/finchina5

 ----imp import 

imp sirmgkzq/sirmgkzq@/sinitek full=y ignore=y statistics=none feedback=10000 buffer=640000 file=E:\kettle\213.dmp log=E:\kettle\123.log

---exp export

exp user/pwd file=/dir/xxx.dmp log=xxx.log full=y commit=y ignore=y buffer=640000  feedback=10000

--command comment

statistics=none does not export statistics error

full=y export and import the entire database instance

buffer=640000 buffer size

feedback=10000 Displays a progress point for every 10,000 rows of data exported

ignore=y tells IMP to import new data directly without creating a table structure if the current table exists

 grants=none does not import permissions

 fromuser=user1 touser=user

owner=user1,user2 This database is the user data of user1 and user2

exp userid/psd@orcl file=d:\test.dmp owner=(table1,table2) Export the tables table1 and table2 under the user

QUERY clause that selects a subset of exported tables

exp userid/psd@orcl file=d:\test.dmp 

 

============================Database import and export====================== ===============================

 

Oracle11g data is imported into oracle10g:

1- Export data with expdp in oracle11g server command line:

expdp ts/ts@orcl directory=expdp_dir dumpfile=tianshan.dmp logfile=tianshan.log version=10.2.0.1.0 (schemas=ccense)

2- Import data with IMPDP in the oracle10g server DOS command line:

Matters needing attention ----------------- Put the backup file of oracle11g in the impdp_dir directory of the oracle10g server, create the corresponding user and tablespace, and then execute the following command:

impdp ts/ts@orcl directory=impdp_dir dumpfile=tianshan.dmp logfile=tianshan.log version=10.2.0.1.0 (schemas=ccense)

Precautions-----------------

Create a directory locally and authorize export users to use

Create the direxp directory on the operating system

create or replace directory DIR_EXP as 'D:direxp';

grant read,write on directory DIR_EXP to db_exp;

 

--Query dirrctory-------

SELECT privilege, directory_name, DIRECTORY_PATH FROM user_tab_privs t, all_directories d WHERE t.table_name(+) = d.directory_name ORDER BY 2, 1;

create directory DUMP as 'D:\dump'; 

Authorize

Grant read,write on directory DUMP to user;

Create folder

impdb (directly exported by dmpdp )

impdp sbls/[email protected]/sirmutf8 schemas=FUNDSIRM_INNER directory=dump dumpfile =FUNDSIRM_INNER.dmp 

impdb ( user exported )

impdp sbls/[email protected]/sirmutf8 remap_schema=aim:user directory=dump dumpfile=filename.dmp 

impdp sirmgsylzcb/[email protected]/sirmutf8 remap_schema=FIA_FLC_BX_GSYL20151019:sirmgsylzcb directory=dump dumpfile =FIA_FLC_BX_GSYL20151019.dmp  version=10.2.0.1.0

----expdp export data

1)--by user guide

expdp system/sinitek@sirmutf8 schemas=sirmhtzq_test dumpfile=sirmhtzq_test.dmp DIRECTORY=DATA_PUMP_DIR EXCLUDE=STATISTICS,GRANT,TABLE:"IN ('EMP','DEPT')"

2)--parallel process parallel

expdp scott/tiger@orcl directory=dpdata1 dumpfile=scott_%U.dmp parallel=4 job_name=scott3--job_name is the process name, optional

3)--Guide by table name

expdp scott/tiger@orcl TABLES=emp,dept dumpfile=expdp.dmp DIRECTORY=dpdata1

4)--Guide by query conditions

expdp scott/tiger@orcl directory=dpdata1 dumpfile=expdp.dmp Tables=emp query='WHERE deptno=20';

expdp sirmbroker/sirmbroker directory=dump dumpfile=sirmbroker.dmp include=table query="'where rownum<=100'"

5)--lead by tablespace

expdp system/manager DIRECTORY=dpdata1 DUMPFILE=tablespace.dmp TABLESPACES=temp,example

6)--Direct the entire database

expdp system/manager DIRECTORY=dpdata1 DUMPFILE=full.dmp FULL=y

7)--Specify version

EXPDP USERID='SYS/cuc2009@cuc as sysdba' schemas=sybj directory=DATA_PUMP_DIR dumpfile=aa.dmp logfile=aa.log version=10.2.0.1.0

 

----impdp restore data

1)--import to the specified user

impdp system/sinitek@sirmutf8 DIRECTORY=DATA_PUMP_DIR DUMPFILE=SIRMHTZQ01_20150129.DMP SCHEMAS=SIRMHTZQ01 EXCLUDE=STATISTICS

2)--Change the owner of the table

impdp system/manager DIRECTORY=dpdata1 DUMPFILE=expdp.dmp TABLES=scott.dept REMAP_SCHEMA=scott:system

3)--Import tablespace

impdp system/manager DIRECTORY=dpdata1 DUMPFILE=tablespace.dmp TABLESPACES=example

4)--Import database

impdb system/manager DIRECTORY=dump_dir DUMPFILE=full.dmp FULL=y

5)--Append data

impdp system/manager DIRECTORY=dpdata1 DUMPFILE=expdp.dmp SCHEMAS=system TABLE_EXISTS_ACTION=append 

6)--change the tablespace

remap_tablespace=1:2

7)--Exclude a table

exclude=table:"in('T1')"

8)--Import data only

impdp tpzcdev/tpzcdev@sinitek DIRECTORY=DATA_PUMP_DIR DUM PFILE=TPZCDEV.DMP content=DATA_ONLY tables=HUNSUN_DICT,METADB_PROPERTY

9)--Regenerate the oid mapping in the original dmp file--ORA-39117

transform=oid:n

10)--network_link

--1. The target library builds the dblink to the source library schemas

--2. Use impdp network_link=dblink directly to skip expdp import into the target library

impdp system/sinitek@sinitek network_link=lk_215_qlzq remap_schema=sirmqlzq:qlzq_text1

You cannot import from a lower version source in a higher version target library, nor can you import from a higher version source in a lower version target library

You cannot use the low-version expdp tool to import from a low-version source in a high-version target library

expdp network_link can also specify version down

The target and source server versions must be the same

 

exp?system/manager@TEST?file=d:\daochu.dmp?owner=(system,sys)?----Export the table of system user and sys user in the database?

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326553118&siteId=291194637