Oracle 11g Active tracing uard Switchover Experiment

Source: Internet
Author: User
Tags failover how to use sql

Oracle Data Guard is an important component of the Oracle HA Architecture system and a key technical solution for Maximum Availability Architecture. With the Switchover and Failover features of Data Guard, we can achieve high availability requirements for O & M systems and minimize planned and unplanned downtime.
 
Data Guard is built on the Database software and hardware and Data redundancy policies. It builds the same Physical (Physical) and Logical (Logical) Standby databases with the same Data as the Primary Database and independent software and hardware, the Redo Log is used to transmit applications to ensure data synchronization. When a single database (usually Primary) fails and cannot continue providing services, the additional Standby can be used as a backup database to support applications, reducing the impact of overall system data loss and downtime.
 
Switchover and Failover are a set of differentiated and correlated concepts in Dataguard. In essence, they all stop external services by Primary, and change from Standby to a new Primary. However, they differ greatly in terms of concept and operation.
 
The core of Switchover is "Planned", which is the Planned stop switch action. During the operation of our O & M system, we often perform maintenance operations such as equipment maintenance and software upgrade patches. In this case, for systems with high SLA requirements, the downtime window is a problem. Especially for some systems, the business department will not allow too long downtime. Switchover is the process of upgrading the temporary Primary point downtime in the replicuard or RAC environment, from Standby to Primary support service, and finally switching back. In this process, the role is converted to role transition in Oracle. Switchover is smooth and will not cause data loss because it has prepared and planned operations.
 
The core of Failover is "unplanned", which corresponds to Switchover and is closer to the original design intention of Data Guard. If Primary fails, the service cannot be supported. Standby can automatically or manually switch to the Primary role within a short period of time. Then the new Primary will support the service. If Primary can be fixed, you may need to re-build the DG or Apply the new Standby, and then switch back to the Primary role. Failover may cause data loss due to the fault type of the Primary site.
 
There are many tools for Switchover and Failover. The most common tools are SQL Command, Data Guard Broker, and DB Grid Control. This article describes how to use SQL Command to perform Switchover operations.
 
 

References:

Important configuration parameters of Oracle Data Guard

Configure Oracle 11g Data Guard based on the same host

Explore Oracle 11g elastic uard

Oracle Data Guard (RAC + DG) archive deletion policies and scripts

Role conversion for Oracle Data Guard

FAL gap in Oracle Data Guard logs

Oracle 11g Data Guard Error 16143 Heartbeat failed to connect to standby

1. Environment Introduction

 

We have set up javasuard in the selected environment, and the version is 11.2.0.4 (the same as Primary and Standby ). The operating system version is Red Hat Linux 6.5.

 

 

SQL> select * from v $ version;

 

BANNER

--------------------------------------------------

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0-Production

PL/SQL Release 11.2.0.4.0-Production

CORE 11.2.0.4.0 Production

 

The unique name of the Primary database is ora11g.

 

SQL> select name, LOG_MODE, OPEN_MODE, database_role, SWITCHOVER_STATUS, db_unique_name from v $ database;
 
 

NAME LOG_MODE OPEN_MODE DATABASE_ROLE SWITCHOVER_STATUS DB_UNIQUE_NAME
 
-----------------------------------------------------------------------------------------------------------
 
ORA11G archivelog read write primary sessions active ora11g
 
 

The Standby database name is ora11gsy. The real-time data synchronization application is enabled.

 

SQL> alter database recover managed standby database using current logfile disconnect from session;
 
 

Database altered

 

SQL> select name, LOG_MODE, OPEN_MODE, database_role, SWITCHOVER_STATUS, db_unique_name from v $ database;
 
 

NAME LOG_MODE OPEN_MODE DATABASE_ROLE SWITCHOVER_STATUS DB_UNIQUE_NAME
 
-----------------------------------------------------------------------------------------------------------
 
ORA11G archivelog read only with apply physical standby not allowed ora11gsy
 
 

Note: The open mode of standby is Read only with apply, which is a feature of 11g Active Data Guard. The traditional DG is in the mount State during the Apply process and does not support real-time data read-only operations. 11g supports enabling the database to read-only status in apply.
 
 

2. Primary master database operations during Switchover

 

The Switchover process is divided into three steps: one is to stop working on the Primary and switch to the Standby status; the other is to select a Standby instance and switch the role to the Primary status, the last step is to start the Apply process for other Standby instances.
 
Note that we can view the v $ database view of the Primary database ora11g above. The value of switchover_status is worth noting. If the value is session active or to standby, we can switch between them. If there are other values, it indicates that the configured log transmission mechanism is faulty and needs to be adjusted.
 
 

-- On ora11g

SQL> alter database commit to switchover to physical standby with session shutdown;
 
Database altered

 

Note: If the status of swtichover_status is session active, add the with session shutdown clause to the command. After the command is executed, we find that the Primary ora11g has been disabled.
 
 

 

SQL> select status from v $ instance;

Select status from v $ instance

*

ERROR at line 1:

ORA-03135: connection lost contact

Process ID: 2357

Session ID: 1 Serial number: 5

 

 

SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0-Production
 
With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

-- The instance process disappears.

[Oracle @ SimpleLinux trace] $ ps-ef | grep pmon

Oracle 2107 1 0? 00:00:01 ora_pmon_ora11gsy

Oracle 2473 1848 1 00:00:00 pts/1 grep pmon

 

At this time, the alert log also records the instance stop situation.

 

Alter database add standby logfile 'srl1. F' SIZE 52428800;

Alter database add standby logfile 'srl2. F' SIZE 52428800;

Alter database add standby logfile 'srl3. F' SIZE 52428800;

Alter database add standby logfile 'srl4. f'size 52428800;

Archivelog for thread 1 sequence 19 required for standby recovery

Switchover: Primary controlfile converted to standby controlfile succesfully.

Switchover: Complete-Database shutdown required

USER (ospid: 2365): terminating the instance

Instance terminated by USER, pid = 2365

Completed: alter database commit to switchover to physical standby with session shutdown
 
 

Shutting down instance (abort)

License high water mark = 6

Sun Apr 20 16:02:11 2014

Instance shutdown complete

 

In this process, to ensure no data loss, Primary must pass all the log information to Standby. In this case, you can start Primary to the mount standby state.

 

[Oracle @ SimpleLinux trace] $ sqlplus/nolog

SQL * Plus: Release 11.2.0.4.0 Production on Sun Apr 20 16:06:47 2014

 

Copyright (c) 1982,201 3, Oracle. All rights reserved.

 

SQL> conn/as sysdba

Connected to an idle instance.

SQL> startup nomount

ORACLE instance started.

 

Total System Global Area 372449280 bytes

Fixed Size 1364732 bytes

Variable Size 331353348 bytes

Database Buffers 33554432 bytes

Redo Buffers 6176768 bytes

 

SQL> alter database mount standby database;

Database altered.

Note: If you need to repair or stop the device, you can disable Primary.

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • Next Page

Related Article

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.