Silahkan Melihat Tutorial di website kami dengan nyaman ENJOY YOUR LIFE ☕

How to dump file ( export and import) on pluggable database


1. Check listener

[oracle@PTUD-SingleSignOn ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 09-SEP-2015 17:57:36

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.1.0 - Production
Start Date                28-AUG-2015 15:10:09
Uptime                    12 days 2 hr. 47 min. 27 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/PTUD-SingleSignOn/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=PTUD-SingleSignOn)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=PTUD-SingleSignOn)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/ptud/xdb_wallet))(Presentation=HTTP)(Session=RAW))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=PTUD-SingleSignOn)(PORT=5501))(Security=(my_wallet_directory=/u01/app/oracle/admin/eppm/xdb_wallet))(Presentation=HTTP)(Session=RAW))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=PTUD-SingleSignOn)(PORT=5502))(Security=(my_wallet_directory=/u01/app/oracle/admin/eppm/xdb_wallet))(Presentation=HTTP)(Session=RAW))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=PTUD-SingleSignOn)(PORT=5503))(Security=(my_wallet_directory=/u01/app/oracle/admin/eppm/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "eppm" has 1 instance(s).
  Instance "eppm", status READY, has 1 handler(s) for this service...
Service "eppmXDB" has 1 instance(s).
  Instance "eppm", status READY, has 1 handler(s) for this service...
Service "p6" has 1 instance(s).
  Instance "eppm", status READY, has 1 handler(s) for this service...
Service "ptud" has 1 instance(s).
  Instance "ptud", status READY, has 1 handler(s) for this service...
Service "ptudXDB" has 1 instance(s).
  Instance "ptud", status READY, has 1 handler(s) for this service...
Service "test" has 1 instance(s).
  Instance "eppm", status READY, has 1 handler(s) for this service...
The command completed successfully


2. export ORACLE_SID=CDB_name

[oracle@PTUD-SingleSignOn ~]$ export ORACLE_SID=eppm
[oracle@PTUD-SingleSignOn ~]$ echo $ORACLE_SID
eppm

3. Show pdbs of CDB_name

[oracle@PTUD-SingleSignOn ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Wed Sep 9 18:00:24 2015

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


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

SQL> show pdbs

    CON_ID CON_NAME                                    OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
             2 PDB$SEED                             READ ONLY  NO
             3 P6                                          READ WRITE NO
             4 TEST                                      READ WRITE YES

4. Adding tnsname.ora pdb connection

[oracle@PTUD-SingleSignOn ~]$ tns
[oracle@PTUD-SingleSignOn admin]$ ls
listener.ora  samples  shrept.lst  sqlnet.ora  tnsnames.ora
[oracle@PTUD-SingleSignOn admin]$ more tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.1.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

EPPM =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = PTUD-SingleSignOn)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = eppm)
    )
  )

LISTENER_PTUD =
  (ADDRESS = (PROTOCOL = TCP)(HOST = PTUD-SingleSignOn)(PORT = 1521))


PTUD =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = PTUD-SingleSignOn)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ptud)
    )
  )


P6 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = PTUD-SingleSignOn)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = p6)
    )
  )


TEST =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = PTUD-SingleSignOn)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = test)
    )
  )

5. Create directory for PDB

[oracle@PTUD-SingleSignOn dpdump]$ mkdir p6_dir
 [oracle@PTUD-SingleSignOn dpdump]$ cd p6_dir/
[oracle@PTUD-SingleSignOn p6_dir]$ pwd
/u01/app/oracle/admin/eppm/dpdump/p6_dir

[oracle@PTUD-SingleSignOn p6_dir]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Wed Sep 9 18:04:42 2015

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


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
SQL> show pdbs;

    CON_ID CON_NAME  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED  READ ONLY  NO
3 P6  READ WRITE NO
4 TEST  READ WRITE YES
SQL> alter session set container=p6;

Session altered.

SQL> create or replace directory p6_dir as '/u01/app/oracle/admin/eppm/dpdump/p6_dir';

Directory created.

SQL> select * from all_directories;

OWNER
--------------------------------------------------------------------------------
DIRECTORY_NAME
--------------------------------------------------------------------------------
DIRECTORY_PATH
--------------------------------------------------------------------------------
ORIGIN_CON_ID
-------------
SYS
ORACLE_HOME
/
                1


