Oracle Database uses its DataGuard technology to implement remote data security in real-time remote Oracle databases through the network. Establish the same environment in different regions,
Oracle Database uses its Data Guard technology to implement remote Data security in real-time remote Oracle databases through the network. Establish the same environment in different regions,
1. Overview
Oracle Database uses its Data Guard technology to implement remote Data security in real-time remote Oracle databases through the network.
Its implementation process is generally as follows:
First, create the same environment in different regions, including the host operating system, database version, and data file storage methods. First, simulate the creation of a database, and then create physical standby based on the database.
Next, modify init on the master and slave database nodes. ora, listener. ora and tnsnames. configure the ora file and change the protection_mode of v $ database in the master database to MAXIMUMAVAILABILITY (maximum available ).
Again, back up the control file on the master database, which is of course in the for standby mode.
Finally, create a standby logfile on the slave database and start it to the recover managed standbydatabase state. Then, the master database will point to the log_archive_dest_state _ * of the slave database for defer and enable, that is, activate it.
This completes the entire process.
Okay, this is not the point.
The point is, can I switch the slave database after the slave uard environment is set up? How to switch?
2. switch between the master and slave Databases
In fact, there are two types of OracleData Guard switching, which are called switchover and failover.
The steps for switching switchover are as follows:
Step 1: Disable the listener on the master database, and then disable all connections on the master database. I can directly kill the oracle process with-9 local = no.
Step 2: Set the database role to physical standby on the master database, and set the switching status to primary.
The SQL statement for the operation is: alter database commit to switchover to physical standby;
Result check:
SQL> select database_role, switchover_status from v $ database;
DATABASE_ROLE SWITCHOVER_STATUS
------------------------------------
PHYSICALSTANDBY TO PRIMARY
The master database has become a standby database. However, the switchover status of the database is set to primary. If you regret this, you can switch back.
After switching, the database instance needs to be restarted, The init. ora file needs to be changed, and the instance is set to Real-Time recovery.
The operation SQL is:
Startupnomount force;
Alterdatabase mount standby database;
Alterdatabase recover managed standby database using current logfile disconnect fromsession;
Step 3: Set the database role to PRIMARY on the slave database.
The SQL statement for the operation is: alter database commit to switchover to primary;
Result check:
First, check the database role and switch status to determine whether the slave database can be switched.
SQL> select database_role, switchover_status from v $ database;
DATABASE_ROLE SWITCHOVER_STATUS
------------------------------------
PHYSICALSTANDBY TO PRIMARY
SQL> alter database commit to switchover to primary;
Databasealtered.
After switching, the database instance needs to be restarted and the init. ora file needs to be changed.
SQL> conn/as sysdba
Connected.
SQL> startup open force;
ORACLEinstance started.
Databasemounted.
Databaseopened.
SQL> select database_role, switchover_status from v $ database;
DATABASE_ROLE SWITCHOVER_STATUS
------------------------------------
PRIMARY TO STANDBY
After completing these three steps, the switchover is complete. This switchover operation can be used for data migration. It is much simpler than the backup/restore that used RMAN previously. More importantly, it can switch back.
These three steps seem simple, but involve the conversion of the master database role. What should I do if the role of the master database cannot be converted to the master database due to some reasons?
Without the master database, it is a disaster for any application system.
Okay, I admit, this is what I want to say.