계획된 전환

Oracle 데이터베이스는 기본 또는 대기 롤 중 하나로 작동합니다. Data Guard는 전환 또는 복구를 사용하여 데이터베이스의 롤을 변경할 수 있도록 합니다:

  • 전환은 기본 데이터베이스와 해당 대기 데이터베이스 중 하나의 롤 전환입니다. 전환은 데이터 손실을 보장하지 않으며 일반적으로 기본 시스템의 계획된 유지 관리를 위해 수행됩니다. 전환 중 기본 데이터베이스는 대기 롤로 전환되고 대기 데이터베이스는 기본 롤로 변환됩니다.
  • 복구는 기본 데이터베이스(Oracle RAC 기본 데이터베이스의 모든 인스턴스) 가 실패하거나 연결할 수 없게 되고 대기 데이터베이스 중 하나가 기본 롤을 인계하도록 전환될 때 수행됩니다. 페일오버 시 적용되는 보호 모드에 따라 페일오버로 인해 데이터가 손실될 수도 있고 손실되지 않을 수도 있습니다.

온프레미스에서 OCI로 기본 데이터베이스 전환

유지 관리와 같은 계획된 작업이 있는 경우 OCI(Oracle Cloud Infrastructure) 의 데이터베이스를 데이터 손실 없이 기본 데이터베이스로 만들 수 있습니다. 전환은 온-프레미스 데이터베이스에서 시작되고 클라우드의 데이터베이스 인스턴스에서 완료된 계획된 이벤트입니다.

  1. sys 사용자 이름과 비밀번호를 사용하여 온-프레미스 데이터베이스의 DGMGRL 세션에 로그인합니다.
    DGMRGL> connect
  2. 온-프레미스 데이터베이스에서 대기 데이터베이스를 전환 및 복구할 준비가 되었는지 검증합니다.
    이 예제에서 기본 데이터베이스는 db1이고 대기 데이터베이스(StandbyDatabaseOCIInstanceDB1_phx3g7 입니다.
    DGMGRL> validate database DB1_phx3g7
    출력은 다음과 비슷합니다:
    Database Role:     Physical standby database
      Primary Database:  db1
    
      Ready for Switchover:  Yes
      Ready for Failover:    Yes (Primary Running)
    
      Managed by Clusterware:
        db1       :  YES             
        db1_phx3g7:  YES   
              
    Standby Apply-Related Information:
        Apply State:      Running
        Apply Lag:        17 minutes 6 seconds (computed 42 seconds ago)
        Apply Delay:      0 minutes
      Current Log File Groups Configuration:
        Thread #  Online Redo Log Groups  Standby Redo Log Groups Status       
                  (db1)                   (db1_phx3g7)                         
        1         2                       0                       Insufficient SRLs
        Warning: standby redo logs not configured for thread 1 on db1_phx3g7
        2         2                       0                       Insufficient SRLs
        Warning: standby redo logs not configured for thread 2 on db1_phx3g7
      Future Log File Groups Configuration:
        Thread #  Online Redo Log Groups  Standby Redo Log Groups Status       
                  (db1_phx3g7)            (db1)                                
        1         2                       0                       Insufficient SRLs
        Warning: standby redo logs not configured for thread 1 on db1
        2         2                       0                       Insufficient SRLs
        Warning: standby redo logs not configured for thread 2 on db1
  3. 기본 데이터베이스를 검증합니다.
    DGMGRL> validate database 'DB1';
    출력은 다음과 비슷합니다:
    Database Role:    Primary database
      Ready for Switchover:  Yes
      Managed by Clusterware:
        db1:  YES    
  4. 대기 데이터베이스를 검증합니다.
    DGMGRL> validate database 'DB1_phx3g7';
    출력은 다음과 비슷합니다:
    
    Database Role:     Physical standby database  
    Primary Database:  db1  
    Ready for Switchover:  Yes  
    Ready for Failover:    Yes (Primary Running)  
    Managed by Clusterware:
        db1       :  YES                
        db1_phx3g7:  YES              
    Standby Apply-Related Information:
        Apply State:      Running
        Apply Lag:        32 minutes 12 seconds (computed 40 seconds ago)
        Apply Delay:      0 minutes  
    Current Log File Groups Configuration:
        Thread #  Online Redo Log Groups  Standby Redo Log Groups Status
                  (db1)                   (db1_phx3g7)
         1         2                       0                       Insufficient SRLs
        Warning: standby redo logs not configured for thread 1 on db1_phx3g7
        2         2                       0                       Insufficient SRLs     
        Warning: standby redo logs not configured for thread 2 on db1_phx3g7
    
    Future Log File Groups Configuration:
        Thread #  Online Redo Log Groups  Standby Redo Log Groups Status       
                  (db1_phx3g7)            (db1)                                
        1         2                       0                       Insufficient SRLs
        Warning: standby redo logs not configured for thread 1 on db1
        2         2                       0                       Insufficient SRLs
        Warning: standby redo logs not configured for thread 2 on db1
  5. 온-프레미스(기본) 데이터베이스에서 대기 데이터베이스로 전환하는 명령을 실행합니다.
    DGMGRL> switchover to db1_phx3g7;
    출력은 다음과 비슷합니다:
    Performing switchover NOW, please wait...
    Operation requires a connection to database "db1_phx3g7"
    Connecting ...
    Connected to "DB1_phx3g7"
    Connected as SYSDBA.
    New primary database "db1_phx3g7" is opening...
    Oracle Clusterware is restarting database "db1" ...
    Connected to "db1"
    Connected to "db1"
    Switchover succeeded, new primary is "db1_phx3g7"
  6. 온-프레미스 데이터베이스에서 구성 상태를 표시합니다.
    DGMGRL> show configuration
    출력은 다음과 비슷합니다:
    Configuration - onpremexadr
    
      Protection Mode: MaxPerformance
      Members:
      db1_phx3g7 - Primary database
          db1        - Physical standby database 
    
    Warning: ORA-16809: multiple warnings detected for the memberFast-Start
            Failover:  Disabled
    Configuration Status:
    WARNING   (status updated 35 seconds ago)
  7. 기본 온-프레미스 Oracle Exadata Database Machine에서 열기 모드 를 선택합니다.
    SQL> select open_mode from v$database;
    출력은 다음과 비슷합니다:
    OPEN_MODE
    -------------------- 
    MOUNTED
  8. 클라우드의 Oracle Database Exadata Cloud Service 데이터베이스에서 데이터베이스가 READ WRITE 인지 확인합니다.
    SQL> select open_mode from v$database;
    출력은 다음과 비슷합니다:
    OPEN_MODE
    -------------------- 
    READ WRITE
클라우드에서 Oracle Database Exadata Cloud Service의 데이터베이스는 기본 데이터베이스입니다.

OCI에서 온프레미스로 기본 데이터베이스 다시 전환

OCI(Oracle Cloud Infrastructure) 의 데이터베이스 인스턴스를 기본 데이터베이스로 만든 후 Oracle Database Exadata Cloud Service의 OCI 데이터베이스 인스턴스에서 DGMGRL(Oracle Data Guard 명령행 인터페이스) 을 사용하여 온-프레미스 데이터베이스를 다시 전환하고 기본 데이터베이스로 설정합니다.

  1. OCI의 데이터베이스 인스턴스에서 온-프레미스 데이터베이스로 전환합니다.
    DGMGRL> switchover to db1;
    출력은 다음과 비슷합니다:
    Performing switchover NOW, please wait...
    Operation requires a connection to database "db1"
    New primary database "db1" is opening...
    Oracle Clusterware is restarting database "db1_phx3g7" ...
    Connected to "DB1_phx3g7"
    Connected to "DB1_phx3g7"
    Switchover succeeded, new primary is "db1"
  2. 온-프레미스 Oracle Exadata Database Machine에서 구성을 연결하고 검토합니다.
    DGMGRL> show configuration;
    출력은 다음과 비슷합니다:
    Configuration - onpremexadr
    
      Protection Mode: MaxPerformance
      Members:
      db1        - Primary database
      Warning: ORA-16809: multiple warnings detected for the member
        db1_phx3g7 - Physical standby database 
          Error: ORA-12650: No common encryption or data integrity algorithm
    Fast-Start Failover:  Disabled
    Configuration Status:
    ERROR   (status updated 899 seconds ago)
  3. 클라우드의 Oracle Database Exadata Cloud Service 데이터베이스에서 테스트 재해 복구 테이블을 생성합니다.
    SQL> create table testdr (a number , b number);
    Table created.
    SQL> desc testdr;
     Name                                        Null?    Type
     ----------------------------------------- -------- ----------------------------
     A                                          NUMBER
     B                                          NUMBER
  4. SQL을 종료합니다.
    SQL> exit
  5. 기본 온-프레미스 Oracle Exadata Database Machine에서 sysdba로 로그인하고 testdr 테이블을 봅니다.
    $ sqlplus / as sysdba
    SQL> desc testdr;
    
     Name                                        Null?    Type
     ----------------------------------------- -------- ----------------------------
     A                                          NUMBER
     B                                          NUMBER
  6. 기본 온-프레미스 Oracle Exadata Database Machine에서 구성을 표시하고 검토합니다.
    DGMGRL> show configuration;
    출력은 다음과 비슷합니다:
    Configuration - onpremexadr
    
      Protection Mode: MaxPerformance
      Members:
    db1        - Primary database
        db1_phx3g7 - Physical standby database 
          Warning: ORA-16809: multiple warnings detected for the member
    Fast-Start Failover:  Disabled
    Configuration Status:
    WARNING   (status updated 36 seconds ago)

온-프레미스 데이터베이스와 OCI(Oracle Database Exadata Cloud Service) 데이터베이스 인스턴스 간에 기본 데이터베이스를 전환할 수 있습니다.