Dear Readers,
In this article, we will see the following Datapump in Oracle 12c.
Oracle Datapump was introduced in Oracle 10g. This article provides an overview of the main Data Pump enhancements in Oracle Database 12c Release 1.
Oracle Datapump have two utilities They are
1.EXPDP
2.IMPDP
EXPDP is a utility provided by ORACLE and it exports the data from database to physical files.
Those physical files we call it as “Dumpfiles”.
IMPDP is a utility provided by ORACLE and it imports the data from physical files(dump files) to database.
Prior to 10g we used traditional export and import to take the backup of database.
Due to some drawbacks in traditional export Oracle came with DATAPUMP utility .
DATAPUMP have so many advantages They are :
1.Data pump operations are faster compared to traditional export and import.
2.Datapump uses two plsql packages to finishes operations faster. They are
a)DBMS_DATAPUMP
b)DBMS_METADATA
3.DATAPUMP will perform read and write operations in block method.
4.We can define a job name for expdp/impdp operations.
5.Using the job name we can monitor,pause and resume the jobs.
6.we can estimate the size of a dump file before exporting using estimate_only=y.
7. For every datapump operations two background processes will invoke They are :
a)MASTER BACKGROUND PROCESS
b)WORKER BACKGROUND PROCESS
MASTER BACKGROUND PROCESS :
It creates a table in the current user schema who is performing the operations.
The table will be known as master table.
The name of the master table is same as jobname.
It maintains the status of job under master table,once the job done successfully master gets dropped automatically.
WORKER BACKGROUND PROCESS :
This process gets created by the master’s background process.
It performs the actual operations.
DATAPUMP in CONTAINER DATABASE :
A multitenant container database (CDB) is an Oracle database that includes zero, one, or many user created pluggable databases (PDBs). A PDB is a portable set of schemas, schema objects, and non schema objects that appear to an Oracle Net client as a non-CDB.
How to take container database backup using datapump .
If you want to know what parameters we can use in datapump then we need to use impdp help=y.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
[oracle@dba20 ~]$ sqlplus / as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Tue Jun 26 21:28:13 2018 Copyright (c) 1982, 2014, Oracle. 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 SYS>>show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PLUG4 READ WRITE NO 4 PLUG2 READ WRITE NO 5 PLUG5 READ WRITE NO |
Check the parameters required to perform datapump operations.
1 2 3 4 5 6 7 8 |
SYS>>sho parameter shared_pool_size NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ shared_pool_size big integer 0 SYS>>show parameter streams_pool_size NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ streams_pool_size big integer 0 |
we need to set values for the above parameters.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
SYS>>shut immediate Database closed. Database dismounted. ORACLE instance shut down. SYS>>exit Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options [oracle@dba20 ~]$ cd $ORACLE_HOME/dbs [oracle@dba20 dbs]$ vi initmicrocdb.ora shared_pool_size=500m streams_pool_size=250m [oracle@dba20 dbs]$ sqlplus / as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Tue Jun 26 21:31:36 2018 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to an idle instance. SYS>>startup ORACLE instance started. Total System Global Area 1073741824 bytes Fixed Size 2932632 bytes Variable Size 1019215976 bytes Database Buffers 46137344 bytes Redo Buffers 5455872 bytes Database mounted. Database opened. SYS>>sho parameter shared_pool_size NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ shared_pool_size big integer 500M SYS>>show parameter streams_pool_size NAME TYPE VALUE ----------------------- ----------- ------------------------------ streams_pool_size big integer 250M |
we need to create directory at db level and physical level.
1 2 3 4 5 6 |
SYS>>create directory datapump_cdb as '/u01/oradata/microcdb/datapump_cdb'; Directory created. SYS>>exit Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options [oracle@dba20 dbs]$ mkdir -p /u01/oradata/microcdb/datapump_cdb |
Use expdp utility to perform export operation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
[oracle@dba20 ~]$ expdp directory=datapump_cdb dumpfile=full_01.dmp logfile=full_01.log job_name=full_cdb full=y Export: Release 12.1.0.2.0 - Production on Wed Jun 27 16:15:13 2018 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. Username: / as sysdba 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 WARNING: Oracle Data Pump operations are not typically needed when connected to the root or seed of a container database. starting "SYS"."FULL_CDB": /******** AS SYSDBA directory=datapump_cdb dumpfile=full_01.dmp logfile=full_01.log job_name=full_cdb full=y 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: 2.812 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/PROFILE Processing object type DATABASE_EXPORT/SYS_USER/USER 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/RESOURCE_COST Processing object type DATABASE_EXPORT/TRUSTED_DB_LINK Processing object type DATABASE_EXPORT/DIRECTORY/DIRECTORY Processing object type DATABASE_EXPORT/SCHEMA/TABLE/TABLE Processing object type DATABASE_EXPORT/SCHEMA/TABLE/STATISTICS/TABLE_STATISTICS Processing object type DATABASE_EXPORT/STATISTICS/MARKER Processing object type DATABASE_EXPORT/FINAL_POST_INSTANCE_IMPCALLOUT/MARKER Processing object type DATABASE_EXPORT/SCHEMA/POST_SCHEMA/PROCACT_SCHEMA Processing object type DATABASE_EXPORT/AUDIT_UNIFIED/AUDIT_POLICY_ENABLE Processing object type DATABASE_EXPORT/POST_SYSTEM_IMPCALLOUT/MARKER . . exported "SYS"."KU$_USER_MAPPING_VIEW" 5.789 KB 20 rows . . exported "WMSYS"."WM$CONSTRAINTS_TABLE$" 0 KB 0 rows . . exported "WMSYS"."WM$LOCKROWS_INFO$" 0 KB 0 rows . . exported "WMSYS"."WM$UDTRIG_INFO$" 0 KB 0 rows . . exported "SYS"."AUD$" 0 KB 0 rows . . exported "SYSTEM"."REDO_DB" 25.58 KB 1 rows . . exported "SYSTEM"."REDO_LOG" 0 KB 0 rows . . exported "WMSYS"."WM$BATCH_COMPRESSIBLE_TABLES$" 0 KB 0 rows . . exported "WMSYS"."WM$CONS_COLUMNS$" 0 KB 0 rows . . exported "WMSYS"."WM$ENV_VARS$" 6.015 KB 3 rows . . exported "WMSYS"."WM$EVENTS_INFO$" 5.812 KB 12 rows . . exported "WMSYS"."WM$HINT_TABLE$" 9.453 KB 75 rows . . exported "WMSYS"."WM$MODIFIED_TABLES$" 0 KB 0 rows . . exported "WMSYS"."WM$MP_GRAPH_WORKSPACES_TABLE$" 0 KB 0 rows . . exported "WMSYS"."WM$MP_PARENT_WORKSPACES_TABLE$" 0 KB 0 rows . . exported "WMSYS"."WM$NESTED_COLUMNS_TABLE$" 0 KB 0 rows . . exported "WMSYS"."WM$NEXTVER_TABLE$" 6.375 KB 1 rows . . exported "WMSYS"."WM$REMOVED_WORKSPACES_TABLE$" 0 KB 0 rows . . exported "WMSYS"."WM$RESOLVE_WORKSPACES_TABLE$" 0 KB 0 rows . . exported "WMSYS"."WM$RIC_LOCKING_TABLE$" 0 KB 0 rows . . exported "SYS"."TSDP_PROTECTION$" 0 KB 0 rows . . exported "SYS"."TSDP_SENSITIVE_DATA$" 0 KB 0 rows . . exported "SYS"."TSDP_SENSITIVE_TYPE$" 0 KB 0 rows . . exported "SYS"."NACL$_WALLET_EXP" 0 KB 0 rows . . exported "WMSYS"."WM$EXP_MAP" 7.710 KB 3 rows . . exported "C##ATG"."T1" 5.054 KB 2 rows Master table "SYS"."FULL_CDB" successfully loaded/unloaded ****************************************************************************** Dump file set for SYS.FULL_CDB is: /u01/oradata/microcdb/datapump_cdb/full_01.dmp Job "SYS"."FULL_CDB" successfully completed at Wed Jun 27 16:19:37 2018 elapsed 0 00:04:14 |
With the above syntax we exported only root database.
In order to take PDB’s backup you must define an explicit directory object with in the PDB that you are exporting or importing.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
[oracle@dba20 ~]$ sqlplus / as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 27 18:10:06 2018 Copyright (c) 1982, 2014, Oracle. 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 SYS>>alter session set container=plug5; Session altered. SYS>>create directory dir_plug5 as '/u01/oradata/microcdb/plug5/datapump'; Directory created. SYS>>exit Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options [oracle@dba20 ~]$ mkdir -p /u01/oradata/microcdb/plug5/datapump |
Then take export of plug5 PDB using following syntax.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
[oracle@dba20 ~]$ expdp directory=dir_plug5 dumpfile=full_plug5.dmp logfile=full_plug5.log job_name=full_plug5 full=y Export: Release 12.1.0.2.0 - Production on Wed Jun 27 18:14:40 2018 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. Username: sys/sys@to_plug5 as sysdba 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 "SYS"."FULL_PLUG5": sys/********@to_plug5 AS SYSDBA directory=dir_plug5 dumpfile=full_plug5.dmp logfile=full_plug5.log job_name=full_plug5 full=y 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: 336 KB 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/PROFILE Processing object type DATABASE_EXPORT/SYS_USER/USER Processing object type DATABASE_EXPORT/SCHEMA/USER 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/TABLE/TABLE Processing object type DATABASE_EXPORT/SCHEMA/TABLE/STATISTICS/TABLE_STATISTICS Processing object type DATABASE_EXPORT/STATISTICS/MARKER Processing object type DATABASE_EXPORT/FINAL_POST_INSTANCE_IMPCALLOUT/MARKER Processing object type DATABASE_EXPORT/SCHEMA/POST_SCHEMA/PROCACT_SCHEMA Processing object type DATABASE_EXPORT/AUDIT_UNIFIED/AUDIT_POLICY_ENABLE Processing object type DATABASE_EXPORT/POST_SYSTEM_IMPCALLOUT/MARKER . . exported "SYS"."KU$_USER_MAPPING_VIEW" 5.820 KB 22 rows . . exported "SYSTEM"."REDO_DB" 25.58 KB 1 rows . . exported "SYS"."DAM_CONFIG_PARAM$" 6.531 KB 14 rows . . exported "SYS"."TSDP_PARAMETER$" 5.945 KB 1 rows . . exported "SYS"."TSDP_POLICY$" 5.914 KB 1 rows . . exported "SYS"."TSDP_SUBPOL$" 6.328 KB 1 rows . . exported "SYS"."AUD$" 0 KB 0 rows . . exported "SYSTEM"."REDO_LOG" 0 KB 0 rows . . exported "SYSTEM"."SCHEDULER_JOB_ARGS" 8.664 KB 4 rows . . exported "SYSTEM"."SCHEDULER_PROGRAM_ARGS" 10.20 KB 22 rows . . exported "SYS"."AUDTAB$TBS$FOR_EXPORT" 5.953 KB 2 rows . . exported "SYS"."DBA_SENSITIVE_DATA" 0 KB 0 rows . . exported "SYS"."DBA_TSDP_POLICY_PROTECTION" 0 KB 0 rows . . exported "SYS"."FGA_LOG$FOR_EXPORT" 0 KB 0 rows . . exported "SYS"."NACL$_ACE_EXP" 9.914 KB 1 rows . . exported "SYS"."NACL$_HOST_EXP" 6.914 KB 1 rows . . exported "SYS"."NACL$_WALLET_EXP" 0 KB 0 rows . . exported "AJAY"."AJAY_T1" 0 KB 0 rows . . exported "LOC_U1"."T1" 0 KB 0 rows Master table "SYS"."FULL_PLUG5" successfully loaded/unloaded ****************************************************************************** Dump file set for SYS.FULL_PLUG5 is: /u01/oradata/microcdb/plug5/datapump/full_plug5.dmp Job "SYS"."FULL_PLUG5" successfully completed at Wed Jun 27 18:22:10 2018 elapsed 0 00:07:18 |
NOLOGGING Option (DISABLE_ARCHIVE_LOGGING)
The TRANSFORM parameter of impdp has been extended to include a DISABLE_ARCHIVE_LOGGING option. The default setting of ‘N’ has no effect on logging behaviour.
Using a value ‘Y’ reduces logging associated with tables and indexes during the import by setting theirlogging attribute to NOLOGGING before the data is imported and resetting it to LOGGING once theoperation is complete.
TRANSFORM=DISABLE_ARCHIVE_LOGGING=Y
The effect can be limited to a specific type of object (Table or Index) by appending the object type.
TRANSFORM=DISABLE_ARCHIVE_LOGGING=Y:TABLE
TRANSFORM=DISABLE_ARCHIVE_LOGGING=Y:INDEX
Example:
Exporting table t1 of loc_u1 owner and importing into loc_u2 schema
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
[oracle@dba20 ~]$ expdp directory=dir_plug5 dumpfile=loc_u1_t1_tab.dmp logfile=loc_u1_t1_tab.log job_name=loc_u1_t1_tab tables=loc_u1.t1 Export: Release 12.1.0.2.0 - Production on Wed Jun 27 18:47:18 2018 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. Username: loc_u1/u1@to_plug5 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 "LOC_U1"."LOC_U1_T1_TAB": loc_u1/********@to_plug5 directory=dir_plug5 dumpfile=loc_u1_t1_tab.dmp logfile=loc_u1_t1_tab.log job_name=loc_u1_t1_tab tables=loc_u1.t1 Estimate in progress using BLOCKS method... Processing object type TABLE_EXPORT/TABLE/TABLE_DATA Total estimation using BLOCKS method: 5 MB Processing object type TABLE_EXPORT/TABLE/TABLE Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER . . exported "LOC_U1"."T1" 2.629 MB 393216 rows Master table "LOC_U1"."LOC_U1_T1_TAB" successfully loaded/unloaded ****************************************************************************** Dump file set for LOC_U1.LOC_U1_T1_TAB is: /u01/oradata/microcdb/plug5/datapump/loc_u1_t1_tab.dmp Job "LOC_U1"."LOC_U1_T1_TAB" successfully completed at Wed Jun 27 18:47:50 2018 elapsed 0 00:00:23 |
Use remap_schema parameter to send table t1 into loc_un schema.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
[oracle@dba20 ~]$ impdp directory=dir_plug5 dumpfile=loc_u1_t1_tab.dmp logfile=loc_u1_t1_tab.log job_name=loc_u1_t1_tab remap_schema=loc_u1:loc_u2 transform=disable_archive_logging:Y Import: Release 12.1.0.2.0 - Production on Wed Jun 27 18:52:37 2018 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. Username: sys/sys@to_plug5 as sysdba 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 "SYS"."LOC_U1_T1_TAB" successfully loaded/unloaded Starting "SYS"."LOC_U1_T1_TAB": sys/********@to_plug5 AS SYSDBA directory=dir_plug5 dumpfile=loc_u1_t1_tab.dmp logfile=loc_u1_t1_tab.log job_name=loc_u1_t1_tab remap_schema=loc_u1:loc_u2 transform=disable_archive_logging:Y Processing object type TABLE_EXPORT/TABLE/TABLE Processing object type TABLE_EXPORT/TABLE/TABLE_DATA . . imported "LOC_U2"."T1" 2.629 MB 393216 rows Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER Job "SYS"."LOC_U1_T1_TAB" successfully completed at Wed Jun 27 18:53:42 2018 elapsed 0 00:00:54 |
The DISABLE_ARCHIVE_LOGGING option has no effect if the database is running in FORCE LOGGING mode.
LOGTIME Parameter
The LOGTIME parameter determines if timestamps should be included in the output messages from
the expdp and impdp utilities.
LOGTIME=[NONE | STATUS | LOGFILE | ALL]
The allowable values are explained below.
NONE : The default value, which indicates that no timestamps should be included in the output,
making the output look similar to that of previous versions.
STATUS : Timestamps are included in output to the console, but not in the associated log file.
LOGFILE : Timestamps are included in output to the log file, but not in the associated console
messages.
ALL : Timestamps are included in output to the log file and console.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
[oracle@dba20 ~]$ impdp directory=dir_plug5 dumpfile=loc_u1_t1_tab.dmp logfile=loc_u1_t1_tab.log job_name=loc_u1_t1_tab remap_schema=loc_u1:loc_u2 logtime=all TABLE_EXISTS_ACTION=replace Import: Release 12.1.0.2.0 - Production on Wed Jun 27 19:03:24 2018 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. Username: sys/sys@to_plug5 as sysdba 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 27-JUN-18 19:03:41.812: Master table "SYS"."LOC_U1_T1_TAB" successfully loaded/unloaded 27-JUN-18 19:03:42.350: Starting "SYS"."LOC_U1_T1_TAB": sys/********@to_plug5 AS SYSDBA directory=dir_plug5 dumpfile=loc_u1_t1_tab.dmp logfile=loc_u1_t1_tab.log job_name=loc_u1_t1_tab remap_schema=loc_u1:loc_u2 logtime=all TABLE_EXISTS_ACTION=replace 27-JUN-18 19:03:42.547: Processing object type TABLE_EXPORT/TABLE/TABLE 27-JUN-18 19:03:43.017: Processing object type TABLE_EXPORT/TABLE/TABLE_DATA 27-JUN-18 19:03:43.416: . . imported "LOC_U2"."T1" 2.629 MB 393216 rows 27-JUN-18 19:03:43.474: Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS 27-JUN-18 19:03:43.547: Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER 27-JUN-18 19:03:45.261: Job "SYS"."LOC_U1_T1_TAB" successfully completed at Wed Jun 27 19:03:45 2018 elapsed 0 00:00:05 |
Export View as Table
The VIEWS_AS_TABLES parameter allows Data Pump to export the specified views as if they were tables. The table structure matches the view columns, with the data being the rows returned by the query supporting the views.
By default expdp creates a temporary table as a copy of the view, but with no data, to provide a source of the metadata for the export. Alternatively to can specify a table with the appropriate structure.
Connect to loc_u1 local user and create a view.
1 2 3 4 5 6 7 |
LOC_U1>>create view t1_view as select * from t1; View created. LOC_U1>>select object_name,object_type from user_objects; OBJECT_NAM OBJECT_TYPE ---------- ----------------------- T1_ VIEW VIEW T1 TABLE |
Perform expdp operation with views_as_tables parameter.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
[oracle@dba20 ~]$ expdp directory=dir_plug5 dumpfile=loc_u1_t1_tab12.dmp logfile=loc_u1_t1_tab.log job_name=loc_u1_t1_ta2b VIEWs_AS_TABLES=loc_u1.t1_view Export: Release 12.1.0.2.0 - Production on Wed Jun 27 19:19:53 2018 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. Username: loc_u1/u1@to_plug5 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 "LOC_U1"."LOC_U1_T1_TA2B": loc_u1/********@to_plug5 directory=dir_plug5 dumpfile=loc_u1_t1_tab12.dmp logfile=loc_u1_t1_tab.log job_name=loc_u1_t1_ta2b VIEWs_AS_TABLES=loc_u1.t1_view Estimate in progress using BLOCKS method... Processing object type TABLE_EXPORT/VIEWS_AS_TABLES/TABLE_DATA Total estimation using BLOCKS method: 16 KB Processing object type TABLE_EXPORT/VIEWS_AS_TABLES/TABLE . . exported "LOC_U1"."T1_VIEW" 2.629 MB 393216 rows Master table "LOC_U1"."LOC_U1_T1_TA2B" successfully loaded/unloaded ****************************************************************************** Dump file set for LOC_U1.LOC_U1_T1_TA2B is: /u01/oradata/microcdb/plug5/datapump/loc_u1_t1_tab12.dmp Job "LOC_U1"."LOC_U1_T1_TA2B" successfully completed at Wed Jun 27 19:20:35 2018 elapsed 0 00:00:15 |
By using views_as_tables parameter expdp will create a temporary table as a copy of view and its export of that temporary table.
Now import that table into another schema using remap_schemas parameter.
1 2 3 4 5 6 7 8 9 10 11 12 |
[oracle@dba20 ~]$ impdp directory=dir_plug5 dumpfile=loc_u1_t1_tab12.dmp logfile=loc_u1_t1_tab.log job_name=loc_u1_t1_ta2b remap_schema=loc_u1:loc_u2 Import: Release 12.1.0.2.0 - Production on Wed Jun 27 19:21:38 2018 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. Username: loc_u2/loc_u2@to_plug5 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 "LOC_U2"."LOC_U1_T1_TA2B" successfully loaded/unloaded Starting "LOC_U2"."LOC_U1_T1_TA2B": loc_u2/********@to_plug5 directory=dir_plug5 dumpfile=loc_u1_t1_tab12.dmp logfile=loc_u1_t1_tab.log job_name=loc_u1_t1_ta2b remap_schema=loc_u1:loc_u2 Processing object type TABLE_EXPORT/VIEWS_AS_TABLES/TABLE Processing object type TABLE_EXPORT/VIEWS_AS_TABLES/TABLE_DATA . . imported "LOC_U2"."T1_VIEW" 2.629 MB 393216 rows Job "LOC_U2"."LOC_U1_T1_TA2B" successfully completed at Wed Jun 27 19:22:06 2018 elapsed 0 00:00:03 |
Connect to local user lc_u2 and check the tables.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
[oracle@dba20 ~]$ sqlplus sys/sys@to_plug5 as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 27 19:22:12 2018 Copyright (c) 1982, 2014, Oracle. 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 SYS>>conn loc_u2/loc_u2@to_plug5 ERROR: ORA-00942: table or view does not exist Error accessing PRODUCT_USER_PROFILE Warning: Product user profile information not loaded! You may need to run PUPBLD.SQL as SYSTEM Connected. LOC_U2>>select * from tab; TNAME TABTYPE CLUSTERID ------- ---------- --------- T1_VIEW TABLE |
You can watch the process of table creation from a second session using the following data dictionary view :
USER_TAB_COMMENTS
Thank you for giving your valuable time to read the above information. Please click here to subscribe for further updates
KTEXPERTS is always active on below social media platforms.
Facebook : https://www.facebook.com/ktexperts/
LinkedIn : https://www.linkedin.com/company/ktexperts/
Twitter : https://twitter.com/ktexpertsadmin
YouTube : https://www.youtube.com/c/ktexperts
Instagram : https://www.instagram.com/knowledgesharingplatform
Vinod
12c: DATAPUMP IN ORACLE 12C
Agenda
How to perform datapump operations on container database.
How to perform export and import on PDB’s
Oracle 12c datapump new features like
logtime,NOLOGGING Option,Export View as Table etc..,
SAT, Jun 30, 2018 8:00 AM – 10:00 AM PDT/8:30 PM IST
Please join my meeting from your computer, tablet or smartphone.
Oracle 12c: DATAPUMP IN ORACLE 12C
Sat, Jun 30, 2018 8:00 AM – 10:00 AM PDT
Please join my meeting from your computer, tablet or smartphone.
https://global.gotomeeting.com/join/482118005
You can also dial in using your phone.
United States: +1 (646) 749-3122
Access Code: 482-118-005
Time Zone Converter
https://www.timeanddate.com/worldclock/converter.html?iso=20180630T150000&p1=176&p2=137&p3=236&p4=136&p5=179
Vinod
Hello Everyone,
Great response to the session on DATAPUMP IN ORACLE 12c. (Session – 1)
Please check Vimeo video link.:
https://vimeo.com/277799766/67c367f6c6
Vinod
Oracle 12c : Data Pump
Sun, Jul 8, 2018 8:00 AM – 10:00 AM PDT
Please join my meeting from your computer, tablet or smartphone.
https://global.gotomeeting.com/join/129511205
You can also dial in using your phone.
United States: +1 (571) 317-3122
Access Code: 129-511-205
Vinod
Hello Everyone,
Great response to the session on DATAPUMP IN ORACLE 12c. (Session – 2)
Please check Vimeo video link.:
https://vimeo.com/278932485/2b01136ed6
Ajay Kumar
If you are interested to know more details about future session please join below telegram group :
https://t.me/joinchat/JFVAtAv1TE9DGHLbJ6rZbw