Oracle 11g 利用泠備份恢複standby庫

來源:互聯網
上載者:User

Oracle 11g 利用泠備份恢複standby庫

Oracle 11g 利用泠備份恢複standby庫

1 開始在備庫上進行泠備份
先查好控制檔案、redo、undo檔案、資料檔案的路徑

1.1 先關閉主庫的歸檔日誌傳輸
SQL> ALTER system SETlog_archive_dest_state_2 ='DEFER';

 

System altered.

SQL>

1.2 先關閉standby庫
SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL>

SQL>

1.3 開始進行泠備份
#建立一個泠備份目錄

mkdir /data/oracle_cold/

開始泠備份控制檔案

cp /data/oracle_cold/

cp /home/oradata/orcl/control01.ctlcontrol01.ctl

cp /oracle/app/oracle/flash_recovery_area/orcl/control02.ctlcontrol02.ctl

開始泠備份redo、undo檔案

mkdir orcl_2

cp -r /home/oradata/orcl/*.log orcl_2

開始泠備份資料檔案

cp -r /home/oradata/orcl/*.dbf orcl_2

2開始使用泠備份進行db恢複
2.1,停止掉standby庫
SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL>

SQL>

2.2,將泠備中的控制檔案覆蓋當前的控制檔案
查看原來的控制檔案目錄

[oracle@localhost oracle_cold]$ morecontrolfile.log

SQL> SELECT name FROMv$controlfile;

NAME

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

/home/oradata/orcl/control01.ctl

/oracle/app/oracle/flash_recovery_area/orcl/control02.ctl

SQL>

開始複製覆蓋

[oracle@localhost oracle_cold]$ cpcontrol02.ctl /oracle/app/oracle/flash_recovery_area/orcl/control02.ctl

[oracle@localhost oracle_cold]$ cpcontrol01.ctl /home/oradata/orcl/control01.ctl

[oracle@localhost oracle_cold]$

2.3,將泠備中的redo、undo檔案覆蓋到以前的目錄中
查看以前的redo、undo檔案路徑

[oracle@localhost oracle_cold]$ morelogfile.log

SQL> select member from v$logfile;

MEMBER

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

/home/oradata/orcl/redo03.log

/home/oradata/orcl/redo02.log

/home/oradata/orcl/redo01.log

/home/oradata/orcl/redo_dg_01.log

/home/oradata/orcl/redo_dg_02.log

/home/oradata/orcl/redo_dg_03.log

6 rows selected.

SQL>

開始覆蓋redo、undo檔案

[oracle@localhost oracle_cold]$ cp orcl_2/*.log/home/oradata/orcl/

[oracle@localhost oracle_cold]$

2.4,將泠備中的資料檔案覆蓋到以前的目錄中
查看以前的資料檔案目錄

[oracle@localhost oracle_cold]$ moredatafile.log

SELECT name FROM v$datafile;

1 /home/oradata/orcl/system01.dbf

2 /home/oradata/orcl/sysaux01.dbf

3 /home/oradata/orcl/undotbs01.dbf

4 /home/oradata/orcl/users01.dbf

5 /home/oradata/orcl/orclk01.dbf

6 /home/oradata/orcl/plas01.dbf

7 /home/oradata/orcl/pl01.dbf

8 /home/oradata/orcl/help01.dbf

9 /home/oradata/orcl/adobelc01.dbf

10 /home/oradata/orcl/sms01.dbf

11 /home/oradata/orcl/plcrm01.dbf

[oracle@localhost oracle_cold]$

開始覆蓋以前的資料檔案目錄

[oracle@localhost oracle_cold]$ cp orcl_2/*.dbf/home/oradata/orcl/

[oracle@localhost oracle_cold]$

2.5 啟動資料庫
SQL> startup

ORACLE instance started.

Total System Global Area 5344731136 bytes

Fixed Size 2213136 bytes

Variable Size 3355446000 bytes

Database Buffers 1946157056 bytes

Redo Buffers 40914944 bytes

Database mounted.

Database opened.

SQL>

2.6 去主庫上開啟歸檔日誌傳輸
SQL> ALTER system SET log_archive_dest_state_2='enable';

 

System altered.

SQL>

2.7 然後備庫啟動應用
select sequence#,applied fromv$archived_log order by sequence# asc;

SQL> alter database recovermanagedstandby database disconnect from session;

 

Database altered.

SQL>

SQL> select open_modefromv$database;

OPEN_MODE

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

READ ONLY WITH APPLY

SQL>

 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.