暂无图片
暂无图片
1
暂无图片
暂无图片
暂无图片

【译】SQLcl:数据泵

原创 剩余价值 2022-05-25
461

原文地址 https://oracle-base.com/articles/misc/sqlcl-data-pump

原文作者  蒂姆...



SQLcl:数据泵

在本文中,我们演示了 SQLcl 中的数据泵功能。从 SQLcl 版本 21.4 开始,我们可以发出一些数据泵命令。这是包裹的DBMS_DATAPUMP包装。在 22.1 版之前,该功能仅限于模式导出和导入。从 22.1 版开始,表导出是可能的。

相关文章。

设置

本文中的示例需要下表。

create table dept (
  deptno number(2) constraint pk_dept primary key,
  dname varchar2(14),
  loc varchar2(13)
) ;

create table emp (
  empno number(4) constraint pk_emp primary key,
  ename varchar2(10),
  job varchar2(9),
  mgr number(4),
  hiredate date,
  sal number(7,2),
  comm number(7,2),
  deptno number(2) constraint fk_deptno references dept
);

insert into dept values (10,'ACCOUNTING','NEW YORK');
insert into dept values (20,'RESEARCH','DALLAS');
insert into dept values (30,'SALES','CHICAGO');
insert into dept values (40,'OPERATIONS','BOSTON');

insert into emp values (7369,'SMITH','CLERK',7902,to_date('17-12-1980','dd-mm-yyyy'),800,null,20);
insert into emp values (7499,'ALLEN','SALESMAN',7698,to_date('20-2-1981','dd-mm-yyyy'),1600,300,30);
insert into emp values (7521,'WARD','SALESMAN',7698,to_date('22-2-1981','dd-mm-yyyy'),1250,500,30);
insert into emp values (7566,'JONES','MANAGER',7839,to_date('2-4-1981','dd-mm-yyyy'),2975,null,20);
insert into emp values (7654,'MARTIN','SALESMAN',7698,to_date('28-9-1981','dd-mm-yyyy'),1250,1400,30);
insert into emp values (7698,'BLAKE','MANAGER',7839,to_date('1-5-1981','dd-mm-yyyy'),2850,null,30);
insert into emp values (7782,'CLARK','MANAGER',7839,to_date('9-6-1981','dd-mm-yyyy'),2450,null,10);
insert into emp values (7788,'SCOTT','ANALYST',7566,to_date('13-JUL-87','dd-mm-rr')-85,3000,null,20);
insert into emp values (7839,'KING','PRESIDENT',null,to_date('17-11-1981','dd-mm-yyyy'),5000,null,10);
insert into emp values (7844,'TURNER','SALESMAN',7698,to_date('8-9-1981','dd-mm-yyyy'),1500,0,30);
insert into emp values (7876,'ADAMS','CLERK',7788,to_date('13-JUL-87', 'dd-mm-rr')-51,1100,null,20);
insert into emp values (7900,'JAMES','CLERK',7698,to_date('3-12-1981','dd-mm-yyyy'),950,null,30);
insert into emp values (7902,'FORD','ANALYST',7566,to_date('3-12-1981','dd-mm-yyyy'),3000,null,20);
insert into emp values (7934,'MILLER','CLERK',7782,to_date('23-1-1982','dd-mm-yyyy'),1300,null,10);
commit;

我们还需要一个目录对象来使用。以下代码连接到特权用户,创建目录对象并授予我们的测试用户访问权限。然后我们以测试用户的身份连接。

-- Connect to a privileged user.
conn sys/SysPassword1@//localhost:1521/pdb1 as sysdba

-- Create a directory object.
create or replace directory tmp_dir as '/tmp/';
grant read, write on directory tmp_dir to testuser1;

-- Connect to the test user.
conn testuser1/testuser1@//localhost:1521/pdb1

出口

USER_OBJECTS 视图向我们展示了测试模式的内容。我们有两个表,它们有各自的主键索引。

column object_name format a30
column object_type format a30

select object_name,
       object_type
from   user_objects
order by 1, 2;

