abase mounted.
SQL> alter database open resetlogs;
Database altered.
SQL> alter database start logical standby apply immediate;
Database altered.
SQL>
SQL> set linesize 200
SQL> select * from v$log
GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ ---------
1 1 1 52428800 512 1 NO CURRENT 1335271 29-APR-14 2.8147E+14
2 1 0 52428800 512 1 YES UNUSED 0 0
3 1 0 52428800 512 1 YES UNUSED 0 0
注:resetlogs做什么的?
resetlogs打开讲会对没有归档的redo日志文件中的内容进行覆盖,sequence重新从1开始计算,相当于数据库进入了一个新的化身或是新的生命周期,进入incarnation的目的就是为了不在去应用resetlog之后的日志的lcr。经常有朋友问我resetlog打开数据库了是否就是一个不完全恢复呢?这是一个非常错误的观点,完全恢复和不完全恢复不是依据resetlog定的。而是我们在前滚的时候是否全部应用了日志。如果全部应用了,那么就是一次完全恢复过程。
我们可以查看数据库的原型列表如下;
[oracle@dg-two dbs]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Tue Apr 29 22:20:46 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: AMY (DBID=1205246033)
RMAN> list incarnation
2> ;
using target database control file instead of recovery catalog
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 AMY 1205246033 PARENT 1335270 29-APR-14
2 2 AMY 1205246033 CURRENT 1335271 29-APR-14
第五步:验证逻辑dg:
SQL> select * from v$logstdby_progress;
APPLIED_SCN APPLIED_T RESTART_SCN RESTART_T LATEST_SCN LATEST_TI MINING_SCN MINING_TI RESETLOGS_ID
----------- --------- ----------- --------- ---------- --------- ---------- --------- ------------
1335268 1334503 1334503
SQL> select process,status,sequence# from v$managed_standby;
PROCESS STATUS SEQUENCE#
--------- ------------ ----------
ARCH CONNECTED 0
ARCH CONNECTED 0
ARCH CONNECTED 0
ARCH CONNECTED 0
ARCH CONNECTED 0
SQL>
咦?发现问题了,查看主数据库日志:
Error 1017 received logging on to the standby
------------------------------------------------------------
Check that the primary and standby are using a password file
and remote_login_passwordfile is set to SHARED or EXCLUSIVE,
and that the SYS password is same in the password files.
returning error ORA-16191
------------------------------------------------------------
PING[ARC1]: Heartbeat failed to connect to standby 'dg2'. Error is 16191.
密码文件的问题咯
重建密码文件?那应该是在10G但是到11g不能重建,我们要做的是将主库的密码 文件copy到备库,然后mv。
之后查看主库日志 状态如下(可以发现主库每隔1分钟去主动ping一下备库):
------------------------------------------------------------
PING[ARC1]: Heartbeat failed to connect to standby 'dg2'. Error is 16191.
Tue Apr 29 22:39:42 2014
Error 1017 received logging on to the standby
------------------------------------------------------------
Check that the primary and standby are using a password file
and remote_login_passwordfile is set to SHARED or EXCLUSIVE,
and that the SYS password is same in the password files.
returning error ORA-16191
------------------------------------------------------------
PING[ARC1]: Heartbeat failed to connect to standby 'dg2'. Error is 16191.
Tue Apr 29 22:40:46 2014
******************************************************************
LGWR: Setting 'active' archival for des