ORACLE11G RAC 環境搭建物理 DATA GUARD (不用duplicate)

kunlunzhiying發表於2016-12-01
整體思路:先把主庫的口令檔案,引數檔案,控制檔案(用 ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/app/temp/standby.ctl'; 命令建立),傳給standby,然後再把主庫的全備傳給standby,之後再在standby的rman裡restore,之後開啟MRP應用程式來應用日誌(可以理解為recover的過程),如果要是10g的話,到這裡已經完成了,但是11g可以在read only 開啟的狀態下來應用日誌,重演變化。所以只要關掉MRP程式,再alter  database open read only ,  最後再開啟MRP程式即可,用備庫來分擔主庫讀的壓力。
下面展示詳細步驟 
前提要保證主庫和standby庫互相能ping通。各自的監聽是開啟的。

一. 檢查資料庫要處於歸檔模式.   如果不是要修改成歸檔模式,已經是歸檔模式,可以跳過這步驟。
SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     11
Current log sequence           12
SQL>

 1> 修改資料庫為歸檔模式(RAC 環境)
 1. 停止資料庫
   srvctl stop database -d racdb
 2. 第一個例項啟動到mount 狀態.
    srvctl start instance -d racdb -i racdb1
   
    shutdown immediate;
    startup mount;

SQL> archive log list
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     11
Current log sequence           12
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area 1224736768 bytes
Fixed Size                  2072352 bytes
Variable Size             285212896 bytes
Database Buffers          922746880 bytes
Redo Buffers               14704640 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.
  
  3. 啟動第二個例項
  [oracle@rac1 ~]$ srvctl start instance -d racdb -i racdb2           
    [oracle@rac1 ~]$ srvctl start service -d racdb -s testdb
    [oracle@rac1 ~]$ crs_stat -t


二: 檢查是否為 force logging .

1.
SQL> select inst_id , force_logging from gv$database;

   INST_ID FOR
---------- ---
         1 NO
         2 NO

2. 修改資料庫為 force logging
 
SQL> alter database force logging;

Database altered.
 
  注意:只需要在一個instance 執行即可.


三:再主庫操作,
  1> rman full backup
 
  RMAN> backup full database  tag 'dbfull' format '/app/temp/dbfull_%u_%s_%p'; 
  
  Starting backup at 30-JUN-08
  allocated channel: ORA_DISK_1
  channel ORA_DISK_1: sid=519 instance=racdb1 devtype=DISK
  channel ORA_DISK_1: starting full datafile backupset
  channel ORA_DISK_1: specifying datafile(s) in backupset
  input datafile fno=00003 name=+DG1/racdb/datafile/sysaux.257.657295195
  input datafile fno=00004 name=+DG1/racdb/datafile/users.259.657295199
  input datafile fno=00001 name=+DG1/racdb/datafile/system.256.657295195
  input datafile fno=00002 name=+DG1/racdb/datafile/undotbs1.258.657295197
  input datafile fno=00005 name=+DG1/racdb/datafile/undotbs2.264.657295475
  input datafile fno=00006 name=+DG1/racdb/datafile/tbs_test.268.658242359
  channel ORA_DISK_1: starting piece 1 at 30-JUN-08
  channel ORA_DISK_1: finished piece 1 at 30-JUN-08
  piece handle=/app/temp/dbfull_01jk7rjj_1_1 tag=DBFULL comment=NONE
  channel ORA_DISK_1: backup set complete, elapsed time: 00:00:55
  channel ORA_DISK_1: starting full datafile backupset
  channel ORA_DISK_1: specifying datafile(s) in backupset
  including current control file in backupset
  including current SPFILE in backupset
  channel ORA_DISK_1: starting piece 1 at 30-JUN-08
  channel ORA_DISK_1: finished piece 1 at 30-JUN-08
  piece handle=/app/temp/dbfull_02jk7rla_2_1 tag=DBFULL comment=NONE
  channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
  Finished backup at 30-JUN-08
   
  2>

-- 修改主庫的初始化引數


1.4、設定主庫初始化引數
$ sqlplus   /as sysdba
SQL> alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(WENDING,PHYSTDBY)' scope=spfile;        ###啟動db接受或傳送redo data,包括所有庫的db_unique_name,如果設定了多個DG庫,如下JLPROJCT3和JLPROJCT4都是DG庫應該:
 alter system set log_archive_config='DG_CONFIG=(JLPROJCT,JLPROJCT3,JLPROJCT4)';)

