中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Oracle RMAN異機恢復的示例分析

發布時間:2021-11-11 10:35:07 來源:億速云 閱讀:157 作者:小新 欄目:關系型數據庫

這篇文章給大家分享的是有關Oracle RMAN異機恢復的示例分析的內容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。

Oracle RMAN異機恢復


實驗場景:
數據庫服務器本機磁盤損壞,數據庫無法實現本機恢復;
存在完整的RMAN全備及歸檔備份,通過RMAN進行異機恢復;

實驗環境:
源庫:IP(192.0.2.12),HOSTNAME(edbj2p2),DB(PROD3) 
目標庫:IP(192.0.2.11),HOSTNAME(edbj2p1)

實驗過程如下:

一:源庫,創建測試數據:
SQL> create user chen identified by a;  
SQL> grant connect,resource to chen;
SQL> conn chen/a
SQL> create table test as select level as id from dual connect by level<=5;
SQL> select * from test;
        ID
----------
         1
         2
         3
         4
         5

二:源庫,進行RMAN全備
[oracle@edbjr2p2 bin]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Wed Jul 19 21:48:16 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: PROD3 (DBID=1562953461)

RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name PROD3 are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_PROD3.f'; # default

RMAN> run{
2> allocate channel c1 type disk;
3> backup full database format '/home/oracle/rmanbak/db_full_%T_%u.bak' tag='FULL' include current controlfile;
4> sql 'alter system archive log current';
5> backup archivelog all format '/home/oracle/rmanbak/arc_%T_%u.bak' delete all input;
6> release channel c1;
7> }

allocated channel: c1
channel c1: SID=139 device type=DISK

Starting backup at 19-JUL-17
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00004 name=/u01/app/oracle/oradata/PROD3/users01.dbf
input datafile file number=00001 name=/u01/app/oracle/oradata/PROD3/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/PROD3/sysaux01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/PROD3/undotbs01.dbf
channel c1: starting piece 1 at 19-JUL-17
channel c1: finished piece 1 at 19-JUL-17
piece handle=/home/oracle/rmanbak/db_full_20170719_01s9p6s1.bak tag=FULL comment=NONE
channel c1: backup set complete, elapsed time: 00:00:35
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel c1: starting piece 1 at 19-JUL-17
channel c1: finished piece 1 at 19-JUL-17
piece handle=/home/oracle/rmanbak/db_full_20170719_02s9p6t4.bak tag=FULL comment=NONE
channel c1: backup set complete, elapsed time: 00:00:03
Finished backup at 19-JUL-17

sql statement: alter system archive log current

Starting backup at 19-JUL-17
current log archived
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=7 RECID=1 STAMP=949787112
input archived log thread=1 sequence=8 RECID=2 STAMP=949787564
input archived log thread=1 sequence=9 RECID=3 STAMP=949787564
channel c1: starting piece 1 at 19-JUL-17
channel c1: finished piece 1 at 19-JUL-17
piece handle=/home/oracle/rmanbak/arc_20170719_03s9p6tc.bak tag=TAG20170719T215244 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:03
channel c1: deleting archived log(s)
archived log file name=/u01/app/oracle/fast_recovery_area/PROD3/archivelog/2017_07_19/o1_mf_1_7_dpyrm5bd_.arc RECID=1 STAMP=949787112
archived log file name=/u01/app/oracle/fast_recovery_area/PROD3/archivelog/2017_07_19/o1_mf_1_8_dpys1d88_.arc RECID=2 STAMP=949787564
archived log file name=/u01/app/oracle/fast_recovery_area/PROD3/archivelog/2017_07_19/o1_mf_1_9_dpys1dd4_.arc RECID=3 STAMP=949787564
Finished backup at 19-JUL-17

released channel: c1

三:打包備份文件,并傳到目標數據庫
源庫:
[oracle@edbjr2p2 rmanbak]$ pwd
/home/oracle/rmanbak
[oracle@edbjr2p2 rmanbak]$ tar -zcvf rmanbak.tar.gz *
arc_20170719_03s9p6tc.bak
db_full_20170719_01s9p6s1.bak
db_full_20170719_02s9p6t4.bak

[oracle@edbjr2p2 rmanbak]$ ll -rth
total 361M
-rw-r----- 1 oracle oinstall 239M Jul 19 21:52 db_full_20170719_01s9p6s1.bak
-rw-r----- 1 oracle oinstall 9.2M Jul 19 21:52 db_full_20170719_02s9p6t4.bak
-rw-r----- 1 oracle oinstall  51M Jul 19 21:52 arc_20170719_03s9p6tc.bak
-rw-r--r-- 1 oracle oinstall  61M Jul 19 21:56 rmanbak.tar.gz

[oracle@edbjr2p2 rmanbak]$ scp rmanbak.tar.gz 192.0.2.11:/home/oracle/rmanbak
The authenticity of host '192.0.2.11 (192.0.2.11)' can't be established.
RSA key fingerprint is 4a:08:1a:c4:c8:bb:3b:01:49:b5:2f:58:af:9e:06:af.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.0.2.11' (RSA) to the list of known hosts.
oracle@192.0.2.11's password: 
rmanbak.tar.gz                                100%   61MB  30.3MB/s   00:02 

目標庫:
[oracle@edbjr2p1 rmanbak]$ pwd
/home/oracle/rmanbak

