|
- select * from dba_directories;
- create directory dir1 as '/home/oracle/dir1';
- create directory dir2 as '/home/oracle/dir2';
- grant read,write on directory dir1 to hr;
- grant read,write on directory dir2 to hr;
- select * from dba_tab_privs tp where tp.grantee='HR';
复制代码 | GRANTEE | OWNER | TABLE_NAME | GRANTOR | PRIVILEGE | GRANTABLE | HIERARCHY | COMMON | TYPE | 1 | HR | SYS | DBMS_STATS | SYS | EXECUTE | NO | NO | NO | PACKAGE | 2 | HR | SYS | DIR1 | SYS | READ | NO | NO | NO | DIRECTORY | 3 | HR | SYS | DIR1 | SYS | WRITE | NO | NO | NO | DIRECTORY | 4 | HR | SYS | DIR2 | SYS | READ | NO | NO | NO | DIRECTORY | 5 | HR | SYS | DIR2 | SYS | WRITE | NO | NO | NO | DIRECTORY |
- CREATE TABLE hr.extab_employees
- (employee_id NUMBER(4),
- first_name VARCHAR2(20),
- last_name VARCHAR2(25),
- hire_date DATE)
- ORGANIZATION EXTERNAL
- ( TYPE ORACLE_LOADER DEFAULT DIRECTORY dir1
- ACCESS PARAMETERS
- ( records delimited by newline
- badfile dir1:'empxt%a_%p.bad'
- logfile dir1:'empxt%a_%p.log'
- fields terminated by ','
- missing field values are null
- ( employee_id, first_name, last_name,
- hire_date char date_format date mask "dd-mon-yyyy"))
- LOCATION (dir1:'empxt1.dat', dir2:'empxt2.dat') )
- PARALLEL REJECT LIMIT UNLIMITED;
-
- select * from dba_tables t where t.owner='HR';
-
复制代码 | OWNER | TABLE_NAME | TABLESPACE_NAME | CLUSTER_NAME | IOT_NAME | STATUS | PCT_FREE | PCT_USED | INI_TRANS | MAX_TRANS | INITIAL_EXTENT | NEXT_EXTENT | MIN_EXTENTS | MAX_EXTENTS | PCT_INCREASE | FREELISTS | FREELIST_GROUPS | LOGGING | BACKED_UP | NUM_ROWS | BLOCKS | EMPTY_BLOCKS | AVG_SPACE | CHAIN_CNT | AVG_ROW_LEN | AVG_SPACE_FREELIST_BLOCKS | NUM_FREELIST_BLOCKS | DEGREE | INSTANCES | CACHE | TABLE_LOCK | SAMPLE_SIZE | LAST_ANALYZED | PARTITIONED | IOT_TYPE | TEMPORARY | SECONDARY | NESTED | BUFFER_POOL | FLASH_CACHE | CELL_FLASH_CACHE | ROW_MOVEMENT | GLOBAL_STATS | USER_STATS | DURATION | SKIP_CORRUPT | MONITORING | CLUSTER_OWNER | DEPENDENCIES | COMPRESSION | COMPRESS_FOR | DROPPED | READ_ONLY | SEGMENT_CREATED | RESULT_CACHE | CLUSTERING | ACTIVITY_TRACKING | DML_TIMESTAMP | HAS_IDENTITY | CONTAINER_DATA | INMEMORY | INMEMORY_PRIORITY | INMEMORY_DISTRIBUTE | INMEMORY_COMPRESSION | INMEMORY_DUPLICATE | 1 | HR | SSMM | SSMM | | | VALID | 10 | 40 | 1 | 255 | | | | | | | | YES | N | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | N | ENABLED | 0 | 7/15/2018 9:10:56 AM | NO | | N | N | NO | DEFAULT | DEFAULT | DEFAULT | DISABLED | YES | NO | | DISABLED | YES | | DISABLED | DISABLED | | NO | NO | NO | DEFAULT | NO | | | NO | NO | DISABLED | | | | | 2 | HR | SSMA | USERS | | | VALID | 10 | | 1 | 255 | | | | | | | | YES | N | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | N | ENABLED | 0 | 7/15/2018 9:10:57 AM | NO | | N | N | NO | DEFAULT | DEFAULT | DEFAULT | DISABLED | YES | NO | | DISABLED | YES | | DISABLED | DISABLED | | NO | NO | NO | DEFAULT | NO | | | NO | NO | DISABLED | | | | | 3 | HR | T05207_A | SSMM | | | VALID | 80 | 20 | 5 | 255 | | | | | | | | YES | N | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | N | ENABLED | 0 | 7/15/2018 9:10:57 AM | NO | | N | N | NO | DEFAULT | DEFAULT | DEFAULT | DISABLED | YES | NO | | DISABLED | YES | | DISABLED | DISABLED | | NO | NO | NO | DEFAULT | NO | | | NO | NO | DISABLED | | | | | 4 | HR | EMPLOYEES | EXAMPLE | | | VALID | 10 | | 1 | 255 | 65536 | 1048576 | 1 | 2147483645 | | | | NO | N | 107 | 5 | 0 | 0 | 0 | 69 | 0 | 0 | 1 | 1 | N | ENABLED | 107 | 7/7/2014 6:56:25 AM | NO | | N | N | NO | DEFAULT | DEFAULT | DEFAULT | DISABLED | YES | NO | | DISABLED | YES | | DISABLED | DISABLED | | NO | NO | YES | DEFAULT | NO | | | NO | NO | DISABLED | | | | | 5 | HR | EXTAB_EMPLOYEES | 没有表空间
| | | VALID | 0 | 0 | 0 | 0 | | | | | | | | YES | N | | | | | | | | | DEFAULT | DEFAULT | N | ENABLED | | | NO | | N | N | NO | DEFAULT | DEFAULT | DEFAULT | DISABLED | NO | NO | | DISABLED | NO | | DISABLED | DISABLED | BASIC | NO | NO | YES | DEFAULT | NO | | | NO | NO | DISABLED | | | | | 6 | HR | JOBS | EXAMPLE | | | VALID | 10 | | 1 | 255 | 65536 | 1048576 | 1 | 2147483645 | | | | NO | N | 19 | 5 | 0 | 0 | 0 | 33 | 0 | 0 | 1 | 1 | N | ENABLED | 19 | 7/7/2014 6:56:25 AM | NO | | N | N | NO | DEFAULT | DEFAULT | DEFAULT | DISABLED | YES | NO | | DISABLED | YES | | DISABLED | DISABLED | | NO | NO | YES | DEFAULT | NO | | | NO | NO | DISABLED | | | | | 7 | HR | T04209_UNAME | TBSUNIFORM | | | VALID | 10 | | 1 | 255 | 524288 | 524288 | 1 | 2147483645 | 0 | | | YES | N | 100000 | 247 | 0 | 0 | 0 | 12 | 0 | 0 | 1 | 1 | N | ENABLED | 100000 | 7/15/2018 9:10:58 AM | NO | | N | N | NO | DEFAULT | DEFAULT | DEFAULT | DISABLED | YES | NO | | DISABLED | YES | | DISABLED | DISABLED | | NO | NO | YES | DEFAULT | NO | | | NO | NO | DISABLED | | | | | 8 | HR | REGIONS | EXAMPLE | | | VALID | 10 | | 1 | 255 | 65536 | 1048576 | 1 | 2147483645 | | | | NO | N | 4 | 5 | 0 | 0 | 0 | 14 | 0 | 0 | 1 | 1 | N | ENABLED | 4 | 7/7/2014 6:56:26 AM | NO | | N | N | NO | DEFAULT | DEFAULT | DEFAULT | DISABLED | YES | NO | | DISABLED | YES | | DISABLED | DISABLED | | NO | NO | YES | DEFAULT | NO | | | NO | NO | DISABLED | | | | | 9 | HR | T_BANK_INVOICE | USERS | | | VALID | 10 | | 1 | 255 | 65536 | 1048576 | 1 | 2147483645 | | | | YES | N | | | | | | | | | 1 | 1 | N | ENABLED | | | NO | | N | N | NO | DEFAULT | DEFAULT | DEFAULT | DISABLED | NO | NO | | DISABLED | YES | | DISABLED | DISABLED | | NO | NO | YES | DEFAULT | NO | | | NO | NO | DISABLED | | | | | 10 | HR | JOB_HISTORY | EXAMPLE | | | VALID | 10 | | 1 | 255 | 65536 | 1048576 | 1 | 2147483645 | | | | NO | N | 10 | 5 | 0 | 0 | 0 | 31 | 0 | 0 | 1 | 1 | N | ENABLED | 10 | 7/7/2014 6:56:25 AM | NO | | N | N | NO | DEFAULT | DEFAULT | DEFAULT | DISABLED | YES | NO | | DISABLED | YES | | DISABLED | DISABLED | | NO | NO | YES | DEFAULT | NO | | | NO | NO | DISABLED | | | | | 11 | HR | T05207_B | USERS | | | VALID | 10 | | 1 | 255 | 10485760 | 1048576 | 1 | 2147483645 | | | | YES | N | 0 | 1006 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | N | ENABLED | 0 | 7/15/2018 9:10:58 AM | NO | | N | N | NO | DEFAULT | DEFAULT | DEFAULT | DISABLED | YES | NO | | DISABLED | YES | | DISABLED | DISABLED | | NO | NO | YES | DEFAULT | NO | | | NO | NO | DISABLED | | | | | 12 | HR | COUNTRIES | | | | VALID | 0 | 0 | 0 | 0 | | | | | | | | | N | 25 | | | 0 | 0 | 15 | 0 | | 1 | 1 | N | ENABLED | 25 | 7/7/2014 6:56:24 AM | NO | IOT | N | N | NO | DEFAULT | DEFAULT | DEFAULT | DISABLED | YES | NO | | DISABLED | YES | | DISABLED | DISABLED | BASIC | NO | NO | YES | DEFAULT | NO | | | NO | NO | DISABLED | | | | | 13 | HR | LOCATIONS | EXAMPLE | | | VALID | 10 | | 1 | 255 | 65536 | 1048576 | 1 | 2147483645 | | | | NO | N | 23 | 5 | 0 | 0 | 0 | 49 | 0 | 0 | 1 | 1 | N | ENABLED | 23 | 7/7/2014 6:56:26 AM | NO | | N | N | NO | DEFAULT | DEFAULT | DEFAULT | DISABLED | YES | NO | | DISABLED | YES | | DISABLED | DISABLED | | NO | NO | YES | DEFAULT | NO | | | NO | NO | DISABLED | | | | | 14 | HR | DEPARTMENTS | EXAMPLE | | | VALID | 10 | | 1 | 255 | 65536 | 1048576 | 1 | 2147483645 | | | | NO | N | 27 | 5 | 0 | 0 | 0 | 21 | 0 | 0 | 1 | 1 | N | ENABLED | 27 | 7/7/2014 6:56:25 AM | NO | | N | N | NO | DEFAULT | DEFAULT | DEFAULT | DISABLED | YES | NO | | DISABLED | YES | | DISABLED | DISABLED | | NO | NO | YES | DEFAULT | NO | | | NO | NO | DISABLED | | | | |
- select * from dba_external_tables et
- where et.owner='HR' ;
复制代码
由于控制文件和外部表都是识别行和列,所以应该可以从控制文件推出外部表:
- sqlldr hr/oracle_4U control=ccb.ctl external_table=GENERATE_ONLY log=ccb.sql
- SQL*Loader: Release 12.1.0.2.0 - Production on Sat Jul 28 10:01:43 2018
- Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
- Path used: External Table
复制代码 看看ccb.sql:
- drop table hr.T_BANK_INVOICE;
- CREATE TABLE hr.T_BANK_INVOICE
- (
- "ACCOUNT_NUMBER" VARCHAR2(255),
- "SUB_NUMBER" VARCHAR2(255),
- "TRANSAC_DATE" DATE,
- "TRANSAC_ADDRESS" VARCHAR2(600),
- "OUT_AMOUNT" NUMBER(20,2),
- "IN_AMOUNT" NUMBER(20,2),
- "BALANCE" NUMBER(20,2),
- "OPPOSITE_NUMBER" NUMBER,
- "OPPOSITE_USERNAME" VARCHAR2(100),
- "CURRENCY" VARCHAR2(100),
- "TRANSAC_COMMENT" VARCHAR2(600)
- )
- ORGANIZATION external
- (
- TYPE oracle_loader
- DEFAULT DIRECTORY dir1
- ACCESS PARAMETERS
- (
- RECORDS DELIMITED BY NEWLINE CHARACTERSET ZHS16GBK
- BADFILE dir1:'ccb.bad'
- LOGFILE dir1:'ccb%a_%p.log'
- READSIZE 1048576
- FIELDS TERMINATED BY "," LDRTRIM
- MISSING FIELD VALUES ARE NULL
- REJECT ROWS WITH ALL NULL FIELDS
- (
- "ACCOUNT_NUMBER" CHAR(255)
- TERMINATED BY ",",
- "SUB_NUMBER" CHAR(255)
- TERMINATED BY ",",
- "TRANSAC_DATE" (1:8) CHAR(8)
- DATE_FORMAT DATE MASK "YYYYMMDD",
- "TRANSAC_ADDRESS" (10) CHAR(255)
- TERMINATED BY ",",
- "OUT_AMOUNT" CHAR(255)
- TERMINATED BY ",",
- "IN_AMOUNT" CHAR(255)
- TERMINATED BY ",",
- "BALANCE" CHAR(255)
- TERMINATED BY ",",
- "OPPOSITE_NUMBER" CHAR(255)
- TERMINATED BY ",",
- "OPPOSITE_USERNAME" CHAR(255)
- TERMINATED BY ",",
- "CURRENCY" CHAR(255)
- TERMINATED BY ",",
- "TRANSAC_COMMENT" CHAR(255)
- TERMINATED BY ","
- )
- )
- location
- (
- 'ccb.dat'
- )
- )REJECT LIMIT UNLIMITED;
复制代码 外部表都是只读的:
工行网银的控制文件:
- LOAD DATA
- characterset ZHS16GBK
- INFILE 'icbc.dat'
- DISCARDFILE 'icbc.dis'
- append
- INTO table t_bank_invoice
- when (5) ='^'
- FIELDS TERMINATED BY '^'
- TRAILING NULLCOLS
- (
- account_number "1402029101000999999",
- sub_number "00000",
- transac_date position(6:15) DATE(10) "YYYY-MM-DD" TERMINATED BY WHITESPACE,
- transac_address TERMINATED BY WHITESPACE
- "substr(:transac_address,2)",
- transac_comment TERMINATED BY WHITESPACE
- "substr(:transac_comment,2)",
- currency TERMINATED BY WHITESPACE
- "substr(:currency,2)",
- remit TERMINATED BY WHITESPACE
- "substr(:remit,2)",
- in_amount TERMINATED BY WHITESPACE
- "TO_NUMBER(substr(:in_amount,2),'999,999,999,999.00')",
- out_amount TERMINATED BY WHITESPACE
- "TO_NUMBER(substr(:out_amount,2),'999,999,999,999.00')",
- balance TERMINATED BY WHITESPACE
- "TO_NUMBER(substr(:balance,2),'999,999,999,999.00')",
- all_comment TERMINATED BY WHITESPACE
- "substr(:all_comment,2)"
- )
复制代码- [oracle@station90 ~]$ sqlldr hr/oracle_4U control=icbc.ctl external_table=GENERATE_ONLY log=icbc.sql
- SQL*Loader: Release 12.1.0.2.0 - Production on Sat Jul 28 10:29:02 2018
- Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
- Path used: External Table
复制代码 icbc.sql的内容:
- drop table hr.T_BANK_INVOICE;
- CREATE TABLE hr.T_BANK_INVOICE
- (
- "TRANSAC_DATE" DATE,
- "TRANSAC_ADDRESS" VARCHAR2(600),
- "TRANSAC_COMMENT" VARCHAR2(600),
- "CURRENCY" VARCHAR2(255),
- "REMIT" VARCHAR2(255),
- "IN_AMOUNT" VARCHAR2(255),
- "OUT_AMOUNT" VARCHAR2(255),
- "BALANCE" VARCHAR2(255),
- "ALL_COMMENT" VARCHAR2(2000)
- )
- ORGANIZATION external
- (
- TYPE oracle_loader
- DEFAULT DIRECTORY dir1
- ACCESS PARAMETERS
- (
- RECORDS DELIMITED BY NEWLINE CHARACTERSET ZHS16GBK
- LOAD WHEN ((5: 5) = "^")
- BADFILE dir1:'icbc.bad'
- DISCARDFILE dir1:'icbc.dis'
- LOGFILE dir1:'icbc%a_%p.log'
- READSIZE 1048576
- FIELDS TERMINATED BY "^" LDRTRIM
- MISSING FIELD VALUES ARE NULL
- REJECT ROWS WITH ALL NULL FIELDS
- (
- "TRANSAC_DATE" (6:15) CHAR(10)
- DATE_FORMAT DATE MASK "YYYY-MM-DD" ,
- "TRANSAC_ADDRESS" char(255)
- TERMINATED BY "^",
- "TRANSAC_COMMENT" (48) CHAR(255)
- TERMINATED BY "^",
- "CURRENCY" CHAR(255)
- TERMINATED BY "^",
- "REMIT" CHAR(255)
- TERMINATED BY "^",
- "IN_AMOUNT" CHAR(255)
- TERMINATED BY "^",
- "OUT_AMOUNT" CHAR(255)
- TERMINATED BY "^",
- "BALANCE" CHAR(255)
- TERMINATED BY "^",
- "ALL_COMMENT" CHAR(255)
- TERMINATED BY "^"
- )
- )
- location
- (
- 'icbc.dat'
- )
- )REJECT LIMIT UNLIMITED;
复制代码
--------------------------------------二进制进出
- [oracle@station90 dir1]$ expdp system/oracle_4U directory=dir1 dumpfile=full.dmp full=y job_name=fulljob
- Export: Release 12.1.0.2.0 - Production on Sat Jul 28 11:29:07 2018
- Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
- Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
- With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
- Starting "SYSTEM"."FULLJOB": system/******** directory=dir1 dumpfile=full.dmp full=y job_name=fulljob
- Estimate in progress using BLOCKS method...
- Processing object type DATABASE_EXPORT/EARLY_OPTIONS/VIEWS_AS_TABLES/TABLE_DATA
- Processing object type DATABASE_EXPORT/NORMAL_OPTIONS/TABLE_DATA
- Processing object type DATABASE_EXPORT/NORMAL_OPTIONS/VIEWS_AS_TABLES/TABLE_DATA
- Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE_DATA
- Total estimation using BLOCKS method: 318.7 MB
- Processing object type DATABASE_EXPORT/PRE_SYSTEM_IMPCALLOUT/MARKER
- Processing object type DATABASE_EXPORT/PRE_INSTANCE_IMPCALLOUT/MARKER
- Processing object type DATABASE_EXPORT/TABLESPACE
- Processing object type DATABASE_EXPORT/PASSWORD_VERIFY_FUNCTION
- Processing object type DATABASE_EXPORT/PROFILE
- Processing object type DATABASE_EXPORT/SYS_USER/USER
- Processing object type DATABASE_EXPORT/SCHEMA/USER
- Processing object type DATABASE_EXPORT/ROLE
- Processing object type DATABASE_EXPORT/RADM_FPTM
- Processing object type DATABASE_EXPORT/GRANT/SYSTEM_GRANT/PROC_SYSTEM_GRANT
- Processing object type DATABASE_EXPORT/SCHEMA/GRANT/SYSTEM_GRANT
- Processing object type DATABASE_EXPORT/SCHEMA/ROLE_GRANT
- Processing object type DATABASE_EXPORT/SCHEMA/DEFAULT_ROLE
- Processing object type DATABASE_EXPORT/SCHEMA/ON_USER_GRANT
- Processing object type DATABASE_EXPORT/SCHEMA/TABLESPACE_QUOTA
- Processing object type DATABASE_EXPORT/RESOURCE_COST
- Processing object type DATABASE_EXPORT/TRUSTED_DB_LINK
- Processing object type DATABASE_EXPORT/SCHEMA/SEQUENCE/SEQUENCE
- Processing object type DATABASE_EXPORT/DIRECTORY/DIRECTORY
- Processing object type DATABASE_EXPORT/DIRECTORY/GRANT/OWNER_GRANT/OBJECT_GRANT
- Processing object type DATABASE_EXPORT/SCHEMA/SYNONYM
- Processing object type DATABASE_EXPORT/SCHEMA/TYPE/INC_TYPE
- Processing object type DATABASE_EXPORT/SCHEMA/TYPE/TYPE_SPEC
- Processing object type DATABASE_EXPORT/SCHEMA/TYPE/GRANT/OWNER_GRANT/OBJECT_GRANT
- Processing object type DATABASE_EXPORT/SYSTEM_PROCOBJACT/PRE_SYSTEM_ACTIONS/PROCACT_SYSTEM
- Processing object type DATABASE_EXPORT/SYSTEM_PROCOBJACT/PROCOBJ
- Processing object type DATABASE_EXPORT/SYSTEM_PROCOBJACT/POST_SYSTEM_ACTIONS/PROCACT_SYSTEM
- Processing object type DATABASE_EXPORT/SCHEMA/PROCACT_SCHEMA
- Processing object type DATABASE_EXPORT/EARLY_OPTIONS/VIEWS_AS_TABLES/TABLE
- Processing object type DATABASE_EXPORT/EARLY_POST_INSTANCE_IMPCALLOUT/MARKER
- Processing object type DATABASE_EXPORT/SCHEMA/XMLSCHEMA/XMLSCHEMA
- Processing object type DATABASE_EXPORT/NORMAL_OPTIONS/TABLE
- 这时,按了ctl+c
- Export> help
- ------------------------------------------------------------------------------
- The following commands are valid while in interactive mode.
- Note: abbreviations are allowed.
- ADD_FILE
- Add dumpfile to dumpfile set.
- CONTINUE_CLIENT
- Return to logging mode. Job will be restarted if idle.
- EXIT_CLIENT
- Quit client session and leave job running.
- FILESIZE
- Default filesize (bytes) for subsequent ADD_FILE commands.
- HELP
- Summarize interactive commands.
- KILL_JOB
- Detach and delete job.
- PARALLEL
- Change the number of active workers for current job.
- REUSE_DUMPFILES
- Overwrite destination dump file if it exists [NO].
- START_JOB
- Start or resume current job.
- Valid keyword values are: SKIP_CURRENT.
- STATUS
- Frequency (secs) job status is to be monitored where
- the default [0] will show new status when available.
- STOP_JOB
- Orderly shutdown of job execution and exits the client.
- Valid keyword values are: IMMEDIATE.
- Export> STOP_JOB
- Are you sure you wish to stop this job ([yes]/no): yes
- [oracle@station90 dir1]$ expdp system/oracle_4U attach=fulljob
- Export: Release 12.1.0.2.0 - Production on Sat Jul 28 11:30:38 2018
- Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
- Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
- With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
- Job: FULLJOB
- Owner: SYSTEM
- Operation: EXPORT
- Creator Privs: TRUE
- GUID: 7207D4B3F9CF3D4AE0535A00A8C00270
- Start Time: Saturday, 28 July, 2018 11:30:40
- Mode: FULL
- Instance: orcl
- Max Parallelism: 1
- Timezone: +00:00
- Timezone version: 18
- Endianness: LITTLE
- NLS character set: AL32UTF8
- NLS NCHAR character set: AL16UTF16
- EXPORT Job Parameters:
- Parameter Name Parameter Value:
- CLIENT_COMMAND system/******** directory=dir1 dumpfile=full.dmp full=y job_name=fulljob
- State: IDLING
- Bytes Processed: 0
- Current Parallelism: 1
- Job Error Count: 0
- Dump File: /home/oracle/dir1/full.dmp
- bytes written: 4,096
-
- Worker 1 Status:
- Instance ID: 1
- Instance name: orcl
- Host name: station90.example.com
- Process Name: DW00
- State: UNDEFINED
- Export> help
- ------------------------------------------------------------------------------
- The following commands are valid while in interactive mode.
- Note: abbreviations are allowed.
- ADD_FILE
- Add dumpfile to dumpfile set.
- CONTINUE_CLIENT
- Return to logging mode. Job will be restarted if idle.
- EXIT_CLIENT
- Quit client session and leave job running.
- FILESIZE
- Default filesize (bytes) for subsequent ADD_FILE commands.
- HELP
- Summarize interactive commands.
- KILL_JOB
- Detach and delete job.
- PARALLEL
- Change the number of active workers for current job.
- REUSE_DUMPFILES
- Overwrite destination dump file if it exists [NO].
- START_JOB
- Start or resume current job.
- Valid keyword values are: SKIP_CURRENT.
- STATUS
- Frequency (secs) job status is to be monitored where
- the default [0] will show new status when available.
- STOP_JOB
- Orderly shutdown of job execution and exits the client.
- Valid keyword values are: IMMEDIATE.
- Export> status
- Job: FULLJOB
- Operation: EXPORT
- Mode: FULL
- State: IDLING
- Bytes Processed: 0
- Current Parallelism: 1
- Job Error Count: 0
- Dump File: /home/oracle/dir1/full.dmp
- bytes written: 4,096
-
- Worker 1 Status:
- Instance ID: 1
- Instance name: orcl
- Host name: station90.example.com
- Process Name: DW00
- State: UNDEFINED
- Export> start_job
- Export>
复制代码-
- select * from dba_datapump_jobs dj
- where dj.job_name='FULLJOB';
-
-
- select * from system.fulljob;
复制代码
作业完成主表进了dumpfile,找不到了,这是正常的:
导入的时候,主表先进来:
- [oracle@station90 ~]$ impdp user1/oracle_4U directory=dir1 dumpfile=full.dmp tables=hr.employees remap_schema=hr:user1
- Import: Release 12.1.0.2.0 - Production on Sat Jul 28 11:39:28 2018
- Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
- Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
- With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
- ORA-31626: job does not exist
- ORA-31633: unable to create master table "USER1.SYS_IMPORT_TABLE_05"
- ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
- ORA-06512: at "SYS.KUPV$FT", line 1048
- ORA-01031: insufficient privileges
复制代码- grant read,write on directory dir1 to user1;
- alter user user1 account unlock;
- grant resource to user1;
- alter user user1 quota unlimited on example;
复制代码- [oracle@station90 ~]$ impdp user1/oracle_4U directory=dir1 dumpfile=full.dmp tables=hr.employees remap_schema=hr:user1
- Import: Release 12.1.0.2.0 - Production on Sat Jul 28 11:44:24 2018
- Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
- Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
- With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
- Master table "USER1"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded
- Starting "USER1"."SYS_IMPORT_TABLE_01": user1/******** directory=dir1 dumpfile=full.dmp tables=hr.employees remap_schema=hr:user1
- Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE
- Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE_DATA
- . . imported "USER1"."EMPLOYEES" 17.07 KB 107 rows
- Processing object type DATABASE_EXPORT/SCHEMA/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
- Processing object type DATABASE_EXPORT/SCHEMA/TABLE/COMMENT
- Processing object type DATABASE_EXPORT/SCHEMA/TABLE/AUDIT_OBJ
- Processing object type DATABASE_EXPORT/SCHEMA/TABLE/INDEX/INDEX
- Processing object type DATABASE_EXPORT/SCHEMA/TABLE/CONSTRAINT/CONSTRAINT
- Processing object type DATABASE_EXPORT/SCHEMA/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
- Processing object type DATABASE_EXPORT/SCHEMA/TABLE/CONSTRAINT/REF_CONSTRAINT
- ORA-39083: Object type REF_CONSTRAINT:"USER1"."EMP_DEPT_FK" failed to create with error:
- ORA-00942: table or view does not exist
- Failing sql is:
- ALTER TABLE "USER1"."EMPLOYEES" ADD CONSTRAINT "EMP_DEPT_FK" FOREIGN KEY ("DEPARTMENT_ID") REFERENCES "USER1"."DEPARTMENTS" ("DEPARTMENT_ID") ENABLE
- ORA-39083: Object type REF_CONSTRAINT:"USER1"."EMP_JOB_FK" failed to create with error:
- ORA-00942: table or view does not exist
- Failing sql is:
- ALTER TABLE "USER1"."EMPLOYEES" ADD CONSTRAINT "EMP_JOB_FK" FOREIGN KEY ("JOB_ID") REFERENCES "USER1"."JOBS" ("JOB_ID") ENABLE
- Processing object type DATABASE_EXPORT/SCHEMA/TABLE/STATISTICS/TABLE_STATISTICS
- Processing object type DATABASE_EXPORT/STATISTICS/MARKER
- Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TRIGGER
- ORA-39083: Object type TRIGGER failed to create with error:
- ORA-31625: Schema SYS is needed to import this object, but is unaccessible
- ORA-01031: insufficient privileges
- Failing sql is:
- CREATE NONEDITIONABLE TRIGGER trg05211
- after update of salary on hr.employees
- referencing new as new old as old
- for each row
- begin
- if :old.salary != :new.salary
- then
- insert into t05211_value values( to_char(sysdate,'YYYY-MM-DD:HH24:MI:SS')||' '||
- sys_context('usere
- ORA-39082: Object type TRIGGER:"USER1"."SECURE_EMPLOYEES" created with compilation warnings
- ORA-39082: Object type TRIGGER:"USER1"."UPDATE_JOB_HISTORY" created with compilation warnings
- Job "USER1"."SYS_IMPORT_TABLE_01" completed with 5 error(s) at Sat Jul 28 11:44:47 2018 elapsed 0 00:00:22
复制代码- [oracle@station90 ~]$ impdp user1/oracle_4U directory=dir1 dumpfile=full.dmp tables=hr.departments remap_schema=hr:user1 remap_tablespace=example:users
- Import: Release 12.1.0.2.0 - Production on Sat Jul 28 11:46:39 2018
- Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
- Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
- With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
- Master table "USER1"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded
- Starting "USER1"."SYS_IMPORT_TABLE_01": user1/******** directory=dir1 dumpfile=full.dmp tables=hr.departments remap_schema=hr:user1 remap_tablespace=example:users
- Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE
- Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE_DATA
- . . imported "USER1"."DEPARTMENTS" 7.125 KB 27 rows
- Processing object type DATABASE_EXPORT/SCHEMA/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
- Processing object type DATABASE_EXPORT/SCHEMA/TABLE/COMMENT
- Processing object type DATABASE_EXPORT/SCHEMA/TABLE/INDEX/INDEX
- Processing object type DATABASE_EXPORT/SCHEMA/TABLE/CONSTRAINT/CONSTRAINT
- Processing object type DATABASE_EXPORT/SCHEMA/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
- Processing object type DATABASE_EXPORT/SCHEMA/TABLE/CONSTRAINT/REF_CONSTRAINT
- ORA-39083: Object type REF_CONSTRAINT:"USER1"."DEPT_LOC_FK" failed to create with error:
- ORA-00942: table or view does not exist
- Failing sql is:
- ALTER TABLE "USER1"."DEPARTMENTS" ADD CONSTRAINT "DEPT_LOC_FK" FOREIGN KEY ("LOCATION_ID") REFERENCES "USER1"."LOCATIONS" ("LOCATION_ID") ENABLE
- Processing object type DATABASE_EXPORT/SCHEMA/TABLE/STATISTICS/TABLE_STATISTICS
- Processing object type DATABASE_EXPORT/STATISTICS/MARKER
- Job "USER1"."SYS_IMPORT_TABLE_01" completed with 1 error(s) at Sat Jul 28 11:47:02 2018 elapsed 0 00:00:21
- [oracle@station90 ~]$
复制代码- select * from dba_tables t where t.table_name in ('DEPARTMENTS',
- 'EMPLOYEES')
- ;
复制代码
| OWNER | TABLE_NAME | TABLESPACE_NAME | CLUSTER_NAME | IOT_NAME | STATUS | PCT_FREE | PCT_USED | INI_TRANS | MAX_TRANS | INITIAL_EXTENT | NEXT_EXTENT | MIN_EXTENTS | MAX_EXTENTS | PCT_INCREASE | FREELISTS | FREELIST_GROUPS | LOGGING | BACKED_UP | NUM_ROWS | BLOCKS | EMPTY_BLOCKS | AVG_SPACE | CHAIN_CNT | AVG_ROW_LEN | AVG_SPACE_FREELIST_BLOCKS | NUM_FREELIST_BLOCKS | DEGREE | INSTANCES | CACHE | TABLE_LOCK | SAMPLE_SIZE | LAST_ANALYZED | PARTITIONED | IOT_TYPE | TEMPORARY | SECONDARY | NESTED | BUFFER_POOL | FLASH_CACHE | CELL_FLASH_CACHE | ROW_MOVEMENT | GLOBAL_STATS | USER_STATS | DURATION | SKIP_CORRUPT | MONITORING | CLUSTER_OWNER | DEPENDENCIES | COMPRESSION | COMPRESS_FOR | DROPPED | READ_ONLY | SEGMENT_CREATED | RESULT_CACHE | CLUSTERING | ACTIVITY_TRACKING | DML_TIMESTAMP | HAS_IDENTITY | CONTAINER_DATA | INMEMORY | INMEMORY_PRIORITY | INMEMORY_DISTRIBUTE | INMEMORY_COMPRESSION | INMEMORY_DUPLICATE | 1 | HR | DEPARTMENTS | EXAMPLE | | | VALID | 10 | | 1 | 255 | 65536 | 1048576 | 1 | 2147483645 | | | | NO | N | 27 | 5 | 0 | 0 | 0 | 21 | 0 | 0 | 1 | 1 | N | ENABLED | 27 | 7/7/2014 6:56:25 AM | NO | | N | N | NO | DEFAULT | DEFAULT | DEFAULT | DISABLED | YES | NO | | DISABLED | YES | | DISABLED | DISABLED | | NO | NO | YES | DEFAULT | NO | | | NO | NO | DISABLED | | | | | 2 | HR | EMPLOYEES | EXAMPLE | | | VALID | 10 | | 1 | 255 | 65536 | 1048576 | 1 | 2147483645 | | | | NO | N | 107 | 5 | 0 | 0 | 0 | 69 | 0 | 0 | 1 | 1 | N | ENABLED | 107 | 7/7/2014 6:56:25 AM | NO | | N | N | NO | DEFAULT | DEFAULT | DEFAULT | DISABLED | YES | NO | | DISABLED | YES | | DISABLED | DISABLED | | NO | NO | YES | DEFAULT | NO | | | NO | NO | DISABLED | | | | | 3 | USER1 | EMPLOYEES | EXAMPLE | | | VALID | 10 | | 1 | 255 | 65536 | 1048576 | 1 | 2147483645 | | | | NO | N | 107 | 5 | 0 | 0 | 0 | 69 | 0 | 0 | 1 | 1 | N | ENABLED | 107 | 7/7/2014 6:56:25 AM | NO | | N | N | NO | DEFAULT | DEFAULT | DEFAULT | DISABLED | YES | NO | | DISABLED | YES | | DISABLED | DISABLED | | NO | NO | YES | DEFAULT | NO | | | NO | NO | DISABLED | | | | | 4 | USER1 | DEPARTMENTS | USERS | | | VALID | 10 | | 1 | 255 | 65536 | 1048576 | 1 | 2147483645 | | | | NO | N | 27 | 5 | 0 | 0 | 0 | 21 | 0 | 0 | 1 | 1 | N | ENABLED | 27 | 7/7/2014 6:56:25 AM | NO | | N | N | NO | DEFAULT | DEFAULT | DEFAULT | DISABLED | YES | NO | | DISABLED | YES | | DISABLED | DISABLED | | NO | NO | YES | DEFAULT | NO | | | NO | NO | DISABLED | | | | |
- [oracle@station90 ~]$ impdp system/oracle_4U directory=dir1 dumpfile=dir1:'sh_hr_%U.dmp',dir2:'sh_hr_%U.dmp' tables=sh.sales parallel=4 remap_schema=sh:user1
- Import: Release 12.1.0.2.0 - Production on Sat Jul 28 11:55:36 2018
- Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
- Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
- With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
- Master table "SYSTEM"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded
- Starting "SYSTEM"."SYS_IMPORT_TABLE_01": system/******** directory=dir1 dumpfile=dir1:sh_hr_%U.dmp,dir2:sh_hr_%U.dmp tables=sh.sales parallel=4 remap_schema=sh:user1
- Processing object type SCHEMA_EXPORT/TABLE/TABLE
- ORA-39171: Job is experiencing a resumable wait.
- Resumable error: ORA-01658: unable to create INITIAL extent for segment in tablespace EXAMPLE
- Resumable stmt: CREATE TABLE "USER1"."SALES" ("PROD_ID" NUMBER NOT NULL ENABLE, "CUST_ID" NUMBER NOT NULL ENABLE, "TIME_ID" DATE NOT NULL ENABLE, "CHANNEL_ID" NUMBER NOT NULL ENABLE, "PROMO_ID" NUMBER NOT NULL ENABLE, "QUANTITY_SOLD" NUMBER(10,2) NOT NULL ENABLE, "AMOUNT_SOLD" NUMBER(10,2) NOT NULL ENABLE) PCTFREE 5 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS NOLOGGING STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "EXAMPLE" PARTITION BY RANGE ("TIME_ID") (PARTITION "SALES_1995" VALUES LESS THAN (TO_DATE(' 1996-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION DEFERRED PCTFREE 0 PCTUSED 40 INITRANS 1 MAXTRANS 255 COMPRESS BASIC NOLOGGING STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "EXAMPLE" , PARTITION "SALES_1996" VALUES LESS THAN (TO_DATE(' 1997-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION DEFERRED PCTFREE 0 PCTUSED 40 INITRANS 1 MAX
- Resumable stmt status: SUSPENDED
- Resumable stmt start: 07/28/18 11:55:40 stmt suspend: 07/28/18 11:55:42
- ORA-39171: Job is experiencing a resumable wait.
- Resumable error: ORA-01658: unable to create INITIAL extent for segment in tablespace EXAMPLE
- Resumable stmt: CREATE TABLE "USER1"."SALES" ("PROD_ID" NUMBER NOT NULL ENABLE, "CUST_ID" NUMBER NOT NULL ENABLE, "TIME_ID" DATE NOT NULL ENABLE, "CHANNEL_ID" NUMBER NOT NULL ENABLE, "PROMO_ID" NUMBER NOT NULL ENABLE, "QUANTITY_SOLD" NUMBER(10,2) NOT NULL ENABLE, "AMOUNT_SOLD" NUMBER(10,2) NOT NULL ENABLE) PCTFREE 5 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS NOLOGGING STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "EXAMPLE" PARTITION BY RANGE ("TIME_ID") (PARTITION "SALES_1995" VALUES LESS THAN (TO_DATE(' 1996-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION DEFERRED PCTFREE 0 PCTUSED 40 INITRANS 1 MAXTRANS 255 COMPRESS BASIC NOLOGGING STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "EXAMPLE" , PARTITION "SALES_1996" VALUES LESS THAN (TO_DATE(' 1997-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')) SEGMENT CREATION DEFERRED PCTFREE 0 PCTUSED 40 INITRANS 1 MAX
- Resumable stmt status: SUSPENDED
- Resumable stmt start: 07/28/18 11:55:40 stmt suspend: 07/28/18 12:02:45
- Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
- . . imported "USER1"."SALES":"SALES_Q1_1998" 1.413 MB 43687 rows
- . . imported "USER1"."SALES":"SALES_Q1_1999" 2.071 MB 64186 rows
- . . imported "USER1"."SALES":"SALES_Q1_2000" 2.012 MB 62197 rows
- . . imported "USER1"."SALES":"SALES_Q1_2001" 1.965 MB 60608 rows
- . . imported "USER1"."SALES":"SALES_Q2_1998" 1.160 MB 35758 rows
- . . imported "USER1"."SALES":"SALES_Q2_1999" 1.754 MB 54233 rows
- . . imported "USER1"."SALES":"SALES_Q4_2001" 2.257 MB 69749 rows
- . . imported "USER1"."SALES":"SALES_1995" 0 KB 0 rows
- . . imported "USER1"."SALES":"SALES_1996" 0 KB 0 rows
- . . imported "USER1"."SALES":"SALES_Q3_2000" 1.910 MB 58950 rows
- . . imported "USER1"."SALES":"SALES_H1_1997" 0 KB 0 rows
- . . imported "USER1"."SALES":"SALES_H2_1997" 0 KB 0 rows
- . . imported "USER1"."SALES":"SALES_Q1_2002" 0 KB 0 rows
- . . imported "USER1"."SALES":"SALES_Q1_2003" 0 KB 0 rows
- . . imported "USER1"."SALES":"SALES_Q2_2002" 0 KB 0 rows
- . . imported "USER1"."SALES":"SALES_Q2_2003" 0 KB 0 rows
- . . imported "USER1"."SALES":"SALES_Q3_2002" 0 KB 0 rows
- . . imported "USER1"."SALES":"SALES_Q3_2003" 0 KB 0 rows
- . . imported "USER1"."SALES":"SALES_Q4_2002" 0 KB 0 rows
- . . imported "USER1"."SALES":"SALES_Q4_2003" 0 KB 0 rows
- . . imported "USER1"."SALES":"SALES_Q2_2000" 1.802 MB 55515 rows
- . . imported "USER1"."SALES":"SALES_Q3_2001" 2.130 MB 65769 rows
- . . imported "USER1"."SALES":"SALES_Q2_2001" 2.051 MB 63292 rows
- . . imported "USER1"."SALES":"SALES_Q4_1998" 1.581 MB 48874 rows
- . . imported "USER1"."SALES":"SALES_Q3_1998" 1.634 MB 50515 rows
- . . imported "USER1"."SALES":"SALES_Q4_1999" 2.014 MB 62388 rows
- . . imported "USER1"."SALES":"SALES_Q3_1999" 2.166 MB 67138 rows
- . . imported "USER1"."SALES":"SALES_Q4_2000" 1.814 MB 55984 rows
- Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
- Processing object type SCHEMA_EXPORT/TABLE/COMMENT
- Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
- ORA-39083: Object type REF_CONSTRAINT:"USER1"."SALES_PROMO_FK" failed to create with error:
- ORA-00942: table or view does not exist
- Failing sql is:
- ALTER TABLE "USER1"."SALES" ADD CONSTRAINT "SALES_PROMO_FK" FOREIGN KEY ("PROMO_ID") REFERENCES "USER1"."PROMOTIONS" ("PROMO_ID") ENABLE NOVALIDATE
- ORA-39083: Object type REF_CONSTRAINT:"USER1"."SALES_CUSTOMER_FK" failed to create with error:
- ORA-00942: table or view does not exist
- Failing sql is:
- ALTER TABLE "USER1"."SALES" ADD CONSTRAINT "SALES_CUSTOMER_FK" FOREIGN KEY ("CUST_ID") REFERENCES "USER1"."CUSTOMERS" ("CUST_ID") ENABLE NOVALIDATE
- ORA-39083: Object type REF_CONSTRAINT:"USER1"."SALES_PRODUCT_FK" failed to create with error:
- ORA-00942: table or view does not exist
- Failing sql is:
- ALTER TABLE "USER1"."SALES" ADD CONSTRAINT "SALES_PRODUCT_FK" FOREIGN KEY ("PROD_ID") REFERENCES "USER1"."PRODUCTS" ("PROD_ID") ENABLE NOVALIDATE
- ORA-39083: Object type REF_CONSTRAINT:"USER1"."SALES_TIME_FK" failed to create with error:
- ORA-00942: table or view does not exist
- Failing sql is:
- ALTER TABLE "USER1"."SALES" ADD CONSTRAINT "SALES_TIME_FK" FOREIGN KEY ("TIME_ID") REFERENCES "USER1"."TIMES" ("TIME_ID") ENABLE NOVALIDATE
- ORA-39083: Object type REF_CONSTRAINT:"USER1"."SALES_CHANNEL_FK" failed to create with error:
- ORA-00942: table or view does not exist
- Failing sql is:
- ALTER TABLE "USER1"."SALES" ADD CONSTRAINT "SALES_CHANNEL_FK" FOREIGN KEY ("CHANNEL_ID") REFERENCES "USER1"."CHANNELS" ("CHANNEL_ID") ENABLE NOVALIDATE
- Processing object type SCHEMA_EXPORT/TABLE/INDEX/BITMAP_INDEX/INDEX
- Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/BITMAP_INDEX/INDEX_STATISTICS
- Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
- Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
- Job "SYSTEM"."SYS_IMPORT_TABLE_01" completed with 7 error(s) at Sat Jul 28 12:06:42 2018 elapsed 0 00:11:04
- [oracle@station90 ~]$
复制代码
如果不用parfile就很难把格式写清楚,
- [oracle@station90 ~]$ expdp user1/oracle_4U directory=dir1 dumpfile=user1.dmp schemas=user1 job_name=user1job exclude=table: "in ('sales')", function: "in ('FUNC2')" query='employees:where department_id=10'
- LRM-00101: unknown parameter name 'department_id'
- [oracle@station90 ~]$ expdp user1/oracle_4U directory=dir1 dumpfile=user1.dmp schemas=user1 job_name=user1job exclude=table: "in ('sales')", function: "in ('FUNC2')" query='employees:where department_id=10'
复制代码
parfile:
- userid=user1/oracle_4U
- directory=dir1
- dumpfile=user1.dmp
- schemas=user1
- job_name=user1job
- exclude=table:" in ('SALES')",function:" in ('FUNC2')"
- query="employees:where department_id=10"
复制代码
- [oracle@station90 ~]$ expdp parfile=/home/oracle/parfile.ora
- Export: Release 12.1.0.2.0 - Production on Sat Jul 28 15:02:19 2018
- Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
- Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
- With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
- Starting "USER1"."USER1JOB": user1/******** parfile=/home/oracle/parfile.ora
- Estimate in progress using BLOCKS method...
- Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
- Total estimation using BLOCKS method: 128 KB
- Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
- Processing object type SCHEMA_EXPORT/TABLE/TABLE
- Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
- Processing object type SCHEMA_EXPORT/TABLE/COMMENT
- Processing object type SCHEMA_EXPORT/TABLE/AUDIT_OBJ
- Processing object type SCHEMA_EXPORT/FUNCTION/FUNCTION
- Processing object type SCHEMA_EXPORT/FUNCTION/ALTER_FUNCTION
- 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/TRIGGER
- Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
- Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
- . . exported "USER1"."DEPARTMENTS" 7.125 KB 27 rows
- . . exported "USER1"."EMPLOYEES" 9.609 KB 1 rows
- Master table "USER1"."USER1JOB" successfully loaded/unloaded
- ******************************************************************************
- Dump file set for USER1.USER1JOB is:
- /home/oracle/dir1/user1.dmp
- Job "USER1"."USER1JOB" successfully completed at Sat Jul 28 15:02:55 2018 elapsed 0 00:00:35
- [oracle@station90 ~]$
复制代码- [oracle@station90 ~]$ impdp system/oracle_4U directory=dir1 dumpfile=user1.dmp schemas=user1 remap_schema=user1:user2
复制代码- select * from dba_objects where owner='USER2';
复制代码 | OWNER | OBJECT_NAME | SUBOBJECT_NAME | OBJECT_ID | DATA_OBJECT_ID | OBJECT_TYPE | CREATED | LAST_DDL_TIME | TIMESTAMP | STATUS | TEMPORARY | GENERATED | SECONDARY | NAMESPACE | EDITION_NAME | SHARING | EDITIONABLE | ORACLE_MAINTAINED | 1 | USER2 | UPDATE_JOB_HISTORY | | 94097 | | TRIGGER | 7/28/2018 3:11:43 PM | 7/28/2018 3:11:57 PM | 2018-07-28:15:11:57 | INVALID | N | N | N | 3 | | NONE | Y | N | 2 | USER2 | SECURE_EMPLOYEES | | 94096 | | TRIGGER | 7/28/2018 3:11:43 PM | 7/28/2018 3:11:57 PM | 2018-07-28:15:11:57 | INVALID | N | N | N | 3 | | NONE | Y | N | 3 | USER2 | EMP_EMAIL_UK | | 94095 | 94095 | INDEX | 7/28/2018 3:11:43 PM | 7/28/2018 3:11:43 PM | 2018-07-28:15:11:43 | VALID | N | N | N | 4 | | NONE | | N | 4 | USER2 | DEPT_LOCATION_IX | | 94094 | 94094 | INDEX | 7/28/2018 3:11:43 PM | 7/28/2018 3:11:43 PM | 2018-07-28:15:11:43 | VALID | N | N | N | 4 | | NONE | | N | 5 | USER2 | DEPT_ID_PK | | 94093 | 94093 | INDEX | 7/28/2018 3:11:43 PM | 7/28/2018 3:11:43 PM | 2018-07-28:15:11:43 | VALID | N | N | N | 4 | | NONE | | N | 6 | USER2 | EMP_NAME_IX | | 94092 | 94092 | INDEX | 7/28/2018 3:11:43 PM | 7/28/2018 3:11:43 PM | 2018-07-28:15:11:43 | VALID | N | N | N | 4 | | NONE | | N | 7 | USER2 | EMP_MANAGER_IX | | 94091 | 94091 | INDEX | 7/28/2018 3:11:43 PM | 7/28/2018 3:11:43 PM | 2018-07-28:15:11:43 | VALID | N | N | N | 4 | | NONE | | N | 8 | USER2 | EMP_JOB_IX | | 94090 | 94090 | INDEX | 7/28/2018 3:11:43 PM | 7/28/2018 3:11:43 PM | 2018-07-28:15:11:43 | VALID | N | N | N | 4 | | NONE | | N | 9 | USER2 | EMP_DEPARTMENT_IX | | 94089 | 94089 | INDEX | 7/28/2018 3:11:43 PM | 7/28/2018 3:11:43 PM | 2018-07-28:15:11:43 | VALID | N | N | N | 4 | | NONE | | N | 10 | USER2 | EMP_EMP_ID_PK | | 94088 | 94088 | INDEX | 7/28/2018 3:11:43 PM | 7/28/2018 3:11:43 PM | 2018-07-28:15:11:43 | VALID | N | N | N | 4 | | NONE | | N | 11 | USER2 | FUNC1 | | 94087 | | FUNCTION | 7/28/2018 3:11:42 PM | 7/28/2018 3:11:42 PM | 2018-07-28:14:53:30 | VALID | N | N | N | 1 | | NONE | Y | N | 12 | USER2 | DEPARTMENTS | | 94086 | 94086 | TABLE | 7/28/2018 3:11:42 PM | 7/28/2018 3:11:43 PM | 2018-07-28:15:11:42 | VALID | N | N | N | 1 | | NONE | | N | 13 | USER2 | EMPLOYEES | | 94085 | 94085 | TABLE | 7/28/2018 3:11:42 PM | 7/28/2018 3:11:43 PM | 2018-07-28:15:11:42 | VALID | N | N | N | 1 | | NONE | | N |
最后带网络链:
parfile:
- userid=user2/oracle_4U
- directory=dirwin
- network_link=dblink1
- version=11.2.0
- job_name=user1job
-
- exclude=table:" in ('SALES')",function:" in ('FUNC2')"
- query="user1.employees:where department_id=10"
- flashback_time='2018-07-28:15:22:29'
- remap_schema=user1:user2
复制代码
在win目的地这边:
impdp parfile=c:\data\parfile.ora
-------------------------------------------------------------------
datapump外部表:
- CREATE TABLE ext_emp_query_results
-
- ORGANIZATION EXTERNAL
- (
- TYPE ORACLE_DATAPUMP
- DEFAULT DIRECTORY dir1
- LOCATION (dir1:'emp1.exp',dir2:'emp2.exp')
- )
- PARALLEL
- AS
- SELECT e.first_name,e.last_name,d.department_name
- FROM employees e, departments d
- WHERE e.department_id = d.department_id AND
- d.department_name in
- ('Marketing', 'Purchasing');
复制代码
[oracle@station90 dir2]$ ls -l *exp
-rw-r----- 1 oracle oinstall 12288 7月 28 15:48 emp2.exp
[oracle@station90 dir2]$ ls -l ../dir1/*exp
-rw-r----- 1 oracle oinstall 12288 7月 28 15:48 ../dir1/emp1.exp
[oracle@station90 dir2]$
- [oracle@station90 dir1]$ strings emp1.exp
- "HR"."U"
- x86_64/Linux 2.4.xx
- AL32UTF8
- 12.01.00.02.00
- 001:001:000001:000001
- i<?xml version="1.0"?>
- <ROWSET>
- <ROW>
- <STRMTABLE_T>
- <VERS_MAJOR>1</VERS_MAJOR>
- <VERS_MINOR>0 </VERS_MINOR>
- <VERS_DPAPI>3</VERS_DPAPI>
- <ENDIANNESS>0</ENDIANNESS>
- <CHARSET>AL32UTF8</CHARSET>
- <NCHARSET>AL16UTF16</NCHARSET>
- <DBTIMEZONE>+00:00</DBTIMEZONE>
- <OWNER_NAME>HR</OWNER_NAME>
- <NAME>EXT_EMP_QUERY_RESULTS</NAME>
- <COL_LIST>
- <COL_LIST_ITEM>
- <COL_NUM>1</COL_NUM>
- <NAME>FIRST_NAME</NAME>
- <TYPE_NUM>1</TYPE_NUM>
- <LENGTH>20</LENGTH>
- <PRECISION_NUM>0</PRECISION_NUM>
- <SCALE>0</SCALE>
- <CHARSETID>873</CHARSETID>
- <CHARSETFORM>1</CHARSETFORM>
- <CHARLENGTH>20</CHARLENGTH>
- </COL_LIST_ITEM>
- <COL_LIST_ITEM>
- <COL_NUM>2</COL_NUM>
- <NAME>LAST_NAME</NAME>
- <TYPE_NUM>1</TYPE_NUM>
- <LENGTH>25</LENGTH>
- <PRECISION_NUM>0</PRECISION_NUM>
- <SCALE>0</SCALE>
- <CHARSETID>873</CHARSETID>
- <CHARSETFORM>1</CHARSETFORM>
- <CHARLENGTH>25</CHARLENGTH>
- </COL_LIST_ITEM>
- <COL_LIST_ITEM>
- <COL_NUM>3</COL_NUM>
- <NAME>DEPARTMENT_NAME</NAME>
- <TYPE_NUM>1</TYPE_NUM>
- <LENGTH>30</LENGTH>
- <PRECISION_NUM>0</PRECISION_NUM>
- <SCALE>0</SCALE>
- <CHARSETID>873</CHARSETID>
- <CHARSETFORM>1</CHARSETFORM>
- <CHARLENGTH>30</CHARLENGTH>
- </COL_LIST_ITEM>
- </COL_LIST>
- </STRMTABLE_T>
- </ROW>
- </ROWSET>
- [oracle@station90 dir1]$
复制代码- CREATE TABLE ext_emp_query_results
- (first_name varchar2(20), last_name varchar2(25), department_name varchar2(30))
- ORGANIZATION EXTERNAL
- (
- TYPE ORACLE_DATAPUMP
- DEFAULT DIRECTORY dir1
- LOCATION (dir1:'emp1.exp',dir2:'emp2.exp')
- )
- PARALLEL
- ;
复制代码- select * from ext_emp_query_results;
复制代码 | FIRST_NAME | LAST_NAME | DEPARTMENT_NAME | 1 | Shelli | Baida | Purchasing | 2 | Karen | Colmenares | Purchasing | 3 | Pat | Fay | Marketing | 4 | Michael | Hartstein | Marketing | 5 | Guy | Himuro | Purchasing | 6 | Alexander | Khoo | Purchasing | 7 | Den | Raphaely | Purchasing | 8 | Sigal | Tobias | Purchasing |
|
|