【DATAGUARD】 基于同一个主机建立物理备库和逻辑备库 (四)--添加一个物理dg节点

本文涉及的产品
日志服务 SLS,月写入数据量 50GB 1个月
简介: 【DATAGUARD】 基于同一个主机建立物理备库和逻辑备库 (四)--添加一个物理dg节点   BLOG文档结构图             ...

DATAGUARD】 基于同一个主机建立物理备库和逻辑备库 (四)--添加一个物理dg节点

 

BLOG文档结构图

 

 

wpsB247.tmp 

 

 

 

DATAGUARD】 基于同一个主机建立物理备库和逻辑备库(一): http://blog.itpub.net/26736162/viewspace-1448197/

 【DATAGUARD】 基于同一个主机建立物理备库和逻辑备库(二 )  :  http://blog.itpub.net/26736162/viewspace-1448207/

 【DATAGUARD】 基于同一个主机建立物理备库和逻辑备库()  :  http://blog.itpub.net/26736162/viewspace-1481972/

 

 

1.1   添加一个物理dg节点

wpsB258.tmp 

 

本次新添加一个物理dg节点orawldg2

1.1.1  查看已有的主库和备库环境情况

 

 

----------- 主库

SQL> select * from v$version;

 

BANNER

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

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi

PL/SQL Release 10.2.0.4.0 - Production

CORE    10.2.0.4.0      Production

TNS for Linux: Version 10.2.0.4.0 - Production

NLSRTL Version 10.2.0.4.0 - Production

 

SQL> archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            /u04/arch/oradg10g

Oldest online log sequence     102

Next log sequence to archive   104

Current log sequence           104

SQL> select dbid,name,current_scn,protection_mode,protection_level,database_role,force_logging,open_mode,switchover_status from v$database;

 

      DBID NAME      CURRENT_SCN PROTECTION_MODE      PROTECTION_LEVEL     DATABASE_ROLE    FOR OPEN_MODE  SWITCHOVER_STATUS

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

1480747539 ORADG10G       774468 MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE  PRIMARY          YES READ WRITE TO STANDBY

 

SQL>

 

 

-----------物理备库一

SQL> select * from v$version;

 

BANNER

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

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi

PL/SQL Release 10.2.0.4.0 - Production

CORE    10.2.0.4.0      Production

TNS for Linux: Version 10.2.0.4.0 - Production

NLSRTL Version 10.2.0.4.0 - Production

 

SQL> archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            /u04/arch/orawldg

Oldest online log sequence     102

Next log sequence to archive   0

Current log sequence           104

SQL> select dbid,name,current_scn,protection_mode,protection_level,database_role,force_logging,open_mode,switchover_status from v$database;

 

      DBID NAME      CURRENT_SCN PROTECTION_MODE      PROTECTION_LEVEL     DATABASE_ROLE    FOR OPEN_MODE  SWITCHOVER_STATUS

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

1480747539 ORADG10G       773422 MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE  PHYSICAL STANDBY YES MOUNTED    SESSIONS ACTIVE

 

SQL>

 

 

---------- 逻辑备库

SQL>  select * from v$version;

 

BANNER

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

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi

PL/SQL Release 10.2.0.4.0 - Production

CORE    10.2.0.4.0      Production

TNS for Linux: Version 10.2.0.4.0 - Production

NLSRTL Version 10.2.0.4.0 - Production

 

SQL>  archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            /u04/arch/oraljdg

Oldest online log sequence     18

Next log sequence to archive   20

Current log sequence           20

SQL> select dbid,name,current_scn,protection_mode,protection_level,database_role,force_logging,open_mode,switchover_status from v$database;

 

      DBID NAME      CURRENT_SCN PROTECTION_MODE      PROTECTION_LEVEL     DATABASE_ROLE    FOR OPEN_MODE  SWITCHOVER_STATUS

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

4072027430 ORALJDG       1063473 MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE  LOGICAL STANDBY YES READ WRITE NOT ALLOWED

 

SQL>

 

 

1.1.2  配置主备库监听tnsnames

--为主库和备库配置监听,整个DG的redo传输服务,都依赖于Oracle Net,因此需要为主备库配置监听 

--配置方法多种多样,可用netmgr,netca,以及直接编辑listener.ora 与tnsnames.ora文件 

--下面是配置之后的listener.ora 与tnsnames.ora文件内容 

[oracle@rhel6_lhr admin]$ cd $ORACLE_HOME/network/admin

[oracle@rhel6_lhr admin]$ more listener.ora

[oracle@rhel6_lhr admin]$ more listener.ora

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

# Generated by Oracle configuration tools.

 

 

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))

      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.130)(PORT = 1522))

    )

  )

 

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (SID_NAME = PLSExtProc)

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

      (PROGRAM = extproc)

    )

   (SID_DESC =

    (GLOBAL_DBNAME = oradg10g)

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

    (SID_NAME= oradg10g)

   )

   (SID_DESC =

    (GLOBAL_DBNAME = orawldg)

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

    (SID_NAME= orawldg)

   )

   (SID_DESC =

    (GLOBAL_DBNAME = oraljdg)

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

    (SID_NAME= oraljdg)

   )

   (SID_DESC =

    (GLOBAL_DBNAME = orawldg2)

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

    (SID_NAME= orawldg2)

   )

  )

 

[oracle@rhel6_lhr admin]$ more tnsnames.ora

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

# Generated by Oracle configuration tools.

 

ORA1024G =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.130)(PORT = 1522))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = ora1024g)

    )

  )

 

oradg10g =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.130)(PORT = 1522))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = oradg10g)

    )

  )

 

orawldg =

(DESCRIPTION =

  (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.130)(PORT = 1522))

  (CONNECT_DATA =

    (SERVER = DEDICATED)

    (SERVICE_NAME = orawldg)

  )

)

 

oraljdg =

(DESCRIPTION =

  (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.130)(PORT = 1522))

  (CONNECT_DATA =

    (SERVER = DEDICATED)

    (SERVICE_NAME = oraljdg)

  )

)

 

tns_orawldg2 =

(DESCRIPTION =

  (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.130)(PORT = 1522))

  (CONNECT_DATA =

    (SERVER = DEDICATED)

    (SERVICE_NAME = orawldg2)

  )

)

[oracle@rhel6_lhr admin]$

 

 

[oracle@rhel6_lhr admin]$  lsnrctl stop

 

LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 02-APR-2015 10:20:09

 

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))

The command completed successfully

[oracle@rhel6_lhr admin]$ lsnrctl start

 

LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 02-APR-2015 10:20:11

 

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

 

Starting /u03/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...

 

TNSLSNR for Linux: Version 10.2.0.4.0 - Production

System parameter file is /u03/app/oracle/product/10.2.0/db_1/network/admin/listener.ora

Log messages written to /u03/app/oracle/product/10.2.0/db_1/network/log/listener.log

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.59.130)(PORT=1522)))

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))

STATUS of the LISTENER

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

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 10.2.0.4.0 - Production

Start Date                02-APR-2015 10:20:11

Uptime                    0 days 0 hr. 0 min. 0 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u03/app/oracle/product/10.2.0/db_1/network/admin/listener.ora

Listener Log File         /u03/app/oracle/product/10.2.0/db_1/network/log/listener.log

