Today, we demonstrated the switching process between switchover and failover on the virtual machine. The customer is concerned with failover. We directly turn off the virtual storage switch to simulate array faults. Failover steps are as follows:
1.
- Select NAME, RESETLOGS_TIME, LOG_MODE, OPEN_MODE, PROTECTION_MODE, REMOTE_ARCHIVE,
- DATABASE_ROLE, SWITCHOVER_STATUS, FORCE_LOGGING
- FromV $Database;
2. Stop the log application
- Alter DatabaseRecover managed standbyDatabaseCancel;
3. Disable standby log Transmission
- Alter DatabaseRecover managed standbyDatabaseFinishForce;
4. Switch to primary
- Alter Database Commit ToSwitchoverTo Primary WithSession shutdown;
If a gap exists during this step, the ORA-16139: Switchover: Media recovery required-standby not in limbo error is reported. During the test, this problem occurs if the master database is started and then the slave database is not waiting for the log transmission of the slave database to complete. Force Switch
- Alter DatabaseActivate physical standbyDatabase;
5. Restart the database to the open state.
Attach the dataguard implementation process from a single machine to a single machine in linux.
Prepare the environment
PRIMARY: RHEL 4.7 + Oracle 10.2.0.4 single host + file system Host Name: zhbqdb1
STANDBY: RHEL 4.7 + oracle 10.2.0.4 single host + file system Host Name: zhbqdb2
Create a database named zhdydb1 on the host and enable the archive mode. The backup machine is installed with data software, and the version is upgraded to the same as that of the host.
Configure/etc/hosts on the host and backup machine and create a data storage path
# Do not remove thefollowing line, or various programs
# That require network functionality will fail.
127.0.0.1 localhost. localdomain localhost
172.17.42.29 zhbqdb1
172.17.42.30 zhbqdb2
Create a directory for storing data files and archives
- Mkdir/u01/flash_recovery_area
- Mkdir/u01/oradata
- Chown oracle: oinstall/u01/flash_recovery_area
- Chown oracle: oinstall/u01/oradata
Host Configuration Enable force logging
SQL> alter database force logging;
Check whether the current database is under force logging:
Selectforce_logging from v $ database;
Create an archive directory
- Mkdir/u01/flash_recovery_area/ZHDYDB1/arch
- Mkdir/u01/flash_recovery_area/ZHDYDB2
- Mkdir/u01/flash_recovery_area/ZHDYDB2/arch
- Mkdir/u01/flash_recovery_area/ZHDYDB2/archivelog
Configure tnsnames
On zhbqdb1
Vi $ ORACLE_HOME/network/admin/tnsnames. ora
ZHDYDB1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = zhbqdb1) (PORT = 1521 ))
)
(CONNECT_DATA =
(SERVICE_NAME = zhdydb1)
)
)
ZHDYDB2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = zhbqdb2) (PORT = 1521 ))
)
(CONNECT_DATA =
(SERVICE_NAME = zhdydb2)
)
)