OBJECT_NAME                    OBJECT_TYPE
------------------------------ ------------------------------
DEPT                           TABLE
EMP                            TABLE
PK_DEPT                        INDEX
PK_EMP                         INDEX

4 rows selected.

SQL>

我们使用DATAPUMP EXPORT命令,在 schemas 参数中传递当前用户。如果未使用 schemas 参数,这是默认操作。我们还提供目录、转储文件和日志文件名称。


datapump export -
     -schemas testuser1 -
     -directory tmp_dir -
     -dumpfile testuser1.dmp -
     -logfile testuser1.log

** Datapump Command Start ** at 2022.03.18-13.37.18
Initiating DATA PUMP
DATABASE TIME ZONE: VERSION:35 CON_ID:0
Log Location: TMP_DIR:testuser1.log
Starting "TESTUSER1"."ESQL_642":
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
. . exported "TESTUSER1"."DEPT"                          6.031 KB       4 rows
. . exported "TESTUSER1"."EMP"                           8.781 KB      14 rows
Master table "TESTUSER1"."ESQL_642" successfully loaded/unloaded
******************************************************************************
Dump file set for TESTUSER1.ESQL_642 is:
  /tmp/testuser1.dmp
Job "TESTUSER1"."ESQL_642" successfully completed at Fri Mar 18 13:38:16 2022 elapsed 0 00:00:55
DataPump Operation Status 'COMPLETED'
Jobname = ESQL_642
** Datapump Command End ** at 2022.03.18-13.38.19
SQL>

导出完成后,我们看到两个表已导出,并且已创建导出操作的主表。

我们可以使用命令的简短形式和参数执行相同的操作。

dp export -
     -s testuser1 -
     -d tmp_dir -
     -f testuser1.dmp -
     -lf testuser1.log

** Datapump Command Start ** at 2022.03.18-13.39.17
Initiating DATA PUMP
DATABASE TIME ZONE: VERSION:35 CON_ID:0
Log Location: TMP_DIR:testuser1.log
Starting "TESTUSER1"."ESQL_682":
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
. . exported "TESTUSER1"."ESQL_642"                      332.9 KB    1598 rows
. . exported "TESTUSER1"."DEPT"                          6.031 KB       4 rows
. . exported "TESTUSER1"."EMP"                           8.781 KB      14 rows
Master table "TESTUSER1"."ESQL_682" successfully loaded/unloaded
******************************************************************************
Dump file set for TESTUSER1.ESQL_682 is:
  /tmp/testuser1.dmp
Job "TESTUSER1"."ESQL_682" successfully completed at Fri Mar 18 13:40:13 2022 elapsed 0 00:00:53
DataPump Operation Status 'COMPLETED'
Jobname = ESQL_682
** Datapump Command End ** at 2022.03.18-13.40.16
SQL>

结果类似,但这次我们还从第一次导出操作中导出了主表。我们为第二次导出操作创建了一个新的主表。

从 22.1 版开始,我们可以包含和排除对象,并使用名称列表来定位特定对象。您可以在此处或从下面的帮助文本中获取完整的参数列表。

在下面的示例中,我们使用该-namelist标志来执行表级导出。

datapump export -
     -schemas testuser1 -
     -namelist TABLE=emp -
     -directory tmp_dir -
     -dumpfile emp.dmp -
     -logfile emp.log

** Datapump Command Start ** at 2022.04.10-14.26.26
Initiating DATA PUMP
DATABASE TIME ZONE: VERSION:35 CON_ID:0
Log Location: TMP_DIR:emp.log
Starting "TESTUSER1"."ESQL_84":
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
. . exported "TESTUSER1"."EMP"                           8.781 KB      14 rows
Master table "TESTUSER1"."ESQL_84" successfully loaded/unloaded
******************************************************************************
Dump file set for TESTUSER1.ESQL_84 is:
  /tmp/emp.dmp