Listening Endpoints Summary...

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

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.59.130)(PORT=1522)))

Services Summary...

Service "PLSExtProc" has 1 instance(s).

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

Service "oradg10g" has 1 instance(s).

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

Service "oraljdg" has 1 instance(s).

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

Service "orawldg" has 1 instance(s).

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

Service "orawldg2" has 1 instance(s).

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

The command completed successfully

[oracle@rhel6_lhr admin]$

 

 

[oracle@rhel6_lhr admin]$ tnsping tns_orawldg2

 

TNS Ping Utility for Linux: Version 10.2.0.4.0 - Production on 02-APR-2015 10:21:09

 

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

 

Used parameter files:

/u03/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora

 

 

Used TNSNAMES adapter to resolve the alias

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.130)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orawldg2)))

OK (0 msec)

[oracle@rhel6_lhr admin]$

 

1.1.3  利用rman对主库备份并生成备库控制文件

RUN {

allocate channel c1 type disk;

allocate channel c2 type disk;

sql 'alter system archive log current';

backup current controlfile for standby format='/u04/backup/control_%U';

BACKUP FORMAT '/u04/backup/oradg_%U_%T.bak' skip inaccessible filesperset 5 DATABASE ;

sql 'alter system archive log current';

BACKUP FORMAT '/u04/backup/arch_%U_%T.bak' skip inaccessible filesperset 5 ARCHIVELOG ALL;

sql "alter database create standby controlfile as ''/u04/backup/control01.ctl'' reuse";

release channel c2;

release channel c1;

}

 

 

 

RMAN> list backup;

 

using target database control file instead of recovery catalog

 

RMAN> RUN {

2> allocate channel c1 type disk;

3> allocate channel c2 type disk;

4> sql 'alter system archive log current';

5> backup current controlfile for standby format='/u04/backup/control_%U';

6> BACKUP FORMAT '/u04/backup/oradg_%U_%T.bak' skip inaccessible filesperset 5 DATABASE ;

7> sql 'alter system archive log current';

8> BACKUP FORMAT '/u04/backup/arch_%U_%T.bak' skip inaccessible filesperset 5 ARCHIVELOG ALL;

9> sql "alter database create standby controlfile as ''/u04/backup/control01.ctl'' reuse";

10> release channel c2;

11> release channel c1;

12> }

 

allocated channel: c1

channel c1: sid=159 devtype=DISK

 

allocated channel: c2

channel c2: sid=137 devtype=DISK

 

sql statement: alter system archive log current

 

Starting backup at 2015-04-02 10:22:35

channel c1: starting full datafile backupset

channel c1: specifying datafile(s) in backupset

including standby control file in backupset

channel c1: starting piece 1 at 2015-04-02 10:22:37

channel c1: finished piece 1 at 2015-04-02 10:22:38

piece handle=/u04/backup/control_0iq3c67d_1_1 tag=TAG20150402T102235 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:01

Finished backup at 2015-04-02 10:22:38

 

Starting backup at 2015-04-02 10:22:39

channel c1: starting full datafile backupset

channel c1: specifying datafile(s) in backupset

input datafile fno=00001 name=/u04/oradata/oradg10g/system01.dbf

input datafile fno=00002 name=/u04/oradata/oradg10g/undotbs01.dbf

input datafile fno=00004 name=/u04/oradata/oradg10g/users01.dbf

channel c1: starting piece 1 at 2015-04-02 10:22:39

channel c2: starting full datafile backupset

channel c2: specifying datafile(s) in backupset

input datafile fno=00003 name=/u04/oradata/oradg10g/sysaux01.dbf

input datafile fno=00005 name=/u04/oradata/oradg10g/example01.dbf

input datafile fno=00006 name=/u04/oradata/oradg10g/logmnrtbs1.dbf

channel c2: starting piece 1 at 2015-04-02 10:22:39

channel c2: finished piece 1 at 2015-04-02 10:23:34

piece handle=/u04/backup/oradg_0kq3c67f_1_1_20150402.bak tag=TAG20150402T102239 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:55

channel c1: finished piece 1 at 2015-04-02 10:23:41

piece handle=/u04/backup/oradg_0jq3c67f_1_1_20150402.bak tag=TAG20150402T102239 comment=NONE

channel c1: backup set complete, elapsed time: 00:01:02

Finished backup at 2015-04-02 10:23:41

 

Starting Control File and SPFILE Autobackup at 2015-04-02 10:23:41

piece handle=/u03/app/oracle/flash_recovery_area/ORADG10G/autobackup/2015_04_02/o1_mf_s_875960621_bksb1fov_.bkp comment=NONE

Finished Control File and SPFILE Autobackup at 2015-04-02 10:23:43

 

sql statement: alter system archive log current

 

Starting backup at 2015-04-02 10:23:44

current log archived

channel c1: starting archive log backupset

channel c1: specifying archive log(s) in backup set

input archive log thread=1 sequence=32 recid=76 stamp=875812400

input archive log thread=1 sequence=33 recid=79 stamp=875812544

input archive log thread=1 sequence=34 recid=84 stamp=875814396

input archive log thread=1 sequence=35 recid=88 stamp=875815068

channel c1: starting piece 1 at 2015-04-02 10:23:48

channel c2: starting archive log backupset

channel c2: specifying archive log(s) in backup set

input archive log thread=1 sequence=36 recid=91 stamp=875815820

channel c2: starting piece 1 at 2015-04-02 10:23:48

channel c1: finished piece 1 at 2015-04-02 10:23:55

piece handle=/u04/backup/arch_0mq3c69j_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:08

channel c2: finished piece 1 at 2015-04-02 10:23:55

piece handle=/u04/backup/arch_0nq3c69j_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:08

channel c1: starting archive log backupset

channel c1: specifying archive log(s) in backup set

input archive log thread=1 sequence=37 recid=94 stamp=875816861

channel c1: starting piece 1 at 2015-04-02 10:23:55

channel c2: starting archive log backupset

channel c2: specifying archive log(s) in backup set

input archive log thread=1 sequence=43 recid=110 stamp=875816891

input archive log thread=1 sequence=44 recid=113 stamp=875816894

input archive log thread=1 sequence=45 recid=117 stamp=875818035

input archive log thread=1 sequence=46 recid=121 stamp=875871111

channel c2: starting piece 1 at 2015-04-02 10:23:55

channel c1: finished piece 1 at 2015-04-02 10:24:02

piece handle=/u04/backup/arch_0oq3c69r_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:07

channel c2: finished piece 1 at 2015-04-02 10:24:02

piece handle=/u04/backup/arch_0pq3c69r_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:07

channel c1: starting archive log backupset

channel c1: specifying archive log(s) in backup set

input archive log thread=1 sequence=47 recid=122 stamp=875874498

input archive log thread=1 sequence=48 recid=125 stamp=875877458

input archive log thread=1 sequence=49 recid=130 stamp=875885435

channel c1: starting piece 1 at 2015-04-02 10:24:02

channel c2: starting archive log backupset

channel c2: specifying archive log(s) in backup set

input archive log thread=1 sequence=100 recid=279 stamp=875957676

input archive log thread=1 sequence=101 recid=284 stamp=875958087

