Computer >> 컴퓨터 >  >> 프로그램 작성 >> 데이터 베이스

Oracle Database 12c:Part 2의 데이터 펌프 개선 사항 작업

원래 TriCore 발행:2017년 6월 6일

Oracle® Data Pump(expdp, impdp)는 데이터베이스 안팎에서 데이터베이스 개체를 내보내고 가져오기 위한 유틸리티입니다. 2부로 구성된 이 블로그 포스트 시리즈의 1부에서는 OracleDatabase 12c의 다중 테넌트 아키텍처 도입과 Data Pump를 사용하여 데이터를 내보내고 가져오는 방법에 대해 설명했습니다. 2부 표지에서는 PDB(플러그 가능 데이터베이스)만 내보내고 Data Pump가 PDB에 적용하는 제한 사항을 보여줍니다.

PDB 내보내기 수행

컨테이너 데이터베이스(CDB)의 경우 실제 데이터는 기본 PDB에 속하며 각 PDB는 클라이언트에게 비 CDB(표준 Oracle 데이터베이스)로 나타납니다. 따라서 PDB에서 개체를 내보내는 것이 좋습니다.

Oracle Database 12c:Part 2의 데이터 펌프 개선 사항 작업

이미지 출처:데이터 펌프 아키텍처

PDB에 대해 Data Pump 내보내기를 사용하는 것은 비 CDB 데이터베이스에 대해 Data Pump 내보내기를 사용하는 것과 동일합니다. PDB용 데이터 펌프 내보내기 유틸리티를 사용할 때의 유일한 차이점은 내보내기를 시작할 때 내보내기 명령 프롬프트에서 연결 식별자 또는 TNS(Transparent NetworkSubstrate) 별칭을 사용해야 한다는 것입니다. 이 단계는 특정 PDB에 대한 데이터 펌프 내보내기를 시작하는지 확인합니다.

예를 들어, 사용자ABBAS 내보내기를 수행할 수 있습니다. PRODPDB1라는 PDB에 속함 다음 명령으로:

  [oracle@labserver ~]$ expdp directory=DP_PDB1 dumpfile=pdb1_abbas.dmp logfile=pdb1_abbas.log schemas=abbas

다음 코드 블록은 이 명령의 출력을 보여줍니다.

Export: Release 12.1.0.1.0 - Production on Fri Mar 27 00:08:09 2015

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

Username: sys@prodpdb1 as sysdba
Password:

Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options
Starting "SYS"."SYS_EXPORT_SCHEMA_01":  sys/********@prodpdb1 AS SYSDBA directory=DP_PDB1 dumpfile=pdb1_abbas.dmp logfile=pdb1_abbas.log schemas=abbas
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
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
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
. . exported "ABBAS"."TAB1"                              67.85 KB      41 rows
Master table "SYS"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYS.SYS_EXPORT_SCHEMA_01 is:
  /backup/exp/prodpdb1/pdb1_abbas.dmp
Job "SYS"."SYS_EXPORT_SCHEMA_01" successfully completed at Thu Mar 26 14:39:44 2015 elapsed 0 00:01:08

사용자 이름을 전달한 명령은 PRODPDB1라는 PDB에 대한 연결 식별자도 지정했습니다. .

[oracle@labserver ~]$ expdp directory=DP_PDB1 dumpfile=pdb1_abbas.dmp logfile=pdb1_abbas.log schemas=abbas

Export: Release 12.1.0.1.0 - Production on Fri Mar 27 00:08:09 2015

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

Username: sys@prodpdb1 as sysdba
Password:

다음 코드 블록은 연결 식별자(prodpdb1 )는 PRODPDB1라는 PDB로 확인됩니다. .

  [oracle@labserver ~]$ tnsping prodpdb1

  TNS Ping Utility for Linux: Version 12.1.0.1.0 - Production on 27-MAR-2015 00:11:54

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

  Used parameter files:
  /app/oracle/db/12.1.0.1/network/admin/sqlnet.ora


  Used TNSNAMES adapter to resolve the alias
  Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = labserver.home.com)(PORT = 1525)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = prodpdb1)))
  OK (10 msec)

PDB에 대한 데이터 펌프 제한

Data Pump는 가져오기 및 내보내기를 위해 루트 컨테이너 또는 CDB가 소유한 디렉토리를 사용하는 것을 허용하지 않는다는 점에 유의하는 것이 중요합니다. 또한 다른 PDB가 소유한 것을 사용할 수 없습니다.

대신 PDB 아래에 디렉터리를 만들어야 합니다. Data Pump 내보내기 및 가져오기 기능을 사용하려면 PDB가 디렉터리를 소유해야 합니다.

다른 PDB 또는 루트 컨테이너에 속한 디렉터리를 사용하려고 하면 명령이 다음 오류를 반환합니다.

  [oracle@labserver ~]$ expdp directory=DP_PDB2 dumpfile=pdb1_abbas.dmp logfile=pdb1_abbas.log schemas=abbas

  Export: Release 12.1.0.1.0 - Production on Fri Mar 27 00:21:08 2015

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

  Username: sys@prodpdb1 as sysdba
  Password:

  Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
  With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
  and Real Application Testing options
  ORA-39002: invalid operation
  ORA-39070: Unable to open the log file.
  ORA-39087: directory name DP_PDB2 is invalid

또한 defaultdirectoryDATA_PUMP_DIR를 사용할 수 없습니다. Data Pump로 aPDB를 내보내거나 가져옵니다. 이 제한은 DATA_PUMP_DIR 때문에 존재합니다. 루트 컨테이너가 항상 소유하고 있으며 소유권을 변경할 수 없습니다.

기본 DATA_PUMP_DIR를 생성하려고 하면 PDB 내부에서 명령은 다음 오류를 반환합니다.

  sys@PRODPDB1> show con_name

  CON_NAME
  ------------------------------
  PRODPDB1
  sys@PRODPDB1> create or replace directory DATA_PUMP_DIR as '/backup/exp/prodpdb1';
  create or replace directory DATA_PUMP_DIR as '/backup/exp/prodpdb1'
  *
  ERROR at line 1:
  ORA-65040: operation not allowed from within a pluggable database

결과적으로 데이터 펌프 내보내기 또는 가져오기를 수행하려면 항상 PDB에 대해 명시적으로 디렉터리를 생성해야 합니다.

결론

Data Pump 유틸리티는 Oracle이 Oracle 10g와 함께 도입한 향상된 내보내기 및 가져오기 도구입니다. 이 블로그 게시물 시리즈의 파트 1과 2에서 다루는 OracleDatabase 12c의 expdp 개선 사항을 활용하면 이 유틸리티를 최대화할 수 있습니다.

피드백 탭을 사용하여 의견을 남기거나 질문하십시오.

참조

다음 문서는 이 블로그 게시물에 대한 참조로 사용되었습니다.

  • 이번 릴리스의 Oracle DatabaseUtilities 변경 사항