Logical DG-Standby role conversion

Source: Internet
Author: User
Primary: 1. Check the initialization parameter of the current Primary database: SQLshowparameterfalNAMETYPEVALUE implements fal_clientstringorcl_192.168.1.222fal_serverstringorcls_192.168.1.2

Primary: 1. Check the initialization parameter of the current Primary database: SQL show parameter fal NAME TYPE VALUE ---------------------------------------- fal_client string orcl_192.168.1.222 fal_server string orcls_192.168.1.2

Primary:
1. Check the initialization parameters of the current Primary database:
SQL> show parameter fal

NAME TYPE VALUE
-----------------------------------------------------------------------------
Fal_client string orcl_192.168.1.222
Fal_server string orcls_192.168.1.223
SQL> show parameter log_archive_dest

NAME TYPE VALUE
-----------------------------------------------------------------------------

Log_archive_dest_1 string location =/u01/arch_orcl

Log_archive_dest_2 string service = orcls_192.168.1.223 lg
Wr async valid_for = (online_log
Files, primary_role) db_unique
_ Name = orclldg
2. Modify log_archive_dest_1
SQL> alter system set log_archive_dest_1 = 'location =/u01/arch_orcl valid_for = (online_logfiles, all_roles) db_unique_name = orclpre ';

System altered.
Standby:
1. Check the initialization parameters of the current Standby database:
SQL> show parameter log_archive_dest

NAME TYPE VALUE
-----------------------------------------------------------------------------
Log_archive_dest string
Log_archive_dest_1 string location =/u01/arch_ldg valid_f
Or = (online_logfiles, all_roles)
Db_unique_name = orclldg
Log_archive_dest_10 string
Log_archive_dest_2 string service = orcl_192.168.1.222 arc
H valid_for = (online_logfiles,
Primary_role) db_unique_name = o
Rclpre
Log_archive_dest_3 string location =/u01/arch_std valid_f
Or = (standby_logfiles, standby_r
NAME TYPE VALUE
-----------------------------------------------------------------------------
Ole) db_unique_name = orclldg
2. Change log_archive_dest_2 to lgwr async.
SQL> alter system set log_archive_dest_2 = 'service = orcl_192.168.1.222 lgwr async valid_for = (online_logfiles, primary_role) db_unique_name = orclpre ';

System altered.
3. log_archive_dest_2 has been asynchronously transmitted
SQL> show parameter archive_dest

NAME TYPE VALUE
-----------------------------------------------------------------------------
Log_archive_dest string
Log_archive_dest_1 string location =/u01/arch_ldg valid_f
Or = (online_logfiles, all_roles)
Db_unique_name = orclldg
Log_archive_dest_10 string
Log_archive_dest_2 string service = orcl_192.168.1.222 lgw
R async valid_for = (online_logf
Iles, primary_role) db_unique_n
Ame = orclpre
Log_archive_dest_3 string location =/u01/arch_std valid_f
Or = (standby_logfiles, standby_r

NAME TYPE VALUE
-----------------------------------------------------------------------------
Ole) db_unique_name = orclldg
4. Check whether Standby Redologs is configured for Primary.
SQL> select * from v $ standby_log;

No rows selected
Add:
SQL> alter database add standby logfile group 4'/u01/app/oracle/oradata/orcl/stdredo01.log 'SIZE 50 m;

Database altered.

SQL> alter database add standby logfile group 5'/u01/app/oracle/oradata/orcl/stdredo02.log 'SIZE 50 m;

Database altered.

SQL> alter database add standby logfile group 6'/u01/app/oracle/oradata/orcl/stdredo03.log 'SIZE 50 m;

Database altered.
5. Check the current Primary database status:
SQL> select switchover_status from v $ database;

SWITCHOVER_STATUS
--------------------
SESSIONS ACTIVE
Set Primary to prepare for conversion:
SQL> alter database prepare to switchover to logical standby;

Database altered.

SQL> select switchover_status from v $ database;

SWITCHOVER_STATUS
--------------------
PREPARING SWITCHOVER
Check the status again to prepare ......, Always prepare to accept REDO data from the logical Standby database (the new Primary database in the future.
6. Convert the Current Logical Standby to Primary
SQL> alter database prepare to switchover to primary;

Database altered.

SQL> select switchover_status from v $ database;

SWITCHOVER_STATUS
--------------------
PREPARING SWITCHOVER
Check the status again to prepare ......
7. view the Primary database
SQL> select switchover_status from v $ database;

SWITCHOVER_STATUS
--------------------
TO LOGICAL STANDBY
The result of this check is related to whether switchover conversion is successful.
8. Convert the current Primary to the logical Standby
SQL> alter database commit to switchover to logical standby;

Database altered.
9. After the logical Standby receives the conversion message of the previous Primary and completes the related REDO data, the SQL application is automatically suspended. If the REDO application has not been started before, it is not too late to start now.
SQL> alter database start logical standby apply;

Database altered.

SQL> select switchover_status from v $ database;

SWITCHOVER_STATUS
--------------------
Preparing switchover ......

SQL> select switchover_status from v $ database;

SWITCHOVER_STATUS
--------------------
TO PRIMARY
10. Switch the logical Standby to the new Primary database
SQL> alter database commit to switchover to primary;

Database altered.
Start the new logical Standby (previous Primary) SQL application
SQL> alter database start logical standby apply immediate;

Database altered.
Test:
Insert test data into the new Primary:
SQL> select * from scott. test;

ID
----------
1
2
3

SQL> insert into scott. test values (4 );

1 row created.

SQL> commit;

Commit complete.

Check the new standby:
SQL> select * from scott. test;

ID
----------
1
2
3

SQL> select * from scott. test;

ID
----------
1
2
3

SQL> select * from scott. test;

ID
----------
1
2
3
May delay ......
SQL> select * from scott. test;

ID
----------
1
2
3
4
The logical Standby role is successfully converted ......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.