單節點主庫、邏輯備庫升級為RAC、物理備庫、邏輯備庫(4)

aaqwsh發表於2010-12-15

 

5         建立rac  phy stdby

 

A   引數

inittestrac1.ora:

*.control_files='+DATA/testrac/controlfile/current.297.737327023'

要先寫成這樣,在restore時才會放入+DATA

 

*.undo_management = AUTO

*.db_name = hellodb

*.db_block_size = 8192

*.processes=500

*.sessions=500

*.sga_max_size=4G

*.sga_target=4G

*.large_pool_size=1G

*.background_dump_dest=/data/oracle/oradata/hellodb/bdump

*.user_dump_dest=/data/oracle/oradata/hellodb/udump

*.core_dump_dest=/data/oracle/oradata/hellodb/cdump

*.DB_UNIQUE_NAME='testrac'

*.FAL_CLIENT='tns52'

*.fal_server='tnsrac'

*.log_archive_config='DG_CONFIG=(testrac,db52,db02)'

*.log_archive_dest_1='LOCATION=+ARCH'

*.log_archive_dest_2='SERVICE=tns52 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=db52'

*.log_archive_dest_3='SERVICE=tns02 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=db02'

*.log_archive_dest_state_1='enable'

*.log_archive_dest_state_2='enable'

*.log_archive_dest_state_3='enable'

*.standby_file_management='AUTO'

*.compatible=10.2.0.1.0

*.log_file_name_convert='/data/oracle/oradata/hellodb','+ARCH'

*.db_create_file_dest='+DATA'

*.db_file_name_convert='/data/oracle/oradata/hellodb','+DATA/testrac/datafile'

 

*.control_files='+DATA/pri/controlfile/current.309.737145001'

#*.cluster_database_instances=2

#*.cluster_database=true

testrac2.instance_number=2

testrac1.instance_number=1

testrac1.local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.25) (PORT = 1521))'

testrac2.local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.26) (PORT = 1521))'

testrac2.thread=2

testrac1.thread=1

testrac1.undo_tablespace='UNDOTBS1'

testrac2.undo_tablespace='UNDOTBS2'

*.remote_listener='LISTENERS_testrac'

testrac1.job_queue_processes=0

testrac2.job_queue_processes=10

*._in_memory_undo=FALSE

 

B   rman 在備庫恢復

cp orapwhellodb /data/oracle/product/10.2/db1/dbs/orapwtestrac1

export ORACLE_SID=testrac1

startup nomount;

 

export ORACLE_SID=testrac1

rman target /

startup nomount

restore controlfile   from '/data/backup/stdctl_hellodb.ctl';

output filename=+DATA/testrac/controlfile/current.297.737327023

 

shutdown  immediate

修改inittestrac1.ora

*.control_files='+DATA/testrac/controlfile/current.297.737327023'

 

startup mount

 

SQL> select name from v$datafile;

 

NAME

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

+DATA/testrac/datafile/system.dbf

+DATA/testrac/datafile/undotbs01.dbf

+DATA/testrac/datafile/sysaux.dbf

 

52 上查

SQL> col NAME format a60

SQL> select FILE# ,NAME from v$datafile;

 

     FILE# NAME

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

         1 /data/oracle/oradata/hellodb/system.dbf

         2 /data/oracle/oradata/hellodb/undotbs01.dbf

         3 /data/oracle/oradata/hellodb/sysaux.dbf

 

SQL>

 

21上(如果目錄不同要註冊):

RUN

{

allocate channel d1 type disk;

allocate channel d2 type disk;

allocate channel d3 type disk;

allocate channel d4 type disk;

SET NEWNAME FOR DATAFILE  1 to '+DATA/testrac/datafile/system.dbf';

SET NEWNAME FOR DATAFILE  2 to '+DATA/testrac/datafile/undotbs01.dbf';

SET NEWNAME FOR DATAFILE  3 to '+DATA/testrac/datafile/sysaux.dbf';

RESTORE DATABASE;

SWITCH DATAFILE ALL;

release channel d1;

release channel d2;

release channel d3;

release channel d4;

}

 

下面的預設設定應該要調整

SQL> col MEMBER format a60;

SQL> select * from v$logfile;

 

    GROUP# STATUS  TYPE    MEMBER                                                       IS_

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

         1         ONLINE  +ARCH/redo1.log                                              NO

         2         ONLINE  +ARCH/redo2.log                                              NO

         3         ONLINE  +ARCH/redo3.log                                              NO

 

 

21 增加STANDBY LOGFILE

ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 4   SIZE 50M;

ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 5   SIZE 50M;

ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 6   SIZE 50M;

SQL> select * from v$logfile;

 

    GROUP# STATUS  TYPE    MEMBER                                                       IS_

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

         1         ONLINE  +ARCH/redo1.log                                              NO

         2         ONLINE  +ARCH/redo2.log                                              NO

         3         ONLINE  +ARCH/redo3.log                                              NO

         4         STANDBY +DATA/testrac/onlinelog/group_4.321.737328085                 NO

         5         STANDBY +DATA/testrac/onlinelog/group_5.320.737328085                 NO

         6         STANDBY +DATA/testrac/onlinelog/group_6.322.737328087                 NO

 

  

shutdown immediate

startup mount

alter database recover managed standby database disconnect from session using current logfile;

 

主庫重啟:

shutdown immediate;

修改:

*.log_archive_dest_state_2='enable'

 

在主庫切換日誌

alter system switch logfile;

col member format a50;

set line 400;

 select * from v$log;

 

看到備庫已經應用同步日誌:

SQL> select * from (

  2  select  thread#,sequence# ,APPLIED, row_number() over(partition by thread# order by sequence# desc ) rn from v$archived_log

) where rn <=8;  3 

 

   THREAD#  SEQUENCE# APP         RN

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

         1         29 YES          1

         1         28 YES          2

         1         27 YES          3

         1         26 YES          4

         1         25 YES          5

         1         24 YES          6

         1         23 YES          7

         1         22 YES          8

 

LOGMINER: Begin mining logfile for session 1 thread 1 sequence 30, /data/oracle/oradata/hellodb/stdlog_5_1.log

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

相關文章