ORA-16456错误,由于备库未mount而在主库执行切换,解决办法详解
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了ORA-16456错误,由于备库未mount而在主库执行切换,解决办法详解,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3540字,纯文字阅读大概需要6分钟。
内容图文
![ORA-16456错误,由于备库未mount而在主库执行切换,解决办法详解](/upload/InfoBanner/zyjiaocheng/546/deeb7143c49b41d5a5be07d5d4435cbb.jpg)
ORA-16456错误,由于备库未mount而在主库执行切换,解决办法详解
如果对数据库进行主备库的切换需要的前提条件是:
我们有时做主备库的切换,结果忘记了把备库处于mount状态而是open状态下;
当在primary执行过切换操作之后:
SQL>alterdatabase commit to switchover to physical standby;
Databasealtered.
现在对primary库进行查看:
00:26:00sys@felix SQL>select switchover_status from v$database;
SWITCHOVER_STATUS
----------------------------------------
RECOVERY NEEDED
状态我们发现时recovery needed
这个时刻,我感觉出事了,该怎么办??
我就在主库执行了如下操作:(以为这样会可以的,但是不行)
00:26:26 sys@felix SQL>alter database commit to switchoverto primary;
alter database commit to switchover to primary
*
ERROR at line 1:
ORA-16456: switchover to standby in progress or completed
0:26:54 sys@felix SQL>shutdown immediate;
ORA-01092: Oracle instance terminated.Disconnection forced
00:27:17 sys@felix SQL>startup mount;
ORA-24324: service handle not initialized
ORA-01041: internal error. hostdefextension doesn't exist
00:27:25 sys@felix SQL>exit
然后mount主库:
00:27:30 SQL>startup mount;
ORACLE instance started.
Total System Global Area 417546240 bytes
Fixed Size 2228944 bytes
Variable Size 289410352 bytes
Database Buffers 121634816 bytes
Redo Buffers 4272128 bytes
Database mounted.
mount备库:
03:21:36 SQL>shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
03:21:48 SQL>startup mount;
ORACLE instance started.
Total System Global Area 417546240 bytes
Fixed Size 2228944 bytes
Variable Size 289410352 bytes
Database Buffers 121634816 bytes
Redo Buffers 4272128 bytes
Database mounted.
03:22:02 SQL>
打开主库:
00:27:41 SQL>alter database open;
Database altered.
把主库的切换状态进行切换过来,再试一下:
00:31:30 SQL>alter database commit to switchover to primary;
Database altered.
Ok,成功了,看来往下面走是有希望了
继续,go!!!!
00:32:08 sys@felix SQL>select statusfrom v$instance;
STATUS
------------------------
MOUNTED
00:32:22 sys@felix SQL>alter database open;
Database altered.
00:32:32 sys@felix SQL>selectswitchover_status from v$database;
SWITCHOVER_STATUS
----------------------------------------
TO STANDBY
终于看到to standby了,心里算是松了一口气!!
ok,,开始真正的主备库的切换:
0:41:57 sys@felix SQL> alter database commit to switchoverto physical standby
Database altered.
主库执行成功:
在备库要进行操作:
03:46:06 SQL>select switchover_status from v$database;
SWITCHOVER_STATUS
----------------------------------------
RECOVERY NEEDED
03:46:46 SQL>alter database recover managed standbydatabase disconnect session;
alter database recovermanaged standby database disconnect session
*
ERROR at line 1:
ORA-00274: illegalrecovery option SESSION
03:52:23 SQL>alter database recover managed standby database disconnect FROMsession;
Database altered.
ORACLE instance shut down.
03:56:01 SQL>startup
ORACLE instance started.
Total System Global Area 417546240 bytes
Fixed Size 2228944 bytes
Variable Size 301993264 bytes
Database Buffers 109051904 bytes
Redo Buffers 4272128 bytes
Database mounted.
Database opened.
03:56:43 SQL>select switchover_status from v$database;
SWITCHOVER_STATUS
----------------------------------------
TO PRIMARY
03:57:13 SQL>alter database commit to switchover to primary;
Database altered.
03:57:42 SQL>shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
03:58:20 SQL>
Ok,打开主备库:
Ok,到此主备库已经完整切换了
内容总结
以上是互联网集市为您收集整理的ORA-16456错误,由于备库未mount而在主库执行切换,解决办法详解全部内容,希望文章能够帮你解决ORA-16456错误,由于备库未mount而在主库执行切换,解决办法详解所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。