1. Preparations
1.0 Import account ready
create tablespace EXPDP_DATA datafile '/home/oracle/app/oracle/oradata/EXPDP_DATA.dbf' size 100m autoextend on next 50m maxsize 10240m extent management local; create temporary tablespace EXPDP_TEMP tempfile '/home/oracle/app/oracle/oradata/EXPDP_TEMP.DBF' size 50m autoextend on next 50m maxsize 10240m extent management local; create user EXPDP_USER identified by 123456 account unlock default tablespace EXPDP_DATA TEMPORARY TABLESPACE EXPDP_TEMP; grant connect,resource to EXPDP_USER;
1.1.xshell: oracle account login
mkdir ora_back;
View directory: pwd show / home / oracle / ora_back
1.2oracle new logical directory
create directory ora_back as '/home/oracle/ora_back/';
Check the directory exists
select * from dba_directories;
1.3 Authorization logical directory account
the Read Grant, ON Directory ora_back the Write to scott ; export directory objects authorized account (where the backup operation is recommended to use system account, scott paper, for example).
the Read Grant, ON Directory ora_back the Write to EXPDP_USER ; import directory objects authorized account
1.4 Setting oracle export support
exec dbms_metadata_util.load_stylesheets;
Export account 0 1.5 Setting record sheet supports exporting (already set, you do not need to be performed again)
select table_name from user_tables where NUM_ROWS=0;
alter table table1 allocate extend; (derived support table disposed specified)
select 'alter table' || table_name || 'allocate extent;' from user_tables where num_rows = 0; (empty support table derived added)
1.6 supports the new table automatically exported (already set, you do not need to be performed again)
sqlplus:
show parameter deferred_segment_creation
alter system set deferred_segment_creation=false
2. Export Import
2.1expdp main parameters:
TABLES = table name needs to be exported 1, table 2
TABLESPACES = need to export the table space
VERSION = oracle version number to be imported
SCHEMAS = list of programs need to be exported
JOB_NAME = Export job name
INCLUDE = the specific subject in need thereof comprising
FULL = Y / N whether to export the entire library
DIRECTORY = Directory object to store the exported file
2.2 Export Operations
linux terminal mode (non sqlplus mode) execute the following export statement
expdp scott/orcl directory=ora_back dumpfile=scott_expdp.dmp schemas=scott
Results of the:
3 Import work
3.1 import parameters
remap_schema = login account Export: Import account login
dumpfile = dmp backup files
table_exists_action = take replacement strategy as replace existing objects (SKIP | APPEND | TRUNCATE | FRPLACE)
directory = directory object
3.2 import
linux terminal mode (non sqlplus mode) execute the following export statement
impdp EXPDP_USER/123456 directory=ora_back dumpfile=scott_expdp.dmp TABLE_EXISTS_ACTION=REPLACE remap_schema=SCOTT:EXPDP_USER
执行结果:
3.3导入对比:
导入前:
导入后:
对比结果表明导出导入操作Ok