input archive log thread=1 sequence=102 recid=287 stamp=875958219

input archive log thread=1 sequence=103 recid=290 stamp=875958241

input archive log thread=1 sequence=104 recid=295 stamp=875960555

channel c2: starting piece 1 at 2015-04-02 10:24:02

channel c1: finished piece 1 at 2015-04-02 10:24:05

piece handle=/u04/backup/arch_0qq3c6a2_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:03

channel c2: finished piece 1 at 2015-04-02 10:24:05

piece handle=/u04/backup/arch_0rq3c6a2_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:03

channel c1: starting archive log backupset

channel c1: specifying archive log(s) in backup set

input archive log thread=1 sequence=28 recid=64 stamp=875810398

input archive log thread=1 sequence=29 recid=67 stamp=875810399

input archive log thread=1 sequence=30 recid=70 stamp=875812386

input archive log thread=1 sequence=31 recid=73 stamp=875812396

channel c1: starting piece 1 at 2015-04-02 10:24:05

channel c2: starting archive log backupset

channel c2: specifying archive log(s) in backup set

input archive log thread=1 sequence=8 recid=6 stamp=875791290

input archive log thread=1 sequence=9 recid=7 stamp=875791358

input archive log thread=1 sequence=10 recid=8 stamp=875791358

input archive log thread=1 sequence=11 recid=9 stamp=875797788

input archive log thread=1 sequence=12 recid=11 stamp=875798232

channel c2: starting piece 1 at 2015-04-02 10:24:05

channel c1: finished piece 1 at 2015-04-02 10:24:08

piece handle=/u04/backup/arch_0sq3c6a5_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:03

channel c2: finished piece 1 at 2015-04-02 10:24:08

piece handle=/u04/backup/arch_0tq3c6a5_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:03

channel c1: starting archive log backupset

channel c1: specifying archive log(s) in backup set

input archive log thread=1 sequence=3 recid=1 stamp=875727158

input archive log thread=1 sequence=4 recid=2 stamp=875727778

input archive log thread=1 sequence=5 recid=3 stamp=875729865

input archive log thread=1 sequence=6 recid=4 stamp=875729921

input archive log thread=1 sequence=7 recid=5 stamp=875729921

channel c1: starting piece 1 at 2015-04-02 10:24:09

channel c2: starting archive log backupset

channel c2: specifying archive log(s) in backup set

input archive log thread=1 sequence=18 recid=25 stamp=875804224

input archive log thread=1 sequence=19 recid=27 stamp=875804225

input archive log thread=1 sequence=20 recid=29 stamp=875804229

input archive log thread=1 sequence=21 recid=44 stamp=875808352

input archive log thread=1 sequence=22 recid=47 stamp=875809690

channel c2: starting piece 1 at 2015-04-02 10:24:09

channel c1: finished piece 1 at 2015-04-02 10:24:12

piece handle=/u04/backup/arch_0uq3c6a8_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:04

channel c2: finished piece 1 at 2015-04-02 10:24:13

piece handle=/u04/backup/arch_0vq3c6a8_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:05

channel c1: starting archive log backupset

channel c1: specifying archive log(s) in backup set

input archive log thread=1 sequence=80 recid=221 stamp=875893065

input archive log thread=1 sequence=81 recid=224 stamp=875895017

input archive log thread=1 sequence=82 recid=229 stamp=875901533

input archive log thread=1 sequence=83 recid=231 stamp=875901535

input archive log thread=1 sequence=84 recid=233 stamp=875901535

channel c1: starting piece 1 at 2015-04-02 10:24:13

channel c2: starting archive log backupset

channel c2: specifying archive log(s) in backup set

input archive log thread=1 sequence=55 recid=146 stamp=875885480

input archive log thread=1 sequence=56 recid=149 stamp=875885482

input archive log thread=1 sequence=57 recid=152 stamp=875885484

input archive log thread=1 sequence=58 recid=155 stamp=875885486

input archive log thread=1 sequence=59 recid=158 stamp=875889122

channel c2: starting piece 1 at 2015-04-02 10:24:13

channel c1: finished piece 1 at 2015-04-02 10:24:14

piece handle=/u04/backup/arch_10q3c6ad_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:01

channel c2: finished piece 1 at 2015-04-02 10:24:14

piece handle=/u04/backup/arch_11q3c6ad_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:01

channel c1: starting archive log backupset

channel c1: specifying archive log(s) in backup set

input archive log thread=1 sequence=13 recid=13 stamp=875800253

input archive log thread=1 sequence=14 recid=16 stamp=875801132

input archive log thread=1 sequence=15 recid=19 stamp=875803786

input archive log thread=1 sequence=16 recid=21 stamp=875804199

input archive log thread=1 sequence=17 recid=23 stamp=875804221

channel c1: starting piece 1 at 2015-04-02 10:24:14

channel c2: starting archive log backupset

channel c2: specifying archive log(s) in backup set

input archive log thread=1 sequence=70 recid=187 stamp=875890215

input archive log thread=1 sequence=71 recid=194 stamp=875891562

input archive log thread=1 sequence=72 recid=196 stamp=875891670

input archive log thread=1 sequence=73 recid=200 stamp=875891671

input archive log thread=1 sequence=74 recid=203 stamp=875891676

channel c2: starting piece 1 at 2015-04-02 10:24:14

channel c1: finished piece 1 at 2015-04-02 10:24:15

piece handle=/u04/backup/arch_12q3c6ae_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:01

channel c2: finished piece 1 at 2015-04-02 10:24:15

piece handle=/u04/backup/arch_13q3c6ae_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:01

channel c1: starting archive log backupset

channel c1: specifying archive log(s) in backup set

input archive log thread=1 sequence=90 recid=249 stamp=875901668

input archive log thread=1 sequence=91 recid=251 stamp=875901707

input archive log thread=1 sequence=92 recid=257 stamp=875901807

input archive log thread=1 sequence=93 recid=259 stamp=875901834

input archive log thread=1 sequence=94 recid=261 stamp=875901836

channel c1: starting piece 1 at 2015-04-02 10:24:15

channel c2: starting archive log backupset

channel c2: specifying archive log(s) in backup set

input archive log thread=1 sequence=85 recid=236 stamp=875901538

input archive log thread=1 sequence=86 recid=239 stamp=875901567

input archive log thread=1 sequence=87 recid=243 stamp=875901655

input archive log thread=1 sequence=88 recid=245 stamp=875901656

input archive log thread=1 sequence=89 recid=247 stamp=875901662

channel c2: starting piece 1 at 2015-04-02 10:24:15

channel c1: finished piece 1 at 2015-04-02 10:24:16

piece handle=/u04/backup/arch_14q3c6af_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:01

channel c2: finished piece 1 at 2015-04-02 10:24:16

piece handle=/u04/backup/arch_15q3c6af_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:01

channel c1: starting archive log backupset

channel c1: specifying archive log(s) in backup set

input archive log thread=1 sequence=75 recid=206 stamp=875891677

input archive log thread=1 sequence=76 recid=209 stamp=875892225

input archive log thread=1 sequence=77 recid=211 stamp=875892227

input archive log thread=1 sequence=78 recid=213 stamp=875892232

input archive log thread=1 sequence=79 recid=218 stamp=875892955