SQL> alter system set LOG_ARCHIVE_DEST_1='LOCATION=/orahome/arch1/WENDING VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=WENDING' scope=spfile;        (主庫歸檔目的地)

SQL> alter system set LOG_ARCHIVE_DEST_2='SERVICE=db_phystdby  LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PHYSTDBY' scope=spfile;    (當該庫充當主庫角色時,設定物理備庫redo data的傳輸目的地)
例如:
 SYS@JLPROJCTALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=JLPROJCT4   
LGWR  SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=JLPROJCT4';
System altered.

SQL> alter system set LOG_ARCHIVE_MAX_PROCESSES=5 scope=spfile;    (最大ARCn程式數,非必須)

SQL> alter system set LOG_ARCHIVE_DEST_STATE_1=ENABLE scope=spfile;    (開啟傳輸日誌的服務,允許redo傳輸服務傳輸資料到目的地,預設是enable)

SQL> alter system set LOG_ARCHIVE_DEST_STATE_2=ENABLE scope=spfile;    (同上)

SQL> alter system set REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE scope=spfile;    (exclusive or shared,所有庫sys密碼要一致,預設是exclusive)

--以下是主庫切換為備庫,充當備庫角色時的一些引數設定,如果不打算做資料庫切換就不用設定了
SQL> alter system set FAL_SERVER=db_phystdby scope=spfile;        (配置網路服務名,假如轉換為備庫角色時,從這裡獲取丟失的歸檔檔案)

SQL> alter system set FAL_CLIENT=db_wending scope=spfile;        (配置網路服務名,fal_server複製丟失的歸檔檔案到這裡)

SQL> alter system set DB_FILE_NAME_CONVERT='PHYSTDBY','WENDING' scope=spfile;    (前為切換後的主庫路徑,後為切換後的備庫路徑,如果主備庫目錄結構完全一樣,則無需設定)

SQL> alter system set LOG_FILE_NAME_CONVERT='PHYSTDBY','WENDING' scope=spfile;        (同上,這兩個名字轉換引數是主備庫的路徑對映關係,可能會是路徑全名,看情況而定)

SQL> alter system set STANDBY_FILE_MANAGEMENT=auto scope=spfile;        (auto後當主庫的datafiles增刪時備庫也同樣自動操作,且會把日誌傳送到備庫standby_archive_dest引數指定的目錄下,確保該目錄存在,如果你的儲存採用檔案系統沒有問題,但是如果採用了裸裝置,你就必須將該引數設定為manual)

SQL> alter system set STANDBY_ARCHIVE_DEST='LOCATION=/orahome/arch1/WENDING' scope=spfile;    (一般和LOG_ARCHIVE_DEST_1的位置一樣,如果備庫採用ARCH傳輸方式,那麼主庫會把歸檔日誌傳到該目錄下,但是11g 一般使用redo,所以這個引數正在被大家遺忘)
有了以上引數設定,則無論該庫充當主庫角色還是備庫角色都無需再修改了。
然後重啟資料庫:



四.  建立備庫的引數檔案 和控制檔案.

SQL> create pfile='/app/oracle/admin/racdb/pfile/standby.pfile' from spfile;

File created.

SQL> ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/app/temp/standby.ctl';                        

Database altered.

把 pfile , ctrontl file  複製到備份資料庫上相應目錄下,引數檔案和口令檔案在  $ORACLE_HOME/dbs/下(在備份資料庫上修改引數檔案,去掉rac的引數.)


