Deploy Oracle 10.2.0.5 DataGuard on Red Hat Enterprise Linux 6.4

系统:Red Hat Enterprise Linux 6.4

数据库:Oracle 10.2.0.5.0 Patch Set 4

主机:10dg1 192.168.1.91

10dg2192.168.1.92

内存:1G

虚拟机:VBox 4.2.14

一,操作系统部分(略)

可以参考我之前写的博客 http://blog.csdn.net/aaron8219/article/details/38239065

二,数据库部分

*****主库配置*****

1. 开启归档,force logging

SQL> archive log list

SQL> shutdown immediate

SQL> startup mount

SQL> alter database archivelog;

SQL> shutdown immediate

SQL> startup

SQL> alter database force logging;

SQL> select log_mode,force_logging from v$database;

SQL> archive log list

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     1

Next log sequence to archive   3

Current log sequence           3

2. 在线修改DG所需参数

SQL> alter system set LOG_ARCHIVE_CONFIG=‘DG_CONFIG=(zlm,zlmdg)‘ scope=both;

SQL> alter system set LOG_ARCHIVE_DEST_1=‘LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=zlm‘ scope=both;

SQL> alter system set LOG_ARCHIVE_DEST_2=‘SERVICE=zlm10gdg LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=zlmdg‘ scope=both;

SQL> alter system set LOG_ARCHIVE_DEST_STATE_1=ENABLE scope=both;

SQL> alter system set LOG_ARCHIVE_DEST_STATE_2=ENABLE scope=both;

SQL> alter system set FAL_SERVER=zlmdg scope=both;

SQL> alter system set FAL_CLIENT=zlm scope=both;

SQL> alter system set STANDBY_FILE_MANAGEMENT=‘AUTO‘ scope=both;

这里只做2个说明:

①. SERVICE对应的是NET SERVICE NAME,而不是tnsnames.ora中配置的SERVICE NAME

②. 由于db_unique_name无法在线修改,如果生产库之前就设置过这个参数,通常会和db_name一致,那么最好了,可以直接使用它,这样就不用停库,我这里假设原来的db_unique_name设置过,并且就是和db_name一样的zlm,

可以说,这是零停机窗口搭建DG环境的必要条件

3. 创建备份目录,开始备份主库,准备在备库上做rman异机恢复

mkdir /u01/rman_bak

run{

allocate channel c1 device type disk;

allocate channel c2 device type disk;

backup incremental level=0 database format ‘/u01/rman_bak/full_lev0_%d_%I_%T_%U.bak‘ tag ‘full_level_0‘include current controlfile for standby;

release channel c1;

release channel c2;

}

查看刚才备份后生成的文件

[[email protected] u01]$ cd rman_bak/

[[email protected] rman_bak]$ ll

total 608976

-rw-r-----. 1 oracle oinstall 383500288 Jul 30 13:22 full_lev0_ZLM_3930348306_20140730_04pemmkd_1_1.bak

-rw-r-----. 1 oracle oinstall 232873984 Jul 30 13:22 full_lev0_ZLM_3930348306_20140730_05pemmkd_1_1.bak

-rw-r-----. 1 oracle oinstall   7110656 Jul 30 13:23 full_lev0_ZLM_3930348306_20140730_06pemmlq_1_1.bak

-rw-r-----. 1 oracle oinstall     98304 Jul 30 13:23 full_lev0_ZLM_3930348306_20140730_07pemmlr_1_1.bak

4. 复制初始化参数initSID.ora和备份集到备库$ORACLE_HOME/dbs

scp $ORACLE_HOME/dbs/initzlm.ora 10dg2:$ORACLE_HOME/dbs

