Oracle10g RAC配置standby

aluocp發表於2007-07-26

準備工作:
1.啟用歸檔
在主庫上的每個節點都要設定,注:在一臺機器設定歸檔時其他的節點例項都要關閉
sqlplus /nolog
SQL>conn /as sysdba
SQL > alter system set log_archive_dest_1 = "location="
SQL > alter system set log_archive_format='arch_%t_%s_%r.arc' scope=spfile;
SQL > shutdown immediate
SQL> alter database archivelog;
Database altered.
SQL> archive log start
Statement processed.
SQL> alter database open
Database altered.
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +ARCH/arch2/
SQL> show parameter archive_start

[@more@]2.設定主庫的強行日誌處理:(每個節點都執行)
SQL> ALTER DATABASE FORCE LOGGING;
3.建立備份目錄(主備同時建立)
mkdir -p /backup/databackup/
chown -R oracle.oinstall /backup
備份主庫資料
3.1 備份spfile檔案
SQL> CREATE PFILE='/backup/databackup/standby.ora' FROM SPFILE;
3.2 rman到處主庫的資料檔案及控制檔案
rman target /
RMAN> backup device type disk format '/backup/databackup/%U' database plus archivelog;
RMAN> backup device type disk format '/backup/databackup/%U' current controlfile for standby;
3.3將主庫的listener.ora, tnsnames.ora檔案複製到/backup/databackup/
cd $ORACLE_HOME/network/admin/*.ora /backup/databackup/
4.在備庫下建立資料庫的檔案存放目錄:
cd $ORACLE_BASE
mkdir -p admin/rac/bdump
mkdir -p admin/rac/cdump
mkdir -p admin/rac/udump
mkdir -p admin/rac/adump
mkdir -p admin/rac/dpdump
mkdir -p admin/rac/hdump
5.將備份的資料從主庫複製到standby機上
5.1 scp -rp /backup/databackup/*
5.2 將standby上的listener.ora, tnsnames.ora 複製到主機
scp -rp $ORACLE_BASE

6.備機上執行一下操作
6.1 備機上合併listener.ora, tnsnames.ora
cat /backup/databackup/listener.ora >> $ORACLE_HOME/network/admin/listener.ora
cat /backup/databackup/tnsnames.ora >> $ORACLE_HOME/network/admin/tnsnames.ora
6.2 主機上合併listener.ora, tnsnames.ora
cat $ORACLE_BASE/listener.ora >> $ORACLE_HOME/network/admin/listener.ora
cat $ORACLE_BASE/tnsnames.ora >> $ORACLE_HOME/network/admin/tnsnames.ora
6.3備機上建立密碼檔案
cd $ORACLE_HOME/dbs
orapwd file=orapw$ORACLE_SID password=oracle entries=5
6.4 將spfie檔案複製到$ORACLE_HOME/dbs下
cp /backup/databackup/standby.ora $ORACLE_HOME/dbs/initstandby.ora
6.5修改其中引數,刪除有關叢集的引數並新增standby設定引數,相見如下
*.audit_file_dest='/oracle/oracle/admin/rac/adump'
*.background_dump_dest='/oracle/oracle/admin/rac/bdump'
*.compatible='10.2.0.2.0'
*.control_files='+SDATA/rac/controlfile/Current.257.607694417','+SDATA/rac/controlfile/backup.258.607694417'
*.core_dump_dest='/oracle/oracle/admin/rac/cdump'
*.db_block_size=8192
*.db_create_file_dest='+SDATA'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='RAC'
*.db_recovery_file_dest='+SDATA'
*.db_recovery_file_dest_size=2147483648
*.instance_name='standby'
*.job_queue_processes=10
*.log_archive_dest_1='location=+SARCH'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_format='arch_%t_%s_%r.arc'
*.open_cursors=300
*.pga_aggregate_target=520093696
*.processes=150
*.remote_login_passwordfile='exclusive'
*.sga_target=1073741824
*.thread=1
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS2'
*.user_dump_dest='/oracle/oracle/admin/rac/udump'
*.db_file_name_convert='+DATA','+SDATA'
*.standby_file_management=auto
*.fal_server='RAC'
*.fal_client='STANDBY'
*.service_names='rac'
*.standby_archive_dest='+SARCH'
6.6 在ASM磁碟組中新增目錄:
export ORACLE_SID=+ASM
sqlplus /nolog
SQL>conn /as sysdba
SQL> alter diskgroup sdata add directory '+SDATA/RAC';
6.7建立spfile檔案
export ORACLE_SID=standby
sqlplus /nolog
SQL>conn /as sysdba
SQL> CREATE SPFILE='+SDATA/spfilestandby.ora FROM PFILE='$ORACLE_HOME/dbs/initstandby.ora';
6.7倒入資料到資料庫
sqlplus /nolog
SQL>conn /as sysdba
SQL> STARTUP NOMOUNT
rman target auxiliary /
RMAN> duplicate target database for standby;
6.8 啟動standby
SQL>startup nomount
SQL>alter database mount standby database;
SQL>recover automatic standby database;
SQL>alter database recover managed standby database disconnect from session;
注:如果遇到不能識別控制檔案的現象,在asm的卷中找到相應的? 7.在主庫上分別設定歸檔路徑 (每個節點?     

 7.在主庫上分別設定歸?

  SQL>alter system set log_archive_de

  SQL>alter system se
SQL>alter system set log_archive_de賈蔥?
觀察alter日誌,如果歸檔正常,說明stst_2='SERVICE=standby REOPEN=180' scope=both;
8.失敗切換: st_state_2=enable scope=both;
預先設定好init引數檔案,去掉其中的standby引數
SQL>alter database recover managed standby database finish force;
SQL>alter database commit to switchover to primary;
SQL>alter database open;
如果start之前有過read only open,需要restart備庫,關閉資料庫,應用引數檔案,重新啟動

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

相關文章