[oracle@edbjr2p1 rmanbak]$ tar -zxvf rmanbak.tar.gz 
arc_20170719_03s9p6tc.bak
db_full_20170719_01s9p6s1.bak
db_full_20170719_02s9p6t4.bak

[oracle@edbjr2p1 rmanbak]$ ll -rth
total 361M
-rw-r----- 1 oracle oinstall 239M Jul 19 21:52 db_full_20170719_01s9p6s1.bak
-rw-r----- 1 oracle oinstall 9.2M Jul 19 21:52 db_full_20170719_02s9p6t4.bak
-rw-r----- 1 oracle oinstall  51M Jul 19 21:52 arc_20170719_03s9p6tc.bak
-rw-r--r-- 1 oracle oinstall  61M Jul 19 21:58 rmanbak.tar.gz

三:目標庫,創建對應目錄
[oracle@edbjr2p1 rmanbak]$ mkdir -p /u01/app/oracle/oradata/PROD3
[oracle@edbjr2p1 ~]$ mkdir -p /u01/app/oracle/admin/PROD3/adump
[oracle@edbjr2p1 rmanbak]$ mkdir -p /u01/app/oracle/fast_recovery_area/PROD3/archivelog/2017_07_19

四:目標庫,運行RMAN執行數據恢復
(1)恢復參數文件
(2)恢復控制文件
(3)恢復數據庫
[oracle@edbjr2p1 rmanbak]$ export ORACLE_SID=PROD3
[oracle@edbjr2p1 rmanbak]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Wed Jul 19 22:05:46 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database (not started)

RMAN> set dbid 1562953461
executing command: SET DBID

RMAN> startup nomount

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initPROD3.ora'

starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started

Total System Global Area     159019008 bytes

Fixed Size                     1343612 bytes
Variable Size                 79695748 bytes
Database Buffers              71303168 bytes
Redo Buffers                   6676480 bytes

RMAN> restore spfile from '/home/oracle/rmanbak/db_full_20170719_02s9p6t4.bak';

Starting restore at 19-JUL-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=111 device type=DISK

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /home/oracle/rmanbak/db_full_20170719_02s9p6t4.bak
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 19-JUL-17

RMAN> startup nomount force

Oracle instance started

Total System Global Area     209235968 bytes

Fixed Size                     1343948 bytes
Variable Size                180358708 bytes
Database Buffers              20971520 bytes
Redo Buffers                   6561792 bytes

RMAN> restore controlfile from '/home/oracle/rmanbak/db_full_20170719_02s9p6t4.bak';

Starting restore at 19-JUL-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=134 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/PROD3/control01.ctl
output file name=/u01/app/oracle/oradata/PROD3/control02.ctl
Finished restore at 19-JUL-17

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

RMAN> restore database;

Starting restore at 19-JUL-17
Starting implicit crosscheck backup at 19-JUL-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=134 device type=DISK
Crosschecked 1 objects
Finished implicit crosscheck backup at 19-JUL-17

Starting implicit crosscheck copy at 19-JUL-17
using channel ORA_DISK_1
Finished implicit crosscheck copy at 19-JUL-17

searching for all files in the recovery area
cataloging files...
no files cataloged

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/PROD3/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/PROD3/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/PROD3/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/PROD3/users01.dbf
channel ORA_DISK_1: reading from backup piece /home/oracle/rmanbak/db_full_20170719_01s9p6s1.bak
channel ORA_DISK_1: piece handle=/home/oracle/rmanbak/db_full_20170719_01s9p6s1.bak tag=FULL
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:02:39
Finished restore at 19-JUL-17

RMAN> recover database;

Starting recover at 19-JUL-17
using channel ORA_DISK_1

starting media recovery

unable to find archived log
archived log thread=1 sequence=8
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 07/19/2017 22:20:27
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 8 and starting SCN of 241384
---報錯原因:RMAN備份不會備份當前的redo logfile文件,異機恢復時找不到redo logfile,所以報錯rman-06054
---解決方案:基于SCN的不完全恢復

RMAN> run {  
2> set until scn 241384;  
3> recover database;  
4> }  

executing command: SET until clause

Starting recover at 19-JUL-17
using channel ORA_DISK_1

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

Finished recover at 19-JUL-17

RMAN> alter database open resetlogs;

database opened

五:目標庫,驗證數據
[oracle@edbjr2p1 rmanbak]$ export ORACLE_SID=PROD3
[oracle@edbjr2p1 rmanbak]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Jul 19 22:41:57 2017
Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select * from chen.test;

        ID
----------
         1
         2
         3
         4
         5

感謝各位的閱讀!關于“Oracle RMAN異機恢復的示例分析”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

阿勒泰市| 蕲春县| 綦江县| 图木舒克市| 宜都市| 桃源县| 怀仁县| 获嘉县| 施甸县| 呼玛县| 枞阳县| 正阳县| 南丹县| 会宁县| 屏南县| 永吉县| 阿城市| 孝义市| 怀来县| 桃园县| 定日县| 柘荣县| 磐石市| 天津市| 六枝特区| 政和县| 康平县| 明星| 韶山市| 抚宁县| 洛浦县| 武宣县| 奎屯市| 德安县| 塘沽区| 乐陵市| 日土县| 萍乡市| 新田县| 清涧县| 甘谷县|