五.口令檔案,可以直接把主庫的口令檔案傳過去進行重新命名即可,
也可以在standby 上建立密碼檔案,但是sys使用者的密碼必須要和主庫的一樣。

[oracle@oradb dbs]$ orapwd file=/opt/oracle/product/11.2.0/dbhome_1/dbs/orapwJLPROJCT4   password=manager202  entries=5;


[oracle@oradb pfile]$ sqlplus   / as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on Tue Jul 1 13:03:12 2008

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

Connected to an idle instance.

六:在備庫操作

1,啟動standby例項。並啟動mount狀態

SQL> startup nomount             
ORACLE instance started.

Total System Global Area  213909504 bytes
Fixed Size                  1260984 bytes
Variable Size              79692360 bytes
Database Buffers          130023424 bytes
Redo Buffers                2932736 bytes
SQL> alter database mount 

Database altered.

2,rman 進行恢復


[oracle@oradb ~]$ rman target /

Recovery Manager: Release 10.2.0.3.0 - Production on Tue Jul 1 13:03:57 2008

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

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

RMAN> restore database;

Starting restore at 01-JUL-08
Starting implicit crosscheck backup at 01-JUL-08
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=536 devtype=DISK
Crosschecked 2 objects
Finished implicit crosscheck backup at 01-JUL-08

Starting implicit crosscheck copy at 01-JUL-08
using channel ORA_DISK_1
Finished implicit crosscheck copy at 01-JUL-08

searching for all files in the recovery area
cataloging files...
no files cataloged

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to +DG1/racdb/datafile/system.256.657295195
restoring datafile 00002 to +DG1/racdb/datafile/undotbs1.258.657295197
restoring datafile 00003 to +DG1/racdb/datafile/sysaux.257.657295195
restoring datafile 00004 to +DG1/racdb/datafile/users.259.657295199
restoring datafile 00005 to +DG1/racdb/datafile/undotbs2.264.657295475
restoring datafile 00006 to +DG1/racdb/datafile/o1_mf_tbs_test_46mjwd9n_.dbf
channel ORA_DISK_1: reading from backup piece /app/temp/dbfull_01jk7rjj_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/app/temp/dbfull_01jk7rjj_1_1 tag=DBFULL
channel ORA_DISK_1: restore complete, elapsed time: 00:01:56
Finished restore at 01-JUL-08


4,開啟MRP程式,應用日誌,重演變化。這個步驟相當於在recover,在進行這個步驟之前,你alter  database open  read only;會報錯:某個檔案需要進行介質恢復

SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION; #歸檔之後 才應用

alter database recover managed standby database using current logfile disconnect from session;#實時應用日誌


七:備用資料庫 新增 standby log file          

注意:如果你在主庫全備份之前已經新增上了standby  日誌組,那麼等你在備庫restore之後,就有了和主庫一樣的日誌組個數,只是路徑變成了在引數檔案裡設定的路徑了,所以你就沒必要再新增了。

1,先關掉MRP程式。

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