Job "TESTUSER1"."ESQL_84" successfully completed at Sun Apr 10 13:27:09 2022 elapsed 0 00:00:40
DataPump Operation Status 'COMPLETED'
Jobname = ESQL_84
** Datapump Command End ** at 2022.04.10-14.27.12
SQL>

进口

我们删除EMPDEPT表,以便我们可以导入它们。

drop table emp purge;
drop table dept purge;

这次我们使用DATAPUMP IMPORT命令,参数与之前相同。操作完成后,我们可以看到我们导入了两个表。datapump import -

     -schemas testuser1 -
     -directory tmp_dir -
     -dumpfile testuser1.dmp -
     -logfile testuser1.log

** Datapump Command Start ** at 2022.03.18-13.44.26
Initiating DATA PUMP
DATABASE TIME ZONE: VERSION:35 CON_ID:0
Log Location: TMP_DIR:testuser1.log
Master table "TESTUSER1"."ISQL_722" successfully loaded/unloaded
Starting "TESTUSER1"."ISQL_722":
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
ORA-39151: Table "TESTUSER1"."ESQL_642" exists. All dependent metadata and data will be skipped due to table_exists_action of skip
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . imported "TESTUSER1"."DEPT"                          6.031 KB       4 rows
. . imported "TESTUSER1"."EMP"                           8.781 KB      14 rows
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
Job "TESTUSER1"."ISQL_722" completed with 1 error(s) at Fri Mar 18 13:44:55 2022 elapsed 0 00:00:27
DataPump Operation Status 'COMPLETED'
Jobname = ISQL_722
** Datapump Command End ** at 2022.03.18-13.44.58
SQL>

我们使用 ESQL 和 ISQL 前缀检查主表。我们看到两个用于导出操作的主表,一个用于导入操作。


column table_name format a30

select table_name
from   user_tables
where  table_name like 'ESQL%'
or     table_name like 'ISQL%'
order by 1;

TABLE_NAME
------------------------------
ESQL_642
ESQL_682
ISQL_722

3 rows selected.

SQL>

从 22.1 版开始,我们可以包含和排除对象,并使用名称列表来定位特定对象。您可以在此处或从下面的帮助文本中获取完整的参数列表。

在以下示例中,我们使用该-namelist标志来执行表级导入。我们在导入之前删除表。

drop table emp purge;

datapump import-
     -schemas testuser1 -
     -namelist TABLE=emp -
     -directory tmp_dir -
     -dumpfile emp.dmp -
     -logfile emp.log

** Datapump Command Start ** at 2022.04.10-14.39.37
Initiating DATA PUMP
DATABASE TIME ZONE: VERSION:35 CON_ID:0
Log Location: TMP_DIR:emp.log
Master table "TESTUSER1"."ISQL_122" successfully loaded/unloaded
Starting "TESTUSER1"."ISQL_122":
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . imported "TESTUSER1"."EMP"                           8.781 KB      14 rows
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
Job "TESTUSER1"."ISQL_122" successfully completed at Sun Apr 10 13:40:10 2022 elapsed 0 00:00:29
DataPump Operation Status 'COMPLETED'
Jobname = ISQL_122
** Datapump Command End ** at 2022.04.10-14.40.13
SQL>

无执行

在此示例中,我们重复原始导出命令,但包含NOEXEC参数。这将显示为该命令运行的 PL/SQL 代码。DBMS_DATAPUMP它主要是对包的调用。

datapump export -
     -schemas testuser1 -
     -directory tmp_dir -
     -dumpfile testuser1.dmp -
     -logfile testuser1.log -
     -noexec

** Datapump Command Start ** at 2022.03.18-13.48.09
DECLARE
    errorlog varchar2(8000):='';
    getStatusOutput boolean:=false;
    backtrace varchar2(8000):='';
BEGIN
DECLARE
    h1 number;
    s varchar2(1000):=NULL;
    errorvarchar varchar2(100):= 'ERROR';
    tryGetStatus number := 0;
    success_with_info EXCEPTION;
    PRAGMA EXCEPTION_INIT(success_with_info, -31627);
    jobname varchar2(500):='ESQL_724';
    schema varchar2(8000):='';
    job_status VARCHAR2(30):='Not set';
    cloud_service varchar2(1000);
    success_with_info_warning_text varchar2(1000):=':DPEXEC_SUCCESS_WITH_INFO:';
    new_line varchar2(10):='
