1. 程式人生 > >RAC+DG搭建過程

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配置。

[[email protected] ~]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/
[[email protected] admin]$ ls
samples  shrept.lst  tnsnames.ora
[[email protected] 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)
    )
  )

[
[email protected]
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 [
[email protected]
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 [[email protected] admin]$ mkdir /rmanbak mkdir: cannot create directory `/rmanbak': Permission denied [[email protected] admin]$ exit logout


(1)將RAC主庫修改為歸檔模式,並開啟force logging模式。

由於事先已經將資料庫置為歸檔模式,故在此只需要修改force logging模式即可。

[[email protected] ~]$ 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恢復。)
[[email protected] ~]# mkdir /rmanbak
[[email protected] ~]# chown oracle:oinstall /rmanbak/
[[email protected] ~]# su - oracle
[[email protected] ~]$ 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.
[[email protected] 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

[[email protected] rmanbak]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/dbs/                              <span style="color:#ff0000;"><strong>-------------去拷貝密碼檔案</strong></span>
[[email protected] 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
[[email protected] dbs]$ cp orapwRACDB /rmanbak/
[[email protected] dbs]$ cd /rmanbak/                                                                     <span style="color:#ff0000;"><strong>-------------資料庫,歸檔,引數,控制檔案準備好,密碼檔案都準備好了</strong></span>
[[email protected] 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
[[email protected] 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
[[email protected] 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    
[[email protected] rmanbak]$ 
[[email protected] rmanbak]$ 
[[email protected] rmanbak]$ 



(2)在備庫修改pfile引數檔案,用RMAN在nomount狀態下恢復standby控制檔案,mount狀態恢復資料庫。

[[email protected] dbs]$ ssh 192.168.77.190
[email protected]'s password: 
[[email protected] ~]$ cd /rmanbak/
[[email protected] rmanbak]$ cp orapwRACDB /u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwRACSTD
[[email protected] rmanbak]$ cp initracdbstd.ora /u01/app/oracle/product/11.2.0/dbhome_1/dbs/initRACSTD.ora
[[email protected] rmanbak]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/dbs/
[[email protected] 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>
[[email protected] 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'

(修改之後)
[[email protected] 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'
[[email protected] dbs]$ 
[[email protected] 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狀態

[[email protected] rmanbak]$ export ORACLE_SID=RACSTD
[[email protected] 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日誌錯誤資訊
[[email protected] 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

[[email protected] 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狀態
[[email protected] ~]$ 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從備份中恢復控制檔案
[[email protected] 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 控制檔案

[[email protected] 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 控制檔案中恢復出了控制檔案

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

-------切換到備庫
[[email protected] ~]$ export ORACLE_SID=RACSTD
[[email protected] ~]$ 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狀態
[[email protected] ~]$ 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恢復資料庫
[[email protected] ~]$ 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檔案。後續操作中不知何時出現了。奇怪。注意。

[[email protected] ~]$ 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
[[email protected] ~]$ cd /u01/app/oracle/oradata/RACSTD/
[[email protected] 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寫錯了。

[[email protected] 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(引數寫錯了),修改。

[[email protected] ~]$ cd /u01/app/oracle/diag/rdbms/racdb/RACDB_2/trace/
[[email protected] 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:
  
[[email protected] 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:


[[email protected] 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


檢視告警日誌,主庫的日誌成功傳到備庫。

主庫日誌:

[[email protected] 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='*';
[[email protected] 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

備庫日誌:
[[email protected] ~]$ cd /u01/app/oracle/diag/rdbms/racstd/RACSTD/trace/
[[email protected] 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


主備庫插入資料驗證:

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

主庫建立表空間,備庫自動建立。

[[email protected] ~]$ 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.

主庫日誌:
[[email protected] ~]$ cd /u01/app/oracle/diag/rdbms/racdb/RACDB_1/trace/
[[email protected] 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

備庫日誌:
[[email protected] 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'