channel c1: starting piece 1 at 2015-04-02 10:24:16

channel c2: starting archive log backupset

channel c2: specifying archive log(s) in backup set

input archive log thread=1 sequence=65 recid=176 stamp=875889852

input archive log thread=1 sequence=66 recid=179 stamp=875890067

input archive log thread=1 sequence=67 recid=181 stamp=875890122

input archive log thread=1 sequence=68 recid=183 stamp=875890153

input archive log thread=1 sequence=69 recid=185 stamp=875890213

channel c2: starting piece 1 at 2015-04-02 10:24:16

channel c1: finished piece 1 at 2015-04-02 10:24:17

piece handle=/u04/backup/arch_16q3c6ag_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:01

channel c2: finished piece 1 at 2015-04-02 10:24:17

piece handle=/u04/backup/arch_17q3c6ag_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:01

channel c1: starting archive log backupset

channel c1: specifying archive log(s) in backup set

input archive log thread=1 sequence=60 recid=161 stamp=875889231

input archive log thread=1 sequence=61 recid=164 stamp=875889386

input archive log thread=1 sequence=62 recid=166 stamp=875889559

input archive log thread=1 sequence=63 recid=168 stamp=875889560

input archive log thread=1 sequence=64 recid=170 stamp=875889630

channel c1: starting piece 1 at 2015-04-02 10:24:17

channel c2: starting archive log backupset

channel c2: specifying archive log(s) in backup set

input archive log thread=1 sequence=23 recid=49 stamp=875810391

input archive log thread=1 sequence=24 recid=52 stamp=875810392

input archive log thread=1 sequence=25 recid=55 stamp=875810395

input archive log thread=1 sequence=26 recid=58 stamp=875810396

input archive log thread=1 sequence=27 recid=61 stamp=875810397

channel c2: starting piece 1 at 2015-04-02 10:24:17

channel c1: finished piece 1 at 2015-04-02 10:24:20

piece handle=/u04/backup/arch_18q3c6ah_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:03

channel c2: finished piece 1 at 2015-04-02 10:24:20

piece handle=/u04/backup/arch_19q3c6ah_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:03

channel c1: starting archive log backupset

channel c1: specifying archive log(s) in backup set

input archive log thread=1 sequence=95 recid=263 stamp=875901836

input archive log thread=1 sequence=96 recid=265 stamp=875901837

input archive log thread=1 sequence=97 recid=266 stamp=875901837

input archive log thread=1 sequence=98 recid=275 stamp=875901896

input archive log thread=1 sequence=99 recid=278 stamp=875957108

channel c1: starting piece 1 at 2015-04-02 10:24:21

channel c2: starting archive log backupset

channel c2: specifying archive log(s) in backup set

input archive log thread=1 sequence=50 recid=131 stamp=875885435

input archive log thread=1 sequence=51 recid=134 stamp=875885442

input archive log thread=1 sequence=52 recid=137 stamp=875885476

input archive log thread=1 sequence=53 recid=140 stamp=875885477

input archive log thread=1 sequence=54 recid=143 stamp=875885479

channel c2: starting piece 1 at 2015-04-02 10:24:21

channel c1: finished piece 1 at 2015-04-02 10:24:22

piece handle=/u04/backup/arch_1aq3c6ak_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:02

channel c2: finished piece 1 at 2015-04-02 10:24:22

piece handle=/u04/backup/arch_1bq3c6ak_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:02

channel c1: starting archive log backupset

channel c1: specifying archive log(s) in backup set

input archive log thread=1 sequence=105 recid=296 stamp=875960624

input archive log thread=1 sequence=106 recid=299 stamp=875960624

channel c1: starting piece 1 at 2015-04-02 10:24:22

channel c2: starting archive log backupset

channel c2: specifying archive log(s) in backup set

input archive log thread=1 sequence=38 recid=95 stamp=875816861

input archive log thread=1 sequence=39 recid=98 stamp=875816867

input archive log thread=1 sequence=40 recid=101 stamp=875816889

input archive log thread=1 sequence=41 recid=104 stamp=875816890

input archive log thread=1 sequence=42 recid=107 stamp=875816891

channel c2: starting piece 1 at 2015-04-02 10:24:22

channel c1: finished piece 1 at 2015-04-02 10:24:22

piece handle=/u04/backup/arch_1cq3c6am_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:00

channel c2: finished piece 1 at 2015-04-02 10:24:23

piece handle=/u04/backup/arch_1dq3c6am_1_1_20150402.bak tag=TAG20150402T102344 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:01

Finished backup at 2015-04-02 10:24:23

 

Starting Control File and SPFILE Autobackup at 2015-04-02 10:24:23

piece handle=/u03/app/oracle/flash_recovery_area/ORADG10G/autobackup/2015_04_02/o1_mf_s_875960663_bksb2qyv_.bkp comment=NONE

Finished Control File and SPFILE Autobackup at 2015-04-02 10:24:25

 

sql statement: alter database create standby controlfile as ''/u04/backup/control01.ctl'' reuse

 

released channel: c2

 

released channel: c1

 

RMAN>

 

 

 

备份过程中的告警日志:

Thu Apr  2 10:22:34 2015

ALTER SYSTEM ARCHIVE LOG

Thu Apr  2 10:22:34 2015

Thread 1 advanced to log sequence 105 (LGWR switch)

  Current log# 3 seq# 105 mem# 0: /u04/oradata/oradg10g/redo03.log

Thu Apr  2 10:22:34 2015

LNS: Standby redo logfile selected for thread 1 sequence 105 for destination LOG_ARCHIVE_DEST_3

Thu Apr  2 10:22:34 2015

LNS: Standby redo logfile selected for thread 1 sequence 105 for destination LOG_ARCHIVE_DEST_2

Thu Apr  2 10:22:37 2015

Clearing standby activation ID 1480716819 (0x5841f213)

The primary database controlfile was created using the

'MAXLOGFILES 16' clause.

There is space for up to 13 standby redo logfiles

Use the following SQL commands on the standby database to create

standby redo logfiles that match the primary database:

ALTER DATABASE ADD STANDBY LOGFILE 'srl1.f' SIZE 52428800;

ALTER DATABASE ADD STANDBY LOGFILE 'srl2.f' SIZE 52428800;

ALTER DATABASE ADD STANDBY LOGFILE 'srl3.f' SIZE 52428800;

ALTER DATABASE ADD STANDBY LOGFILE 'srl4.f' SIZE 52428800;

Thu Apr  2 10:23:41 2015

Starting control autobackup

Control autobackup written to DISK device

        handle '/u03/app/oracle/flash_recovery_area/ORADG10G/autobackup/2015_04_02/o1_mf_s_875960621_bksb1fov_.bkp'

Thu Apr  2 10:23:44 2015

ALTER SYSTEM ARCHIVE LOG

Thu Apr  2 10:23:44 2015

Thread 1 advanced to log sequence 106 (LGWR switch)

  Current log# 1 seq# 106 mem# 0: /u04/oradata/oradg10g/redo01.log

Thu Apr  2 10:23:44 2015

ALTER SYSTEM ARCHIVE LOG

Thu Apr  2 10:23:44 2015

LNS: Standby redo logfile selected for thread 1 sequence 106 for destination LOG_ARCHIVE_DEST_3

