DataGuard环境搭建(二)

2014-11-24 09:21:15 · 作者: · 浏览: 1
le;
SQL> select max(sequence#) from v$archived_log;
主备切换
--主库
SQL> select switchover_status fromv$database;
SWITCHOVER_STATUS
--------------------
TO STANDBY
SQL> alter database commit to switchoverto physical standby with session shutdown ;
数据库已更改。
SQL> alter database commit to switchoverto physical standby;
alter database commit to switchover tophysical standby
*
第 1 行出现错误:
ORA-01507: 未装载数据库
SQL> shutdown immediate;
ORA-01507: 未装载数据库
ORACLE 例程已经关闭。
SQL> startup
ORACLE 例程已经启动。
Total System Global Area 836976640 bytes
Fixed Size 1377812 bytes
Variable Size 687868396 bytes
Database Buffers 142606336 bytes
Redo Buffers 5124096 bytes
数据库装载完毕。
数据库已经打开。
SQL> alter database commit to switchoverto physical standby;
数据库已更改。
SQL> select switchover_status fromv$database;
SWITCHOVER_STATUS
--------------------
TO PRIMARY
SQL> shutdown immediate;
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> startup nomount;
ORACLE 例程已经启动。
Total System Global Area 836976640 bytes
Fixed Size 1377812 bytes
Variable Size 687868396 bytes
Database Buffers 142606336 bytes
Redo Buffers 5124096 bytes
SQL> alter database mount standbydatabase;
数据库已更改。
SQL> alter database recover managedstandby database disconnect from session;
数据库已更改。
---备库
SQL> select switchover_status fromv$database;
SWITCHOVER_STATUS
--------------------
SWITCHOVER PENDING
SQL> alter database commit to switchoverto primary;
alter database commit to switchover toprimary
*
ERROR at line 1:
ORA-16139: media recovery required
开始介质恢复
SQL> alter database recover managedstandby database finish;
Database altered.
SQL> alter database commit to switchoverto primary;
Database altered.
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area 836976640 bytes
Fixed Size 1377812 bytes
Variable Size 687868396 bytes
Database Buffers 142606336 bytes
Redo Buffers 5124096 bytes
Database mounted.
Database opened.
SQL> alter system switch logfile;
System altered.
SQL> select switchover_status fromv$database;
SWITCHOVER_STATUS
--------------------
TO STANDBY
以下是介质恢复时的alert 日志:
alterdatabase commit to switchover to primary
Maximumwait for role transition is 15 minutes.
Databasenot available for switchover
End-Of-REDO archived log file has beenreceived
End-Of-REDO archived log file has not beenrecovered
Archived log files detected beyondEnd-Of-REDO
Incomplete recovery SCN:7:-536647664 archiveSCN:7:-536628763
Databasenot available for switchover
End-Of-REDO archived log file has beenreceived
End-Of-REDO archived log file has not beenrecovered
Archived log files detected beyondEnd-Of-REDO
Incomplete recovery SCN:7:-536647664 archiveSCN:7:-536628763
Switchover:Media recovery required - standby not in limbo
ORA-16139signalled during: alter databas