11g的STANDBY数据库可以在应用日志的同时打开数据库,但是对于RAC环境,这里有一些小的问题。
即使是RAC环境,STANDBY数据库也只能有一个实例在进行日志恢复工作。但是STANDBY的两个节点是可以同时打开进行READ ONLY访问的。
而且11g还支持在进行恢复的时候打开数据库。
那么Oracle是否支持在恢复的时候,同时打开两个节点进行只读访问呢。
根据测试发现,这种操作是被禁止的:
SQL> startup mount
ORACLE 例程已经启动。
Total System Global Area 1.7108E+10 bytes
Fixed Size 2101632 bytes
Variable Size 3344420480 bytes
Database Buffers 1.3757E+10 bytes
Redo Buffers 4431872 bytes数据库装载完毕。
SQL> set pages 100 lines 120
SQL> column unique_db_name format a15
SQL> column primary_db_unique_name format a25
SQL> select name,
2 open_mode,
3 database_role,
4 guard_status,
5 db_unique_name,
6 primary_db_unique_name
7 from v$database;
NAME OPEN_MODE DATABASE_ROLE GUARD_S DB_UNIQUE_NAME PRIMARY_DB_UNIQUE_NAME ——— ———- —————- ——- —————————— ————————- RAC11G MOUNTED PHYSICAL STANDBY NONE rac11g_s rac11g SQL> select instance_name, status from gv$instance; INSTANCE_NAME STATUS —————- ———— rac11g1 MOUNTED SQL> alter database recover managed standby database disconnect from session; |
数据库已更改。
而实例2尝试启动数据库则会报错:
SQL> startup
ORACLE 例程已经启动。
Total System Global Area 1.7108E+10 bytes
Fixed Size 2101632 bytes
Variable Size 3478638208 bytes
Database Buffers 1.3623E+10 bytes
Redo Buffers 4431872 bytes数据库装载完毕。
ORA-01187: 由于验证测试失败而无法从文件 1 读取
ORA-01110: 数据文件 1: ‘+DATA/rac11g/rac11g_system_1_1g’
SQL> select instance_name from v$instance; INSTANCE_NAME —————- rac11g2 |
如果说这个错误不是很明确,那么alert文件里面的错误信息就清楚多了:
Errors in file /data/oracle/diag/rdbms/rac11g_s/rac11g2/trace/rac11g2_dbw0_1093.trc:
ORA-01186: file 1 failed verification tests
ORA-01108: file 1 is in backup or media recovery
ORA-01110: data file 1: ‘+DATA/rac11g/rac11g_system_1_1g’
File 1 not verified due to error ORA-01108
Errors in file /data/oracle/diag/rdbms/rac11g_s/rac11g2/trace/rac11g2_dbw0_1093.trc:
ORA-01186: file 2 failed verification tests
ORA-01108: file 2 is in backup or media recovery
ORA-01110: data file 2: ‘+DATA/rac11g/rac11g_sysaux_1_1g’
File 2 not verified due to error ORA-01108
Errors in file /data/oracle/diag/rdbms/rac11g_s/rac11g2/trace/rac11g2_dbw0_1093.trc:
ORA-01186: file 3 failed verification tests
ORA-01108: file 3 is in backup or media recovery
ORA-01110: data file 3: ‘+DATA/rac11g/rac11g_undotbs1_1_4g’
File 3 not verified due to error ORA-01108
Errors in file /data/oracle/diag/rdbms/rac11g_s/rac11g2/trace/rac11g2_dbw0_1093.trc:
ORA-01186: file 4 failed verification tests
ORA-01108: file 4 is in backup or media recovery
ORA-01110: data file 4: ‘+DATA/rac11g/rac11g_undotbs2_1_4g’
File 4 not verified due to error ORA-01108
Errors in file /data/oracle/diag/rdbms/rac11g_s/rac11g2/trace/rac11g2_dbw0_1093.trc:
ORA-01186: file 5 failed verification tests
ORA-01108: file 5 is in backup or media recovery
ORA-01110: data file 5: ‘+DATA/rac11g/rac11g_users_1_4g’
File 5 not verified due to error ORA-01108
Errors in file /data/oracle/diag/rdbms/rac11g_s/rac11g2/trace/rac11g2_dbw0_1093.trc:
ORA-01186: file 6 failed verification tests
ORA-01108: file 6 is in backup or media recovery
ORA-01110: data file 6: ‘+DATA/rac11g/rac11g_ndmain_1_32g’
File 6 not verified due to error ORA-01108
Errors in file /data/oracle/diag/rdbms/rac11g_s/rac11g2/trace/rac11g2_dbw0_1093.trc:
ORA-01186: file 7 failed verification tests
ORA-01108: file 7 is in backup or media recovery
ORA-01110: data file 7: ‘+DATA/rac11g/rac11g_ndmain_2_32g’
File 7 not verified due to error ORA-01108
Errors in file /data/oracle/diag/rdbms/rac11g_s/rac11g2/trace/rac11g2_dbw0_1093.trc:
ORA-01186: file 8 failed verification tests
ORA-01108: file 8 is in backup or media recovery
ORA-01110: data file 8: ‘+DATA/rac11g/rac11g_ndmain_3_32g’
File 8 not verified due to error ORA-01108
Errors in file /data/oracle/diag/rdbms/rac11g_s/rac11g2/trace/rac11g2_dbw0_1093.trc:
ORA-01186: file 9 failed verification tests
ORA-01108: file 9 is in backup or media recovery
ORA-01110: data file 9: ‘+DATA/rac11g/rac11g_ndmain_4_32g’
File 9 not verified due to error ORA-01108
Errors in file /data/oracle/diag/rdbms/rac11g_s/rac11g2/trace/rac11g2_dbw0_1093.trc:
ORA-01186: file 10 failed verification tests
ORA-01108: file 10 is in backup or media recovery
ORA-01110: data file 10: ‘+DATA/rac11g/rac11g_ndmain_5_32g’
File 10 not verified due to error ORA-01108
Errors in file /data/oracle/diag/rdbms/rac11g_s/rac11g2/trace/rac11g2_dbw0_1093.trc:
ORA-01186: file 11 failed verification tests
ORA-01108: file 11 is in backup or media recovery
ORA-01110: data file 11: ‘+DATA/rac11g/rac11g_ndmain_6_32g’
File 11 not verified due to error ORA-01108
Errors in file /data/oracle/diag/rdbms/rac11g_s/rac11g2/trace/rac11g2_dbw0_1093.trc:
ORA-01186: file 12 failed verification tests
ORA-01108: file 12 is in backup or media recovery
ORA-01110: data file 12: ‘+DATA/rac11g/rac11g_undotbs1_2_32g’
File 12 not verified due to error ORA-01108
Errors in file /data/oracle/diag/rdbms/rac11g_s/rac11g2/trace/rac11g2_dbw0_1093.trc:
ORA-01186: file 13 failed verification tests
ORA-01108: file 13 is in backup or media recovery
ORA-01110: data file 13: ‘+DATA/rac11g/rac11g_undotbs2_2_32g’
File 13 not verified due to error ORA-01108
Errors in file /data/oracle/diag/rdbms/rac11g_s/rac11g2/trace/rac11g2_dbw0_1093.trc:
ORA-01186: file 14 failed verification tests
ORA-01108: file 14 is in backup or media recovery
ORA-01110: data file 14: ‘+DATA/rac11g/rac11g_perfstat_1_8g’
File 14 not verified due to error ORA-01108
Errors in file /data/oracle/diag/rdbms/rac11g_s/rac11g2/trace/rac11g2_dbw0_1093.trc:
ORA-01186: file 201 failed verification tests
ORA-01122: database file 201 failed verification check
ORA-01110: data file 201: ‘+DATA/rac11g/rac11g_temp_1_4g’
ORA-01203: wrong incarnation of this file – wrong creation SCN
File 201 not verified due to error ORA-01122
Errors in file /data/oracle/diag/rdbms/rac11g_s/rac11g2/trace/rac11g2_dbw0_1093.trc:
ORA-01186: file 202 failed verification tests
ORA-01122: database file 202 failed verification check
ORA-01110: data file 202: ‘+DATA/rac11g/rac11g_temp_2_16g’
ORA-01206: file is not part of this database – wrong database id
File 202 not verified due to error ORA-01122
ORA-1187 signalled during: ALTER DATABASE OPEN…
显然Oracle不允许一个实例进行恢复的时候,另外一个实例只读打开。
不过Oracle11g是允许当前实例进行恢复的同时打开数据库的,而且这个实例只读打开数据库后,另外一个实例也可以只读打开。具体的过程可以参考:
但是这种情况下,Oracle会自动停止后台的恢复过程。
而且似乎一旦这种情况发生过,下次就没有办法再次在恢复的时候打开数据库,这时会报错:
SQL> alter database open;
alter database open
*第 1 行出现错误:ORA-01154: 数据库忙。现在不允许打开, 关闭, 装载和卸装
现在还不清楚为什么会出现这个ORA-1154的错误,怀疑是bug导致的,但是这个错误的出现意味着无法在恢复的时候只读打开了。
下面从另一个方面验证这种情况:
SQL> alter database recover managed standby database cancel;
数据库已更改。
SQL> alter database open;
数据库已更改。
把另一个节点也打开:
SQL> alter database open;
数据库已更改。
下面在实例1关闭数据库,并尝试进行恢复:
SQL> alter database close;
数据库已更改。
SQL> alter database recover managed standby database disconnect from session; |
数据库已更改。
似乎成功了,但是通过查询V$DATAGUARD_STATUS就可以看到,实际上恢复过程报错停止了:
SQL> select message from v$dataguard_status 2 where message_num > (select max(message_num) – 2 from v$dataguard_status); MESSAGE ————————————————————————————– MRP0: Background Media Recovery terminated with error 1153 MRP0: Background Media Recovery process shutdown |
通过下面的命令也可以看到,实际上当前并没有进行恢复:
SQL> alter database recover managed standby database cancel; alter database recover managed standby database cancel |
*第 1 行出现错误:ORA-16136: 受管备用恢复未激活
可以看到,Oracle虽然在11g支持了应用归档的时候只读打开。但是对于另外一个节点,仍然是无法访问的。而且存在bug,会导致本节点在应用归档日志的时候也无法只读打开数据库。
我们一直都在努力坚持原创.......请不要一声不吭,就悄悄拿走。
我原创,你原创,我们的内容世界才会更加精彩!
【所有原创内容版权均属TechTarget,欢迎大家转发分享。但未经授权,严禁任何媒体(平面媒体、网络媒体、自媒体等)以及微信公众号复制、转载、摘编或以其他方式进行使用。】
微信公众号
TechTarget
官方微博
TechTarget中国
作者
相关推荐
-
Collaborate 18大会:了解甲骨文云数据库和应用的进展
在Collaborate 18大会即将举行时,我们会发现,甲骨文用户社区的技术变化会略高于平常水平。 由独立甲 […]
-
甲骨文自治数据库亮相 带来云计算新希望
早前甲骨文还不在云计算公司之列,而现在该公司正在迅速弥补其失去的时间。甲骨文的云计算核心是甲骨文自治数据库(O […]
-
Oracle TNS 错误:管理员旷日持久的战斗
TNS经常给IT管理员带来麻烦,而且很难定位。尤其是在Oracle数据库中。本文将介绍如何避免这些常见错误。
-
DBA支招:如何实现Oracle EBS 12.2.5升级
那些对于是否要将EBS进行升级持观望态度的Oracle数据库管理员们可以从一家研究公司获得一些启示。