Thu Apr  2 10:23:44 2015

Thread 1 advanced to log sequence 107 (LGWR switch)

  Current log# 2 seq# 107 mem# 0: /u04/oradata/oradg10g/redo02.log

Thu Apr  2 10:23:44 2015

LNS: Standby redo logfile selected for thread 1 sequence 106 for destination LOG_ARCHIVE_DEST_2

LNS: Standby redo logfile selected for thread 1 sequence 107 for destination LOG_ARCHIVE_DEST_2

Thu Apr  2 10:23:46 2015

LNS: Standby redo logfile selected for thread 1 sequence 107 for destination LOG_ARCHIVE_DEST_3

Thu Apr  2 10:24:23 2015

Starting control autobackup

Control autobackup written to DISK device

        handle '/u03/app/oracle/flash_recovery_area/ORADG10G/autobackup/2015_04_02/o1_mf_s_875960663_bksb2qyv_.bkp'

Thu Apr  2 10:24:27 2015

alter database create standby controlfile as '/u04/backup/control01.ctl' reuse

Thu Apr  2 10:24:27 2015

Clearing standby activation ID 1480716819 (0x5841f213)

The primary database controlfile was created using the

'MAXLOGFILES 16' clause.

There is space for up to 13 standby redo logfiles

Use the following SQL commands on the standby database to create

standby redo logfiles that match the primary database:

ALTER DATABASE ADD STANDBY LOGFILE 'srl1.f' SIZE 52428800;

ALTER DATABASE ADD STANDBY LOGFILE 'srl2.f' SIZE 52428800;

ALTER DATABASE ADD STANDBY LOGFILE 'srl3.f' SIZE 52428800;

ALTER DATABASE ADD STANDBY LOGFILE 'srl4.f' SIZE 52428800;

Completed: alter database create standby controlfile as '/u04/backup/control01.ctl' reuse

 

 

一.1.1.4  修改主库参数文件 

--使用下面的命令修改主库参数(此时主库应当使用spfile启动参数) 

--修改primary端参数,加入归档日志传输、文件自动管理和命名转换参数

一、 原主库参数文件

[oracle@rhel6_lhr dbs]$ more initoradg10g.ora

oradg10g.__db_cache_size=310378496

oradg10g.__java_pool_size=4194304

oradg10g.__large_pool_size=4194304

oradg10g.__shared_pool_size=121634816

oradg10g.__streams_pool_size=0

*.audit_file_dest='/u03/app/oracle/admin/oradg10g/adump'

*.background_dump_dest='/u03/app/oracle/admin/oradg10g/bdump'

*.compatible='10.2.0.3.0'

*.control_files='/u04/oradata/oradg10g/control01.ctl','/u04/oradata/oradg10g/control02.ctl','/u04/oradata/oradg10g/control03.ctl'

*.core_dump_dest='/u03/app/oracle/admin/oradg10g/cdump'

*.db_block_size=8192

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_file_name_convert='oradg10g','orawldg'

*.db_name='oradg10g'

*.db_recovery_file_dest='/u03/app/oracle/flash_recovery_area'

*.db_recovery_file_dest_size=2147483648

*.db_unique_name='oradg10g'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=oradg10gXDB)'

*.fal_client='oradg10g'

*.fal_server='orawldg'

*.job_queue_processes=10

*.log_archive_config='DG_CONFIG=(oradg10g,orawldg,oraljdg)'

*.log_archive_dest_1='LOCATION=/u04/arch/oradg10g db_unique_name=oradg10g valid_for=(ALL_LOGFILES,ALL_ROLES)'

*.log_archive_dest_2='SERVICE=orawldg LGWR ASYNC db_unique_name=orawldg valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)'

*.log_archive_dest_3='SERVICE=oraljdg LGWR ASYNC db_unique_name=oraljdg valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)'

*.log_archive_dest_state_1='ENABLE'

*.log_archive_dest_state_2='enable'

*.log_archive_dest_state_3='enable'

*.log_archive_format='log_oradg10g_%d_%t_%s_%r.arc'

*.log_archive_max_processes=4

*.log_file_name_convert='oradg10g','orawldg'

*.open_cursors=300

*.pga_aggregate_target=112197632

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.sga_target=448790528

*.standby_file_management='AUTO'

*.undo_management='AUTO'

*.undo_tablespace='UNDOTBS1'

*.user_dump_dest='/u03/app/oracle/admin/oradg10g/udump'

[oracle@rhel6_lhr dbs]$

 

 

二、 修改后主库参数文件

 

alter system set log_archive_config='DG_CONFIG=(oradg10g,orawldg,oraljdg,orawldg2)'; 

alter system set log_archive_dest_4='SERVICE=tns_orawldg2 LGWR ASYNC db_unique_name=orawldg2 valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)';

alter system set log_archive_dest_state_4=enable; 

alter system set log_archive_max_processes=6

 

[oracle@rhel6_lhr dbs]$ more initoradg10g.ora

oradg10g.__db_cache_size=310378496

oradg10g.__java_pool_size=4194304

oradg10g.__large_pool_size=4194304

oradg10g.__shared_pool_size=121634816

oradg10g.__streams_pool_size=0

*.audit_file_dest='/u03/app/oracle/admin/oradg10g/adump'

*.background_dump_dest='/u03/app/oracle/admin/oradg10g/bdump'

*.compatible='10.2.0.3.0'

*.control_files='/u04/oradata/oradg10g/control01.ctl','/u04/oradata/oradg10g/control02.ctl','/u04/oradata/oradg10g/control03.ctl'

*.core_dump_dest='/u03/app/oracle/admin/oradg10g/cdump'

*.db_block_size=8192

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_file_name_convert='oradg10g','orawldg'

*.db_name='oradg10g'

*.db_recovery_file_dest='/u03/app/oracle/flash_recovery_area'

*.db_recovery_file_dest_size=2147483648

*.db_unique_name='oradg10g'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=oradg10gXDB)'

*.fal_client='oradg10g'

*.fal_server='orawldg'

*.job_queue_processes=10

*.log_archive_config='DG_CONFIG=(oradg10g,orawldg,oraljdg,orawldg2)'

*.log_archive_dest_1='LOCATION=/u04/arch/oradg10g db_unique_name=oradg10g valid_for=(ALL_LOGFILES,ALL_ROLES)'

*.log_archive_dest_2='SERVICE=orawldg LGWR ASYNC db_unique_name=orawldg valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)'

*.log_archive_dest_3='SERVICE=oraljdg LGWR ASYNC db_unique_name=oraljdg valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)'

*.log_archive_dest_4='SERVICE=tns_orawldg2 LGWR ASYNC db_unique_name=orawldg2 valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)'

*.log_archive_dest_state_1='ENABLE'

*.log_archive_dest_state_2='enable'

*.log_archive_dest_state_3='enable'

*.log_archive_dest_state_4='ENABLE'

*.log_archive_format='log_oradg10g_%d_%t_%s_%r.arc'

*.log_archive_max_processes=6

*.log_file_name_convert='oradg10g','orawldg'

*.open_cursors=300

*.pga_aggregate_target=112197632

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.sga_target=448790528

*.standby_file_management='AUTO'

*.undo_management='AUTO'

