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

aaqwsh發表於2010-12-15

 

6          主備庫切換

 

在主庫執行:

 

ALTER DATABASE ADD STANDBY  LOGFILE THREAD 1 GROUP 4 ('/data/oracle/oradata/hellodb/stdlog_5_1.log') SIZE 50M;

ALTER DATABASE ADD STANDBY  LOGFILE THREAD 1 GROUP 5 ('/data/oracle/oradata/hellodb/stdlog_6_1.log') SIZE 50M;

ALTER DATABASE ADD STANDBY  LOGFILE THREAD 1 GROUP 6('/data/oracle/oradata/hellodb/stdlog_7_1.log') SIZE 50M;

 

ALTER DATABASE ADD STANDBY  LOGFILE THREAD 2 GROUP 7 ('/data/oracle/oradata/hellodb/stdlog_8_1.log') SIZE 50M;

ALTER DATABASE ADD STANDBY  LOGFILE THREAD 2 GROUP 8 ('/data/oracle/oradata/hellodb/stdlog_9_1.log') SIZE 50M;

ALTER DATABASE ADD STANDBY  LOGFILE THREAD 2 GROUP 9 ('/data/oracle/oradata/hellodb/stdlog_10_1.log') SIZE 50M;

 

02邏輯備庫:

ALTER DATABASE ADD STANDBY  LOGFILE THREAD 2 GROUP 8 ('/data/oracle/oradata/hellodb/stdlog_9_1.log') SIZE 50M;

ALTER DATABASE ADD STANDBY  LOGFILE THREAD 2 GROUP 9 ('/data/oracle/oradata/hellodb/stdlog_10_1.log') SIZE 50M;

ALTER DATABASE ADD STANDBY  LOGFILE THREAD 2 GROUP 11 ('/data/oracle/oradata/hellodb/stdlog_11_1.log') SIZE 50M;

 

在主庫執行:

SELECT SWITCHOVER_STATUS FROM V$DATABASE;

ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY  WITH SESSION SHUTDOWN;

 

Shutdown immediate;

startup mount;

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

 

 

在備庫執行:

 SELECT SWITCHOVER_STATUS FROM V$DATABASE;

 ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;

 alter database open;

 

 alter system switch logfile;

 

切換日誌觀察日誌應用的情況

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         35 YES          1

         1         34 YES          2

         1         33 YES          3

         1         32 YES          4

         1         32 NO           5

         1         32 NO           6

         1         31 YES          7

         1         31 NO           8

RFS LogMiner: Registered logfile [/data/oracle/oradata/hellodb/arch/1_35_737312896.dbf] to LogMiner session id [1]

 

 

在主庫修改日誌:

ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 10   SIZE 50M;

ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 11   SIZE 50M;

ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 12   SIZE 50M;

 

ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 7   SIZE 50M;

ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 8   SIZE 50M;

ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 9   SIZE 50M;

 

SQL> alter database drop logfile group 1;

 

Database altered.

 

SQL> alter database drop logfile group 2;

 

Database altered.

 

SQL> alter database drop logfile group 3;

 

Database altered.

 

 

CREATE UNDO TABLESPACE UNDOTBS2 DATAFILE '+DATA/testrac/datafile/undotbs02.dbf' SIZE 200M autoextend on;

----增加或者調整tmpfile

alter database tempfile '+DATA/testrac/datafile/temp02.dbf' resize 20G;

or

alter database tempfile '+DATA/testrac/datafile/temp01.dbf' resize 2G;

 

 

 

SQL> select name from v$datafile;

 

NAME

+DATA/testrac/datafile/system.dbf

+DATA/testrac/datafile/undotbs01.dbf

+DATA/testrac/datafile/sysaux.dbf

+DATA/testrac/datafile/undotbs02.dbf

 

ALTER DATABASE ENABLE THREAD 2;

 

shutdown immediate

啟用下面兩個

*.cluster_database_instances=2

*.cluster_database=true

 

開啟節點2

scp inittestrac1.ora 192.168.1.22:/data/oracle/product/10.2/db1/dbs/inittestrac1.ora

scp orapwtestrac1 192.168.1.22:/data/oracle/product/10.2/db1/dbs/orapwtestrac2

類似修改

listener.ora

tnsnames.ora

 

startup

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

相關文章