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

aaqwsh發表於2010-12-15
 

拷貝密碼檔案:

cp orapwhellodb /data/oracle/product/10205/db1/dbs/

 

B  恢復:

export ORACLE_SID=hellodb

rman target /

startup nomount;

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

 

根據

output filename=/data/oracle/oradata/hellodb/controlhellodb01.ctl

修改

control_files = /data/oracle/oradata/hellodb/controlhellodb01.ctl

 

startup mount;

 

catalog start with '/data/backup';

 

在備庫恢復資料庫

run{

allocate channel d1 type disk;

allocate channel d2 type disk;

allocate channel d3 type disk;

allocate channel d4 type disk;

 restore database;

 release channel d1;

 release channel d2;

 release channel d3;

 release channel d4;

 }

 

 

C 開啟恢復程式(如果沒有STANDBY LOGFILE ,應該增加):

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;

 

shutdown immediate

startup mount

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

 

D 轉邏輯備庫

02 先停止

alter database recover managed standby database cancel;

 

52 執行

SQL> exec dbms_logstdby.build;

 

PL/SQL procedure successfully completed.

 

SQL> alter system archive log current;

 

System altered.

 

02  執行

SQL> ALTER DATABASE RECOVER TO LOGICAL STANDBY hellodb;

ALTER DATABASE RECOVER TO LOGICAL STANDBY hellodb

*

ERROR at line 1:

ORA-16254: change db_name to HELLODB in the client-side parameter file (pfile)

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

 

shutdown immediate

startup mount

alter database open resetlogs;

 

alter database start logical standby apply immediate;

 

52 執行(如果日誌沒有傳過來,該操作會立即啟用傳輸)

shutdown immediate

startup

 

02 看到類似,表示成功了

Indexes of table  SYSTEM.LOGMNR_ATTRCOL$ have been rebuilt and are now usable

Indexes of table  SYSTEM.LOGMNR_ATTRIBUTE$ have been rebuilt and are now usable

……

Indexes of table  SYSTEM.LOGMNR_USER$ have been rebuilt and are now usable

LSP2 started with pid=27, OS id=21614

Thu Dec 09 18:26:16 CST 2010

LOGMINER: Begin mining logfile for session 1 thread 1 sequence 21, /data/oracle/oradata/hellodb/arch/1_21_737312896.dbf

Thu Dec 09 18:26:16 CST 2010

LOGMINER: Turning ON Log Auto Delete

LOGSTDBY Analyzer process P003 started with pid=27 OS id=21616

LOGSTDBY Apply process P004 started with pid=28 OS id=21618

LOGSTDBY Apply process P006 started with pid=30 OS id=21622

LOGSTDBY Apply process P005 started with pid=29 OS id=21620

LOGSTDBY Apply process P008 started with pid=32 OS id=21626

LOGSTDBY Apply process P007 started with pid=31 OS id=21624

Thu Dec 09 18:26:17 CST 2010

LOGMINER: End mining logfile: /data/oracle/oradata/hellodb/arch/1_21_737312896.dbf

Thu Dec 09 18:26:17 CST 2010

LOGMINER: Begin mining logfile for session 1 thread 1 sequence 22, /data/oracle/oradata/hellodb/arch/1_22_737312896.dbf

Thu Dec 09 18:26:17 CST 2010

LOGMINER: End mining logfile: /data/oracle/oradata/hellodb/arch/1_22_737312896.dbf

 

52 測試

create user testuser

identified by "test123"

default tablespace system

temporary tablespace TEMP

 profile DEFAULT;

grant dba to testuser;

create table testuser.test(a int);

insert into testuser.test values(1);

commit;

 

02 檢視結果

 

SQL> select * from testuser.test;

 

         A

----------

         1

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

相關文章