Database altered.

ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 5 ('/backup/onlinelog/standby1.log') SIZE 2g;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 6 ('/backup/onlinelog/standby2.ora') SIZE 2g;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 7 ('/backup/onlinelog/standby3.ora') SIZE 2g;

ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 group 8 ('/backup/onlinelog/standby4.ora') SIZE 2g;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 group 9 ('/backup/onlinelog/standby5.ora') SIZE 2g;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 group 10('/backup/onlinelog/standby6.ora') SIZE 2g;

ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 11 ('/backup/onlinelog/standby7.log') SIZE 2g;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 12 ('/backup/onlinelog/standby8.ora') SIZE 2g;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 13 ('/backup/onlinelog/standby9.ora') SIZE 2g;

ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 group 14 ('/backup/onlinelog/standby10.ora') SIZE 2g;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 group 15 ('/backup/onlinelog/standby11.ora') SIZE 2g;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 group 16('/backup/onlinelog/standby12.ora') SIZE 2g;

ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 17 ('/backup/onlinelog/standby13.log') SIZE 2g;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 18 ('/backup/onlinelog/standby14.ora') SIZE 2g;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 19 ('/backup/onlinelog/standby15.ora') SIZE 2g;

ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 group 20 ('/backup/onlinelog/standby16.ora') SIZE 2g;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 group 21 ('/backup/onlinelog/standby17.ora') SIZE 2g;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 group 22('/backup/onlinelog/standby18.ora') SIZE 2g;

ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group23 ('/backup/onlinelog/standby19.log') SIZE 2g;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 24 ('/backup/onlinelog/standby20.ora') SIZE 2g;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 25 ('/backup/onlinelog/standby21.ora') SIZE 2g;

ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 group 26 ('/backup/onlinelog/standby22.ora') SIZE 2g;


八:-- 檢查 standby 日誌應用情況.

先檢視主庫歸檔的位置:備庫比主庫小點正常。

 SYS@JLPROJCT4> select sequence#,thread#,first_time,next_time,APPLIED from v$archived_log order by 1;     

 SEQUENCE#    THREAD# FIRST_TIME         NEXT_TIME          APPLIED

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

     27387          1 26-OCT-15          26-OCT-15          NO

     27388          1 26-OCT-15          26-OCT-15          NO

     27388          1 26-OCT-15          26-OCT-15          NO

     27389          1 26-OCT-15          26-OCT-15          NO

     27390          1 26-OCT-15          26-OCT-15          NO

 SYS@JLPROJCT4> select sequence#,thread#,first_time,next_time,APPLIED from v$archived_log order by 1;     

 SEQUENCE#    THREAD# FIRST_TIM NEXT_TIME APPLIED

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

     27377          1 26-OCT-15 26-OCT-15 NO

     27378          1 26-OCT-15 26-OCT-15 NO

     27379          1 26-OCT-15 26-OCT-15 NO

     27380          1 26-OCT-15 26-OCT-15 NO

     27381          1 26-OCT-15 26-OCT-15 NO

     27382          1 26-OCT-15 26-OCT-15 NO

     27383          1 26-OCT-15 26-OCT-15 NO

     27384          1 26-OCT-15 26-OCT-15 NO

     27385          1 26-OCT-15 26-OCT-15 NO

     27386          1 26-OCT-15 26-OCT-15 NO

     27387          1 26-OCT-15 26-OCT-15 NO

     27388          1 26-OCT-15 26-OCT-15 NO

九:關掉MRP程式,然後以只讀的方式,開啟資料庫,再重新開啟MRP程式。

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

SYS@JLPROJCT3> alter database open read only;

Database altered.

SYS@JLPROJCT3> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION; #歸檔之後 才應用
alter database recover managed standby database using current logfile disconnect from session;#實時應用日誌

Database altered.


錯誤處理:

1.standby資料庫mount時,

SQL> alter database mount
alter database mount standby database
*
ERROR at line 1:
ORA-01103: database name 'RACDB' in control file is not 'ORADB'

解決: 是由於備庫的 初始化引數檔案 db_name 和主庫配置的不一樣. 主備資料庫的db_name 要一致.例項名稱可以不一致.

2.

=====================
Tue Jul  1 13:42:27 2008
Errors in file /app/oracle/admin/oradb/bdump/oradb_mrp0_6850.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '+RECOVERYDEST/racdb/onlinelog/group_1.257.657295339'
ORA-17503: ksfdopn:2 Failed to open file +RECOVERYDEST/racdb/onlinelog/group_1.257.657295339
ORA-15001: diskgroup "RECOVERYDEST" does not exist or is not mounted
ORA-15077: could not locate ASM instance serving a required diskgroup
ORA-29701: unable to connect to Cluster Manager
ORA-00312: online log 1 thread 1: '+DG1/racdb/onlinelog/group_1.261.657295335'
ORA-17503: ksfdopn:2 Failed to open file +DG1/racdb/onlinelog/group_1.261.657295335
ORA-15001: diskgroup "DG1" does not exist or is not mounted
ORA-15077: could not locate ASM instance serving a required diskgroup
ORA-29701: unable to connect to Cluster Manager
Tue Jul  1 13:42:27 2008


