配置 Oracle 10g RAC primary + RAC physical standby dataguard

wenaini發表於2009-01-22
MMA的東西,正好手上有機器,以前老偷懶不寫過程,現在也要給寫出來作手冊。。。。[@more@]

其實配置過程對老手來說可能就花在備份資料庫上了呵呵

下面以prdb作為primary,lstdb作為standby,用lstdb做名字是因為接下來一篇還要把physical standby(dataguard)轉換成邏輯的standby(logical standby)

這裡介紹一個快速裝dataguard的方法,就是索性在standby端直接dbca安裝一個資料庫,這樣必要的資料夾有了,密碼檔案也不需要從primary傳過來了,監聽也有現成的了。新手犯錯誤的機率會降低很多。

prdb端:

首先修改設定:

ALTER DATABASE FORCE LOGGING;

alter system set log_archive_dest_1='location=+data/prdb/arch valid_for=(all_logfiles,all_roles) db_unique_name=prdb' scope=both;
alter system set standby_archive_dest='location=+data/prdb/arch' scope=both;
alter system set fal_client='prdb' scope=both;
alter system set fal_server='lstdb' scope=both;
alter system set db_file_name_convert='+data/lstdb','+data/prdb' scope=spfile;
alter system set log_file_name_convert='+data/lstdb','+data/prdb' scope=spfile;
alter system set standby_file_management=auto scope=both;
alter system set db_unique_name='prdb' scope=spfile;

startup mount force 讓引數生效

alter database archivelog; 開啟歸檔模式

然後進行備份:

rman target /

BACKUP DEVICE TYPE DISK FORMAT '/nas_data/orabackup/%U' DATABASE plus ARCHIVELOG;
BACKUP DEVICE TYPE DISK FORMAT '/nas_data/orabackup/st_%U' CURRENT CONTROLFILE FOR STANDBY;

備份完以後最好執行一下

alter system archive log current;

否則如果傳送到standby端開始duplicate的時候,primary還沒有切換過日誌,那麼會報錯找不到可用的控制檔案備份.

把備份傳送到standby端同樣的目錄.

lstdb:

startup nomount pfile='pst.ora'

create spfile='+DATA/lstdb/spfilelstdb.ora' from pfile='pst.ora';

startup nomount force;

就可以了pst.ora是引數檔案,後面會貼出來。

然後進行復製備用資料庫:

rman target auxiliary /

DUPLICATE TARGET DATABASE FOR STANDBY DORECOVER;

複製最後可能會報一些錯誤如:

Oracle Error:
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '+DATA/lstdb/datafile/system.272.676722947'

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 01/21/2009 10:36:20
RMAN-03015: error occurred in stored script Memory Script
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of log thread 2 seq 7 lowscn 542060 found to restore
RMAN-06025: no backup of log thread 2 seq 6 lowscn 541904 found to restore
RMAN-06025: no backup of log thread 1 seq 8 lowscn 542063 found to restore

這些都沒關係,只要保證日誌沒有缺失就可以,少的日誌都可以透過FAL傳送過去

完成以後就可以開始進行保護恢復了:

lstdb:

alter database recover managed standby database disconnect from session;

prdb:

alter system set log_archive_dest_2='service=lstdb reopen=120 valid_for=(online_logfiles,primary_role) db_unique_name=prdb' scope=both;

上面是最大效能,如果要作最大保護和最大可用就要新增standby redo和修改下log_archive_dest_2

dataguard的設定其實就是個經驗問題,測試下雙方是不是能用sys登入對方,引數設定是不是有問題。事後看看alert和arch或者lgwr的trc就差不多了。

下面是2個叢集的初始化檔案:

[oracle@jiaoyou1 ~]$ more pr.ora
prdb1.__db_cache_size=889192448
prdb2.__db_cache_size=889192448
prdb1.__java_pool_size=16777216
prdb2.__java_pool_size=16777216
prdb1.__large_pool_size=16777216
prdb2.__large_pool_size=16777216
prdb1.__shared_pool_size=285212672
prdb2.__shared_pool_size=285212672
prdb1.__streams_pool_size=0
prdb2.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/prdb/adump'
*.background_dump_dest='/u01/app/oracle/admin/prdb/bdump'
*.cluster_database_instances=2
*.cluster_database=true
*.compatible='10.2.0.3.0'
*.control_files='+DATA/prdb/controlfile/current.386.676829633'
*.core_dump_dest='/u01/app/oracle/admin/prdb/cdump'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_file_name_convert='+data/lstdb','+data/prdb'
*.db_name='prdb'
*.db_unique_name='prdb'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=prdbXDB)'
*.fal_client='prdb'
*.fal_server='lstdb'
prdb1.instance_number=1
prdb2.instance_number=2
*.job_queue_processes=10
*.log_archive_dest_1='location=+data/prdb/arch valid_for=(all_logfiles,all_roles) db_unique_name=prdb'
*.log_archive_dest_2='service=lstdb reopen=120 valid_for=(online_logfiles,primary_role) db_unique_name=prdb'
*.log_file_name_convert='+data/lstdb','+data/prdb'
*.open_cursors=300
*.pga_aggregate_target=406847488
*.processes=150
*.remote_listener='LISTENERS_PRDB'
*.remote_login_passwordfile='exclusive'
*.sga_target=1222639616
*.standby_archive_dest='location=+data/prdb/arch'
*.standby_file_management='AUTO'
prdb2.thread=2
prdb1.thread=1
*.undo_management='AUTO'
prdb2.undo_tablespace='UNDOTBS2'
prdb1.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/app/oracle/admin/prdb/udump'

[oracle@jy1 ~]$ more pst.ora
lstdb2.__db_cache_size=1929379840
lstdb1.__db_cache_size=1862270976
lstdb2.__java_pool_size=16777216
lstdb1.__java_pool_size=16777216
lstdb2.__large_pool_size=16777216
lstdb1.__large_pool_size=16777216
lstdb2.__shared_pool_size=503316480
lstdb1.__shared_pool_size=570425344
lstdb2.__streams_pool_size=0
lstdb1.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/lstdb/adump'
*.background_dump_dest='/u01/app/oracle/admin/lstdb/bdump'
*.cluster_database_instances=2
*.cluster_database=TRUE
*.compatible='10.2.0.3.0'
*.control_files='+DATA/lstdb/controlfile/current.652.676829111'#Restore Controlfile
*.core_dump_dest='/u01/app/oracle/admin/lstdb/cdump'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_file_name_convert='+data/prdb','+data/lstdb'
*.db_name='prdb'
*.db_unique_name='lstdb'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=lstdbXDB)'
*.fal_client='lstdb'
*.fal_server='prdb'
lstdb2.instance_number=2
lstdb1.instance_number=1
*.job_queue_processes=10
*.log_archive_dest_1='location=+data/lstdb/arch valid_for=(all_logfiles,all_roles) db_unique_name=lstdb'
*.log_archive_dest_2='service=prdb valid_for=(online_logfiles,primary_role) db_unique_name=lstdb'
*.log_file_name_convert='+data/prdb','+data/lstdb'
*.open_cursors=300
*.pga_aggregate_target=825229312
*.processes=150
*.remote_listener='LISTENERS_LSTDB'
*.remote_login_passwordfile='exclusive'
*.service_names='LSTDB'
*.sga_target=2476736512
*.standby_archive_dest='location=+data/lstdb/arch'
*.standby_file_management='AUTO'
lstdb2.thread=2
lstdb1.thread=1
*.undo_management='AUTO'
lstdb2.undo_tablespace='UNDOTBS2'
lstdb1.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/app/oracle/admin/lstdb/udump'

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

相關文章