Expdp and impdp usage details

GPS platform, website construction, software development, system operation and maintenance, look for Senda Network Technology!
https://cnsendnet.taobao.com
comes from the official blog of Senda Technology
http://www.cnsendblog.com/index.php/?p=1475

1. About expdp and impdp Things to pay attention to when using EXPDP and IMPDP:
EXP and IMP are client tool programs, they can be used on the client side or on the server side.
EXPDP and IMPDP are tool programs on the server side. They can only be used on the ORACLE server side, not on the client side.
IMP is only applicable to files exported from EXP, not to files exported from EXPDP; IMPDP is only applicable to files exported from EXPDP, not to files exported from EXP.
In expdp or impdp command, you can temporarily not indicate the user name/password@instance name as identity, and then enter it according to the prompt, such as:
expdp schemas=scott dumpfile=expdp.dmp DIRECTORY=dpdata1;
1. Create a logical directory, this command does not A real directory will be created in the operating system, preferably created by an administrator such as system.
create directory dpdata1 as'd:\test\dump';
2. Check the administrator directory (at the same time check whether the operating system exists, because Oracle does not care whether the directory exists, if it does not exist, an error occurs)
select * from dba_directories;
3. Give the scott user the operation authority in the specified directory, it is best to give it to the administrator such as system.
grant read, write on directory dpdata1 to scott;
IV. Export data
1) According to user guide
expdp scott/tiger@orcl schemas=scott dumpfile=expdp.dmp DIRECTORY=dpdata1;
2) Parallel process parallel
expdp scott/tiger@orcl directory=dpdata1 dumpfile=scott3.dmp parallel=40 job_name=scott3
3) According to the table name guide
expdp scott/tiger@orcl TABLES=emp,dept dumpfile=expdp.dmp DIRECTORY=dpdata1;
4) According to the query Conditional guide
expdp scott/tiger@orcl directory=dpdata1 dumpfile=expdp.dmp Tables=emp query='WHERE deptno=20';
5) Guide
expdp system/manager DIRECTORY=dpdata1 DUMPFILE=tablespace.dmp TABLESPACES=temp, example;
6)
Import the entire database expdp system/manager DIRECTORY=dpdata1 DUMPFILE=full.dmp FULL=y;
5. Restore data
1) Import to the specified user
impdp scott/tiger DIRECTORY=dpdata1 DUMPFILE=expdp.dmp SCHEMAS=scott;
2) Change the owner
impdp system/manager DIRECTORY=dpdata1 DUMPFILE=expdp.dmp TABLES=scott.dept REMAP_SCHEMA=scott:system;
3) Import the tablespace
impdp system/manager DIRECTORY=dpdata1 DUMPFILE=tablespace.dmp TABLESPACES=example;
4)导入数据库
impdb system/manager DIRECTORY=dump_dir DUMPFILE=full.dmp FULL=y;
5)追加数据
impdp system/manager DIRECTORY=dpdata1 DUMPFILE=expdp.dmp SCHEMAS=system TABLE_EXISTS_ACTION

Two additional explanations Parallel operation (PARALLEL)
You can use more than one thread for export through the PARALLEL parameter to speed up the job significantly. Each thread creates a separate dump file, so the parameter dumpfile should have as many items as parallelism. You can specify a wildcard as the file name, instead of explicitly inputting each file name, for example:
expdp ananda/abc123 tables=CASES directory=DPDATA1 dumpfile=expCASES_%U.dmp parallel=4 job_name=Cases_Export
Note: The dumpfile parameter has a wildcard %U, it indicates that the file will be created as needed, and the format will be expCASES_nn.dmp, where nn starts from 01 and then increases as needed.
In parallel mode, the status screen will display four work processes. (In the default mode, only one process is visible) All the worker processes simultaneously fetch data and display their progress on the status screen.
It is important to separate the input/output channels for accessing data files and dump directory file systems. Otherwise, the overhead associated with maintaining Data Pump operations may exceed the benefits of parallel threads, and therefore reduce performance. The parallel mode is effective only when the number of tables exceeds the parallel value and the tables are large.
Database Monitoring
You can also get more information about Data Pump jobs that run from the database view. The main view of the monitoring job is DBA_DATAPUMP_JOBS, which will tell you how many worker processes (column DEGREE) are working on the job.
Another important view is DBA_DATAPUMP_SESSIONS, which when combined with the above view and V$SESSION will give the session SID of the main foreground process.
select sid, serial# from v$session s, dba_datapump_sessions d where s.saddr = d.saddr;
This command displays the sessions of the foreground process. More useful information can be obtained from the alert log. When the process starts, the MCP and worker process are displayed as follows in the alarm log:
kupprdp:master process DM00 started with pid=23, OS id=20530 to execute-SYS.KUPM$MCP.MAIN('CASES_EXPORT','ANANDA') ; kupprdp:worker process DW01 started with worker id=1, pid=24, OS id=20532 to execute-SYS.KUPW$WORKER.MAIN('CASES_EXPORT','ANANDA'); kupprdp:worker process DW03 started with worker id =2, pid=25, OS id=20534 to execute-SYS.KUPW$WORKER.MAIN('CASES_EXPORT','ANANDA');
It shows the PID of the session started by the data pump operation. You can find the actual SID with the following query:
select sid, program from v$session where paddr in (select addr from v$process where pid in (23,24,25));
The PROGRAM column will display the process DM (main process) or DW (work process) corresponding to the name in the alarm log file. If a worker process uses parallel query, such as SID 23, you can see it in the view V$PX_SESSION and find it out. It will show you all parallel query sessions running from the worker process represented by SID 23:
select sid from v$px_session where qcsid = 23;
From the view V$SESSION_LONGOPS, you can get other useful information to predict how much it will cost to complete the job time.
select sid, serial#, sofar, totalwork from v$session_longops where opname ='CASES_EXPORT' and sofar != totalwork; the
column totalwork shows the total workload, the number of sofar in this column is added to the current moment — so you can use it To estimate how long it will take.

GPS platform, website construction, software development, system operation and maintenance, look for Senda Network Technology!
https://cnsendnet.taobao.com
comes from the official blog of Senda Technology
http://www.cnsendblog.com/index.php/?p=1475

Guess you like

Origin blog.51cto.com/14861463/2539890