Chinaunix首页 | 论坛 | 博客
  • 博客访问: 87553
  • 博文数量: 16
  • 博客积分: 1425
  • 博客等级: 上尉
  • 技术积分: 137
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-26 15:36
个人简介

篮球爱好者,喜欢走走看看。熟悉linux、lvs、haproxy、nginx、tomcat、oracle、mysql等。

文章分类

全部博文(16)

文章存档

2008年(16)

我的朋友

分类: Oracle

2008-04-15 09:32:22

主备库切换时有点小错误,记录如下:
主库:
select LOG_MODE,CONTROLFILE_TYPE,OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS from v$database;
LOG_MODE     CONTROL OPEN_MODE  PROTECTION_MODE      DATABASE_ROLE
------------ ------- ---------- -------------------- ----------------
SWITCHOVER_STATUS
--------------------
ARCHIVELOG   CURRENT READ WRITE MAXIMUM PROTECTION   PRIMARY
TO STANDBY
 SQL> alter database commit to switchover to physical standby;
Database altered.
SQL> shutdown immediate;
ORA-01507: database not mounted

ORACLE instance shut down.
SQL> startup mount
 select LOG_MODE,CONTROLFILE_TYPE,OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS from v$database;
LOG_MODE     CONTROL OPEN_MODE  PROTECTION_MODE      DATABASE_ROLE
------------ ------- ---------- -------------------- ----------------
SWITCHOVER_STATUS
--------------------
ARCHIVELOG   STANDBY MOUNTED    MAXIMUM PROTECTION   PHYSICAL STANDBY
TO PRIMARY
备库:
 select LOG_MODE,CONTROLFILE_TYPE,OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS from v$database;
LOG_MODE     CONTROL OPEN_MODE  PROTECTION_MODE      DATABASE_ROLE
------------ ------- ---------- -------------------- ----------------
SWITCHOVER_STATUS
--------------------
ARCHIVELOG   STANDBY MOUNTED    MAXIMUM PROTECTION   PHYSICAL STANDBY
SWITCHOVER PENDING
SQL> alter database commit to switchover to primary;
alter database commit to switchover to primary
*
ERROR at line 1:
ORA-16139: media recovery required
SQL> !
[oracle@linux2 ~]$ tail /oracle/oradata/standby/bdump/alert_stand.log
  End-Of-REDO archived log file has not been recovered
  Archived log files detected beyond End-Of-REDO
  Incomplete recovery SCN:0:234931 archive SCN:0:265075
Database not available for switchover
  End-Of-REDO archived log file has been received
  End-Of-REDO archived log file has not been recovered
  Archived log files detected beyond End-Of-REDO
  Incomplete recovery SCN:0:234931 archive SCN:0:265075
Switchover: Media recovery required - standby not in limbo
ORA-16139 signalled during: alter database commit to switchover to primary...
SQL> alter database recover managed standby database disconnect from session;
Database altered.
SQL> !
[oracle@linux2 ~]$ tail /oracle/oradata/standby/bdump/alert_stand.log
Completed: alter database recover managed standby database disconnect from session
Tue Apr 15 09:08:37 2008
Media Recovery Log /oracle/oradata/standby/arch/1_29_651601678.dbf
Media Recovery Log /oracle/oradata/standby/arch/1_30_651601678.dbf
Media Recovery Log /oracle/oradata/standby/arch/1_31_651601678.dbf
Media Recovery Log /oracle/oradata/standby/arch/1_32_651601678.dbf
Media Recovery Log /oracle/oradata/standby/arch/1_33_651601678.dbf
Media Recovery Log /oracle/oradata/standby/arch/1_34_651601678.dbf
Media Recovery Log /oracle/oradata/standby/arch/1_35_651601678.dbf
Media Recovery Log /oracle/oradata/standby/arch/1_36_651601678.dbf
SQL> select LOG_MODE,CONTROLFILE_TYPE,OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS from v$database;
LOG_MODE     CONTROL OPEN_MODE  PROTECTION_MODE      DATABASE_ROLE
------------ ------- ---------- -------------------- ----------------
SWITCHOVER_STATUS
--------------------
ARCHIVELOG   STANDBY MOUNTED    MAXIMUM PROTECTION   PHYSICAL STANDBY
TO PRIMARY

SQL> alter database commit to switchover to primary;
Database altered.
SQL> alter database open;
Database altered.
SQL>  select LOG_MODE,CONTROLFILE_TYPE,OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE,SWITCHOVER_STATUS from v$database;
LOG_MODE     CONTROL OPEN_MODE  PROTECTION_MODE      DATABASE_ROLE
------------ ------- ---------- -------------------- ----------------
SWITCHOVER_STATUS
--------------------
ARCHIVELOG   CURRENT READ WRITE MAXIMUM PROTECTION   PRIMARY
TO STANDBY

阅读(3877) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~