說明: 第一次出現這個錯誤是正常的.因為standby db 沒有primary 的online log , db 會自動處理把parimay db 的online log copy 到 standby 機器上面.

 3,備庫沒有RFS程式,可知道這個程式是備庫接受主庫傳來的日誌的。

SYS@JLPROJCT4> SELECT PROCESS, STATUS, THREAD#, SEQUENCE#, BLOCK#, BLOCKS FROM V$MANAGED_STANDBY;

PROCESS   STATUS          THREAD#  SEQUENCE#     BLOCK#     BLOCKS
--------- ------------ ---------- ---------- ---------- ----------
ARCH      CONNECTED             0          0          0          0
ARCH      CONNECTED             0          0          0          0
ARCH      CONNECTED             0          0          0          0
ARCH      CONNECTED             0          0          0          0

MRP0      WAIT_FOR_LOG          2      25234          0          0

解決:備庫口令檔案失效導致,把主庫的口令檔案,scp到standby庫相應目錄,重啟standby,就OK了。

SYS@JLPROJCT4> SELECT PROCESS, STATUS, THREAD#, SEQUENCE#, BLOCK#, BLOCKS FROM V$MANAGED_STANDBY;

PROCESS   STATUS          THREAD#  SEQUENCE#     BLOCK#     BLOCKS
--------- ------------ ---------- ---------- ---------- ----------
ARCH      CONNECTED             0          0          0          0
ARCH      CONNECTED             0          0          0          0
ARCH      CONNECTED             0          0          0          0
ARCH      CONNECTED             0          0          0          0
RFS       IDLE                  0          0          0          0
RFS       IDLE                  0          0          0          0
RFS       IDLE                  0          0          0          0
MRP0      WAIT_FOR_LOG          2      25234          0          0
RFS       IDLE                  0          0          0          0
RFS       IDLE                  0          0          0          0

10 rows selected.

4,

RMAN> restore database;
Starting restore at 26-JUL-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=47 devtype=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/26/2012 12:41:17
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 7 found to restore
RMAN-06023: no backup or copy of datafile 6 found to restore
RMAN-06023: no backup or copy of datafile 5 found to restore
RMAN-06023: no backup or copy of datafile 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore
原因:這個是由於
Oracle使用的當前控制檔案不允許
從這個歷史的備份集中進行恢復,從而導致了RMAN-06026這個錯誤
解決:在主庫重新建立standby  控制檔案,
SQL> ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/app/temp/standby.ctl';
然後傳給備庫,名字和路徑要和引數檔案制定的路徑和名字一致。


附錄:
主庫引數檔案:

[oracle@rac1 backup]$ cat pfile.ora

JLPROJCT2.__db_cache_size=181999239168

JLPROJCT1.__db_cache_size=177704271872

JLPROJCT2.__java_pool_size=536870912

JLPROJCT1.__java_pool_size=536870912

JLPROJCT2.__large_pool_size=536870912

JLPROJCT1.__large_pool_size=536870912

JLPROJCT1.__oracle_base='/oracle'#ORACLE_BASE set from environment

JLPROJCT2.__oracle_base='/oracle'#ORACLE_BASE set from environment

JLPROJCT2.__pga_aggregate_target=63350767616

JLPROJCT1.__pga_aggregate_target=63350767616

JLPROJCT2.__sga_target=209916526592

JLPROJCT1.__sga_target=209916526592

JLPROJCT2.__shared_io_pool_size=0

JLPROJCT1.__shared_io_pool_size=0

JLPROJCT2.__shared_pool_size=25769803776

