oracle 12 c expdp導出異機impdp導入

16113 ワード

oracle 12 cは、1つのコンテナcdbに複数のテナントとして同時に存在しているので、12 c以前の導出とは若干異なるソースライブラリとターゲットライブラリは、導入導出pdbのtns配置ソースライブラリに対して動作しなければならない。
SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT
SYS@shgxdb>alter session set container=esb;

Session altered.

SYS@shgxdb>select owner, table_name from dba_tables where owner='ESBDB';

OWNER
--------------------------------------------------------------------------------
TABLE_NAME
--------------------------------------------------------------------------------
ESBDB
EOS_QRTZ_TRIGGERS

ESBDB
EOS_QRTZ_JOB_DETAILS

ESBDB
EOS_QRTZ_CALENDARS


OWNER
--------------------------------------------------------------------------------
TABLE_NAME
--------------------------------------------------------------------------------
ESBDB
EOS_QRTZ_BLOB_TRIGGERS

ESBDB
DI_PROCESS_MODEL

ESBDB
COMP_WIN7_CONFIG


OWNER
--------------------------------------------------------------------------------
TABLE_NAME
--------------------------------------------------------------------------------
ESBDB
CAP_RULE


118 rows selected.
dba権限ユーザーを創立してエクスポートに使います。
grant dba to jason identified by jason;
論理ディレクトリを作成
SQL> create or replace directory dp_dir as  '/home/oracle';

Directory created.

SQL> exit
論理ディレクトリに対する読み書き権限を付与します。ユーザーがdba権限であれば無視できます。
SQL> grant read,write on directory dp_dir to dp;
Grant succeeded.
ソースライブラリにpdb tnsを追加します
esb =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oracle12c-70)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = esb)
    )
  )
テストtnsが0 msecに戻り成功を表します。
[oracle@oracle12c-70 admin]$ tnsping esb

TNS Ping Utility for Linux: Version 12.2.0.1.0 - Production on 29-APR-2020 11:19:23

Copyright (c) 1997, 2016, Oracle.  All rights reserved.

Used parameter files:
/u01/app/oracle/product/12.2.0/db_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oracle12c-70)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = esb)))
OK (0 msec)
エクスポート操作
oracle@oracle12c-70 ~]$ expdp jason/jason@esb directory=dp_dir dumpfile=esbdb.dmp logfile=esbdb.log schemas=esbdb
Export: Release 12.2.0.1.0 - Production on Tue Apr 28 17:04:23 2020

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 "JASON"."SYS_EXPORT_SCHEMA_01":  jason/********@esb directory=dp_dir dumpfile=esbdb.dmp logfile=esbdb.log schemas=esbdb 
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/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/SEQUENCE/SEQUENCE
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/VIEW/VIEW
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/TRIGGER
. . exported "ESBDB"."REG_CONTENT"                       2.221 MB    2412 rows
. . exported "ESBDB"."REG_CONTENT_HISTORY"               139.0 KB     206 rows
. . exported "ESBDB"."REG_RESOURCE"                      169.5 KB    1527 rows
. . exported "ESBDB"."REG_PATH"                          53.11 KB     410 rows
. . exported "ESBDB"."REG_SNAPSHOT"                      15.85 KB     206 rows
. . exported "ESBDB"."SSM_SERVICE_TOP"                   3.701 MB      51 rows
. . exported "ESBDB"."REG_RESOURCE_HISTORY"              31.37 KB     206 rows
. . exported "ESBDB"."SAM_OPERATION"                     22.53 KB      94 rows
. . exported "ESBDB"."ORG_EMPLOYEE"                      22.07 KB       1 rows
. . exported "ESBDB"."APP_MENU"                          19.11 KB      57 rows
. . exported "ESBDB"."UM_USER_PERMISSION"                    0 KB       0 rows
Master table "JASON"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for JASON.SYS_EXPORT_SCHEMA_01 is:
  /home/oracle/esbdb.dmp
Job "JASON"."SYS_EXPORT_SCHEMA_01" successfully completed at Tue Apr 28 17:09:45 2020 elapsed 0 00:05:21
dmpとロゴの名前は自分で決めます。
インポート操作
前の準備はエクスポートと同じです。同じ論理ディレクトリを作成します。
dba権限ユーザーを創立してエクスポートに使います。
grant dba to jason identified by jason;
論理ディレクトリを作成
SQL> create or replace directory dp_dir as  '/home/oracle';

Directory created.

SQL> exi
tライセンス論理ディレクトリに対する読み書き権限は、ユーザーがdba権限であれば無視できます。
SQL> grant read,write on directory dp_dir to dp;
Grant succeeded.
ソースライブラリにpdb tnsを追加します
esb =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oracle12c-70)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = esb)
    )
  )
テストtnsが0 msecに戻り成功を表します。
[oracle@oracle12c-70 admin]$ tnsping esb

TNS Ping Utility for Linux: Version 12.2.0.1.0 - Production on 29-APR-2020 11:19:23

Copyright (c) 1997, 2016, Oracle.  All rights reserved.

Used parameter files:
/u01/app/oracle/product/12.2.0/db_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oracle12c-70)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = esb)))
OK (0 msec)
impインポート

```bash
[oracle@oracle12c-70 ~]$ impdp jason/jason@esb directory=dp_dir dumpfile=esbdb.dmp logfile=esbdb.log schemas=esbdb

Import: Release 12.2.0.1.0 - Production on Tue Apr 28 17:21:12 2020

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 "JASON"."SYS_IMPORT_SCHEMA_01" successfully loaded/unloaded
Starting "JASON"."SYS_IMPORT_SCHEMA_01":  jason/********@esb directory=dp_dir dumpfile=esbdb.dmp logfile=esbdb.log schemas=esbdb 
Processing object type SCHEMA_EXPORT/USER