操作系统:
Oracle Linux Server release 5.7
数据库版本:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
主:yoon 备:yoondg
备库:
SQL> alter database open read only;
alter database open read only
*
ERROR at line 1:
ORA-10458: standby database requires recovery
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '/opt/oracle/oradata/yoon/system01.dbf'
查看备库:
SQL>select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
TO PRIMARY
查看主库:
SQL>select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
NOT ALLOWED
查看主库参数:
SQL> show parameter log_archive_dest_2;
NAME TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
log_archive_dest_2 string
service=yoon async valid_for=(
online_logfiles,primary_role)
db_unique_name=yoon
log_archive_dest_20 string
蓝色地方设置错误:
SQL>alter system set log_archive_dest_2='servce=yoondg async valid_for=(online_logfiles,primary_role) db_unique_name=yoondg';
修改完再次查看:
SQL>select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
TO STANDBY
查看备库:
SQL>show parameter log_archive_dest_2;
NAME TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
log_archive_dest_2 string
service=yoondg async valid_for=(
online_logfiles,primary_role)
db_unique_name=yoondg
log_archive_dest_20 string
依旧蓝色地方设置错误:
SQL>alter system set log_archive_dest_2='service=yoon async valid_for=(online_logfies,primary_role) db_unique_name=yoon';
重启备库:
SQL>shutdown immediate;
SQL>startup nomount;
SQL>alter database mount standby database;
SQL>alter database open read only;
OK,问题解决.
配置ORACLE-DG的时候一定要认真、仔细,造成的报错往往都是由于小错误引起的,报错的时候不要着急,仔细分析alterSID.log和trace文件.