1. First, check the current protection mode-primary database operations
SQL> select protection_mode, protection_level from V $ database;
Protection_mode protection_level
----------------------------------------
Maximum performance
2. Modify the initialization parameter-primary database operation
SQL> alter system set log_archive_dest_2 = 'service = standby
2 optional lgwr sync affrem valid_for = (online_logfiles, primary_role)
3 db_unique_name = standby ';
The system has been changed.
3. Restart the database and set a new data protection mode-primary database operation
The statement is very simple, as follows:
SQL> shutdown immediate
The database has been closed.
The database has been detached.
The Oracle routine has been disabled.
SQL> startup Mount
The Oracle routine has been started.
Total system global area 167772160 bytes
Fixed size 1289484 bytes
Variable Size 121635572 bytes
Database buffers 37748736 bytes
Redo buffers 7098368 bytes
The database has been loaded.
SQL> alter database set standby database to maximize availability;
The database has been changed.
Tip: Maximize and {protection | availability | performance} correspond to the maximum protection, maximum availability, and maximum performance respectively.
Drop the database and restart
SQL> alter database open;
4. Check the current protection mode-primary database operations
SQL> select protection_mode, protection_level from V $ database;
Protection_mode protection_level
----------------------------------------
Maximum availability
5. Modify the standby initialization parameter settings (mainly considering Role Switching. skip this step if you only want to test) --- standby database operations
SQL> alter system set log_archive_dest_2 = 'service = primary optional lgwr sync affsert
2 valid_for = (online_logfiles, primary_role) db_unique_name = primary ';
The system has been changed.
View the current protection mode
SQL> select instance_name from V $ instance;
Instance_name
----------------
Standby
SQL> select protection_mode, protection_level from V $ database;
Protection_mode protection_level
----------------------------------------
Maximum availability
Configuration successful. Test the configuration on the front.
6. Stop the standby database and check the status of the primary database.
SQL> select protection_mode, protection_level from V $ database;
Protection_mode protection_level
----------------------------------------
Maximum availability Resynchronization
After the standby database is shut down, the protection level of the primary database is switched to be synchronized.