전환은 기본 데이터베이스가 대기 데이터베이스가 되는 역할 역전입니다. 전환 프로세스 중에 데이터베이스 클라이언트가 기본 데이터베이스에서 연결 해제됩니다. 애플리케이션이 데이터베이스에 연결하는 방법에 따라, 전환이 애플리케이션 트래픽을 방해할 수 있습니다. Oracle은 역할 전환 중에 애플리케이션 연속성을 유지하는 옵션을 제공합니다. 다음 안내에 따라 데이터베이스 전환을 수행하여 재해 복구 준비 상태를 테스트할 수 있습니다.
기본 데이터베이스를 호스팅하는 베어메탈 솔루션 서버에 로그인합니다.
Data Guard 명령줄 인터페이스를 시작하고 대기 데이터베이스에 연결합니다.
dgmgrl
CONNECTSYS@DBDG_SITE2
비밀번호를 입력하라는 메시지가 표시되면 데이터베이스의 SYS 원격 로그인 비밀번호를 입력합니다.
데이터베이스가 전환할 준비가 되었는지 확인합니다.
VALIDATE DATABASE DBDG_SITE2;
성공하면 데이터베이스를 전환할 준비가 되었다고 보고됩니다.
성공하면 다음과 같은 전환 명령어를 수행합니다.
SWITCHOVER TO DBDG_SITE2;
명령어가 성공하면 DBDG_SITE2가 구성의 새 기본 데이터베이스라는 메시지가 표시됩니다.
다음 명령어를 실행하여 데이터베이스 역할이 전환되었는지 확인합니다.
SHOW CONFIGURATION;
다음 명령어를 실행하여 원래 구성으로 돌아갑니다.
SWITCHOVER TO DBDG_SITE1;
Data Guard 브로커를 사용한 데이터베이스 장애 조치
장애 조치는 전체 데이터베이스 중단으로 인해 대기 데이터베이스 중 하나가 기본 역할로 이동하는 역할 전환입니다. 대기 데이터베이스가 복구될 때까지 Redo는 대기 데이터베이스로 배송되지 않습니다.
장애 조치 수행
대기 데이터베이스를 호스팅하는 첫 번째 베어메탈 솔루션 서버에 로그인합니다.
Data Guard 명령줄 인터페이스에 연결한 후 기본 데이터베이스를 대기 데이터베이스로 장애 조치합니다.
dgmgrl
CONNECTSYS@DBDG_SITE2
비밀번호를 입력하라는 메시지가 표시되면 데이터베이스의 SYS 원격 로그인 비밀번호를 입력합니다.
다음 명령어를 통해 장애 조치를 시작합니다.
FAILOVER TO DBDG_SITE2
show configuration;를 실행하여 이제 DBDG_SITE2가 현재 기본 데이터베이스이며 DBDG_SITE1를 복구해야 하는지 확인합니다.
기본 데이터베이스 복구
flashback database가 사용 설정된 경우에만 장애 조치 후 기본 데이터베이스를 복구할 수 있습니다. 장애가 발생한 기본 데이터베이스를 복구하려면 다음 안내를 따르세요.
기본 데이터베이스를 호스팅하는 첫 번째 베어메탈 솔루션 서버에 로그인합니다.
Data Guard 명령줄 인터페이스에 연결하고 기본 데이터베이스에 로그인한 후 장애가 발생한 데이터베이스를 복구합니다.
dgmgrl
CONNECTSYS@DBDG_SITE2
비밀번호를 입력하라는 메시지가 표시되면 데이터베이스의 SYS 원격 로그인 비밀번호를 입력합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eThis document provides instructions on how to validate a Data Guard deployment by checking redo log sequence numbers and process status between primary and standby databases.\u003c/p\u003e\n"],["\u003cp\u003eThe process for performing a database switchover, which reverses the roles of the primary and standby databases, is detailed, including steps to validate and execute the switchover.\u003c/p\u003e\n"],["\u003cp\u003eSteps to perform a database failover, where a standby database becomes the new primary due to a site outage, are outlined, as well as a warning about potential data loss during this process.\u003c/p\u003e\n"],["\u003cp\u003eThe document explains how to reinstate a failed primary database after a failover, requiring that the flashback database feature is enabled.\u003c/p\u003e\n"]]],[],null,["# Validate the Data Guard deployment\n==================================\n\nAfter you've [set up the Data Guard broker](/bare-metal/docs/solutions/oracle/data-guard-setup/broker),\nyou need to verify that redo was copied from the primary database and applied on\nthe standby database. The following procedure can be used to check the Data\nGuard status from within the primary and standby databases.\n\nThe following examples are used throughout this guide:\n\nValidate the Data Guard deployment\n----------------------------------\n\n1. Log in to the first Bare Metal Solution server that hosts the primary database,\n then set the `ORACLE_SID` environment variable so you can connect to the\n primary database:\n\n source oraenv \u003c\u003c\u003c \"\u003cvar translate=\"no\"\u003eDBDG_SITE11\u003c/var\u003e\"\n\n2. Start SQL\\*Plus, then determine the latest sequence number for archived redo\n logs:\n\n sqlplus / as sysdba\n\n SELECT THREAD#, max(SEQUENCE#) \"Last Primary Seq Archived\"\n FROM V$ARCHIVED_LOG VAL, V$DATABASE VDB WHERE VAL.RESETLOGS_CHANGE# =\n VDB.RESETLOGS_CHANGE# GROUP BY THREAD# ORDER BY 1;\n\n The following output has maximum sequence number of 40 for thread 1 and a\n maximum sequence number of 33 for thread 2: \n\n THREAD# Last Primary Seq Archived\n ---------- -------------------------\n 1 40\n 2 33\n\n Record the results to compare with the standby database. Sequence numbers on\n the standby database are expected to match the primary database.\n3. Log in to the first Bare Metal Solution server that hosts the standby database, then\n set the `ORACLE_SID` environment variable so you can connect to the standby\n database:\n\n source oraenv \u003c\u003c\u003c \"\u003cvar translate=\"no\"\u003eDBDG_SITE21\u003c/var\u003e\"\n\n4. Start SQL\\*Plus, then validate that the latest sequence number received and\n applied for archived redo logs matches the latest sequence number on the\n primary database:\n\n sqlplus / as sysdba\n\n SELECT THREAD#, max(SEQUENCE#) \"Last Standby Seq Received\"\n FROM V$ARCHIVED_LOG VAL, V$DATABASE VDB WHERE VAL.RESETLOGS_CHANGE# =\n VDB.RESETLOGS_CHANGE# GROUP BY THREAD# ORDER BY 1;\n\n SELECT THREAD#, max(SEQUENCE#) \"Last Standby Seq Applied\"\n FROM V$ARCHIVED_LOG VAL, V$DATABASE VDB WHERE VAL.RESETLOGS_CHANGE# =\n VDB.RESETLOGS_CHANGE# AND VAL.APPLIED IN ('YES','IN-MEMORY') GROUP BY\n THREAD# ORDER BY 1;\n\n The following output has sequence numbers that match the prior query run\n against the standby database: \n\n THREAD# Last Standby Seq Received\n ---------- -------------------------\n 1 40\n 2 33\n\n THREAD# Last Standby Seq Applied\n ---------- ------------------------\n 1 40\n 2 33\n\n5. Check that the status of the managed recovery process is `APPLYING_LOG`:\n\n SELECT PROCESS, STATUS FROM V$MANAGED_STANDBY WHERE PROCESS LIKE '%MRP%';\n\n The following example shows a single managed recovery process named `MRP0`\n with status of `APPLYING_LOG`: \n\n PROCESS STATUS\n --------- ------------\n MRP0 APPLYING_LOG\n\n6. Check for any transport or apply lag on the standby database:\n\n COLUMN NAME FORMAT a20\n COLUMN VALUE FORMAT a30\n SELECT NAME, VALUE FROM V$DATAGUARD_STATS WHERE NAME LIKE '%lag%';\n\n The following output shows no lag on the standby database: \n\n NAME VALUE\n -------------------- ------------------------------\n transport lag +00 00:00:00\n apply lag +00 00:00:00\n\n If there is lag, consult Oracle's Data Guard troubleshooting [documentation](https://docs.oracle.com/en/database/oracle/oracle-database/19/haovw/tune-and-troubleshoot-oracle-data-guard.html#GUID-E8C27979-9D37-4899-9306-A5AE2B5CF6C0).\n\nDatabase switchover using the Data Guard broker\n-----------------------------------------------\n\nA switchover is a role reversal in which the primary database becomes a standby\ndatabase, and vice versa. During the switchover process, database clients are\ndisconnected from the primary database. Depending on how your application\nconnects to the database, a switchover can disrupt application traffic. Oracle\noffers [options to maintain application continuity](https://docs.oracle.com/en/database/oracle/oracle-database/19/racad/ensuring-application-continuity.html)\nduring role transitions. You can test your disaster recovery readiness by\nperforming a database switchover with the following instructions:\n\n1. Log in to the Bare Metal Solution server that hosts the primary database.\n\n2. Launch the Data Guard command line interface, and connect to the standby\n database:\n\n dgmgrl\n\n CONNECT SYS@\u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e\n\n3. When prompted for a password, enter your SYS remote login password for the\n database.\n\n4. Validate that the database is ready for a switchover.\n\n VALIDATE DATABASE \u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e;\n\n A successful result will report that the database is ready for switchover.\n5. If successful, perform the switchover command:\n\n SWITCHOVER TO \u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e;\n\n If the command succeeds, you'll receive a message that \u003cvar scope=\"DBDG_SITE2\" translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e\n is the new primary database in the configuration.\n6. Run the following command to confirm that the database roles are swapped:\n\n SHOW CONFIGURATION;\n\n7. Run the following command to return to the original configuration:\n\n SWITCHOVER TO \u003cvar translate=\"no\"\u003eDBDG_SITE1\u003c/var\u003e;\n\n| **Note:** Running the switchover command while connected to the primary database might result in the connection being dropped. This is due to the primary database being restarted during the switchover process.\n\nDatabase failover using Data Guard broker\n-----------------------------------------\n\nA failover is a role transition in which one of the standby databases moves to\nthe primary role due to a complete site outage. Redo will not be shipped to the\nstandby database until the standby database has been reinstated.\n| **Warning:** A failover typically involves data loss.\n\n### Perform the failover\n\n1. Log in to the first Bare Metal Solution server that hosts the standby database.\n\n2. Connect to the Data Guard command line interface, then failover the primary\n to the standby database:\n\n dgmgrl\n\n CONNECT SYS@\u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e\n\n3. When prompted for a password, enter your SYS remote login password for the\n database.\n\n4. Initiate the failover:\n\n FAILOVER TO \u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e\n\n Run `show configuration;` to verify that \u003cvar scope=\"DBDG_SITE2\" translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e\n is now the primary database, and \u003cvar scope=\"DBDG_SITE1\" translate=\"no\"\u003eDBDG_SITE1\u003c/var\u003e\n needs to be reinstated.\n\n### Reinstate the primary database\n\nYou can only reinstate the primary database after a failover if\n[`flashback database`](https://docs.oracle.com/en/database/oracle/oracle-database/19/sbydb/examples-of-using-oracle-data-guard.html#GUID-1163448F-6B18-4A44-AA8D-7CDF0D1360FB)\nis enabled. To reinstate the failed primary database:\n\n1. Log in to the first Bare Metal Solution server that hosts the primary database.\n\n2. Connect to the Data Guard command line interface, log in to the primary\n databases, then reinstate the failed database:\n\n dgmgrl\n\n CONNECT SYS@\u003cvar translate=\"no\"\u003eDBDG_SITE2\u003c/var\u003e\n\n When prompted for a password, enter your SYS remote login password for the\n database.\n3. Reinstate the database:\n\n REINSTATE DATABASE \u003cvar translate=\"no\"\u003eDBDG_SITE1\u003c/var\u003e;\n EXIT;\n\nNext steps\n----------\n\nNext, [set up a Data Guard observer on Compute Engine](/bare-metal/docs/solutions/oracle/data-guard-setup/observer)."]]