New Features 12c EXPDP

While i am testing Oracle 12c i notice new features in expdp , which you can export view like the following :

SQL> create table test ( id number);
Table created.

SQL> create view test_vw as select * from test ;
View created.

SQL> create directory dump as ‘/u01/dump’;
Directory created.

SQL> grant read,write on directory dump to osama ;
Grant succeeded.

[oracle@test12c u01]$ expdp directory=dump dumpfile=test.dmp logfile=test.log VIEWS_AS_TABLES=test_vw
Export: Release 12.1.0.1.0 – Production on Wed Jun 26 18:33:52 2013
Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.
Username: osama
Password: 
Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
Starting “OSAMA”.”SYS_EXPORT_TABLE_01″:  osama/******** directory=dump dumpfile=test.dmp logfile=test.log VIEWS_AS_TABLES=test_vw 
Estimate in progress using BLOCKS method…
Processing object type TABLE_EXPORT/VIEWS_AS_TABLES/TABLE_DATA
Total estimation using BLOCKS method: 0 KB
Processing object type TABLE_EXPORT/VIEWS_AS_TABLES/TABLE
. . exported “OSAMA”.”TEST_VW”                              0 KB       0 rows
Master table “OSAMA”.”SYS_EXPORT_TABLE_01″ successfully loaded/unloaded
******************************************************************************
Dump file set for OSAMA.SYS_EXPORT_TABLE_01 is:
  /u01/dump/test.dmp
Job “OSAMA”.”SYS_EXPORT_TABLE_01″ successfully completed at Wed Jun 26 18:34:15 2013 elapsed 0 00:00:17
I dropped the view 

SQL> drop view Test_vw ;
View dropped.
impdp directory=dump dumpfile=test.dmp logfile=test.log VIEWS_AS_TABLES=test_vw


Thank you 
Osama mustafa

Expdp Error –> ORA-31617/ORA-19505/ORA-27037

Setup like the following :

Database 11gr2
Rac 11gr2

When trying to expdp the below error appear :

expdp dumpfile=tdmp_test.dmp logfile=1.log directory=expdp_folder schemas=siebel parallel=4

ORA-31693: Table data object “CS_XM_TEMP”.”CS_XM_TEMP_CC” failed to load/unload and is being skipped due to error:
ORA-31617: unable to open dump file “/u01/expdp /dump_test.dmp” for write
ORA-19505: failed to identify file “/u01/expdp/dump_test.dmp”
ORA-27037: unable to obtain file status

You need to make sure of the below :
–  Folder exdp_folder should be exists on the both nodes with same path.

even if you try to connect using tnsnames it will generate error so solution
-Remove parallel from your expdp command to be like this

expdp dumpfile=tdmp_test.dmp logfile=1.log directory=expdp_folder schemas=siebel 


-Use Cluster Option in expdp

expdp dumpfile=tdmp_test.dmp logfile=1.log directory=expdp_folder schemas=siebel cluster=n

Thank you
Osama mustafa

Data Pump impdp expdp NETWORK_LINK option

First what is the network_Link Option :

you can import the schema from source database to target database. One advantage of this option you don’t need export and import as it does the export and import in single shot from the source to destination. Also, the file system space is not needed to accommodate the huge dump files as we can directly import to target using network_link. It is very amazing option with data pump. You can take the backup of source database schema from another database and you can store in dump files in target location as well.
Examples One :
SQL>  select name from v$database;
NAME
———
Production
SQL> show user
USER is “OSAMA”
SQL> select * from tab;
no rows selected
SQL> create table test1 as select * from all_objects;
Table created.
SQL> select * from tab;
TNAME                          TABTYPE  CLUSTERID
—————————— ——- ———-
test1                           TABLE
added a TNS entry (File location: $ORACLE_HOME/network/admin/tnsnames.ora) for production database in my source database box. Entry as below:

production =
   (description =
      (address =
         (protocol = tcp)
         (host = xxx.xxxx.xxx.xxx)
         (port = 1521)
      )
      (connect_data =
         (server = dedicated)
         (sid = production)
      )
   )

Make Sure you test the connection using tnsping .

Connect to source database using sqlplus and create a database link to production database with osama user
SQL> create database link production connect to osama identified by osama using ‘production’;
Database link created.
SQL> select * from tab@production
  2  ;
TNAME                          TABTYPE  CLUSTERID
—————————— ——- ———-
test1                          TABLE
import the osama schema of production database to source database without dumpfile(Run it From Source)
 
$ impdp osama/osama directory=network logfile=osama.log network_link=production
Import: Release 11.2.0.3.0 – 64bit Production on Tuesday, 24 July, 2012 01:30:35
Copyright (c) 2003, 2007, Oracle.  All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting “OSAMA”.”SYS_IMPORT_SCHEMA_01″:  OSAMA/******** directory=exp_dir logfile=impnetworkscott.log network_link=prod8
Estimate in progress using BLOCKS method…
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 12 MB
Processing object type SCHEMA_EXPORT/USER
ORA-31684: Object type USER:”OSAMA” already exists
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
. . imported “OSAMA”.”TEST1″                      11222 rows

Example Two :
we will export  schema from source database from target machine. You can store the dump in files.
 From Source Run (Copy to dump to folder network)
$ expdp osama/osama directory=network dumpfile=osama.dmp logfile=osama.log network_link=production
Export: Release 11.2.0.3.0 – 64bit Production on Tuesday, 24 July, 2012 02:05:09
Copyright (c) 2003, 2007, Oracle.  All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting “OSAMA”.”SYS_EXPORT_SCHEMA_01″:  osama/******** directory=test dumpfile=osama.dmp logfile=osama.log network_link=production
Estimate in progress using BLOCKS method…
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 12 MB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
. . exported “OSAMA”.”TEST1″                     9.496 MB   11222rows
Master table “osama”.”SYS_EXPORT_SCHEMA_01″ successfully loaded/unloaded
******************************************************************************
Also Check
1-Ronny Egners Blog

Enjoy 

Osama Mustafa