Run export backup in PDB

 How to run expdp in Pluggable database (PDB):


Step-1: PDB services should be registered in the listener.

[oracle@oracle12c ~]$ lsnrctl status |grep pdb1
Service "pdb1" has 1 instance(s).

Step-2: Add PDB entries in TNS file.

PDB1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oracle12c.localdomain)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = pdb1)
    )
  )

Step-3: Create a data pump directory under the PDB.


SQL> alter session set container=pdb1;

Session altered.

$ mkdir -p /u01/pdb1_expdir

SQL> create directory pdb1_expdir as '/u01/pdb1_expdir';

Directory created.

SQL> grant read,write on DIRECTORY pdb1_expdir to HR;

Grant succeeded.

Step-4: Backup the PDB.

expdp HR/HR@pdb1 directory=pdb1_expdir dumpfile=pdb1_hr.dmp logfile=exp_pdb1_hr.log schemas=HR


Export logfile:

[oracle@oracle12c ~]$ expdp HR/HR@pdb1 directory=pdb1_expdir dumpfile=pdb1_hr.dmp logfile=exp_pdb1_hr.log schemas=HR
Export: Release 12.2.0.1.0 - Production on Sat Jun 11 15:57:47 2022
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 "HR"."SYS_EXPORT_SCHEMA_01":  HR/********@pdb1 directory=pdb1_expdir dumpfile=pdb1_hr.dmp logfile=exp_pdb1_hr.log schemas=HR
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
. . exported "HR"."EMPLOYEES"                            5.546 KB       2 rows
Master table "HR"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for HR.SYS_EXPORT_SCHEMA_01 is:
  /u01/pdb1_expdir/pdb1_hr.dmp
Job "HR"."SYS_EXPORT_SCHEMA_01" successfully completed at Sat Jun 11 15:59:44 2022 elapsed 0 00:01:54



Comments

Popular posts from this blog

Auditing in Oracle database

rs.stepDown() in MongoDB replication

Tuples in Python