standby库从readonly状态转到recover状态,本来用以下命令直接可以切换
alter database recover managed standby database disconnect from session;
但如果切换时,仍有用户连接,以上命令切换会失败。
方法一:shutdown immediate standby库,然后再启动到recover模式
方法二:把已连接的用户kill掉,再执行切换
Terminate any active user sessions on the standby database (except your own):
select 'alter system kill session ''' || sid || ',' || serial# || ''';'
from v$session where username is not null
and sid not in (select distinct sid from v$mystat);
select '!kill -9 ' || vp.spid
from v$session vs,v$process vp where vs.paddr = vp.addr
and vs.username is not null
and vs.sid not in (select distinct sid from v$mystat);
alter database recover managed standby database disconnect from session;
阅读(800) | 评论(0) | 转发(0) |