日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

oracle adg 备份,Oracle Physical Dataguard环境使用RMAN备份和恢复

發布時間:2025/3/12 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 oracle adg 备份,Oracle Physical Dataguard环境使用RMAN备份和恢复 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Oracle Physical Dataguard環境使用RMAN備份和恢復

由于Physical Dataguard使用的是塊恢復技術來保持和PRIMARY的一致性,因此可以在STANDBY

上進行rman備份,從而減輕PRIMARY的壓力.當PRIMARY出現數據庫故障時,可以使用在STANDBY上

的備份來進行恢復.

先決條件:需要配置catalog.

在PRIMARY上以catalog方式連接,并且注冊數據庫

[oracle@PRIMARY admin]$ $ORACLE_HOME/bin/rman target / catalog

> register database;

database registered in recovery catalog

starting full resync of recovery catalog

full resync complete

RMAN> configure db_unique_name CP connect identifier 'cp';

new RMAN configuration parameters:

CONFIGURE DB_UNIQUE_NAME 'cp' CONNECT IDENTIFIER? 'cp';

new RMAN configuration parameters are successfully stored

starting full resync of recovery catalog

full resync complete

RMAN> configure db_unique_name cepstby connect identifier 'cepstby';

new RMAN configuration parameters:

CONFIGURE DB_UNIQUE_NAME 'cepstby' CONNECT IDENTIFIER? 'cepstby';

new RMAN configuration parameters are successfully stored

starting full resync of recovery catalog

full resync complete

查看已注冊的數據庫信息,rman自動識別數據庫角色等信息.

RMAN> list db_unique_name of database;

List of Databases

DB Key? DB Name? DB ID??????????? Database Role??? Db_unique_name

------- ------- ----------------- ---------------? ------------------

1?????? CP??? 2894644313?????? PRIMARY????????? CP

1?????? CP??? 2894644313?????? STANDBY????????? CEPSTBY

rman 連接到STANDBY的target進行備份

[oracle@standby ~]$ $ORACLE_HOME/bin/rman target / catalog

Manager: Release 11.1.0.7.0 - Production on Sat Mar 26 10:52:00 2016

Copyright (c) 1982, 2007, Oracle.? All rights reserved.

connected to target database: CP (DBID=2894644313, not open)

connected to recovery catalog database

在standby上執行備份操作.

RMAN> run

2> {

3> allocate channel c2 device type disk;

4> backup as backupset database format '/home/oracle/%U';

5> release channel c2;

6> }

allocated channel: c2

channel c2: SID=1085 device type=DISK

Starting backup at 26-MAR-16

Starting implicit crosscheck backup at 26-MAR-16

Finished implicit crosscheck backup at 26-MAR-16

.............................

我們通過在主庫移動文件來摸擬數據文件被破壞的情形

[oracle@primary]$ mv /u01/app/oracle/oradata/cp/users01.dbf /u01/app/oracle/oradata/cp/oldusers01.dbf

DONGDONGTANG> startup;

ORACLE instance started.

Total System Global Area 1135747072 bytes

Fixed Size????? 2158992 bytes

Variable Size??? 822087280 bytes

Database Buffers?? 301989888 bytes

Redo Buffers????? 9510912 bytes

Database mounted.

ORA-01157: cannot identify/lock data file 4 - see DBWR trace file

ORA-01110: data file 4: '/u01/app/oracle/oradata/cp/users01.dbf'

接下來我們要做的是從備庫上復制相關備份文件到主庫中

[oracle@standby ~]$ scp /home/oracle/0* 192.168.56.21:/home/oracle/bak

在主庫中對相關文件進行catalog

[oracle@PRIMARY admin]$ $ORACLE_HOME/bin/rman target / catalog

Manager: Release 11.1.0.7.0 - Production on Sat Mar 26 10:56:56 2016

Copyright (c) 1982, 2007, Oracle.? All rights reserved.

connected to target database: CP (DBID=2894644313, not open)

connected to recovery catalog database

RMAN> catalog start with '/home/oracle/bak';

searching for all files that match the pattern /home/oracle/bak

List of Files Unknown to the Database

=====================================

File Name: /home/oracle/bak/09r1eku6_1_1

File Name: /home/oracle/bak/08r1ekse_1_1

Do you really want to catalog the above files (enter YES or NO)? yes

cataloging files...

cataloging done

List of Cataloged Files

=======================

File Name: /home/oracle/bak/09r1eku6_1_1

File Name: /home/oracle/bak/08r1ekse_1_1

現在可以發現4號文件的相關備份信息

RMAN> list backup of datafile 4;

List of Backup Sets

===================

BS Key? Type LV Size?????? Device Type Elapsed Time Completion Time

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

111???? Full??? 1.08G????? DISK??????? 00:00:53???? 26-MAR-16

BP Key: 176?? Status: AVAILABLE? Compressed: NO? Tag: TAG20160326T105302

PRIMARYece Name: /home/oracle/bak/08r1ekse_1_1

List of Datafiles in backup set 111

File LV Type Ckp SCN??? Ckp Time? Name

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

4?????? Full 927757???? 26-MAR-16 /u01/app/oracle/oradata/cp/users01.dbf

恢復/u01/app/oracle/oradata/cp/users01.dbf文件

RMAN> run

{

allocate channel c1 device type disk;

restore datafile 4;

recover datafile 4;

release channel c1;

}2> 3> 4> 5> 6> 7>

allocated channel: c1

channel c1: SID=1090 device type=DISK

Starting restore at 26-MAR-16

channel c1: starting datafile backup set restore

channel c1: specifying datafile(s) to restore from backup set

channel c1: restoring datafile 00004 to /u01/app/oracle/oradata/cp/users01.dbf

channel c1: reading from backup PRIMARYece /home/oracle/bak/08r1ekse_1_1

channel c1: PRIMARYece handle=/home/oracle/bak/08r1ekse_1_1 tag=TAG20160326T105302

channel c1: restored backup PRIMARYece 1

channel c1: restore complete, elapsed time: 00:00:03

Finished restore at 26-MAR-16

Starting recover at 26-MAR-16

starting media recovery

media recovery complete, elapsed time: 00:00:01

Finished recover at 26-MAR-16

released channel: c1

再次嘗試打開數據庫.

....................

Variable Size??? 822087280 bytes

Database Buffers?? 301989888 bytes

Redo Buffers????? 9510912 bytes

Database mounted.

ORA-01157: cannot identify/lock data file 4 - see DBWR trace file

ORA-01110: data file 4: '/u01/app/oracle/oradata/cp/users01.dbf'

DONGDONGTANG> alter database open;

Database altered.

DONGDONGTANG> select name,status from v$datafile where file#=4;

NAME

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

STATUS

-------

/u01/app/oracle/oradata/cp/users01.dbf

ONLINE

主數據庫已經可以成功打開.

總結

以上是生活随笔為你收集整理的oracle adg 备份,Oracle Physical Dataguard环境使用RMAN备份和恢复的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。