*.undo_tablespace='UNDOTBS1'

*.user_dump_dest='/u03/app/oracle/admin/oradg10g/udump'

 

 

1.1.5  配置备库密码文件及参数文件 

 

--由于要求主库与备库sys使用相同的密码,在此处,我们直接复制了主库的密码文件到备库而且db_name必须相同

[oracle@rhel6_lhr dbs]$ cp $ORACLE_HOME/dbs/orapworadg10g $ORACLE_HOME/dbs/orapworawldg2

[oracle@rhel6_lhr dbs]$

 

 

[oracle@rhel6_lhr ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 10.2.0.4.0 - Production on Fri Apr 3 09:33:36 2015

 

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

 

 

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

SQL>  create pfile='?/dbs/initorawldg2.ora' from spfile;

 

File created.

 

SQL>

 

 

mkdir -p /u03/app/oracle/admin/orawldg2/adump

mkdir -p /u03/app/oracle/admin/orawldg2/bdump

mkdir -p /u03/app/oracle/admin/orawldg2/cdump

mkdir -p /u03/app/oracle/admin/orawldg2/udump

 

[oracle@rhel6_lhr dbs]$ mkdir -p /u03/app/oracle/admin/orawldg2/adump

[oracle@rhel6_lhr dbs]$ mkdir -p /u03/app/oracle/admin/orawldg2/bdump

[oracle@rhel6_lhr dbs]$ mkdir -p /u03/app/oracle/admin/orawldg2/cdump

[oracle@rhel6_lhr dbs]$ mkdir -p /u03/app/oracle/admin/orawldg2/udump

[oracle@rhel6_lhr dbs]$

 

 

一、 配置新物理备库节点参数文件

 

--红色字体是需要创建相关路径或修改相关路径

--黄色背景是需要注意的地方

 

 

[oracle@rhel6_lhr dbs]$ more initorawldg2.ora

*.audit_file_dest='/u03/app/oracle/admin/orawldg2/adump'

*.background_dump_dest='/u03/app/oracle/admin/orawldg2/bdump'

*.compatible='10.2.0.3.0'

*.control_files='/u04/oradata/orawldg2/control01.ctl','/u04/oradata/orawldg2/control02.ctl','/u04/oradata/orawldg2/control03.ctl'

*.core_dump_dest='/u03/app/oracle/admin/orawldg2/cdump'

*.db_block_size=8192

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_file_name_convert='oradg10g','orawldg2'

*.db_name='oradg10g'

*.db_recovery_file_dest='/u03/app/oracle/flash_recovery_area'

*.db_recovery_file_dest_size=2147483648

*.db_unique_name='orawldg2'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=oradg10gXDB)'

*.fal_client='orawldg2'

*.fal_server='oradg10g'

*.job_queue_processes=10

*.log_archive_config='DG_CONFIG=(oradg10g,orawldg,oraljdg,orawldg2)'

*.log_archive_dest_1='LOCATION=/u04/arch/orawldg2 db_unique_name=orawldg2 valid_for=(ALL_LOGFILES,ALL_ROLES)'

*.log_archive_dest_state_1='ENABLE'

*.log_archive_format='log_orawldg2_%d_%t_%s_%r.arc'

*.log_archive_max_processes=6

*.log_file_name_convert='oradg10g','orawldg2'

*.open_cursors=300

*.pga_aggregate_target=112197632

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.sga_target=448790528

*.standby_file_management='AUTO'

*.undo_management='AUTO'

*.undo_tablespace='UNDOTBS1'

*.user_dump_dest='/u03/app/oracle/admin/orawldg2/udump'

 

 

 

二、 创建新物理备库节点的相关路径

mkdir -p /u03/app/oracle/admin/orawldg2/adump

mkdir -p /u03/app/oracle/admin/orawldg2/bdump

mkdir -p /u03/app/oracle/admin/orawldg2/cdump

mkdir -p /u03/app/oracle/admin/orawldg2/udump

mkdir -p /u04/oradata/orawldg2/

mkdir -p /u04/arch/orawldg2

 

 

 

 

三、 控制文件

按照参数文件中的定义将控制文件拷贝到相关路径:

 

---拷贝物理备库控制文件

[oracle@rhel6_lhr backup]$ cp /u04/backup/control01.ctl /u04/oradata/orawldg2/control01.ctl

[oracle@rhel6_lhr backup]$ cp /u04/backup/control01.ctl /u04/oradata/orawldg2/control02.ctl

[oracle@rhel6_lhr backup]$ cp /u04/backup/control01.ctl /u04/oradata/orawldg2/control03.ctl

[oracle@rhel6_lhr backup]$

 

 

 

1.1.6  搭建新物理备库节点

 

[oracle@rhel6_lhr ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 10.2.0.4.0 - Production on Fri Apr 3 09:46:00 2015

 

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

 

Connected to an idle instance.

 

SQL> create spfile from pfile='?/dbs/initorawldg2.ora';

 

File created.

 

SQL> startup nomount;

ORACLE instance started.

 

Total System Global Area  448790528 bytes

Fixed Size                  2084616 bytes

Variable Size             130023672 bytes

Database Buffers          310378496 bytes

Redo Buffers                6303744 bytes

SQL> alter database mount standby database;

 

Database altered.

 

SQL> exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

 

[oracle@rhel6_lhr ~]$ rman target /

 

Recovery Manager: Release 10.2.0.4.0 - Production on Fri Apr 3 09:49:03 2015

 

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

 

connected to target database: ORADG10G (DBID=1480747539, not open)

 

RMAN> restore database;

 

Starting restore at 2015-04-03 09:49:09

Starting implicit crosscheck backup at 2015-04-03 09:49:09

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=149 devtype=DISK

Crosschecked 29 objects

Finished implicit crosscheck backup at 2015-04-03 09:49:12

 

Starting implicit crosscheck copy at 2015-04-03 09:49:12

using channel ORA_DISK_1

Crosschecked 1 objects

Finished implicit crosscheck copy at 2015-04-03 09:49:12

 

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 00003 to /u04/oradata/orawldg2/sysaux01.dbf

restoring datafile 00005 to /u04/oradata/orawldg2/example01.dbf

restoring datafile 00006 to /u04/oradata/orawldg2/logmnrtbs1.dbf

channel ORA_DISK_1: reading from backup piece /u04/backup/oradg_0kq3c67f_1_1_20150402.bak

channel ORA_DISK_1: restored backup piece 1

piece handle=/u04/backup/oradg_0kq3c67f_1_1_20150402.bak tag=TAG20150402T102239

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

channel ORA_DISK_1: starting datafile backupset restore

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

restoring datafile 00001 to /u04/oradata/orawldg2/system01.dbf

restoring datafile 00002 to /u04/oradata/orawldg2/undotbs01.dbf

restoring datafile 00004 to /u04/oradata/orawldg2/users01.dbf

channel ORA_DISK_1: reading from backup piece /u04/backup/oradg_0jq3c67f_1_1_20150402.bak

channel ORA_DISK_1: restored backup piece 1

piece handle=/u04/backup/oradg_0jq3c67f_1_1_20150402.bak tag=TAG20150402T102239

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

Finished restore at 2015-04-03 09:49:57

 

RMAN>

 

 

 

 

-----告警日志

Fri Apr  3 09:48:17 2015

Physical Standby Database mounted.

Completed: alter database mount standby database

Fri Apr  3 09:49:17 2015

Full restore complete of datafile 6 /u04/oradata/orawldg2/logmnrtbs1.dbf.  Elapsed time: 0:00:01

  checkpoint is 774792

Full restore complete of datafile 5 /u04/oradata/orawldg2/example01.dbf.  Elapsed time: 0:00:05

  checkpoint is 774792

  last deallocation scn is 617217

Fri Apr  3 09:49:27 2015

Full restore complete of datafile 3 /u04/oradata/orawldg2/sysaux01.dbf.  Elapsed time: 0:00:08

  checkpoint is 774792

  last deallocation scn is 681458

Full restore complete of datafile 2 /u04/oradata/orawldg2/undotbs01.dbf.  Elapsed time: 0:00:01

  checkpoint is 774791

  last deallocation scn is 728954

Full restore complete of datafile 4 /u04/oradata/orawldg2/users01.dbf.  Elapsed time: 0:00:04

  checkpoint is 774791

Fri Apr  3 09:49:55 2015

Full restore complete of datafile 1 /u04/oradata/orawldg2/system01.dbf.  Elapsed time: 0:00:16

  checkpoint is 774791

  last deallocation scn is 682364

Fri Apr  3 09:51:35 2015

Using STANDBY_ARCHIVE_DEST parameter default value as /u04/arch/orawldg2

Redo Shipping Client Connected as PUBLIC

-- Connected User is Valid

RFS[1]: Assigned to RFS process 34780

RFS[1]: Identified database type as 'physical standby'

Fri Apr  3 09:51:35 2015

RFS LogMiner: Client disabled from further notification

 

 

 

 

 

一、 启用实时应用校验结果

 

 

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

 

Database altered.

 

 

SQL>  show parameter name

 

NAME                                 TYPE        VALUE

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

db_file_name_convert                 string      oradg10g, orawldg2

db_name                              string      oradg10g

db_unique_name                       string      orawldg2

global_names                         boolean     FALSE

instance_name                        string      orawldg2

lock_name_space                      string

log_file_name_convert                string      oradg10g, orawldg2

service_names                        string      orawldg2

SQL>                     string      orawldg

 

 

 

 

---主库多切换几次日志 alter system switch logfile;

 

---备库read only打开:

SQL> alter database recover managed standby database cancel;

 

Database altered.

 

SQL> alter database open;

 

Database altered.

 

SQL>

 

 

查看后续的告警日志,如果standby logfile

没有的话就需要为物理备库添加standby log,该步骤可选:

SQL> alter database drop standby logfile group 4;

SQL> alter database drop standby logfile group 5;

SQL> alter database drop standby logfile group 6;

SQL> alter database drop standby logfile group 7;

 

 

alter database recover managed standby database cancel;

alter database add standby logfile

group 4 ('/u04/oradata/orawldg2/standby_redo04.log') size 50m,

group 5 ('/u04/oradata/orawldg2/standby_redo05.log') size 50m,

group 6 ('/u04/oradata/orawldg2/standby_redo06.log') size 50m,

group 7 ('/u04/oradata/orawldg2/standby_redo07.log') size 50m;

alter database recover managed standby database using current logfile disconnect from session;

 

 

--告警日志

Fri Apr  3 09:55:54 2015

alter database recover managed standby database using current logfile disconnect from session

Fri Apr  3 09:55:54 2015

Attempt to start background Managed Standby Recovery process (orawldg2)

MRP0 started with pid=22, OS id=35010

Fri Apr  3 09:55:54 2015

MRP0: Background Managed Standby Recovery process started (orawldg2)

Managed Standby Recovery starting Real Time Apply

parallel recovery started with 2 processes

Fri Apr  3 09:55:59 2015

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

Fri Apr  3 09:55:59 2015

Errors in file /u03/app/oracle/admin/orawldg2/bdump/orawldg2_mrp0_35010.trc:

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

ORA-00312: online log 1 thread 1: '/u04/oradata/orawldg2/redo01.log'

ORA-27037: unable to obtain file status

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

Additional information: 3

Fri Apr  3 09:55:59 2015

Errors in file /u03/app/oracle/admin/orawldg2/bdump/orawldg2_mrp0_35010.trc:

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

ORA-00312: online log 1 thread 1: '/u04/oradata/orawldg2/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 /u04/oradata/orawldg2/redo01.log

Clearing online log 1 of thread 1 sequence number 106

Fri Apr  3 09:55:59 2015

Errors in file /u03/app/oracle/admin/orawldg2/bdump/orawldg2_mrp0_35010.trc:

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

ORA-00312: online log 1 thread 1: '/u04/oradata/orawldg2/redo01.log'

ORA-27037: unable to obtain file status

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

Additional information: 3

Fri Apr  3 09:56:00 2015

Completed: alter database recover managed standby database using current logfile disconnect from session

Fri Apr  3 09:56:01 2015

Clearing online redo logfile 1 complete

Fri Apr  3 09:56:01 2015

Errors in file /u03/app/oracle/admin/orawldg2/bdump/orawldg2_mrp0_35010.trc:

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

ORA-00312: online log 2 thread 1: '/u04/oradata/orawldg2/redo02.log'

ORA-27037: unable to obtain file status

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

Additional information: 3

Fri Apr  3 09:56:01 2015

Errors in file /u03/app/oracle/admin/orawldg2/bdump/orawldg2_mrp0_35010.trc:

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

ORA-00312: online log 2 thread 1: '/u04/oradata/orawldg2/redo02.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 2 /u04/oradata/orawldg2/redo02.log

Clearing online log 2 of thread 1 sequence number 107

Fri Apr  3 09:56:01 2015

Errors in file /u03/app/oracle/admin/orawldg2/bdump/orawldg2_mrp0_35010.trc:

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

ORA-00312: online log 2 thread 1: '/u04/oradata/orawldg2/redo02.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 2 complete

Fri Apr  3 09:56:01 2015

Errors in file /u03/app/oracle/admin/orawldg2/bdump/orawldg2_mrp0_35010.trc:

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

ORA-00312: online log 3 thread 1: '/u04/oradata/orawldg2/redo03.log'

ORA-27037: unable to obtain file status

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

Additional information: 3

Fri Apr  3 09:56:01 2015

Errors in file /u03/app/oracle/admin/orawldg2/bdump/orawldg2_mrp0_35010.trc:

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

ORA-00312: online log 3 thread 1: '/u04/oradata/orawldg2/redo03.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 3 /u04/oradata/orawldg2/redo03.log

Clearing online log 3 of thread 1 sequence number 105

Fri Apr  3 09:56:01 2015

Errors in file /u03/app/oracle/admin/orawldg2/bdump/orawldg2_mrp0_35010.trc:

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

ORA-00312: online log 3 thread 1: '/u04/oradata/orawldg2/redo03.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 3 complete

Media Recovery Waiting for thread 1 sequence 105

Fetching gap sequence in thread 1, gap sequence 105-105

 

 

以只读方式打开数据库,oracle知道我们在备用数据库控制文件中进行装载,所以当打开数据时,他将自动置于只读模式。

 

----告警日志

Tue Mar 31 14:18:11 2015

alter database open

Tue Mar 31 14:18:11 2015

SMON: enabling cache recovery

Tue Mar 31 14:18:12 2015

Re-creating tempfile /u04/oradata/orawldg/temp01.dbf

Database Characterset is ZHS16GBK

Opening with internal Resource Manager plan

where NUMA PG = 1, CPUs = 2

replication_dependency_tracking turned off (no async multimaster replication found)

Physical standby database opened for read only access.

Completed: alter database open

 

 

SQL> select * from v$log;

 

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM

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

         1          1        109   52428800          1 YES CLEARING_CURRENT        789160 03-APR-15

         2          1        107   52428800          1 YES CLEARING                774840 02-APR-15

         3          1        108   52428800          1 YES CLEARING                789080 03-APR-15

 

SQL>

 

 

SQL> select * from v$standby_log;

 

    GROUP# DBID                                        THREAD#  SEQUENCE#      BYTES       USED ARC STATUS     FIRST_CHANGE# FIRST_TIM LAST_CHANGE# LAST_TIME

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

         4 1480747539                                        1        109   52428800     132608 YES ACTIVE            789160 03-APR-15       789363 03-APR-15

         5 UNASSIGNED                                        1          0   52428800        512 NO  UNASSIGNED             0                      0

         6 UNASSIGNED                                        0          0   52428800        512 YES UNASSIGNED             0                      0

         7 UNASSIGNED                                        0          0   52428800        512 YES UNASSIGNED             0                      0

 

SQL>

 

SQL> archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            /u04/arch/orawldg2

Oldest online log sequence     107

Next log sequence to archive   0

Current log sequence           109

SQL>

 

SQL> select dbid,name,current_scn,protection_mode,protection_level,database_role,force_logging,open_mode,switchover_status from v$database;

 

      DBID NAME      CURRENT_SCN PROTECTION_MODE      PROTECTION_LEVEL     DATABASE_ROLE    FOR OPEN_MODE  SWITCHOVER_STATUS

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

1480747539 ORADG10G       789159 MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE  PHYSICAL STANDBY YES READ ONLY  NOT ALLOWED

 

SQL>

 

 

 

为了实时查询,启用管理恢复open状态下执行后,数据库将自动由open变为mount状态

 

SQL> alter database recover managed standby database using current logfile disconnect;

 

Database altered.

 

SQL> select dbid,name,current_scn,protection_mode,protection_level,database_role,force_logging,open_mode,switchover_status from v$database;

 

      DBID NAME      CURRENT_SCN PROTECTION_MODE      PROTECTION_LEVEL     DATABASE_ROLE    FOR OPEN_MODE  SWITCHOVER_STATUS

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

1480747539 ORADG10G       789159 MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE  PHYSICAL STANDBY YES MOUNTED    SESSIONS ACTIVE

 

SQL>

 

 

 

 

-----查看主库的LNS进程是否启动

SQL> col group_# format a5

SQL> set line 9999 pagesize 9999

SQL> SELECT a.PROCESS,

  2         a.PID,

  3         a.STATUS,

  4         a.GROUP# group_#,

  5         a.SEQUENCE#,

  6         a.DELAY_MINS,

  7         a.RESETLOG_ID,

  8         c.SID,

  9         c.SERIAL#

10    FROM V$MANAGED_STANDBY a,v$process b,v$session c

11  WHERE a.PID=b.SPID

12  and b.ADDR=c.PADDR;

 

PROCESS          PID STATUS       GROUP  SEQUENCE# DELAY_MINS RESETLOG_ID        SID    SERIAL#

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

ARCH           33570 OPENING      N/A          106          0   875726293        139         20

ARCH            5602 OPENING      N/A          106          0   875726293        155          3

ARCH            5604 CLOSING      2            107          0   875726293        156          3

ARCH            5606 CLOSING      N/A          107          0   875726293        154          1

ARCH            5608 CLOSING      3            108          0   875726293        153          1

LNS             5610 WRITING      1            109          0   875726293        152          1

LNS             5620 WRITING      1            109          0   875726293        151          1

ARCH           33572 OPENING      N/A          106          0   875726293        138         58

LNS            36346 WRITING      1            109          0   875726293        135         70

 

---------查看物理备库的FRS和MRP进程是否启动

 

SQL> col group_# format a5

SQL> set line 9999 pagesize 9999

SQL> SELECT a.PROCESS,

  2         a.PID,

  3         a.STATUS,

  4         a.GROUP# group_#,

  5         a.SEQUENCE#,

  6         a.DELAY_MINS,

  7         a.RESETLOG_ID,

  8         c.SID,

  9         c.SERIAL#

10    FROM V$MANAGED_STANDBY a,v$process b,v$session c

11  WHERE a.PID=b.SPID

12  and b.ADDR=c.PADDR;

 

PROCESS          PID STATUS       GROUP  SEQUENCE# DELAY_MINS RESETLOG_ID        SID    SERIAL#

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

ARCH           35364 CONNECTED    N/A            0          0           0        156          1

ARCH           35366 CONNECTED    N/A            0          0           0        155          1

ARCH           35368 CONNECTED    N/A            0          0           0        154          1

ARCH           35370 CLOSING      5            107          0   875726293        153          1

ARCH           35372 CONNECTED    N/A            0          0           0        152          1

ARCH           35374 CLOSING      4            108          0   875726293        151          1

RFS            36348 IDLE         1            109          0   875726293        149         27

RFS            36350 IDLE         N/A            0          0           0        159         16

RFS            36358 IDLE         N/A            0          0           0        158         22

MRP0           36840 APPLYING_LOG N/A          109          0   875726293        162          3

 

10 rows selected.

 

 

 

至此,物理备库节点搭建完成。

 

 

 

 

 

...........................................................................................................................................................................................

本文作者:小麦苗,只专注于数据库的技术,更注重技术的运用

ITPUB BLOG:http://blog.itpub.net/26736162

本文地址:http://blog.itpub.net/26736162/viewspace-1484878/

QQ:642808185 注明:ITPUB的文章标题

...........................................................................................................................................................................................

 

目录
相关文章
|
数据库
备库数据文件异常,物理DG如何恢复?
备库数据文件异常,物理DG如何恢复?
255 0
|
SQL 数据库 数据安全/隐私保护
|
存储 块存储
逻辑备份和物理备份简单理解
数据备份是为了尽可能快地全盘恢复运行计算机系统所需的数据和系统信息,它不仅在网络系统硬件故障或人为失误时起到保护作用,同时能在集群环境下失效切换之后备机能够正常接管关键业务的基础。当然,数据备份也是系统灾难恢复的前提之一。
8693 0
|
SQL Oracle 关系型数据库
【DATAGUARD】物理dg配置客户端无缝切换 (八.3)--客户端TAF 配置
【DATAGUARD】物理dg配置客户端无缝切换 (八.3)--客户端TAF 配置 1.1  BLOG文档结构图       1.
1380 0
|
SQL 监控 Oracle
【DATAGUARD】物理dg在主库丢失归档文件的情况下的恢复(七)
【DATAGUARD】物理dg在主库丢失归档文件的情况下的恢复(七) 一.1  BLOG文档结构图     一.
1444 0