OWNER
--------------------------------------------------------------------------------
DIRECTORY_NAME
--------------------------------------------------------------------------------
DIRECTORY_PATH
--------------------------------------------------------------------------------
ORIGIN_CON_ID
-------------
SYS
ORACLE_BASE
/
                1


OWNER
--------------------------------------------------------------------------------
DIRECTORY_NAME
--------------------------------------------------------------------------------
DIRECTORY_PATH
--------------------------------------------------------------------------------
ORIGIN_CON_ID
-------------
SYS
OPATCH_LOG_DIR
/u01/app/oracle/product/12.1.0/db_1/QOpatch
                1


OWNER
--------------------------------------------------------------------------------
DIRECTORY_NAME
--------------------------------------------------------------------------------
DIRECTORY_PATH
--------------------------------------------------------------------------------
ORIGIN_CON_ID
-------------
SYS
OPATCH_SCRIPT_DIR
/u01/app/oracle/product/12.1.0/db_1/QOpatch
                1


OWNER
--------------------------------------------------------------------------------
DIRECTORY_NAME
--------------------------------------------------------------------------------
DIRECTORY_PATH
--------------------------------------------------------------------------------
ORIGIN_CON_ID
-------------
SYS
XSDDIR
/u01/app/oracle/product/12.1.0/db_1/rdbms/xml/schema
                1


OWNER
--------------------------------------------------------------------------------
DIRECTORY_NAME
--------------------------------------------------------------------------------
DIRECTORY_PATH
--------------------------------------------------------------------------------
ORIGIN_CON_ID
-------------
SYS
DATA_PUMP_DIR
/u01/app/oracle/admin/eppm/dpdump/
                1


OWNER
--------------------------------------------------------------------------------
DIRECTORY_NAME
--------------------------------------------------------------------------------
DIRECTORY_PATH
--------------------------------------------------------------------------------
ORIGIN_CON_ID
-------------
SYS
ORACLE_OCM_CONFIG_DIR
/u01/app/oracle/product/12.1.0/db_1/ccr/hosts/PTUD-SingleSignOn/state
                1


OWNER
--------------------------------------------------------------------------------
DIRECTORY_NAME
--------------------------------------------------------------------------------
DIRECTORY_PATH
--------------------------------------------------------------------------------
ORIGIN_CON_ID
-------------
SYS
ORACLE_OCM_CONFIG_DIR2
/u01/app/oracle/product/12.1.0/db_1/ccr/state
                1


OWNER
--------------------------------------------------------------------------------
DIRECTORY_NAME
--------------------------------------------------------------------------------
DIRECTORY_PATH
--------------------------------------------------------------------------------
ORIGIN_CON_ID
-------------
SYS
XMLDIR
/u01/app/oracle/product/12.1.0/db_1/rdbms/xml
                1


OWNER
--------------------------------------------------------------------------------
DIRECTORY_NAME
--------------------------------------------------------------------------------
DIRECTORY_PATH
--------------------------------------------------------------------------------
ORIGIN_CON_ID
-------------
SYS
P6_DIR
/u01/app/oracle/admin/eppm/dpdump/p6_dir
                1


10 rows selected.

SQL>

6. Import or Export data

[oracle@PTUD-SingleSignOn pdb_dir]$ impdp system/***********@p6 schemas=privuser directory=P6_DIR dumpfile=exPRIVUSER.dmp logfile=imPRIVUSER.log

Import: Release 12.1.0.1.0 - Production on Wed Sep 9 18:11:41 2015

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

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
Master table "SYSTEM"."SYS_IMPORT_SCHEMA_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_SCHEMA_01":  system/********@p6 schemas=privuser directory=PDB_DIR dumpfile=exPRIVUSER.dmp logfile=imPRIVUSER.log
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/SYNONYM/SYNONYM
Processing object type SCHEMA_EXPORT/VIEW/VIEW
ORA-39082: Object type VIEW:"PRIVUSER"."ACCOUNT" created with compilation warnings
ORA-39082: Object type VIEW:"PRIVUSER"."ACTVCODE" created with compilation warnings
ORA-39082: Object type VIEW:"PRIVUSER"."ACTVTYPE" created with compilation warnings






0 komentar:

Post a Comment

How to dump file ( export and import) on pluggable database