. 环境
db版本 | 11.2.0.4.0 | 11.2.0.4.0 | |
os版本 | centos 6.4 | centos 6.4 | |
db_unique_name | newtest | snewtest | |
db name | newtest | newtest | |
ip | 10.10.0.23 | 10.10.0.24 | |
1 主库上查询状态
[oracle@localhost dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 26 22:53:39 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select open_mode ,database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
READ WRITE PRIMARY
2 备库上查询状态
[oracle@localhost trace]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 26 22:55:23 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select open_mode ,database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
READ ONLY WITH APPLY PHYSICAL STANDBY
3.备库上swichover
[oracle@localhost trace]$ dgmgrl /
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> switchover to snewtest;
Performing switchover NOW, please wait...
New primary database "snewtest" is opening...
Operation requires startup of instance "newtest" on database "newtest"
Starting instance "newtest"...
Unable to connect to database
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Failed.
Warning: You are no longer connected to ORACLE.
Please complete the following steps to finish switchover:
start up instance "newtest" of database "newtest"
4.新备库上开启数据库
[oracle@localhost dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 26 22:56:29 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 784998400 bytes
Fixed Size 2257352 bytes
Variable Size 478154296 bytes
Database Buffers 301989888 bytes
Redo Buffers 2596864 bytes
Database mounted.
Database opened.
5. 新备库上查询状态
SQL> select open_mode ,database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
READ ONLY PHYSICAL STANDBY
6.我们看到数据库打开了adg 但是 状态还是readonly,此时还没应用redo**
[oracle@localhost dbs]$ dgmgrl /
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright (c) 2000, 2009,
Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> edit database newtest set state='ONLINE'
> ;
Succeeded.
DGMGRL> exit
7.再次查看新备库的状态
[oracle@localhost dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 26 22:57:35 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select open_mode ,database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
READ ONLY WITH APPLY PHYSICAL STANDBY
8.查看新主库的数据库状态以及dgbroke的状态
[oracle@localhost trace]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 26 22:57:24 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select open_mode ,database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
READ WRITE PRIMARY
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@localhost trace]$ dgmgrl /
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> show configuration;
Configuration - dg_newtest
Protection Mode: MaxPerformance
Databases:
snewtest - Primary database
newtest - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS