RAC+DG搭建过程

环境描述


  节点1 节点2
Public IP 192.168.77.185 192.168.77.186
Private IP 192.168.56.101 192.168.56.102
VIP 192.168.77.187 192.168.77.188
scan IP 192.168.77.189  
     
备库IP  192.168.77.190  
     

配置RAC+DG的过程简述

(1)RMAN备份主库(全库备份,包括归档日志)。将RMAN备份,pfile参数文件,密码文件,standby控制文件拷贝至备库。

(2)在备库修改pfile参数文件,用RMAN在nomount状态下恢复standby控制文件,mount状态恢复数据库。

(3)备库开启日志应用

(4)修改主库参数(为failover或switchover准备)


具体步骤

(0)前期检查,查看数据库监听情况,及tnsnames.ora配置。

[oracle@racnode1 ~]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/
[oracle@racnode1 admin]$ ls
samples  shrept.lst  tnsnames.ora
[oracle@racnode1 admin]$ cat tnsnames.ora 
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

RACDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = racnode-cluster-scan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = RACDB)
    )
  )

[oracle@racnode1 admin]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 24-AUG-2015 13:22:18

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                23-AUG-2015 18:58:20
Uptime                    0 days 18 hr. 23 min. 58 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/racnode1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.77.185)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.77.187)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "RACDB" has 1 instance(s).
  Instance "RACDB_1", status READY, has 1 handler(s) for this service...
Service "RACDBXDB" has 1 instance(s).
  Instance "RACDB_1", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@racnode1 admin]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Aug 24 13:22:33 2015

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> show parameter service

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      RACDB
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
[oracle@racnode1 admin]$ mkdir /rmanbak
mkdir: cannot create directory `/rmanbak': Permission denied
[oracle@racnode1 admin]$ exit
logout



(1)将RAC主库修改为归档模式,并开启force logging模式。

由于事先已经将数据库置为归档模式,故在此只需要修改force logging模式即可。


[oracle@racnode1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Aug 24 13:13:57 2015

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> alter database force logging;

Database altered.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

(2)主库全备,创建standby control file,生成pfile文件,复制密码文件。然后将准备好的所有文件复制到备库所在目录(最好对应主库的备份目录,方便RMAN恢复。)


[root@racnode1 ~]# mkdir /rmanbak
[root@racnode1 ~]# chown oracle:oinstall /rmanbak/
[root@racnode1 ~]# su - oracle
[oracle@racnode1 ~]$ rman target / 

Recovery Manager: Release 11.2.0.3.0 - Production on Mon Aug 24 13:27:15 2015

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: RACDB (DBID=883515518)
                                                                                         <span style="color:#ff0000;"><strong>----------------------备份数据库和归档</strong></span>
RMAN> run {
2> allocate channel c1 type disk;
3> allocate channel c2 type disk;
4> allocate channel c3 type disk;
5> allocate channel c4 type disk;
6> backup database format '/rmanbak/FULL_%U.bak';
7> backup archivelog all format '/rmanbak/ARC_%U.bak';
8> release channel c1;
9> release channel c2;
10> release channel c3;
11> release channel c4;
12> }

released channel: ORA_DISK_1
allocated channel: c1
channel c1: SID=155 instance=RACDB_1 device type=DISK

allocated channel: c2
channel c2: SID=24 instance=RACDB_1 device type=DISK

allocated channel: c3
channel c3: SID=29 instance=RACDB_1 device type=DISK

allocated channel: c4
channel c4: SID=158 instance=RACDB_1 device type=DISK

Starting backup at 24-AUG-15
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00006 name=+DATADG/racdb/datafile/data01.269.886180153
channel c1: starting piece 1 at 24-AUG-15
channel c2: starting full datafile backup set
channel c2: specifying datafile(s) in backup set
input datafile file number=00002 name=+DATADG/racdb/datafile/sysaux.261.885898927
input datafile file number=00005 name=+DATADG/racdb/datafile/users.265.885899091
channel c2: starting piece 1 at 24-AUG-15
channel c3: starting full datafile backup set
channel c3: specifying datafile(s) in backup set
input datafile file number=00003 name=+DATADG/racdb/datafile/undotbs1.262.885898975
input datafile file number=00007 name=+DATADG/racdb/datafile/index01.270.886180183
channel c3: starting piece 1 at 24-AUG-15
channel c4: starting full datafile backup set
channel c4: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATADG/racdb/datafile/system.260.885898771
input datafile file number=00004 name=+DATADG/racdb/datafile/undotbs2.264.885899061
channel c4: starting piece 1 at 24-AUG-15
channel c2: finished piece 1 at 24-AUG-15
piece handle=/rmanbak/FULL_0gqfdgi0_1_1.bak tag=TAG20150824T134016 comment=NONE
channel c2: backup set complete, elapsed time: 00:02:54
channel c2: starting full datafile backup set
channel c2: specifying datafile(s) in backup set
channel c1: finished piece 1 at 24-AUG-15
piece handle=/rmanbak/FULL_0fqfdgi0_1_1.bak tag=TAG20150824T134016 comment=NONE
channel c1: backup set complete, elapsed time: 00:03:29
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel c1: starting piece 1 at 24-AUG-15
channel c3: finished piece 1 at 24-AUG-15
piece handle=/rmanbak/FULL_0hqfdgi0_1_1.bak tag=TAG20150824T134016 comment=NONE
channel c3: backup set complete, elapsed time: 00:03:30
channel c4: finished piece 1 at 24-AUG-15
piece handle=/rmanbak/FULL_0iqfdgi6_1_1.bak tag=TAG20150824T134016 comment=NONE
channel c4: backup set complete, elapsed time: 00:02:48
channel c1: finished piece 1 at 24-AUG-15
piece handle=/rmanbak/FULL_0kqfdgoh_1_1.bak tag=TAG20150824T134016 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:02
including current control file in backup set
channel c2: starting piece 1 at 24-AUG-15
channel c2: finished piece 1 at 24-AUG-15
piece handle=/rmanbak/FULL_0jqfdgni_1_1.bak tag=TAG20150824T134016 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:01
Finished backup at 24-AUG-15

Starting backup at 24-AUG-15
current log archived
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=148 RECID=3 STAMP=888506477
input archived log thread=2 sequence=47 RECID=1 STAMP=888506297
input archived log thread=2 sequence=48 RECID=2 STAMP=888506471
input archived log thread=2 sequence=49 RECID=5 STAMP=888507728
input archived log thread=1 sequence=149 RECID=4 STAMP=888507693
input archived log thread=1 sequence=150 RECID=6 STAMP=888507767
channel c1: starting piece 1 at 24-AUG-15
channel c2: starting archived log backup set
channel c2: specifying archived log(s) in backup set
input archived log thread=2 sequence=50 RECID=8 STAMP=888507794
input archived log thread=1 sequence=151 RECID=7 STAMP=888507769
input archived log thread=1 sequence=152 RECID=11 STAMP=888507797
input archived log thread=2 sequence=51 RECID=9 STAMP=888507796
input archived log thread=2 sequence=52 RECID=10 STAMP=888507797
input archived log thread=2 sequence=53 RECID=13 STAMP=888510307
channel c2: starting piece 1 at 24-AUG-15
channel c3: starting archived log backup set
channel c3: specifying archived log(s) in backup set
input archived log thread=1 sequence=153 RECID=12 STAMP=888510267
input archived log thread=1 sequence=154 RECID=15 STAMP=888516453
input archived log thread=2 sequence=54 RECID=14 STAMP=888516452
channel c3: starting piece 1 at 24-AUG-15
channel c4: starting archived log backup set
channel c4: specifying archived log(s) in backup set
input archived log thread=2 sequence=55 RECID=16 STAMP=888516453
input archived log thread=1 sequence=155 RECID=17 STAMP=888519593
input archived log thread=1 sequence=156 RECID=19 STAMP=888586542
channel c4: starting piece 1 at 24-AUG-15
channel c2: finished piece 1 at 24-AUG-15
piece handle=/rmanbak/ARC_0mqfdgop_1_1.bak tag=TAG20150824T134352 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:02
channel c2: starting archived log backup set
channel c2: specifying archived log(s) in backup set
input archived log thread=2 sequence=56 RECID=18 STAMP=888586548
channel c2: starting piece 1 at 24-AUG-15
channel c1: finished piece 1 at 24-AUG-15
piece handle=/rmanbak/ARC_0lqfdgop_1_1.bak tag=TAG20150824T134352 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:04
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=157 RECID=20 STAMP=888587032
input archived log thread=2 sequence=57 RECID=21 STAMP=888587032
channel c1: starting piece 1 at 24-AUG-15
channel c1: finished piece 1 at 24-AUG-15
piece handle=/rmanbak/ARC_0qqfdgot_1_1.bak tag=TAG20150824T134352 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
channel c3: finished piece 1 at 24-AUG-15
piece handle=/rmanbak/ARC_0nqfdgop_1_1.bak tag=TAG20150824T134352 comment=NONE
channel c3: backup set complete, elapsed time: 00:00:04
channel c2: finished piece 1 at 24-AUG-15
piece handle=/rmanbak/ARC_0pqfdgos_1_1.bak tag=TAG20150824T134352 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:03
channel c4: finished piece 1 at 24-AUG-15
piece handle=/rmanbak/ARC_0oqfdgoq_1_1.bak tag=TAG20150824T134352 comment=NONE
channel c4: backup set complete, elapsed time: 00:00:05
Finished backup at 24-AUG-15

released channel: c1

released channel: c2

released channel: c3

released channel: c4
                                                                                                   <span style="color:#ff0000;"><strong>-------------备份控制文件</strong></span>
RMAN> backup device type disk format '/rmanbak/standby_%U.ctl' current controlfile for standby;    <span style="color:#ff0000;"><strong>-------------做实验的时候,这种方式备份出来的控制文件,在恢复的时候失败,具体提示继续往下看。</strong></span>

Starting backup at 24-AUG-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=155 instance=RACDB_1 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including standby control file in backup set
channel ORA_DISK_1: starting piece 1 at 24-AUG-15
channel ORA_DISK_1: finished piece 1 at 24-AUG-15
piece handle=/rmanbak/standby_0rqfdgpd_1_1.ctl tag=TAG20150824T134413 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 24-AUG-15

RMAN> 

RMAN> 

RMAN> exit


Recovery Manager complete.
[oracle@racnode1 rmanbak]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Aug 24 13:44:43 2015

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
                                                                                                   <span style="color:#ff0000;">-------------创建pfile文件,准备复制到备库后修改</span>
SQL> create pfile ='/rmanbak/initracdbstd.ora' from spfile;

File created.

SQL> 
SQL> 
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

[oracle@racnode1 rmanbak]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/dbs/                              <span style="color:#ff0000;"><strong>-------------去拷贝密码文件</strong></span>
[oracle@racnode1 dbs]$ ll
total 18104
-rw-rw---- 1 oracle asmadmin     1544 Aug 23 19:01 hc_RACDB_1.dat
-rw-r--r-- 1 oracle oinstall     2851 May 15  2009 init.ora
-rw-r----- 1 oracle oinstall       39 Jul 24 12:07 initRACDB_1.ora
-rw-r----- 1 oracle oinstall     1536 Jul 24 10:58 orapwRACDB
-rw-r----- 1 oracle asmadmin 18497536 Aug 24 13:44 snapcf_RACDB_1.f
[oracle@racnode1 dbs]$ cp orapwRACDB /rmanbak/
[oracle@racnode1 dbs]$ cd /rmanbak/                                                                     <span style="color:#ff0000;"><strong>-------------数据库,归档,参数,控制文件准备好,密码文件都准备好了</strong></span>
[oracle@racnode1 rmanbak]$ ll
total 3226968
-rw-r----- 1 oracle asmadmin    4591616 Aug 24 13:43 ARC_0lqfdgop_1_1.bak
-rw-r----- 1 oracle asmadmin    1551872 Aug 24 13:43 ARC_0mqfdgop_1_1.bak
-rw-r----- 1 oracle asmadmin   38523904 Aug 24 13:43 ARC_0nqfdgop_1_1.bak
-rw-r----- 1 oracle asmadmin   33679872 Aug 24 13:43 ARC_0oqfdgoq_1_1.bak
-rw-r----- 1 oracle asmadmin   33270784 Aug 24 13:43 ARC_0pqfdgos_1_1.bak
-rw-r----- 1 oracle asmadmin      12288 Aug 24 13:43 ARC_0qqfdgot_1_1.bak
-rw-r----- 1 oracle asmadmin 1485406208 Aug 24 13:43 FULL_0fqfdgi0_1_1.bak
-rw-r----- 1 oracle asmadmin  807731200 Aug 24 13:42 FULL_0gqfdgi0_1_1.bak
-rw-r----- 1 oracle asmadmin  203046912 Aug 24 13:43 FULL_0hqfdgi0_1_1.bak
-rw-r----- 1 oracle asmadmin  656097280 Aug 24 13:43 FULL_0iqfdgi6_1_1.bak
-rw-r----- 1 oracle asmadmin   18546688 Aug 24 13:43 FULL_0jqfdgni_1_1.bak
-rw-r----- 1 oracle asmadmin      98304 Aug 24 13:43 FULL_0kqfdgoh_1_1.bak
-rw-r--r-- 1 oracle asmadmin       1363 Aug 24 13:45 initracdbstd.ora
-rw-r----- 1 oracle oinstall       1536 Aug 24 13:47 orapwRACDB
-rw-r----- 1 oracle asmadmin   18546688 Aug 24 13:44 standby_0rqfdgpd_1_1.ctl
[oracle@racnode1 rmanbak]$ ps -ef | grep smon
root      3246     1  0 Aug23 ?        00:07:54 /u01/app/11.2.0/grid/bin/osysmond.bin
grid      3698     1  0 Aug23 ?        00:00:01 asm_smon_+ASM1
oracle    4470     1  0 Aug23 ?        00:00:04 ora_smon_RACDB_1
oracle   16514 15008  0 13:48 pts/0    00:00:00 grep smon
[oracle@racnode1 rmanbak]$ scp * [email protected]:/rmanbak/
The authenticity of host '192.168.77.190 (192.168.77.190)' can't be established.
RSA key fingerprint is d4:00:00:37:a9:be:9e:31:b3:5d:3d:a9:de:17:4e:d2.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.77.190' (RSA) to the list of known hosts.
[email protected]'s password: 
ARC_0lqfdgop_1_1.bak                                                                                 100% 4484KB   4.4MB/s   00:00    
ARC_0mqfdgop_1_1.bak                                                                                 100% 1516KB   1.5MB/s   00:00    
ARC_0nqfdgop_1_1.bak                                                                                 100%   37MB  36.7MB/s   00:01    
ARC_0oqfdgoq_1_1.bak                                                                                 100%   32MB  32.1MB/s   00:01    
ARC_0pqfdgos_1_1.bak                                                                                 100%   32MB  31.7MB/s   00:00    
ARC_0qqfdgot_1_1.bak                                                                                 100%   12KB  12.0KB/s   00:00    
FULL_0fqfdgi0_1_1.bak                                                                                100% 1417MB  18.4MB/s   01:17    
FULL_0gqfdgi0_1_1.bak                                                                                100%  770MB  10.9MB/s   01:11    
FULL_0hqfdgi0_1_1.bak                                                                                100%  194MB   7.5MB/s   00:26    
FULL_0iqfdgi6_1_1.bak                                                                                100%  626MB   8.8MB/s   01:11    
FULL_0jqfdgni_1_1.bak                                                                                100%   18MB   8.8MB/s   00:02    
FULL_0kqfdgoh_1_1.bak                                                                                100%   96KB  96.0KB/s   00:00    
initracdbstd.ora                                                                                     100% 1363     1.3KB/s   00:00    
orapwRACDB                                                                                           100% 1536     1.5KB/s   00:00    
standby_0rqfdgpd_1_1.ctl                                                                             100%   18MB   2.5MB/s   00:07    
[oracle@racnode1 rmanbak]$ 
[oracle@racnode1 rmanbak]$ 
[oracle@racnode1 rmanbak]$ 

 
 
 
 
 
 

(2)在备库修改pfile参数文件,用RMAN在nomount状态下恢复standby控制文件,mount状态恢复数据库。


[oracle@racnode1 dbs]$ ssh 192.168.77.190
[email protected]'s password: 
[oracle@stdby ~]$ cd /rmanbak/
[oracle@stdby rmanbak]$ cp orapwRACDB /u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwRACSTD
[oracle@stdby rmanbak]$ cp initracdbstd.ora /u01/app/oracle/product/11.2.0/dbhome_1/dbs/initRACSTD.ora
[oracle@stdby rmanbak]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/dbs/
[oracle@stdby dbs]$ ll
total 12
-rw-r--r-- 1 oracle oinstall 2851 May 15  2009 init.ora
-rw-r--r-- 1 oracle oinstall 1363 Aug 24 13:55 initRACSTD.ora
-rw-r----- 1 oracle oinstall 1536 Aug 24 13:54 orapwRACSTD

<span style="color:#ff0000;"><strong>修改备库参数文件

</strong></span>
<span style="color:#ff0000;"><strong>(修改之前)</strong></span>
[oracle@stdby dbs]$ cat initRACSTD.ora 
RACDB_1.__db_cache_size=301989888
RACDB_2.__db_cache_size=301989888
RACDB_1.__java_pool_size=16777216
RACDB_2.__java_pool_size=16777216
RACDB_1.__large_pool_size=16777216
RACDB_2.__large_pool_size=16777216
RACDB_1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
RACDB_2.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
RACDB_1.__pga_aggregate_target=436207616
RACDB_2.__pga_aggregate_target=436207616
RACDB_1.__sga_target=838860800
RACDB_2.__sga_target=838860800
RACDB_1.__shared_io_pool_size=0
RACDB_2.__shared_io_pool_size=0
RACDB_1.__shared_pool_size=469762048
RACDB_2.__shared_pool_size=486539264
RACDB_1.__streams_pool_size=16777216
RACDB_2.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/RACDB/adump'
*.audit_trail='db'
*.cluster_database=true
*.compatible='11.2.0.0.0'
*.control_files='+DATADG/RACDB/control01.ctl','+DATADG/RACDB/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='RACDB'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=RACDBXDB)'
RACDB_1.log_archive_dest_1='LOCATION=/u01/app/oracle/archivelog'
RACDB_2.log_archive_dest_1='LOCATION=/u01/app/oracle/archivelog'
*.log_archive_dest_1='LOCATION=+DATADG/ARCH'
*.memory_target=1264582656
*.open_cursors=300
*.processes=150
*.remote_listener='racnode-cluster-scan:1521'
*.remote_login_passwordfile='exclusive'

(修改之后)


[oracle@stdby dbs]$ cat initRACSTD.ora 
RACSTD.__db_cache_size=301989888
RACSTD.__java_pool_size=16777216
RACSTD.__large_pool_size=16777216
RACSTD.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
RACSTD.__pga_aggregate_target=436207616
RACSTD.__sga_target=838860800
RACSTD.__shared_io_pool_size=0
RACSTD.__shared_pool_size=469762048
RACSTD.__streams_pool_size=16777216
*.audit_file_dest='/u01/app/oracle/admin/RACSTD/adump'
*.audit_trail='db'
*.cluster_database=false
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/RACSTD/control01.ctl','/u01/app/oracle/oradata/RACSTD/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='RACDB'
*.db_create_file_dest='/u01/app/oracle/oradata/RACSTD'
*.db_file_name_convert='+DATADG/racdb/datafile/','/u01/app/oracle/oradata/RACSTD/'
*.db_unique_name='RACSTD'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=RACDBXDB)'
*.fal_client='RACSTD'
*.fal_server='RACDB'
*.log_archive_config='dg_config=(RACDB,RACSTD)'
*.log_archive_dest_1='location=/u01/app/oracle/arch valid_for=(all_logfiles,all_roles) db_unique_name=RACSTD'
*.log_archive_dest_2='service=RACDB valid_for=(online_logfiles,primary_role) db_unique_name=RACDB'
*.log_archive_format='ARC_%t_%S_%r.arc'
*.log_file_name_convert='+DATADG/racdb/','/u01/app/oracle/oradata/RACSTD/'




*.memory_target=1264582656
*.open_cursors=300
*.processes=150
#*.remote_listener='racnode-cluster-scan:1521'
*.remote_login_passwordfile='exclusive'


*.service_names='RACSTD'
*.standby_file_management='auto'
*.undo_management='auto'
*.undo_tablespace='UNDOTBS1'
[oracle@stdby dbs]$ 
[oracle@stdby dbs]$ 


修改的参数主要有:

*.cluster_database=false
*.control_files='/u01/app/oracle/oradata/RACSTD/control01.ctl','/u01/app/oracle/oradata/RACSTD/control02.ctl'
*.db_create_file_dest='/u01/app/oracle/oradata/RACSTD'
*.db_file_name_convert='+DATADG/racdb/datafile/','/u01/app/oracle/oradata/RACSTD/'
*.db_unique_name='RACSTD'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=RACDBXDB)'                              --------------是否可以修改?试试。
*.fal_client='RACSTD'
*.fal_server='RACDB'
*.log_archive_config='dg_config=(RACDB,RACSTD)'
*.log_archive_dest_1='location=/u01/app/oracle/arch valid_for=(all_logfiles,all_roles) db_unique_name=RACSTD'
*.log_archive_dest_2='service=RACDB valid_for=(online_logfiles,primary_role) db_unique_name=RACDB'
*.log_archive_format='ARC_%t_%S_%r.arc'
*.log_file_name_convert='+DATADG/racdb/','/u01/app/oracle/oradata/RACSTD/'
<pre name="code" class="plain">*.service_names='RACSTD'
*.standby_file_management='auto'
*.undo_management='auto'
*.undo_tablespace='UNDOTBS1'

 
 


备库启动到nomount状态

[oracle@stdby rmanbak]$ export ORACLE_SID=RACSTD
[oracle@stdby rmanbak]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Aug 24 14:40:19 2015

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

Connected to an idle instance.

SQL> startup mount
ORACLE instance started.

Total System Global Area 1269366784 bytes
Fixed Size                  2227984 bytes
Variable Size             956301552 bytes
Database Buffers          301989888 bytes
Redo Buffers                8847360 bytes
ORA-00205: error in identifying control file, check alert log for more info

                                                                               -----------------------启动到mount出错,因为没有控制文件,具体错误信息见下面
SQL> exit

alert日志错误信息

[oracle@stdby RACSTD]$ ll                                                       -------------查看备库控制文件路径,能找到控制文件(RMAN自动创建的)。但不能用。
total 36272
-rw-r----- 1 oracle oinstall 18546688 Aug 24 14:39 control01.ctl
-rw-r----- 1 oracle oinstall 18546688 Aug 24 14:40 control02.ctl

[oracle@stdby trace]$ tail alert_RACSTD.log 
ORA-00202: control file: '/u01/app/oracle/oradata/RACSTD/control02.ctl'
ORA-00227: corrupt block detected in control file: (block 1, # blocks 1)
ORA-00202: control file: '/u01/app/oracle/oradata/RACSTD/control01.ctl'
Incident details in: /u01/app/oracle/diag/rdbms/racstd/RACSTD/incident/incdir_1364/RACSTD_m000_16269_i1364.trc
ORA-00227: corrupt block detected in control file: (block 1, # blocks 1)
ORA-00202: control file: '/u01/app/oracle/oradata/RACSTD/control02.ctl'
ORA-00227: corrupt block detected in control file: (block 1, # blocks 1)
ORA-00202: control file: '/u01/app/oracle/oradata/RACSTD/control01.ctl'
ORA-205 signalled during: alter database mount...
Dumping diagnostic data in directory=[cdmp_20150824144516], requested by (instance=1, osid=16236 (CKPT)), summary=[incident=1300].
-----------------------提示控制文件有坏块,其实是因为控制文件是RMAN自己创建的,并不是从备份里恢复出来的。所以控制文件里可能什么也没有,所以数据库认为有坏块。

将数据库启动到nomount状态


[oracle@stdby ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Aug 24 14:56:08 2015

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

Connected to an idle instance.

SQL> startup nomount
ORACLE instance started.

Total System Global Area 1269366784 bytes
Fixed Size                  2227984 bytes
Variable Size             956301552 bytes
Database Buffers          301989888 bytes
Redo Buffers                8847360 bytes
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


RMAN从备份中恢复控制文件


[oracle@stdby rmanbak]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Mon Aug 24 14:56:54 2015

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: RACDB (not mounted)

RMAN> restore standby controlfile from 'standby_0rqfdgpd_1_1.ctl';

Starting restore at 24-AUG-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=134 device type=DISK

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 08/24/2015 14:57:30
RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece

在RMAN命令行中备份的standby控制文件不能用。。。。不知道什么原因。


返回主库,在sqlplus命令行中生成standby 控制文件


[oracle@racnode1 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Aug 24 15:06:10 2015

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> alter database create standby controlfile as '/rmanbak/standbyctl.ctl';

Database altered.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options


用RMAN成功从重新生成的standby 控制文件中恢复出了控制文件


[oracle@racnode1 rmanbak]$ scp standbyctl.ctl 192.168.77.190:/rmanbak/
[email protected]'s password: 
standbyctl.ctl                                                                                       100%   18MB  17.6MB/s   00:01  

-------切换到备库
[oracle@stdby ~]$ export ORACLE_SID=RACSTD
[oracle@stdby ~]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Mon Aug 24 15:05:40 2015

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: RACDB (not mounted)

RMAN> restore standby controlfile from '/rmanbak/standbyctl.ctl';                 

Starting restore at 24-AUG-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=125 device type=DISK

channel ORA_DISK_1: copied control file copy
output file name=/u01/app/oracle/oradata/RACSTD/control01.ctl
output file name=/u01/app/oracle/oradata/RACSTD/control02.ctl
Finished restore at 24-AUG-15

RMAN> exit


Recovery Manager complete.


数据库启动到mount状态


[oracle@stdby ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Aug 24 15:07:35 2015

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> alter database mount;

Database altered.


RMAN恢复数据库


[oracle@stdby ~]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Mon Aug 24 15:08:24 2015

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: RACDB (DBID=883515518, not open)

RMAN> run {
2> 
3> allocate channel c1 type disk;
4> 
5> allocate channel c2 type disk;
6> 
7> allocate channel c3 type disk;
8> 
9> allocate channel c4 type disk;
10> 
11> restore database ;
12> 
13> release channel c1;
14> 
15> release channel c2;
16> 
17> release channel c3;
18> 
19> release channel c4;
20> 
21> }

using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=134 device type=DISK

allocated channel: c2
channel c2: SID=13 device type=DISK

allocated channel: c3
channel c3: SID=137 device type=DISK

allocated channel: c4
channel c4: SID=14 device type=DISK

Starting restore at 24-AUG-15

channel c1: starting datafile backup set restore
channel c1: specifying datafile(s) to restore from backup set
channel c1: restoring datafile 00002 to /u01/app/oracle/oradata/RACSTD/sysaux.261.885898927
channel c1: restoring datafile 00005 to /u01/app/oracle/oradata/RACSTD/users.265.885899091
channel c1: reading from backup piece /rmanbak/FULL_0gqfdgi0_1_1.bak
channel c2: starting datafile backup set restore
channel c2: specifying datafile(s) to restore from backup set
channel c2: restoring datafile 00003 to /u01/app/oracle/oradata/RACSTD/undotbs1.262.885898975
channel c2: restoring datafile 00007 to /u01/app/oracle/oradata/RACSTD/index01.270.886180183
channel c2: reading from backup piece /rmanbak/FULL_0hqfdgi0_1_1.bak
channel c3: starting datafile backup set restore
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00006 to /u01/app/oracle/oradata/RACSTD/data01.269.886180153
channel c3: reading from backup piece /rmanbak/FULL_0fqfdgi0_1_1.bak
channel c4: starting datafile backup set restore
channel c4: specifying datafile(s) to restore from backup set
channel c4: restoring datafile 00001 to /u01/app/oracle/oradata/RACSTD/system.260.885898771
channel c4: restoring datafile 00004 to /u01/app/oracle/oradata/RACSTD/undotbs2.264.885899061
channel c4: reading from backup piece /rmanbak/FULL_0iqfdgi6_1_1.bak
channel c2: piece handle=/rmanbak/FULL_0hqfdgi0_1_1.bak tag=TAG20150824T134016
channel c2: restored backup piece 1
channel c2: restore complete, elapsed time: 00:04:39


channel c4: piece handle=/rmanbak/FULL_0iqfdgi6_1_1.bak tag=TAG20150824T134016
channel c4: restored backup piece 1
channel c4: restore complete, elapsed time: 00:08:47
channel c1: piece handle=/rmanbak/FULL_0gqfdgi0_1_1.bak tag=TAG20150824T134016
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:08:57
channel c3: piece handle=/rmanbak/FULL_0fqfdgi0_1_1.bak tag=TAG20150824T134016
channel c3: restored backup piece 1
channel c3: restore complete, elapsed time: 00:09:47
Finished restore at 24-AUG-15

released channel: c1

released channel: c2

released channel: c3

released channel: c4

RMAN> 
RMAN> 
RMAN> exit


Recovery Manager complete.


查看恢复出的数据库文件

---------------刚恢复完的时候,没找到redo log文件。后续操作中不知何时出现了。奇怪。注意。


[oracle@stdby ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Aug 24 15:19:12 2015

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/RACSTD/redo01.log
/u01/app/oracle/oradata/RACSTD/redo02.log
/u01/app/oracle/oradata/RACSTD/redo03.log
/u01/app/oracle/oradata/RACSTD/redo04.log

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@stdby ~]$ cd /u01/app/oracle/oradata/RACSTD/
[oracle@stdby RACSTD]$ ll
total 4674388
-rw-r----- 1 oracle oinstall   18497536 Aug 24 15:19 control01.ctl
-rw-r----- 1 oracle oinstall   18497536 Aug 24 15:19 control02.ctl
-rw-r----- 1 oracle oinstall 1677729792 Aug 24 15:18 data01.269.886180153
-rw-r----- 1 oracle oinstall  314580992 Aug 24 15:11 index01.270.886180183
-rw-r----- 1 oracle oinstall 1090527232 Aug 24 15:16 sysaux.261.885898927
-rw-r----- 1 oracle oinstall  775954432 Aug 24 15:14 system.260.885898771
-rw-r----- 1 oracle oinstall  671096832 Aug 24 15:08 undotbs1.262.885898975
-rw-r----- 1 oracle oinstall  209723392 Aug 24 15:08 undotbs2.264.885899061
-rw-r----- 1 oracle oinstall    5251072 Aug 24 15:10 users.265.885899091



备库添加standby redo logfile


SQL> alter database add standby logfile thread 1 group 5 size 50M ,group 6 size 50M ,group 7 size 50M ;

Database altered.

SQL> alter database add standby logfile thread 2 group 8 size 50M ,group 9 size 50M ,group 10 size 50M ;

Database altered.


(3)调整主库参数

--------------------写错了个参数,log_archive_dest_2 中的db_unique_name写错了。

[oracle@racnode1 rmanbak]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Aug 24 15:27:57 2015

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> alter system set log_archive_dest_2='service=RACSTD lgwr sync valid_for=(online_logfiles,primary_role) db_unique_name=RADSTD' sid='*';

System altered.

SQL> alter system set log_archive_config='dg_config=(RACDB,RACSTD)' sid='*';

System altered.


查看归档日志应用情况

---------------------------------因为参数写错了,所以日志一直没有被应用。。。。。

SQL> select sequence#,name,applied from v$archived_log;
SQL> column NAME format a50
SQL> /

 SEQUENCE# NAME                                               APPLIED
---------- -------------------------------------------------- ---------
        47 /u01/app/oracle/archivelog/2_47_885898750.dbf      NO
        48 /u01/app/oracle/archivelog/2_48_885898750.dbf      NO
       148 /u01/app/oracle/archivelog/1_148_885898750.dbf     NO
       149 /u01/app/oracle/archivelog/1_149_885898750.dbf     NO
        49 /u01/app/oracle/archivelog/2_49_885898750.dbf      NO
       150 /u01/app/oracle/archivelog/1_150_885898750.dbf     NO
       151 /u01/app/oracle/archivelog/1_151_885898750.dbf     NO
        50 /u01/app/oracle/archivelog/2_50_885898750.dbf      NO
        51 /u01/app/oracle/archivelog/2_51_885898750.dbf      NO
        52 /u01/app/oracle/archivelog/2_52_885898750.dbf      NO
       152 /u01/app/oracle/archivelog/1_152_885898750.dbf     NO

 SEQUENCE# NAME                                               APPLIED
---------- -------------------------------------------------- ---------
       153 +DATADG/arch/1_153_885898750.dbf                   NO
        53 +DATADG/arch/2_53_885898750.dbf                    NO
        54 +DATADG/arch/2_54_885898750.dbf                    NO
       154 +DATADG/arch/1_154_885898750.dbf                   NO
        55 +DATADG/arch/2_55_885898750.dbf                    NO
       155 /u01/app/oracle/archivelog/1_155_885898750.dbf     NO
        56 /u01/app/oracle/archivelog/2_56_885898750.dbf      NO
       156 /u01/app/oracle/archivelog/1_156_885898750.dbf     NO
       157 /u01/app/oracle/archivelog/1_157_885898750.dbf     NO
        57 /u01/app/oracle/archivelog/2_57_885898750.dbf      NO
        58 /u01/app/oracle/archivelog/2_58_885898750.dbf      NO

 SEQUENCE# NAME                                               APPLIED
---------- -------------------------------------------------- ---------
       158 /u01/app/oracle/archivelog/1_158_885898750.dbf     NO

23 rows selected.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options


查看alert日志,发现找不到RADSTD(参数写错了),修改。


[oracle@racnode2 ~]$ cd /u01/app/oracle/diag/rdbms/racdb/RACDB_2/trace/
[oracle@racnode2 trace]$ tail -f alert_RACDB_2.log 
Mon Aug 24 15:28:27 2015
ARC3: Archivelog destination LOG_ARCHIVE_DEST_2 disabled: destination Data Guard configuration error
Archived Log entry 22 added for thread 2 sequence 58 ID 0x34a99b7e dest 1:
Mon Aug 24 15:28:27 2015
GEN0: DB_UNIQUE_NAME RADSTD is not in the Data Guard configuration
Mon Aug 24 15:40:35 2015
Thread 2 advanced to log sequence 60 (LGWR switch)
  Current log# 4 seq# 60 mem# 0: +DATADG/racdb/redo04.log
Mon Aug 24 15:40:35 2015
Archived Log entry 25 added for thread 2 sequence 59 ID 0x34a99b7e dest 1:
  
[oracle@racnode2 trace]$ tail -30 alert_RACDB_2.log 
Thread 2 advanced to log sequence 57 (LGWR switch)
  Current log# 3 seq# 57 mem# 0: +DATADG/racdb/redo03.log
Mon Aug 24 13:35:48 2015
Archived Log entry 18 added for thread 2 sequence 56 ID 0x34a99b7e dest 1:
Mon Aug 24 13:35:48 2015
Dumping diagnostic data in directory=[cdmp_20150824133542], requested by (instance=1, osid=4486 (MMON)), summary=[incident=9793].
Mon Aug 24 13:43:57 2015
Thread 2 advanced to log sequence 58 (LGWR switch)
  Current log# 4 seq# 58 mem# 0: +DATADG/racdb/redo04.log
Mon Aug 24 15:28:22 2015
******************************************************************
LGWR: Setting 'active' archival for destination LOG_ARCHIVE_DEST_2
******************************************************************
Mon Aug 24 15:28:22 2015
NSS2 started with pid=44, OS id=12294 
LGWR: Error 16057 disconnecting from destination LOG_ARCHIVE_DEST_2 standby host 'RACSTD'
Error 16057 for archive log file 3 to 'RACSTD'
LGWR: Failed to archive log 3 thread 2 sequence 59 (16057)
Thread 2 advanced to log sequence 59 (LGWR switch)
  Current log# 3 seq# 59 mem# 0: +DATADG/racdb/redo03.log
Mon Aug 24 15:28:27 2015
ARC3: Archivelog destination LOG_ARCHIVE_DEST_2 disabled: destination Data Guard configuration error
Archived Log entry 22 added for thread 2 sequence 58 ID 0x34a99b7e dest 1:
Mon Aug 24 15:28:27 2015
GEN0: DB_UNIQUE_NAME RADSTD is not in the Data Guard configuration
Mon Aug 24 15:40:35 2015
Thread 2 advanced to log sequence 60 (LGWR switch)
  Current log# 4 seq# 60 mem# 0: +DATADG/racdb/redo04.log
Mon Aug 24 15:40:35 2015
Archived Log entry 25 added for thread 2 sequence 59 ID 0x34a99b7e dest 1:


[oracle@racnode1 trace]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Aug 24 15:49:22 2015

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> alter system set log_archive_dest_2='service=RACSTD lgwr sync valid_for=(online_logfiles,primary_role) db_unique_name=RACSTD' sid='*';

System altered.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options


查看告警日志,主库的日志成功传到备库。

主库日志:

[oracle@racnode1 trace]$ tail -30 alert_RACDB_1.log 
database, requires manual RMAN intervention to resolve OMF 
datafile pathnames.
NOTE: Please refer to the RMAN documentation for procedures 
describing how to manually resolve OMF datafile pathnames.
Completed: alter database create standby controlfile as '/rmanbak/standbyctl.ctl'
Mon Aug 24 15:28:09 2015
ALTER SYSTEM SET log_archive_dest_2='service=RACSTD lgwr sync valid_for=(online_logfiles,primary_role) db_unique_name=RADSTD' SCOPE=BOTH SID='*';
Mon Aug 24 15:28:11 2015
******************************************************************
LGWR: Setting 'active' archival for destination LOG_ARCHIVE_DEST_2
******************************************************************
Mon Aug 24 15:28:11 2015
NSS2 started with pid=36, OS id=22542 
LGWR: Error 16057 disconnecting from destination LOG_ARCHIVE_DEST_2 standby host 'RACSTD'
Error 16057 for archive log file 1 to 'RACSTD'
LGWR: Failed to archive log 1 thread 1 sequence 159 (16057)
Thread 1 advanced to log sequence 159 (LGWR switch)
  Current log# 1 seq# 159 mem# 0: +DATADG/racdb/redo01.log
Mon Aug 24 15:28:21 2015
USER: DB_UNIQUE_NAME RADSTD is not in the Data Guard configuration
Mon Aug 24 15:28:21 2015
Archived Log entry 23 added for thread 1 sequence 158 ID 0x34a99b7e dest 1:
ALTER SYSTEM SET log_archive_config='dg_config=(RACDB,RACSTD)' SCOPE=BOTH SID='*';
Mon Aug 24 15:34:15 2015
Thread 1 advanced to log sequence 160 (LGWR switch)
  Current log# 2 seq# 160 mem# 0: +DATADG/racdb/redo02.log
Mon Aug 24 15:34:15 2015
Archived Log entry 24 added for thread 1 sequence 159 ID 0x34a99b7e dest 1:
Mon Aug 24 15:50:12 2015
ALTER SYSTEM SET log_archive_dest_2='service=RACSTD lgwr sync valid_for=(online_logfiles,primary_role) db_unique_name=RACSTD' SCOPE=BOTH SID='*';
[oracle@racnode1 trace]$ tail -f alert_RACDB_1.log 
Mon Aug 24 15:28:21 2015
Archived Log entry 23 added for thread 1 sequence 158 ID 0x34a99b7e dest 1:
ALTER SYSTEM SET log_archive_config='dg_config=(RACDB,RACSTD)' SCOPE=BOTH SID='*';
Mon Aug 24 15:34:15 2015
Thread 1 advanced to log sequence 160 (LGWR switch)
  Current log# 2 seq# 160 mem# 0: +DATADG/racdb/redo02.log
Mon Aug 24 15:34:15 2015
Archived Log entry 24 added for thread 1 sequence 159 ID 0x34a99b7e dest 1:
Mon Aug 24 15:50:12 2015
ALTER SYSTEM SET log_archive_dest_2='service=RACSTD lgwr sync valid_for=(online_logfiles,primary_role) db_unique_name=RACSTD' SCOPE=BOTH SID='*';
Mon Aug 24 15:51:39 2015
NSS2 started with pid=52, OS id=24020 
Mon Aug 24 15:51:42 2015
LGWR: Standby redo logfile selected for thread 1 sequence 161 for destination LOG_ARCHIVE_DEST_2
Thread 1 advanced to log sequence 161 (LGWR switch)
  Current log# 1 seq# 161 mem# 0: +DATADG/racdb/redo01.log
Mon Aug 24 15:51:42 2015
Archived Log entry 28 added for thread 1 sequence 160 ID 0x34a99b7e dest 1:
Mon Aug 24 15:51:42 2015
ARC0: Standby redo logfile selected for thread 1 sequence 160 for destination LOG_ARCHIVE_DEST_2
Expanded controlfile section 11 from 28 to 191 records
Requested to grow by 163 records; added 6 blocks of records

备库日志:

[oracle@stdby ~]$ cd /u01/app/oracle/diag/rdbms/racstd/RACSTD/trace/
[oracle@stdby trace]$ tail -f alert_RACSTD.log 
RFS[7]: Selected log 5 for thread 1 sequence 161 dbid 883515518 branch 885898750
Mon Aug 24 15:49:26 2015
RFS[8]: Assigned to RFS process 16828
RFS[8]: Selected log 6 for thread 1 sequence 160 dbid 883515518 branch 885898750
Mon Aug 24 15:49:27 2015
Recovery of Online Redo Log: Thread 1 Group 6 Seq 160 Reading mem 0
  Mem# 0: /u01/app/oracle/oradata/RACSTD/RACSTD/onlinelog/o1_mf_6_bxokh4z0_.log
Mon Aug 24 15:49:27 2015
Archived Log entry 7 added for thread 1 sequence 160 ID 0x34a99b7e dest 1:
Media Recovery Waiting for thread 2 sequence 60
Mon Aug 24 15:53:08 2015
Primary database is in MAXIMUM PERFORMANCE mode
RFS[9]: Assigned to RFS process 16864
RFS[9]: Selected log 8 for thread 2 sequence 61 dbid 883515518 branch 885898750
Mon Aug 24 15:53:08 2015
RFS[10]: Assigned to RFS process 16866
RFS[10]: Selected log 9 for thread 2 sequence 60 dbid 883515518 branch 885898750
Mon Aug 24 15:53:09 2015
Recovery of Online Redo Log: Thread 2 Group 9 Seq 60 Reading mem 0
  Mem# 0: /u01/app/oracle/oradata/RACSTD/RACSTD/onlinelog/o1_mf_9_bxokhp2k_.log
Mon Aug 24 15:53:09 2015
Archived Log entry 8 added for thread 2 sequence 60 ID 0x34a99b7e dest 1:
Media Recovery Waiting for thread 1 sequence 161 (in transit)
Recovery of Online Redo Log: Thread 1 Group 5 Seq 161 Reading mem 0
  Mem# 0: /u01/app/oracle/oradata/RACSTD/RACSTD/onlinelog/o1_mf_5_bxokh4wp_.log
Media Recovery Waiting for thread 2 sequence 61 (in transit)
Recovery of Online Redo Log: Thread 2 Group 8 Seq 61 Reading mem 0
  Mem# 0: /u01/app/oracle/oradata/RACSTD/RACSTD/onlinelog/o1_mf_8_bxokhp05_.log


主备库插入数据验证:


-----------------省略



主库创建表空间,备库自动创建。


[oracle@racnode1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Tue Aug 25 15:46:14 2015

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> create tablespace TEST1 datafile '+datadg' size 50m;

Tablespace created.

主库日志:


[oracle@racnode1 ~]$ cd /u01/app/oracle/diag/rdbms/racdb/RACDB_1/trace/
[oracle@racnode1 trace]$ tail -10 alert_RACDB_1.log 
ARC0: Standby redo logfile selected for thread 1 sequence 161 for destination LOG_ARCHIVE_DEST_2
Tue Aug 25 13:36:41 2015
LGWR: Standby redo logfile selected for thread 1 sequence 166 for destination LOG_ARCHIVE_DEST_2
Thread 1 advanced to log sequence 166 (LGWR switch)
  Current log# 2 seq# 166 mem# 0: +DATADG/racdb/redo02.log
Tue Aug 25 13:36:49 2015
Archived Log entry 41 added for thread 1 sequence 165 ID 0x34a99b7e dest 1:
Tue Aug 25 15:47:01 2015
create tablespace TEST1 datafile '+datadg' size 50m
Completed: create tablespace TEST1 datafile '+datadg' size 50m

备库日志:


[oracle@stdby trace]$ tail -10 alert_RACSTD.log 
Media Recovery Waiting for thread 2 sequence 65 (in transit)
Recovery of Online Redo Log: Thread 2 Group 9 Seq 65 Reading mem 0
  Mem# 0: /u01/app/oracle/oradata/RACSTD/RACSTD/onlinelog/o1_mf_9_bxokhp2k_.log
Tue Aug 25 13:39:14 2015
Media Recovery Waiting for thread 1 sequence 166 (in transit)
Recovery of Online Redo Log: Thread 1 Group 6 Seq 166 Reading mem 0
  Mem# 0: /u01/app/oracle/oradata/RACSTD/RACSTD/onlinelog/o1_mf_6_bxokh4z0_.log
Tue Aug 25 15:44:57 2015
Successfully added datafile 8 to media recovery
Datafile #8: '/u01/app/oracle/oradata/RACSTD/RACSTD/datafile/o1_mf_test1_bxr77n78_.dbf'




你可能感兴趣的:(RAC+DG搭建过程)