Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle 11g dataguard active / standby handoff

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Check the environment of the master and standby

Dg1 node:

SQL > archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination / u01/oradata/tong/archive

Oldest online log sequence 59

Next log sequence to archive 61

Current log sequence 61

SQL >

Dg2 node:

SQL > archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination / u01/oradata/tong/archive

Oldest online log sequence 60

Next log sequence to archive 0

Current log sequence 61

SQL >

two。 View the roles of the master and slave

Dg1 node (primary role):

SQL > select switchover_status,database_role from v$database

SWITCHOVER_STATUS DATABASE_ROLE

--

TO STANDBY PRIMARY

SQL >

Dg2 node (standby role):

SQL > select switchover_status,database_role from v$database

SWITCHOVER_STATUS DATABASE_ROLE

--

NOT ALLOWED PHYSICAL STANDBY

SQL >

3. Execute the switch command (primary node) on the main library

SQL > alter database commit to switchover to physical standby;-- convert the primary role to the standby role

Database altered.

SQL > shutdown immediate-- close the database and start to mount state

ORA-01507: database not mounted

ORACLE instance shut down.

SQL > startup mount

Total System Global Area 830930944 bytes

Fixed Size 2217912 bytes

Variable Size 545261640 bytes

Database Buffers 281018368 bytes

Redo Buffers 2433024 bytes

Database mounted.

SQL > select switchover_status,database_role from vault database;-- View the status of the current primary role

SWITCHOVER_STATUS DATABASE_ROLE

--

TO PRIMARY PHYSICAL STANDBY

SQL >

4. Execute on slave library (standby node)

SQL > select switchover_status,database_role from vault database;-- View the status of the standby backup role

SWITCHOVER_STATUS DATABASE_ROLE

--

TO PRIMARY PHYSICAL STANDBY

SQL > alter database commit to switchover to primary;-- change the role of slave library to primary

Database altered.

SQL > select switchover_status,database_role from v$database

SWITCHOVER_STATUS DATABASE_ROLE

--

NOT ALLOWED PRIMARY

SQL > alter database open;-- Open the database

Database altered.

SQL >

5. Execute on slave library (standby node)

SQL > select switchover_status,database_role from v$database

SWITCHOVER_STATUS DATABASE_ROLE

--

RECOVERY NEEDED PHYSICAL STANDBY

SQL > ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;-- modify the previous master database to log application

Database altered.

SQL >

6. Test whether the active and standby nodes are switched successfully

Dg2 node (primary role):

SQL > select * from tt

A

-

one

three

four

five

six

seven

6 rows selected.

SQL > insert into tt values (8)

1 row created.

SQL > commit

Commit complete.

SQL > select * from tt where axi8

A

-

eight

SQL > alter system switch logfile

System altered.

SQL > /

System altered.

SQL > archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination / u01/oradata/tong/archive

Oldest online log sequence 78

Next log sequence to archive 80

Current log sequence 80

SQL >

Dg1 node (standby role):

SQL > archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination / u01/oradata/tong/archive

Oldest online log sequence 79

Next log sequence to archive 0

Current log sequence 80

SQL > alter database recover managed standby database cancel

Database altered.

SQL > alter database open read only

Database altered.

SQL > select * from tt

A

-

one

three

four

five

six

seven

eight

7 rows selected.

SQL >

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report