';
    get_status varchar2(1000):='dbms_datapump.get_status(';
    wait_for_job_status varchar2(1000):=':DPEXEC_DATAPUMP_OPERATION_STATUS:';
begin
    success_with_info_warning_text:=success_with_info_warning_text||new_line;
    BEGIN
    h1 := dbms_datapump.open (operation => :OPERATION, job_mode => :JOB_MODE, job_name => jobname, version =>  :VERSION);
    EXCEPTION when success_with_info THEN errorlog:=errorlog||success_with_info_warning_text;
    END;
    tryGetStatus := 1;
    BEGIN
    dbms_datapump.add_file(handle => h1, filename => :FILENAME_DMP, directory => :DIRECTORY_DMP,  filesize => :FILESIZE,  filetype => 1, reusefile => 1);
    EXCEPTION when success_with_info THEN errorlog:=errorlog||success_with_info_warning_text; END;
    BEGIN
    dbms_datapump.add_file(handle => h1, filename => :FILENAME_LOG, directory => :DIRECTORY_LOG, filetype => 3);
    EXCEPTION when success_with_info THEN errorlog:=errorlog||success_with_info_warning_text; END;
    BEGIN
    dbms_datapump.metadata_filter(handle => h1, name => 'SCHEMA_EXPR', value => 'IN ('''||:SCHEMA1||''')');
    EXCEPTION when success_with_info THEN errorlog:=errorlog||success_with_info_warning_text;
    END;
    BEGIN
    dbms_datapump.set_parameter(handle => h1, name => 'KEEP_MASTER', value => 1);
    EXCEPTION when success_with_info THEN errorlog:=errorlog||success_with_info_warning_text;
    END;
    BEGIN
    dbms_datapump.start_job(handle => h1, skip_current => 0, abort_step => 0);
    EXCEPTION when success_with_info THEN errorlog:=errorlog||success_with_info_warning_text;
    END;
    BEGIN
    dbms_datapump.wait_for_job (handle    => h1, job_state => job_status);
    EXCEPTION when success_with_info THEN errorlog:=errorlog||success_with_info_warning_text; END;
    errorlog:=errorlog||(wait_for_job_status||job_status||''''||new_line);
    h1:=null;
    BEGIN
    IF (h1 IS NOT NULL)
    THEN
        dbms_datapump.detach(handle => h1);
    END IF;
    EXCEPTION when success_with_info THEN errorlog:=errorlog||success_with_info_warning_text; END;
    errorvarchar := 'NO_ERROR';
    :jobnameout:=jobname;
EXCEPTION
When Others then
    backtrace:=backtrace||(SQLERRM)||new_line;
    backtrace:=backtrace|| dbms_utility.format_error_backtrace || new_line;
    IF ((S IS NOT NULL) AND (S!='COMPLETED')) THEN
         errorlog:=errorlog||'WAIT_FOR_JOB JOB_STATE STATE='||s|| new_line;
    END IF;
    DECLARE
        ind NUMBER;
        percent_done NUMBER;
        job_state VARCHAR2(30);
        le ku$_LogEntry;
        js ku$_JobStatus;
        jd ku$_JobDesc;
        sts ku$_Status;
    BEGIN
        if ((errorvarchar = 'ERROR')AND(tryGetStatus=1)) then
            dbms_datapump.get_status(h1,
            dbms_datapump.ku$_status_job_error +
            dbms_datapump.ku$_status_job_status +
            dbms_datapump.ku$_status_wip,-1,job_state,sts);
            js := sts.job_status;
            if (bitand(sts.mask,dbms_datapump.ku$_status_wip) != 0)
            then
                le := sts.wip;
            else
                if (bitand(sts.mask,dbms_datapump.ku$_status_job_error) != 0)
                then
                    le := sts.error;
                else
                    le := null;
                end if;
            end if;
            if le is not null
            then
                ind := le.FIRST;
                if ind is not null
                then
                    errorlog:=errorlog||(get_status||h1||'...)')||new_line;
                    getStatusOutput:=true;
                end if;
                while ind is not null loop
                    errorlog:=errorlog||(le(ind).LogText)||new_line;
                    ind := le.NEXT(ind);
                end loop;
            end if;
        END IF;
    EXCEPTION
    when others then null;
    END;
    BEGIN
        IF ((errorvarchar = 'ERROR')AND(tryGetStatus=1)AND(h1 IS NOT NULL)) THEN
            DBMS_DATAPUMP.DETACH(h1);
        END IF;
    EXCEPTION
    WHEN OTHERS THEN
        NULL;
    END;
END;
IF (getStatusOutput=false)
THEN
    errorlog:=errorlog||backtrace;
END IF;
:errorlogout:=errorlog;
END;
GEN DIRECTORY_DMP: TMP_DIR

GEN DIRECTORY_LOG: TMP_DIR

GEN FILENAME_DMP: testuser1.dmp

GEN FILENAME_LOG: testuser1.log

GEN FILESIZE: 500MB

GEN JOB_MODE: SCHEMA

GEN OPERATION: EXPORT

GEN SCHEMA1: TESTUSER1

GEN VERSION: COMPATIBLE

Execution is disabled due to -noexec option
** Datapump Command End ** at 2022.03.18-13.48.09
SQL>

帮助

DATAPUMP HELP命令显示完整的使用详情。如前所述,此版本仅支持使用该DBMS_DATAPUMP软件包可能实现的功能子集。

SQL> datapump help

DP | DATAPUMP
----------------
Usage: dp help [examples|syntax] |
         export [,...] |
         import [,...] |

 :
 File Arguments
 --------------
  -credential,-c               Default: as specified on CLOUDSTORAGE command
                             CREDENTIAL for dump file access in ORACLE OBJECT STORE.
  -directory,-d               :  Default: DATA_PUMP_DIR
                             Default database DIRECTORY for reading and writing dump and log files.
  -dumpdirectory,-dd          :  Default: -directory if specified or DATA_PUMP_DIR
                             Database DIRECTORY for dump file.
  -dumpfile,-f               [,...] :  Default .DMP
                             Dump file name(s) when using database DIRECTORY.
                             Multiple files can be specified whether parallelism is enabled or not.
                             The number of files specified should be at least as large as the degree of parallelism.
  -dumpuri,-u                [[,...] | [,...]]  Default: object name is  .DMP
                              :  complete uri for the ORACLE OBJECT STORE file if a default is not set on CLOUDSTORAGE command
                               : name of the object, optionally qualified by the namespace and the bucket.
                             The qualified name concatenated to the uri specified on CLOUDSTORAGE command must fully identify the object uri.
                             Specify the option without a value when the full url is specified on CLOUDSTORAGE command.
                             CREDENTIAL must be set for direct read/write access to ORACLE OBJECT STORE from autonomous database.
                             For -copycloud between database DIRECTORY and ORACLE OBJECT STORE, OCI PROFILE must be set.
                             Multiple uris can be specified whether parallelism is enabled or not.
                             The number of files specified should be at least as large as the degree of parallelism.
  -logdirectory,-ld            Default: -directory if specified or DATA_PUMP_DIR
                             Database DIRECTORY for log file.
  -logfile,-lf                 Default: .LOG
                             Log file name in the database DIRECTORY.


 Command Arguments
 -----------------
  -noexec,-ne                [TRUE|FALSE]  Default: FALSE
                             TRUE : Validate and generate the PL/SQL, but do not execute it.
  -verbose,-ve               [TRUE|FALSE]  Default: FALSE
                             TRUE : Show additional diagnostic output.
 Common Arguments
 ----------------
  -copycloud,-cc             [TRUE|FALSE]  Default: FALSE
                             [TRUE] : Copy the dumpfile between database directory and ORACLE OBJECT STORE
                               On EXPORT, copy the dumpfile from the database directory to ORACLE OBJECT STORE after the datapump job completes.
                               On IMPORT, copy the dumpfile from ORACLE OBJECT STORE to the database directory before the datapump job starts
                               OCI PROFILE must be set using OCI command or CLOUDSTORAGE command.
                               Cloud storage uri must be set using the CLOUDSTORAGE command, SET DATAPUMP command or DATAPUMP command.
  -encryptionpassword,-enp     Default:  None
                             If password is not specified, a prompt for one will be given.
                             On export, encrypts the dump files using the password.
                             On import, the same password that was used for export must be provided.
  -excludeexpr,-ex             Default: None
                             Specify an expression identifying an object type or set of object types to exclude from the job.
                             Example: -excludeexpr "IN ('GRANT','INDEX','TRIGGER')"
  -excludelist,-el           [,...]   Default: None
                             Specify a comma separated value list of object types to exclude from the job.
                             Example: -excludelist GRANT,INDEX,TRIGGER
  -includeexpr,-ix             Default: None
                             Specify an expression identifying an object type or set of object types to include in the job.
                             Only matching object types and their dependents will be included in the job.
                             Use -excludelist or -excludeexpr to exclude dependent objects.
                             Example: -includeexpr "IN ('TABLE','VIEW')"
  -includelist,-il           [,...]  Default: None
                             Specify a comma separated value list of object types to include in the job.
                             Only matching object types and their dependents will be included in the job.
                             Use -excludelist or -excludeexpr to exclude dependent objects.
                             Example: -includelist TABLE,VIEW
  -includemetadata,-im       [TRUE|FALSE]  Default: TRUE
                             TRUE : Include metadata in the job. Default: TRUE
  -includerows,-ir           [TRUE|FALSE]  Default: TRUE
                             TRUE: Include data in the job.  Default: TRUE
  -jobname,-j                 Name for the datapump job. (default: ESQL_ | ISQL_) where n is a datapump generated number
                             Job Name is appended with a datapump generated number, unless it ends with a number.
                             Job Name is used when submitting the datapump job and as default name for dump and log filenames/objectnames.
  -nameexpr,-nx              {=}[;...]  Default: None
                             For specified object type, provide an expression identifying a set of object names to include in the job.
                             Example: -nameexpr TABLE="IN ('EMPLOYEES', 'DEPARTMENTS')";PROCEDURE="IN ('ADD_JOB_HISTORY','SECURE_DML')"
  -namelist,nl               {=[,...]}[;...]  Default: None
                             For specified object type, provide a comma separated value list of objects to include in the job.
                             Example: -namelist TABLE=employees,departments;PROCEDURE=add_job_history,secure_dml
  -parallel,-p                 Default 1
                             Adjusts the degree of parallelism within a job allowing multiple processes simultaneously.
                             Specify the same number of files as the degree or some processes may remain idle.
  -schemas,-s                [,...] Default: On export, schema for the current connection.
                             Default: On import, full import.
                             The schema or comma separated value list of schemas to process.
                             Example: schema1,schema2.
  -version,-v                {|COMPATIBLE|LATEST}  Default: COMPATIBLE
                              : A specific database version, for example, '11.0.0'.
                               When exporting from Oracle Database 11g release 2 (11.2.0.3) or later into an Oracle Database 12 c Release 1 (12.1):
                                 Specify a value of 12 to allow all existing database features, components, and options to be exported.
                                 This applies to either a multitenant container database (CDB) or a non-CDB.
                             COMPATIBLE :  Uses metadata version from database compatibility level and the compatibility release level for feature.
                             LATEST : The version of the metadata corresponds to the database version.
  -wait,-w                   [TRUE|FALSE]  Default: TRUE
                             TRUE : Wait for the datapump job to finish and show summary results.
                             FALSE : Submit the datapump job without waiting and showing results.

 Export Only Arguments
 ---------------------
  -compression,-cm           {ALL|DATA_ONLY|METADATA_ONLY|NONE}  Default: METADATA_ONLY
                             Indicates if compression should be done on user data and metadata.
                             ALL : Compress user data and metadata.
                             DATA_ONLY : Compress only user data.
                             METADATA_ONLY : Compress only metadata.
                             NONE : Do not compress user data or metadata.
  -encryption,-en            {ALL | DATA_ONLY | ENCRYPTED_COLUMNS_ONLY | METADATA_ONLY | NONE}
                             Default: NONE, or ALL if any other encryption option is specified.
                             Specifying any encryption option will turn encryption on if you do not specify -encryption NONE.
  -encryptionalgorithm,-ena  {AES128 | AES192 | AES256} Default: AES128
                             Identifies the cryptographic algorithm to be used.
  -encryptionmode,-enm       {DUAL | PASSWORD | TRANSPARENT}
                             Default(if encryption is on): TRANSPARENT, or PASSWORD if -encryptionpassword is specified.
                             Identifies the types of security used for encryption and decryption.
                               PASSWORD encrypts the dumpfiles using the provided password.
                               TRANSPARENT allows encryption if the Oracle Encryption Wallet is available.
                               DUAL allows import using the Oracle Encryption Wallet or the password.
                               When using DUAL, -encryptionpassword must be specified.
  -estimate,-e               {BLOCKS|STATISTICS}
                             Specifies the estimate method for the size of the tables should be performed before starting the job.
                             BLOCKS : Estimate is calculated using the count of blocks allocated to the user tables.
                             STATISTICS : Estimate is calculated using the statistics for each table.
                               If no statistics are available for a table, BLOCKS is used.
  -filesize,-fs              {{B|KB|MB|GB|TB}}  Default: 500MB
                             Limit for the size of files.
  -flashbackscn,-fb          [TRUE|FALSE]  Default: FALSE
                             TRUE : Use consistent database content based on scn at start time of execution.
  -reusefile,-r              [TRUE|FALSE]  Default: TRUE
                             TRUE : Replace existing dump file(s) with new file.

 Import Only Arguments
 ---------------------
  -columnencryption,-ce      [TRUE|FALSE]  Default: TRUE if supported by database
                             TRUE : Include column encryption clause on table metadata.
                             FALSE : Omit column encryption clause.
  -objectid,-oid             [TRUE|FALSE]  Default: TRUE
                             TRUE : Assign the exported OID.
                             FALSE : Assign a new OID.
  -remapschemas,-rs          {=[,...]}
                              objects in the job will be moved to .
                             Example: oldschema1=newschema1,oldschema2=newschema2.
  -remaptablespaces,-rt      {=[,...]}
                              storage segment in the job will be relocated to .
                             Example: oldtablespace1=newtablespace1,oldtablespace2=newtablespace2
  -segmentattributes,-sa     [TRUE|FALSE]  Default TRUE
                             TRUE : Include segment attributes clauses (physical attributes, storage attributes, tablespace, logging).
  -skipunusableindexes,-sui  [TRUE|FALSE]  Default: TRUE
                             TRUE : Tables or partitions with an index in the UNUSABLE state are loaded, as if the unusable index did not exist.
                             FALSE : Tables or partitions with an index in the UNUSABLE state are not loaded.
  -storage,-st               [TRUE|FALSE]  Default TRUE
                             TRUE : Include storage clauses.
  -tableexists,-te           {APPEND|REPLACE|SKIP|TRUNCATE} Default: SKIP when -includemetadata=true, otherwise APPEND
                             Action to be taken if table exists on import.
                             APPEND : New rows are added to the existing rows in the table.
                             REPLACE : Before creating the new table, the old table is dropped.
                             SKIP : The preexisting table is left unchanged.
                             TRUNCATE : Rows are removed from a preexisting table before inserting rows from the IMPORT.
  -tablecompression,-tc      [TRUE|FALSE]  Default: TRUE
                             TRUE : The table compression clause will be included if supported.
                             FALSE : The table will have the default compression for the tablespace.

SQL>
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论