scp /u01/rman_bak/*.bak 10dg2:/u01/rman_bak  --注意必须先在备库主机上创建/u01/rman_bak目录

5. 复制tnsnames.ora和listener.ora到备库$ORACLE_HOME/dbs

这里贴一下我主库这2个文件的配置,推荐直接修改成备库的内容以后再复制,tnsnames.ora可以不用修改

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

ZLM10G =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.91)(PORT = 1521))

)

(CONNECT_DATA =

(SERVICE_NAME = zlm_SN)

)

)

ZLM10GDG =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.92)(PORT = 1521))

)

(CONNECT_DATA =

(SERVICE_NAME = zlm_SN1)

)

)

# listener.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SID_NAME = PLSExtProc)

(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)

(PROGRAM = extproc)

)

(SID_DESC =

(GLOBAL_DBNAME = zlm_SN)

(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)

(SID_NAME = zlm)

)

)

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.91)(PORT = 1521))

)

(DESCRIPTION =

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))

)

)

还记得怎么区分GLOBAL_DBNAME,SID_NAME,SERVICE_NAME,NET SERVICE
NAME这些概念吗?请参考我的另一篇博客 http://blog.csdn.net/aaron8219/article/details/38267145

-------------------------------------------------分割线 -----------------------------------------------------

*****备库配置*****

[[email protected] ~]$ mkdir /u01/app/oracle/admin/zlm/adump -p

[[email protected] ~]$ mkdir /u01/app/oracle/admin/zlm/bdump -p

[[email protected] ~]$ mkdir /u01/app/oracle/admin/zlm/cdump -p

[[email protected] ~]$ mkdir /u01/app/oracle/admin/zlm/udump -p

[[email protected] ~]$ mkdir /u01/app/oracle/oradata/zlm -p

[[email protected] ~]$ mkdir /u01/app/oracle/flash_recovery_area -p

sqlplus / as sysdba

startup nomount

exit

[[email protected] ~]$ ls -lrt /u01/rman_bak

total 608976

-rw-r-----. 1 oracle oinstall 383500288 Jul 30 13:39 full_lev0_ZLM_3930348306_20140730_04pemmkd_1_1.bak

-rw-r-----. 1 oracle oinstall 232873984 Jul 30 13:40 full_lev0_ZLM_3930348306_20140730_05pemmkd_1_1.bak

-rw-r-----. 1 oracle oinstall   7110656 Jul 30 13:40 full_lev0_ZLM_3930348306_20140730_06pemmlq_1_1.bak

-rw-r-----. 1 oracle oinstall     98304 Jul 30 13:40 full_lev0_ZLM_3930348306_20140730_07pemmlr_1_1.bak

[[email protected] ~]$ rman target /

RMAN> restore controlfile from ‘/u01/rman_bak/full_lev0_ZLM_3930348306_20140730_06pemmlq_1_1.bak‘;

Starting restore at 30-JUL-14

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=156 devtype=DISK

channel ORA_DISK_1: restoring control file

channel ORA_DISK_1: restore complete, elapsed time: 00:00:03

output filename=/u01/app/oracle/oradata/zlm/control01.ctl

output filename=/u01/app/oracle/oradata/zlm/control02.ctl

output filename=/u01/app/oracle/oradata/zlm/control03.ctl

Finished restore at 30-JUL-14

RMAN> alter database mount;

database mounted

released channel: ORA_DISK_1

RMAN> restore database;

Starting restore at 30-JUL-14

Starting implicit crosscheck backup at 30-JUL-14

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=156 devtype=DISK

Crosschecked 2 objects

Finished implicit crosscheck backup at 30-JUL-14

Starting implicit crosscheck copy at 30-JUL-14

using channel ORA_DISK_1

Finished implicit crosscheck copy at 30-JUL-14

searching for all files in the recovery area

cataloging files...

no files cataloged

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backupset restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

restoring datafile 00002 to /u01/app/oracle/oradata/zlm/undotbs01.dbf

restoring datafile 00003 to /u01/app/oracle/oradata/zlm/sysaux01.dbf

restoring datafile 00005 to /u01/app/oracle/oradata/zlm/example01.dbf

channel ORA_DISK_1: reading from backup piece /u01/rman_bak/full_lev0_ZLM_3930348306_20140730_05pemmkd_1_1.bak

channel ORA_DISK_1: restored backup piece 1

piece handle=/u01/rman_bak/full_lev0_ZLM_3930348306_20140730_05pemmkd_1_1.bak tag=FULL_LEVEL_0

channel ORA_DISK_1: restore complete, elapsed time: 00:00:25

channel ORA_DISK_1: starting datafile backupset restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

restoring datafile 00001 to /u01/app/oracle/oradata/zlm/system01.dbf

restoring datafile 00004 to /u01/app/oracle/oradata/zlm/users01.dbf

channel ORA_DISK_1: reading from backup piece /u01/rman_bak/full_lev0_ZLM_3930348306_20140730_04pemmkd_1_1.bak

channel ORA_DISK_1: restored backup piece 1

piece handle=/u01/rman_bak/full_lev0_ZLM_3930348306_20140730_04pemmkd_1_1.bak tag=FULL_LEVEL_0

channel ORA_DISK_1: restore complete, elapsed time: 00:00:25

Finished restore at 30-JUL-14

RMAN>

[[email protected] ~]$ cd /u01/app/oracle/oradata/zlm

[[email protected] zlm]$ ll

total 865540

-rw-r-----. 1 oracle oinstall   7061504 Jul 30 13:52 control01.ctl

-rw-r-----. 1 oracle oinstall   7061504 Jul 30 13:52 control02.ctl

-rw-r-----. 1 oracle oinstall   7061504 Jul 30 13:52 control03.ctl

-rw-r-----. 1 oracle oinstall 104865792 Jul 30 13:47 example01.dbf

-rw-r-----. 1 oracle oinstall 262152192 Jul 30 13:47 sysaux01.dbf

-rw-r-----. 1 oracle oinstall 461381632 Jul 30 13:47 system01.dbf

-rw-r-----. 1 oracle oinstall  31465472 Jul 30 13:47 undotbs01.dbf

-rw-r-----. 1 oracle oinstall   5251072 Jul 30 13:47 users01.dbf

SQL> archive log list

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     1

Next log sequence to archive   3

Current log sequence           3

主库启动监听

[[email protected] ~]$ lsnrctl start

...

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.91)(PORT=1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

Services Summary...

Service "PLSExtProc" has 1 instance(s).

Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

Service "zlm_SN" has 1 instance(s).

Instance "zlm", status UNKNOWN, has 1 handler(s) for this service...

The command completed successfully

备库启动监听

[[email protected] ~]$ lsnrctl start

...

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.92)(PORT=1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

Services Summary...

Service "PLSExtProc" has 1 instance(s).

Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

Service "zlm_SN1" has 1 instance(s).

Instance "zlm", status UNKNOWN, has 1 handler(s) for this service...

The command completed successfully

备库中需要调整的参数

db_unique_name=‘ZLMDG‘

fal_client=‘ZLMDG‘

fal_server=‘ZLM‘

log_archive_dest_1=‘LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=zlmdg‘

log_archive_dest_2=‘SERVICE=zlm10g LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=zlm‘

主库查看归档路径状态

SQL> set lin 120 pages 120

SQL> col dest_name for a20

SQL> col destination for a15

SQL> col error for a40

SQL> select dest_id,dest_name,destination,status,error from v$archive_dest_status;

DEST_ID DEST_NAME            DESTINATION     STATUS    ERROR

---------- -------------------- --------------- --------- ----------------------------------------

1 LOG_ARCHIVE_DEST_1                   VALID

2 LOG_ARCHIVE_DEST_2   zlm10gdg        ERROR     ORA-01031: insufficient privileges

3 LOG_ARCHIVE_DEST_3                   INACTIVE

4 LOG_ARCHIVE_DEST_4                   INACTIVE

5 LOG_ARCHIVE_DEST_5                   INACTIVE

6 LOG_ARCHIVE_DEST_6                   INACTIVE

7 LOG_ARCHIVE_DEST_7                   INACTIVE

8 LOG_ARCHIVE_DEST_8                   INACTIVE

9 LOG_ARCHIVE_DEST_9                   INACTIVE

10 LOG_ARCHIVE_DEST_10                  INACTIVE

10 rows selected.

备库查看归档路径状态

SQL> set lin 120 pages 120

SQL> col dest_name for a20

SQL> col destination for a15

SQL> col error for a40

SQL> select dest_id,dest_name,destination,status,error from v$archive_dest_status;

DEST_ID DEST_NAME            DESTINATION     STATUS    ERROR

---------- -------------------- --------------- --------- ----------

1 LOG_ARCHIVE_DEST_1           VALID

2 LOG_ARCHIVE_DEST_2   zlm10g        VALID

3 LOG_ARCHIVE_DEST_3           INACTIVE

4 LOG_ARCHIVE_DEST_4           INACTIVE

5 LOG_ARCHIVE_DEST_5           INACTIVE

6 LOG_ARCHIVE_DEST_6           INACTIVE

7 LOG_ARCHIVE_DEST_7           INACTIVE

8 LOG_ARCHIVE_DEST_8           INACTIVE

9 LOG_ARCHIVE_DEST_9           INACTIVE

10 LOG_ARCHIVE_DEST_10          INACTIVE

11 STANDBY_ARCHIVE_DEST         VALID

11 rows selected.

权限问题,重新复制主库密码到备库

SQL> !scp $ORACLE_HOME/dbs/orapwzlm 10dg2:$ORACLE_HOME/dbs

[email protected]‘s password:

orapwzlm                                                                                           100% 1536     1.5KB/s   00:00

主库tnsping一下NET SERVICE NAME

[[email protected] rman_bak]$ tnsping zlm10gdg

TNS Ping Utility for Linux: Version 10.2.0.5.0 - Production on 30-JUL-2014 14:50:45

Copyright (c) 1997,  2010, Oracle.  All rights reserved.

Used parameter files:

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.92)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = zlm_SN1)))

OK (0 msec)

主库tnsping一下NET SERVICE NAME

[[email protected] zlm]$ tnsping zlm10g

TNS Ping Utility for Linux: Version 10.2.0.5.0 - Production on 30-JUL-2014 14:50:56

Copyright (c) 1997,  2010, Oracle.  All rights reserved.

Used parameter files:

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.91)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = zlm_SN)))

OK (10 msec)

再次查看主库归档路径状态

SQL> select dest_id,dest_name,destination,status,error from v$archive_dest_status;

DEST_ID DEST_NAME            DESTINATION     STATUS    ERROR

---------- -------------------- --------------- --------- ----------------------------------------

1 LOG_ARCHIVE_DEST_1                   VALID

2 LOG_ARCHIVE_DEST_2   zlm10gdg        VALID

3 LOG_ARCHIVE_DEST_3                   INACTIVE

4 LOG_ARCHIVE_DEST_4                   INACTIVE

5 LOG_ARCHIVE_DEST_5                   INACTIVE

6 LOG_ARCHIVE_DEST_6                   INACTIVE

7 LOG_ARCHIVE_DEST_7                   INACTIVE

8 LOG_ARCHIVE_DEST_8                   INACTIVE

9 LOG_ARCHIVE_DEST_9                   INACTIVE

10 LOG_ARCHIVE_DEST_10                  INACTIVE

10 rows selected.

主备库创建standby redo logfile

SQL> alter database add standby logfile group 4 (‘/u01/app/oracle/oradata/zlm/std04.redo‘) size 100m;

SQL> alter database add standby logfile group 5 (‘/u01/app/oracle/oradata/zlm/std05.redo‘) size 100m;

SQL> alter database add standby logfile group 6 (‘/u01/app/oracle/oradata/zlm/std06.redo‘) size 100m;

SQL> alter database add standby logfile group 7 (‘/u01/app/oracle/oradata/zlm/std07.redo‘) size 100m;

主库创建的时候没问题,备库创建到第2个文件的时候出现坏块!!!

SQL> alter database add standby logfile group 4 (‘/u01/app/oracle/oradata/zlm/std04.redo‘) size 100m;

Database altered.

SQL> alter database add standby logfile group 5 (‘/u01/app/oracle/oradata/zlm/std05.redo‘) size 100m;

alter database add standby logfile group 5 (‘/u01/app/oracle/oradata/zlm/std05.redo‘) size 100m

*

ERROR at line 1:

ORA-19502: write error on file "/u01/app/oracle/oradata/zlm/std05.redo", blockno 198657 (blocksize=512)

ORA-27072: File I/O error

Linux-x86_64 Error: 9: Bad file descriptor

Additional information: 4

Additional information: 198657

Additional information: 790016

SQL> !df -Th

Filesystem    Type    Size  Used Avail Use% Mounted on

/dev/mapper/vg_10dg2-lv_root

ext4     13G   12G   99M 100% /

tmpfs        tmpfs    499M   68K  499M   1% /dev/shm

/dev/sda1     ext4    485M   33M  427M   8% /boot

/dev/sr0   iso9660    3.5G  3.5G     0 100% /media/disk

原来是可用空间不够了,初始只给了15G,想想装个10g足够了,Oracle软件和patch的安装文件用完后没及时删除,占用掉不少空间

SQL> !ls -lrt /u01/app/oracle/oradata/zlm

total 1275164

-rw-r-----. 1 oracle oinstall  31465472 Jul 30 13:47 undotbs01.dbf

-rw-r-----. 1 oracle oinstall 104865792 Jul 30 13:47 example01.dbf

-rw-r-----. 1 oracle oinstall 262152192 Jul 30 13:47 sysaux01.dbf

-rw-r-----. 1 oracle oinstall   5251072 Jul 30 13:47 users01.dbf

-rw-r-----. 1 oracle oinstall 461381632 Jul 30 13:47 system01.dbf

-rw-r-----. 1 oracle oinstall 104858112 Jul 30 15:07 std04.redo

-rw-r-----. 1 oracle oinstall 104858112 Jul 30 15:25 std05.redo

-rw-r-----. 1 oracle oinstall 104858112 Jul 30 15:25 std06.redo

-rw-r-----. 1 oracle oinstall 104858112 Jul 30 15:25 std07.redo

-rw-r-----. 1 oracle oinstall   7061504 Jul 30 15:25 control01.ctl

-rw-r-----. 1 oracle oinstall   7061504 Jul 30 15:25 control02.ctl

-rw-r-----. 1 oracle oinstall   7061504 Jul 30 15:25 control03.ctl

备库开始redo apply

SQL> recover managed standby database using current logfile disconnect from session;

Media recovery complete.

查看备库数据文件目录,发现并未生成redo01.log,redo02.log,redo03.log这3个文件

SQL> !ls -lrt /u01/app/oracle/oradata/zlm

total 1275164

-rw-r-----. 1 oracle oinstall 104858112 Jul 30 15:07 std04.redo

-rw-r-----. 1 oracle oinstall 104858112 Jul 30 15:25 std05.redo

-rw-r-----. 1 oracle oinstall 104858112 Jul 30 15:25 std06.redo

-rw-r-----. 1 oracle oinstall 104858112 Jul 30 15:25 std07.redo

-rw-r-----. 1 oracle oinstall 461381632 Jul 30 15:27 system01.dbf

-rw-r-----. 1 oracle oinstall  31465472 Jul 30 15:27 undotbs01.dbf

-rw-r-----. 1 oracle oinstall 262152192 Jul 30 15:27 sysaux01.dbf

-rw-r-----. 1 oracle oinstall   5251072 Jul 30 15:27 users01.dbf

-rw-r-----. 1 oracle oinstall 104865792 Jul 30 15:27 example01.dbf

-rw-r-----. 1 oracle oinstall   7061504 Jul 30 15:27 control01.ctl

-rw-r-----. 1 oracle oinstall   7061504 Jul 30 15:27 control02.ctl

-rw-r-----. 1 oracle oinstall   7061504 Jul 30 15:27 control03.ctl

查看备库alertlog,提示无法得到文件状态,找不到该文件

ALTER DATABASE RECOVER  managed standby database using current logfile disconnect from session

Wed Jul 30 15:27:18 CST 2014

Attempt to start background Managed Standby Recovery process (zlm)

MRP0 started with pid=19, OS id=16199

Wed Jul 30 15:27:18 CST 2014

MRP0: Background Managed Standby Recovery process started (zlm)

Managed Standby Recovery starting Real Time Apply

parallel recovery started with 2 processes

Wed Jul 30 15:27:24 CST 2014

Waiting for all non-current ORLs to be archived...

Wed Jul 30 15:27:24 CST 2014

Errors in file /u01/app/oracle/admin/zlm/bdump/zlm_mrp0_16199.trc:

ORA-00313: open failed for members of log group 1 of thread 1

ORA-00312: online log 1 thread 1: ‘/u01/app/oracle/oradata/zlm/redo01.log‘

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

Wed Jul 30 15:27:24 CST 2014

Errors in file /u01/app/oracle/admin/zlm/bdump/zlm_mrp0_16199.trc:

ORA-00313: open failed for members of log group 1 of thread 1

ORA-00312: online log 1 thread 1: ‘/u01/app/oracle/oradata/zlm/redo01.log‘

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

Clearing online redo logfile 1 /u01/app/oracle/oradata/zlm/redo01.log

Clearing online log 1 of thread 1 sequence number 1

Wed Jul 30 15:27:24 CST 2014

Errors in file /u01/app/oracle/admin/zlm/bdump/zlm_mrp0_16199.trc:

ORA-00313: open failed for members of log group 1 of thread 1

ORA-00312: online log 1 thread 1: ‘/u01/app/oracle/oradata/zlm/redo01.log‘

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

Wed Jul 30 15:27:24 CST 2014

Errors in file /u01/app/oracle/admin/zlm/bdump/zlm_mrp0_16199.trc:

ORA-19527: physical standby redo log must be renamed

ORA-00312: online log 1 thread 1: ‘/u01/app/oracle/oradata/zlm/redo01.log‘

Clearing online redo logfile 1 complete

Media Recovery Waiting for thread 1 sequence 3

Wed Jul 30 15:27:24 CST 2014

Completed: ALTER DATABASE RECOVER  managed standby database using current logfile disconnect from session

在之前的文章中提到过,对于10g,需要要设置一个参数,那就是log_file_name_convert,哪怕主备库的路径完全一样,而且由于这个参数无法在线修改,必须重启数据库才能生效,也就是要停库。由于创建过standby redo logfile,还是可以应用日志的,所以可以暂时先这样用着,等主库有停机时间了再搞,而且由于备库没有办法生成online redo log,如果这个时候发生switchover切换,是会产生问题的

备库初始状态:

SQL> archive log list

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     1

Next log sequence to archive   0

Current log sequence           3

主库初始状态:

SQL> archive log list

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     1

Next log sequence to archive   3

Current log sequence           3

主库切换3次日志

SQL> alter system switch logfile;

System altered.

SQL> alter system switch logfile;

System altered.

SQL> alter system switch logfile;

System altered.

备库归档日志状态:

SQL> archive log list

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     4

Next log sequence to archive   0

Current log sequence           6

日志应用情况:

SQL> select sequence#,applied from v$archived_log;

SEQUENCE# APP

---------- ---

3 YES

4 YES

5 YES

备库停止redo apply

SQL> recover managed standby disconnect from session;

主库再切2次归档

SQL> alter system switch logfile;

System altered.

SQL> alter system switch logfile;

System altered.

SQL> archive log list

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     7

Next log sequence to archive   9

Current log sequence           9

此时可以看到,备库接收到了2个新切的归档7,8,但未应用

SQL> archive log list

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     7

Next log sequence to archive   0

Current log sequence           9

SQL> select sequence#,applied from v$archived_log;

SEQUENCE# APP

---------- ---

3 YES

4 YES

5 YES

6 YES

7 NO

8 NO

备库再启用redo apply,不使用using crrent logfile

SQL> recover managed standby database disconnect from session;

跟踪备库的alertlog日志

Wed Jul 30 15:47:03 CST 2014

ALTER DATABASE RECOVER  managed standby database cancel

Wed Jul 30 15:47:03 CST 2014

MRP0: Background Media Recovery cancelled with status 16037

Wed Jul 30 15:47:03 CST 2014

Errors in file /u01/app/oracle/admin/zlm/bdump/zlm_mrp0_16199.trc:

ORA-16037: user requested cancel of managed recovery operation

Managed Standby Recovery not using Real Time Apply

Recovery interrupted!

Recovered data files to a consistent state at change 465658

Wed Jul 30 15:47:04 CST 2014

Errors in file /u01/app/oracle/admin/zlm/bdump/zlm_mrp0_16199.trc:

ORA-16037: user requested cancel of managed recovery operation

Wed Jul 30 15:47:04 CST 2014

MRP0: Background Media Recovery process shutdown (zlm)

Wed Jul 30 15:47:04 CST 2014

Managed Standby Recovery Canceled (zlm)

Wed Jul 30 15:47:04 CST 2014

Completed: ALTER DATABASE RECOVER  managed standby database cancel

Wed Jul 30 15:47:13 CST 2014

Primary database is in MAXIMUM PERFORMANCE mode

RFS[2]: Successfully opened standby log 4: ‘/u01/app/oracle/oradata/zlm/std04.redo‘

Primary database is in MAXIMUM PERFORMANCE mode

RFS[2]: Successfully opened standby log 5: ‘/u01/app/oracle/oradata/zlm/std05.redo‘

Wed Jul 30 15:47:42 CST 2014

ALTER DATABASE RECOVER  managed standby database disconnect from session

Wed Jul 30 15:47:42 CST 2014

Attempt to start background Managed Standby Recovery process (zlm)

MRP0 started with pid=19, OS id=16248

Wed Jul 30 15:47:42 CST 2014

MRP0: Background Managed Standby Recovery process started (zlm)

Managed Standby Recovery not using Real Time Apply

parallel recovery started with 2 processes

Wed Jul 30 15:47:47 CST 2014

Waiting for all non-current ORLs to be archived...

Wed Jul 30 15:47:47 CST 2014

Errors in file /u01/app/oracle/admin/zlm/bdump/zlm_mrp0_16248.trc:

ORA-00313: open failed for members of log group 1 of thread 1

ORA-00312: online log 1 thread 1: ‘/u01/app/oracle/oradata/zlm/redo01.log‘

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

Wed Jul 30 15:47:47 CST 2014

Errors in file /u01/app/oracle/admin/zlm/bdump/zlm_mrp0_16248.trc:

ORA-00313: open failed for members of log group 1 of thread 1

ORA-00312: online log 1 thread 1: ‘/u01/app/oracle/oradata/zlm/redo01.log‘

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

Clearing online redo logfile 1 /u01/app/oracle/oradata/zlm/redo01.log

Clearing online log 1 of thread 1 sequence number 7

Wed Jul 30 15:47:47 CST 2014

Errors in file /u01/app/oracle/admin/zlm/bdump/zlm_mrp0_16248.trc:

ORA-00313: open failed for members of log group 1 of thread 1

ORA-00312: online log 1 thread 1: ‘/u01/app/oracle/oradata/zlm/redo01.log‘

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

Wed Jul 30 15:47:47 CST 2014

Errors in file /u01/app/oracle/admin/zlm/bdump/zlm_mrp0_16248.trc:

ORA-19527: physical standby redo log must be renamed

ORA-00312: online log 1 thread 1: ‘/u01/app/oracle/oradata/zlm/redo01.log‘

Clearing online redo logfile 1 complete

Media Recovery Log /u01/app/oracle/flash_recovery_area/ZLMDG/archivelog/2014_07_30/o1_mf_1_7_9xk8r16v_.arc

Media Recovery Log /u01/app/oracle/flash_recovery_area/ZLMDG/archivelog/2014_07_30/o1_mf_1_8_9xk8r1jc_.arc

Wed Jul 30 15:47:48 CST 2014

Completed: ALTER DATABASE RECOVER  managed standby database disconnect from session

Wed Jul 30 15:47:48 CST 2014

Media Recovery Waiting for thread 1 sequence 9 (in transit)

发现online redo logfile还是无法获取,还提示standby redo log需要重命名,但是依然可以成功地应用刚才剩下的归档7,8

SQL> select sequence#,applied from v$archived_log;

SEQUENCE# APP

---------- ---

3 YES

4 YES

5 YES

6 YES

7 YES

8 YES

6 rows selected.

查看一下数据文件存放的目录,的确依旧没有生成我么所期待的online redo logfile(redo01.log,redo02.log,redo03.log)

SQL> !ls -lrt /u01/app/oracle/oradata/zlm

total 1275164

-rw-r-----. 1 oracle oinstall 104858112 Jul 30 15:25 std06.redo

-rw-r-----. 1 oracle oinstall 104858112 Jul 30 15:25 std07.redo

-rw-r-----. 1 oracle oinstall 104858112 Jul 30 15:47 std04.redo

-rw-r-----. 1 oracle oinstall  31465472 Jul 30 15:47 undotbs01.dbf

-rw-r-----. 1 oracle oinstall 461381632 Jul 30 15:47 system01.dbf

-rw-r-----. 1 oracle oinstall 262152192 Jul 30 15:47 sysaux01.dbf

-rw-r-----. 1 oracle oinstall   5251072 Jul 30 15:47 users01.dbf

-rw-r-----. 1 oracle oinstall 104865792 Jul 30 15:47 example01.dbf

-rw-r-----. 1 oracle oinstall 104858112 Jul 30 15:56 std05.redo

-rw-r-----. 1 oracle oinstall   7061504 Jul 30 15:56 control01.ctl

-rw-r-----. 1 oracle oinstall   7061504 Jul 30 15:56 control02.ctl

-rw-r-----. 1 oracle oinstall   7061504 Jul 30 15:56 control03.ctl

关闭主库,添加log_file_name_convert参数后,这个DG才算是完整的配置

Deploy Oracle 10.2.0.5 DataGuard on Red Hat Enterprise Linux 6.4

时间: 2024-10-11 19:45:32

Deploy Oracle 10.2.0.5 DataGuard on Red Hat Enterprise Linux 6.4的相关文章

Deploy Oracle 10.2.0.5 on Red Hat Enterprise Linux 6.4

一.Linux系统安装配置 1.安装系统时选Desktop 2.设置eth0网卡为静态IP,添加子网掩码,网关,DNS,并配置自动启动 3.修改/etc/hosts,添加主机名和对应IP 4.禁用firewall和selinux chkconfig iptables off vi /etc/selinux/config SELINUX=disabled [[email protected] selinux]# setenforce 0 [[email protected] selinux]# g

ORACLE Install (10g r2) FOR Red Hat Enterprise Linux Server release 5.5 (64 bit) (转)

OS Info----------# cat /etc/redhat-releaseRed Hat Enterprise Linux Server release 5.5 (Tikanga)# cat /etc/issue.netRed Hat Enterprise Linux Server release 5.5 (Tikanga)Kernel r on an m# uname -rm2.6.18-194.el5 x86_64# echo $MACHTYPEx86_64-redhat-linu

oracle 11gR2 client安装(Red Hat Enterprise Linux Server release 5.5 (Tikanga) 安装ORACLE客户端)

安装DBD::ORALCE模块时报错: Running Mkbootstrap for DBD::Oracle () chmod 644 Oracle.bs rm -f blib/arch/auto/DBD/Oracle/Oracle.so gcc -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=gener

Red Hat Enterprise Linux 5.10在vmware10下的安装

Red Hat Enterprise Linux 5.10在vmware10下的安装 1.启动"新建虚拟机"向导程序.如下图,选择"自定义",点击"下一步" 2.选择虚拟机硬件兼容性,你可以根据自己需求选择,这里选择默认,如下图.单击"下一步" 3.指定虚拟机系统的安装方式.选择"稍后安装操作系统",如果选择"安装盘镜像文件(iso)",虚拟机启动后会自动执行快速安装,不方便用户控制安装

Red Hat Enterprise Linux Server release 7.0双系统安装

Red Hat Enterprise Linux Server release 7.0双系统安装 1.RedHat 公司的企业版7.0已经发布了.下面介绍一下在7.0下装双系统的步骤. 安装前系统:WIN7 要安装的第二个系统:RedHat Enterprise 7.0 @请注意:WIN8系统和企业版7.0不兼容.安装完7.0后,WIN8系统会起不来. @首先BOIS已经确定调好.[注意启用笔记本的高速运转模式],我是用PXE网络来安装的,所以还得设置从PXE网络启动. @接着以PXE启动. @

Red Hat Enterprise Linux Server 6.0官方多国语言版光盘镜像下载

来源:http://www.linuxidc.com/Linux/2011-09/43704.htm 电驴下载: rhel-server-6.0-i386-dvd.iso ed2k://|file|rhel-server-6.0-i386-dvd.iso|2931056640|503184dff4dd37542eee6e57f4a85341|h=azsa3gqbngp23ujbqeyc3ghd4wwtdley|/ ed2k://|file|HashTab_Setup.exe|799610|886

How to create Oracle ASM devices using device-mapper multipath devices in Red Hat Enterprise Linux 6

How to create Oracle ASM devices using device-mapper multipath devices in Red Hat Enterprise Linux 6? 环境 Red Hat Enterprise Linux 6 Device-Mapper Multipath (DM Multipath) Oracle ASM Udev 决议 Please use the following steps to create Oracle ASM disks wi

Red Hat Enterprise Linux 4(64位) 下安装 Oracle 10g

参考资料:ORACLE 10G官方文档 参考资料:甲骨论2012版Oracle免费视频教程 一.安装linux 1.注意分区:内存小于4G,则swap分区=内存*2:内存大于4G,则swap分区=内存大小: 2.tmp目录大于10G; 3.根目录>25G; 4.开发工具包全部选上: 5.安装完成后,再多安装一个sysstat包. 二.安装oracle 1.检查以下必备包的安装:(命令是rpm -qa|grep xxx) binutils-2.15.92.0.2-10.EL4 compat-db-

Red Hat Enterprise Linux AS4, C++ OCCI connect Oracle 9i

前提是已经安装好Oracle 9i. 1. 下载对应的ORACLE client安装. http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html 因为没有9i的client提供下载了,我选择最接近的版本下载: Version 10.1.0.5 Instant Client Package - Basic: All files required to run OCI, OCCI, and