JLPROJCT1.__shared_pool_size=28991029248

JLPROJCT2.__streams_pool_size=0

JLPROJCT1.__streams_pool_size=1073741824

*.audit_file_dest='/oracle/admin/JLPROJCT/adump'

*.audit_trail='db'

*.cluster_database=true

*.compatible='11.2.0.0.0'

*.control_files='+DATA/jlprojct/controlfile/current.260.865954309','+ARCH/jlprojct/controlfile/current.256.865954309'

*.db_block_size=8192

*.db_create_file_dest='+DATA'

*.db_domain=''

*.db_file_name_convert='/backup/data/JLPROJCT/','+data/jlprojct/datafile/'

*.db_name='JLPROJCT'

*.db_recovery_file_dest='+ARCH'

*.db_recovery_file_dest_size=536870912000

*.db_unique_name='JLPROJCT'

*.diagnostic_dest='/oracle'

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

JLPROJCT1.fal_client='JLPROJCT1'

JLPROJCT2.fal_client='JLPROJCT2'

*.fal_client='JLPROJCT'

*.fal_server='JLPROJCT3'

JLPROJCT1.instance_number=1

JLPROJCT2.instance_number=2

*.log_archive_config='DG_CONFIG=(JLPROJCT,JLPROJCT3,JLPROJCT4)'

*.log_archive_dest_1='location=+arch/jlprojct/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=JLPROJCT'

*.log_archive_dest_2='SERVICE=JLPROJCT3  LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=JLPROJCT3'

*.log_archive_dest_3='SERVICE=JLPROJCT4  LGWR  SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=JLPROJCT4'

*.log_archive_dest_state_1='ENABLE'

*.log_archive_dest_state_2='ENABLE'

*.log_archive_format='%t_%s_%r.dbf'

*.log_file_name_convert='/backup/arch/','+arch/jlprojct/archivelog/'

*.nls_language='SIMPLIFIED CHINESE'

*.nls_territory='CHINA'

*.open_cursors=300

*.pga_aggregate_target=62914560000

*.processes=10000

*.remote_listener='rac-scan:1521'

*.remote_login_passwordfile='EXCLUSIVE'

*.sessions=10000

*.sga_target=209715200000

*.standby_file_management='AUTO'

JLPROJCT2.thread=2

JLPROJCT1.thread=1

JLPROJCT1.undo_tablespace='UNDOTBS1'

JLPROJCT2.undo_tablespace='UNDOTBS2'

