Export from pdb and import into pdb
In this post, we will see how we can take an export from one pdb and import into another pdb.Step 1: Connect to pdb from where you want to take export :
SQL> alter session set container = orclpdb;
Session altered.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
------ -------- --------- ----------
3 ORCLPDB READ WRITE NO
Step 2: Create a directory for data pump export :
SQL> create directory bkp as '/u01/';
Directory created.
Step 3: Create tns entry in tnsnames.ora for the pluggable database if not already done :
orclpdb =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orclpdb)
)
)
Step 4: Grant necessary privileges to the user with whom you want to take backup :
SQL> grant read , write on directory bkp to hra;
Grant succeeded.
SQL>grant exp_full_database to hra;
Step 5: Take export using expdp and give clause full=Y
[oracle@12cws1 u01]$ expdp hra/hra@orclpdb directory=bkp dumpfile=hra_23082018.dmp logfile=hra_23082018.log full=y
Export: Release 12.2.0.1.0 - Production on Mon Aug 27 21:51:26 2018
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
Starting "HRA"."SYS_EXPORT_FULL_01": hra/********@orclpdb directory=bkp dumpfile=hra_23082018.dmp logfile=hra_23082018.log full=y
Processing object type DATABASE_EXPORT/EARLY_OPTIONS/VIEWS_AS_TABLES/TABLE_DATA
Processing object type DATABASE_EXPORT/NORMAL_OPTIONS/TABLE_DATA
******************************************************************************
Dump file set for HRA.SYS_EXPORT_FULL_01 is:
/u01/hra_23082018.dmp
Job "HRA"."SYS_EXPORT_FULL_01" successfully completed at Mon Aug 27 21:57:06 2018 elapsed 0 00:05:31
[oracle@12cws1 ~]$
Step 6: Connect to target pdb where you want to import dump.
SQL> alter session set container = orclpdb2;
Session altered.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
4 ORCLPDB2 READ WRITE NO
Step 7: Create a directory for data pump import
SQL> create directory bkp as '/u01/';
Directory created.
Step 8: Create a tns entry
orclpdb2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orclpdb2)
)
)
Step 9: Import using impdp
[oracle@12cws1 u01]$ impdp system/oracle@orclpdb2 directory=bkp dumpfile=hra_23082018.dmp logfile=hra_23082018_imp.log full=y
Import: Release 12.2.0.1.0 - Production on Mon Aug 27 22:00:35 2018
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
Master table "SYSTEM"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Job "SYSTEM"."SYS_IMPORT_FULL_01" completed with 5 error(s) at Mon Aug 27 22:09:36 2018 elapsed 0 00:08:38
[oracle@12cws1 u01]$
No comments:
Post a Comment