准备数据环境
SQL> create user test identified by testtesttest;
executed successfully
used time: 5.441(ms). Execute id is 66.
SQL> grant dba to test;
executed successfully
used time: 2.699(ms). Execute id is 67.
SQL> conn test/testtesttest
Server[LOCALHOST:5236]:mode is normal, state is open
login used time: 3.029(ms)
SQL> begin
2 for i in 1 .. 100000
3 loop
4 insert into test values (i, 'test');
5 commit;
6 end loop;
7 end;
8 /
DMSQL executed successfully
used time: 00:04:28.125. Execute id is 69.
SQL> SQL> select count(*) from test;
LINEID COUNT(*)
---------- --------------------
1 100000
used time: 3.061(ms). Execute id is 70.
SQL>
整库dmp备份
dexp sysdba/sysdba file=full_%u.dmp log=full_%u.log directory=/dm/dmbak/ full=y parallel=4;
用户级dmp备份
dexp sysdba/sysdba OWNER=test file=full_test.dmp log=full_test.log directory=/dm/dmbak/ parallel=4;
schemas级dmp备份
dexp sysdba/sysdba SCHEMAS=test file=SCHEMAS_test.dmp log=SCHEMAS_test.log directory=/dm/dmbak/ parallel=4 ;
表级别dmp备份
dexp sysdba/sysdba TABLES=test.test file=tables_test.dmp log=tables_test.log directory=/dm/dmbak/ parallel=4;
[dmdba@dm1 dmbak]$ more full_01.log
export NO. 1 SYSPACKAGE_DEF : SYS_VIEWexport NO. 2 SYSPACKAGE_DEF : SYSREP----- export total 2 SYSPACKAGE_DEF -----
----- export total 0 SYSPACKAGE_DATA -----
----- export total 0 SYNONYM -----
----- export total 0 DBLINK -----
export NO. 1 USER : TEST----- export total 1 USER -----
----- export total 0 ROLE -----
----- export total 0 CONTEXT -----
----- export total 0 DIRECTORY -----
----- export total 0 SYSTEM_PRIVILEGE -----
----- export total 0 USER_ROLE_PRIVILEGE -----
export NO. 1 SYS_ROLE_PRIVILEGE : RESOURCEexport NO. 2 SYS_ROLE_PRIVILEGE : PUBLICexport NO. 3 SYS_ROLE_PRIVILEGE : DB
Aexport NO. 4 SYS_ROLE_PRIVILEGE : PUBLICexport NO. 5 SYS_ROLE_PRIVILEGE : VTI----- export total 5 SYS_ROLE_PRIVILEGE
-----
the privilege of the object at the export mode...
start export schema[TEST].....----- export total 0 SEQUENCE -----
----- export total 0 VIEW -----
----- export total 0 TRIGGER -----
----- export total 0 COMMENT VIEW -----
----- export total 0 COMMENT COL -----
----- export total 0 PROCEDURE -----
----- export total 0 SYNONYM -----
----- export total 0 DBLINK -----
----- export total 0 TRIGGER -----
----- export total 0 PACKAGE -----
----- export total 0 PKG_BODY -----
----- export total 0 OBJECT of NO REFER OTHER CLASS -----
----- export total 0 OBJECT of REFER OTHER CLASS -----
----- export total 0 JCLASS -----
----- export total 0 CLASS_BODY -----
----- export total 0 DOMAIN -----
the privilege of the object at the export mode...
---- [2020-03-02 20:05:13]export table:TEST -----
the privilege of the object at the export mode...
table :TEST export terminate, total export 100000 rows
schema[TEST] export terminate.....successfully exported NO.1 SCHEMA : TEST
start export schema[SYSDBA].....----- export total 0 SEQUENCE -----
----- export total 0 VIEW -----
----- export total 0 TRIGGER -----
----- export total 0 COMMENT VIEW -----
----- export total 0 COMMENT COL -----
----- export total 0 PROCEDURE -----
----- export total 0 SYNONYM -----
----- export total 0 DBLINK -----
----- export total 0 TRIGGER -----
----- export total 0 PACKAGE -----
----- export total 0 PKG_BODY -----
----- export total 0 OBJECT of NO REFER OTHER CLASS -----
----- export total 0 OBJECT of REFER OTHER CLASS -----
----- export total 0 JCLASS -----
----- export total 0 CLASS_BODY -----
----- export total 0 DOMAIN -----
the privilege of the object at the export mode...
schema[SYSDBA] export terminate.....successfully exported NO.2 SCHEMA : SYSDBA
export total 2 SCHEMA
all the export process spent total 0.492 s
terminate export success without warning
用户级导入
dimp USERID=sysdba/sysdba FILE=full_01.dmp LOG=full_imp.log directory=/dm/dmbak owner=test table_exists_action=replace
用户级 remap_schema导入
dimp USERID=sysdba/sysdba FILE=full_01.dmp LOG=SCHEMAS_testimp.log directory=/dm/dmbak remap_schema=TEST:TEST3
表级导入
dimp USERID=sysdba/sysdba FILE=full_01.dmp log=tables.log directory=/dm/dmbak tables=TEST.test table_exists_action=replace
[dmdba@dm1 ~]$ dexp help
dexp V8
Format: ./dexp KEYWORD=value or KEYWORD=(value1,value2,...,valueN)
Example: ./dexp SYSDBA/SYSDBA GRANTS=Y TABLES=(SYSDBA.TAB1,SYSDBA.TAB2,SYSDBA.TAB3)
USERID Imperative argument and be as the first argument
Keyword Explanation(default value)
--------------------------------------------------------------------------------
USERID username/password Format:USER/PWD*MPP_TYPE@SERVER:PORT#SSLPATH@SSLPWD
FILE export file (dexp.dmp)
DIRECTORY the path of the export file
FULL export all database (N)
OWNER export with the user method, Format (user1,user2,...)
SCHEMAS export with the schema method, Format (schema1,schema2,...)
TABLES export with the table method, Format (table1,table2,...)
FUZZY_MATCH whether to support fuzzy matching when export with the table method (N)
QUERY export with the table sub-set method, the select statement
PARALLEL the thread number be used to export
TABLE_PARALLEL the thread number be used to export one table, convert into single thread when MPP
TABLE_POOL the buffer number of one table
EXCLUDE ignore appointed objects
Format EXCLUDE=(ROWS,INDEXES,CONSTRAINTS) or
EXCLUDE=TABLES:table1,table2 or
EXCLUDE=SCHEMAS:sch1,sch2
INCLUDE include appointed objects
Format INCLUDE=(ROWS,INDEXES,CONSTRAINTS) or
INCLUDE=TABLES:table1,table2
CONSTRAINTS export constraints (Y)
TABLESPACE export objects with tablespace (N)
GRANTS export grants (Y)
INDEXES export indexes (Y)
TRIGGERS export triggers (Y)
ROWS export rows (Y)
LOG the log file of the display show
NOLOGFILE not use log file (N)
NOLOG log message not display on console (N)
LOG_WRITE information write into file directly: YES(Y),NO(N)
DUMMY user message input: print(P), all input YES(Y),all input NO(N)
PARFILE argument file name
FEEDBACK show the process every x rows(0)
COMPRESS whether to compress export data or not (N)
ENCRYPT whether to encrypt export data or not (N)
ENCRYPT_PASSWORD the password of encrypt
ENCRYPT_NAME the name of encrypt
FILESIZE the max size of single file
FILENUM numbers of files of one template
DROP delete origin table after exported, but no cascade (N)
DESCRIBE describe of data file, recorded in data file
LOCAL login with MPP_LOCAL when MPP(N)
HELP output help information
[dmdba@dm1 ~]$ dimp help
dimp V8
Format: ./dimp KEYWORD=value or KEYWORD=(value1,value2,...,vlaueN)
Example: ./dimp SYSDBA/SYSDBA IGNORE=Y ROWS=Y FULL=Y
USERID Imperative Argument and be as the first argument
Keyword Explanation(default value)
--------------------------------------------------------------------------------
USERID username/password Format:USER/PWD*MPP_TYPE@SERVER:PORT#SSLPATH@SSLPWD
FILE import file (dexp.dmp)
DIRECTORY the path of the import file
FULL import all database (N)
OWNER import by owner method, Format (user1,user2,...)
SCHEMAS import by schema method, Format (schema1,schema2,...)
TABLES import by table method, Format(table1,table2,...)
PARALLEL the thread number be used to import
TABLE_PARALLEL the thread number be used to import one table, valid when FAST_LOAD=Y
IGNORE ignore create fail (N)
TABLE_EXISTS_ACTION action when table already exists [SKIP | APPEND | TRUNCATE | REPLACE]
FAST_LOAD use dmfldr to import data(N)
FLDR_ORDER need ordered when use dmfldr to import data (Y)
COMMIT_ROWS the batch committed rows(5000)
EXCLUDE ignore appointed objects
EXCLUDE=(CONSTRAINTS,INDEXES,ROWS,TRIGGERS,GRANTS)
GRANTS import grants (Y)
CONSTRAINTS import constraints (Y)
INDEXES import indexes (Y)
TRIGGERS import triggers (Y)
ROWS import rows (Y)
LOG the log file of the display show
NOLOGFILE not use log file(N)
NOLOG log message not display on console(N)
LOG_WRITE information write into file directly(N): YES(Y),NO(N)
DUMMY user message input(P): print(P), all input Y(Y),all input NO(N)
PARFILE argument file name
FEEDBACK show the process every x rows(0)
COMPILE compile procedure, package and function ... (Y)
INDEXFILE write constraints/indexes information into the file
INDEXFIRST fisrt import indexes,then import data(N)
REMAP_SCHEMA Format (SOURCE_SCHEMA:TARGET_SCHEMA)
make form SOURCE_SCHEMA's data to TARGET_SCHEMA
ENCRYPT_PASSWORD the password of encrypt
ENCRYPT_NAME the name of ENCRYPT
SHOW/DESCRIBE output the info of the appointed file(N)
LOCAL login with MPP_LOCAL when MPP(N)
TASK_THREAD_NUMBER set the number of task thread for dmfldr
BUFFER_NODE_SIZE set the size of buffer node for dmfldr
TASK_SEND_NODE_NUMBER set the number of send node for dmfldr[16,65535]
LOB_NOT_FAST_LOAD not use dmfldr when lob in table, dmfldr commits lob data every row
PRIMARY_CONFLICT way of resolving primary key conflict[IGNORE|OVERWRITE], report error if not setting
TABLE_FIRST import table first (N)
HELP output help information