standby庫引數檔案:
[oracle@java3 dbs]$ cat initJLPROJCT4.ora
JLPROJCT1.__db_cache_size=180388626432
JLPROJCT2.__db_cache_size=184683593728
JLPROJCT3.__db_cache_size=196494753792
JLPROJCT4.__db_cache_size=196494753792
JLPROJCT1.__java_pool_size=536870912
JLPROJCT2.__java_pool_size=536870912
JLPROJCT3.__java_pool_size=536870912
JLPROJCT4.__java_pool_size=536870912
JLPROJCT1.__large_pool_size=536870912
JLPROJCT2.__large_pool_size=536870912
JLPROJCT3.__large_pool_size=536870912
JLPROJCT4.__large_pool_size=536870912
JLPROJCT1.__oracle_base='/oracle'#ORACLE_BASE set from environment
JLPROJCT2.__oracle_base='/oracle'#ORACLE_BASE set from environment
JLPROJCT3.__oracle_base='/opt/oracle'#ORACLE_BASE set from environment
JLPROJCT4.__oracle_base='/opt/oracle'#ORACLE_BASE set from environment
JLPROJCT1.__pga_aggregate_target=63350767616
JLPROJCT2.__pga_aggregate_target=63350767616
JLPROJCT3.__pga_aggregate_target=63350767616
JLPROJCT4.__pga_aggregate_target=63350767616
JLPROJCT1.__sga_target=209916526592
JLPROJCT2.__sga_target=209916526592
JLPROJCT3.__sga_target=209916526592
JLPROJCT4.__sga_target=209916526592
JLPROJCT1.__shared_io_pool_size=0
JLPROJCT2.__shared_io_pool_size=0
JLPROJCT3.__shared_io_pool_size=0
JLPROJCT4.__shared_io_pool_size=0
JLPROJCT1.__shared_pool_size=26306674688
JLPROJCT2.__shared_pool_size=23085449216
JLPROJCT3.__shared_pool_size=11274289152
JLPROJCT4.__shared_pool_size=11274289152
JLPROJCT1.__streams_pool_size=1073741824
JLPROJCT2.__streams_pool_size=0
JLPROJCT3.__streams_pool_size=0
JLPROJCT4.__streams_pool_size=0
*.audit_file_dest='/oracle/admin/JLPROJCT/adump'
*.audit_trail='none'
*.cluster_database=false
*.compatible='11.2.0.0.0'
*.control_files='/opt/oracle/control_1.ctl','/opt/oracle/control_2.ctl'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain=''
*.DB_FILE_NAME_CONVERT='+data/jlprojct/datafile/','/backup/','+DATA/jlprojct/tempfile/','/backup/'
*.DB_NAME='JLPROJCT'
*.db_recovery_file_dest='/backup/'
*.db_recovery_file_dest_size=536870912000
*.DB_UNIQUE_NAME='JLPROJCT4'
*.diagnostic_dest='/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=JLPROJCTXDB)'
##JLPROJCT1.fal_client='JLPROJCT1'
##JLPROJCT2.fal_client='JLPROJCT2'
*.FAL_SERVER='JLPROJCT'
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(JLPROJCT4,JLPROJCT)'
*.LOG_ARCHIVE_DEST_1='location=/backup/
  VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
  DB_UNIQUE_NAME=JLPROJCT4'
*.log_archive_dest_2='SERVICE=JLPROJCT LGWR SYNC  VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)   DB_UNIQUE_NAME=JLPROJCT'
*.LOG_ARCHIVE_DEST_STATE_1='ENABLE'
*.LOG_ARCHIVE_DEST_STATE_2='ENABLE'
*.LOG_ARCHIVE_FORMAT='%t_%s_%r.arc'
*.LOG_FILE_NAME_CONVERT='+DATA/jlprojct/onlinelog/','/backup/','+ARCH/jlprojct/onlinelog/','/backup/','+ARCH/jlprojct/archivelog/','/backup/'
*.nls_language='AMERICAN'
*.nls_territory='CHINA'
*.open_cursors=300
*.pga_aggregate_target=62914560000
*.processes=3000
*.REMOTE_LOGIN_PASSWORDFILE='EXCLUSIVE'
*.sessions=3305
*.sga_target=209715200000
*.STANDBY_FILE_MANAGEMENT='AUTO'
JLPROJCT2.thread=2
JLPROJCT1.thread=1
JLPROJCT1.undo_tablespace='UNDOTBS1'




補充:
備庫建立並配置 Standby Redo Log 是為了能夠接收到主庫傳過來的日誌,用作恢復
主庫建立並配置 Standby Redo Log 是為了在主備切換之後,能夠接收到原備庫(切換之後的主庫)傳過來的日誌
        
       ㈠ 建立 Standby Redo Log
        建立的原則:
          ① Standby Redo Log 的檔案大小與主庫 online redo log 檔案大小相同
          ② Standby Redo Log 日誌檔案組的個數依照下面的原則進行計算:
              Standby redo log組數公式 >= (每個instance日誌組個數+1)*instance個數
              例如在我的環境中,只有一個節點,這個節點有三組redo,所以
              Standby redo log組數公式>=(3+1)*1  == 4
              所以需要建立4組Standby redo log
          ③ 每一日誌組為了安全起見,可以做多路映象

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28211342/viewspace-2129451/,如需轉載,請註明出處,否則將追究法律責任。

相關文章