Welcome to the Oracle community forum and interact with 2 million technical staff. When 1.1.1expdp is used to use EXPDP, its dump files can only be stored in the OS DIRECTORY corresponding to the DIRECTORY object, you cannot directly specify the OS directory where the dump file is located. therefore, when using the EXPDP tool, you must first create a DIRECTORY object. and must be a Database User
Welcome to the Oracle community forum and interact with 2 million technical staff> when you enter 1.1.1 expdp and use the EXPDP tool, its dump files can only be stored in the OS DIRECTORY corresponding to the DIRECTORY object, you cannot directly specify the OS directory where the dump file is located. therefore, when using the EXPDP tool, you must first create a DIRECTORY object. and must be a Database User
Welcome to the Oracle community forum and interact with 2 million technical staff> enter
1.1.1 use of expdp
When the EXPDP tool is used, its dump file can only be stored in the OS directory corresponding to the DIRECTORY object, rather than directly specifying the OS DIRECTORY where the dump file is located. therefore, when using the EXPDP tool, you must first create a DIRECTORY object. the database user must be granted the permission to use the DIRECTORY object.
First, you must create DIRECTORY:
SQL> conn/as sysdba
SQL> CREATE OR REPLACE DIRECTORY dir_dump AS '/u01/backup /';
SQL> GRANT read, write ON DIRECTORY dir_dump TO public;
1) Export scott's entire schema
-- The schema of the login account is exported by default.
$ Expdp scott/tiger @ db_esuite parfile =/orahome/expdp. par
Expdp. par content:
DIRECTORY = dir_dump
DUMPFILE = scott_full.dmp
LOGFILE = scott_full.log
-- Log on to another account and specify schemas in the parameter.
$ Expdp system/oracle @ db_esuite parfile =/orahome/expdp. par
Expdp. par content:
DIRECTORY = dir_dump
DUMPFILE = scott_full.dmp
LOGFILE = scott_full.log
SCHEMAS = SCOTT
2) Export the dept and emp tables under scott
$ Expdp scott/tiger @ db_esuite parfile =/orahome/expdp. par
Expdp. par content:
DIRECTORY = dir_dump
DUMPFILE = scott. dmp
LOGFILE = scott. log
TABLES = DEPT, EMP
3) Export tables except emp under scott
$ Expdp scott/tiger @ db_esuite parfile =/orahome/expdp. par
Expdp. par content:
DIRECTORY = dir_dump
DUMPFILE = scott. dmp
LOGFILE = scott. log
EXCLUDE = TABLE: "= 'emp '"
4) export the stored procedure under scott
$ Expdp scott/tiger @ db_esuite parfile =/orahome/expdp. par
Expdp. par content:
DIRECTORY = dir_dump
DUMPFILE = scott. dmp
LOGFILE = scott. log
INCLUDE = PROCEDURE
5) Export tables starting with 'e' under scott
$ Expdp scott/tiger @ db_esuite parfile =/orahome/expdp. par
Expdp. par content:
DIRECTORY = dir_dump
DUMPFILE = scott. dmp
LOGFILE = scott. log
INCLUDE = TABLE: "LIKE 'e % '" // you can change it to not like to export a TABLE that does NOT start with E.
6) Export with QUERY
$ Expdp scott/tiger @ db_esuite parfile =/orahome/expdp. par
Expdp. par content:
DIRECTORY = dir_dump
DUMPFILE = scott. dmp
LOGFILE = scott. log
TABLES = EMP, DEPT
QUERY = EMP: "where empno >=8000"
QUERY = DEPT: "where deptno> = 10 and deptno <= 40"
Note: to export a multi-table with query in this way, if there is an external association between multiple tables, you may need to pay attention to whether the data filtered by the query condition meets this external constraint, for example, one column in EMP is deptno, which is the primary key associated with dept. If deptno = 50 is obtained from "where empno> = 8000, your dept condition "where deptno> = 10 and deptno <= 40" does not contain data of deptno = 50. Therefore, an error occurs during import.
[1] [2] [3] [4]