OEM RMAN 备份恢复测试
上一篇 / 下一篇 2008-05-16 14:46:42 / 个人分类:备份恢复
Walsin OEM RMAN备份恢复测试
状况1:
target DB坏掉(controlfiles,datafile,pfile不能读取),当天的归档日志亦不能从磁盘上找到
Catalog DB正常
只有前一天夜里的全备份,含当时的归档日志
1.建立目录结构
$ mkdir -p /oracle/ora9/admin/dbpp/
$ cd /oracle/ora9/admin/dbpp
$ mkdir bdump udump cdump pfile
$ mkdir -p /oradata/dbpp/archive
2.建立密码文件
$ orapwd file=orapwDBPP entries=4 password=oracle
3.恢复参数文件并强制重启DB到nomount
$export ORACLE_SID=DBPP
$rman target / catalog rman/rman@oemsh
Recovery Manager: Release
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database (not started)
connected to recovery catalog database
RMAN>startup force nomount;
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/oracle/ora9/product/9.2/dbs/initDBBH.ora'
trying to start the Oracle instance without parameter files ...
Oracle instance started
Total System Global Area 160923376 bytes
Fixed Size 741104 bytes
Variable Size 109051904 bytes
Database Buffers 50331648 bytes
Redo Buffers 798720 bytes
$ sqlplus /nolog
SQL*Plus: Release
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> conn /as sysdba
Connected.
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string DUMMY
$ ps –ef |grep ora_
oracle 467036 1 0 11:43:37 - 0:00 ora_dbw0_DBPP
oracle 483536 1 0 11:43:37 - 0:00 ora_pmon_DBPP
oracle 614520 1 0 11:43:37 - 0:00 ora_ckpt_DBPP
oracle 634958 1 0 11:43:37 - 0:00 ora_smon_DBPP
oracle 639054 1 0 11:43:37 - 0:00 ora_reco_DBPP
oracle 647240 1 0 11:43:37 - 0:00 ora_lgwr_DBPP
(这时db_name<DUMMY>与ORACLE_SID<DBPP>是不一样的,是由于我用rman在没有pfile/spfile的情况下,强制启DB所致)
RMAN>list incarnation;
List of Database Incarnations
DB Key Inc Key DB Name DB ID CUR Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
52763 52764 CTMESD1 254951686 YES 1 12-JUN-06
52720 52721 DBPH 1709056384 YES 2849400834 06-JAN-08
53624 53625 CSMESD1 2995353784 NO 1 05-NOV-07
53624 54846 CSMESD1 2995353784 YES 2758808316 22-FEB-08
55684 55685 DBPP 3220702298 YES 168425 04-MAR-08
53178 53179 OEMSH 3554504513 YES 1 04-SEP-07
RMAN>SET DBID 3220702298;
executing command: SET DBID
RMAN>restore spfile;
Starting restore at 04-MAR-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: restoring SPFILE
output filename=/oracle/ora9/product/9.2/dbs/spfileDBPP.ora
channel ORA_DISK_1: restored backup piece 1
piece handle=/oradata/backdump/cf_c-3220702298-20080304-01 tag=null params=NULL
channel ORA_DISK_1: restore complete
Finished restore at 04-MAR-08
或:
RMAN>restore spfile to pfile '/oracle/ora9/product/9.2/dbs/initDBPP.ora';
Starting restore at 04-MAR-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: restoring SPFILE to PFILE
output filename=/oracle/ora9/product/9.2/dbs/initDBPP.ora
channel ORA_DISK_1: restored backup piece 1
piece handle=/oradata/backdump/cf_c-3220702298-20080304-01 tag=null params=NULL
channel ORA_DISK_1: restore complete
Finished restore at 04-MAR-08
RMAN>startup force nomount;
或
RMAN>startup force pfile='/oracle/ora9/product/9.2/dbs/initDBPP.ora' nomount;
4.恢复控制文件和数据文件
RMAN>restore controlfile;
Starting restore at 04-MAR-08
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: restoring controlfile
output filename=/oradata/dbpp/control01.ctl
channel ORA_DISK_1: restored backup piece 1
piece handle=/oradata/backdump/cf_c-3220702298-20080304-01 tag=null params=NULL
channel ORA_DISK_1: restore complete
replicating controlfile
input filename=/oradata/dbpp/control01.ctl
output filename=/oradata/dbpp/control02.ctl
output filename=/oradata/dbpp/control03.ctl
Finished restore at 04-MAR-08
RMAN>alter database mount;
database mounted
RMAN>restore database;
Starting restore at 04-MAR-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=10 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /oradata/dbpp/system01.dbf
restoring datafile 00002 to /oradata/dbpp/undotbs01.dbf
restoring datafile 00003 to /oradata/dbpp/drsys01.dbf
restoring datafile 00004 to /oradata/dbpp/example01.dbf
restoring datafile 00005 to /oradata/dbpp/indx01.dbf
restoring datafile 00006 to /oradata/dbpp/odm01.dbf
restoring datafile 00007 to /oradata/dbpp/tools01.dbf
restoring datafile 00008 to /oradata/dbpp/users01.dbf
restoring datafile 00009 to /oradata/dbpp/xdb01.dbf
channel ORA_DISK_1: restored backup piece 1
piece handle=/oradata/backdump/df_6_DBPP tag=TAG20080304T104333 params=NULL
channel ORA_DISK_1: restore complete
Finished restore at 04-MAR-08
RMAN>recover database;
Starting recover at 04-MAR-08
using channel ORA_DISK_1
starting media recovery
channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=6
channel ORA_DISK_1: restored backup piece 1
piece handle=/oradata/backdump/df_7_DBPP tag=TAG20080304T104401 params=NULL
channel ORA_DISK_1: restore complete
archive log filename=/oradata/dbpp/archive/1_6.dbf thread=1 sequence=6
unable to find archive log
archive log thread=1 sequence=7
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 03/04/2008 17:30:42
RMAN-06054: media recovery requesting unknown log: thread 1 scn 181375
RMAN>alter database recover until cancel;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01005: syntax error: found "recover": expecting one of: "mount, open"
RMAN-01007: at line 1 column 16 file: standard input
RMAN> host;
$ sqlplus /nolog
SQL>recover database using backup controlfile until cancel;
ORA-00279: change 181375 generated at 03/04/2008 02:44:00 needed for thread 1
ORA-00289: suggestion : /oradata/dbpp/archive/1_7.dbf
ORA-00280: change 181375 for thread 1 is in sequence #7
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.
SQL>alter database open resetlogs;
Database altered.
RMAN>reset database;
new incarnation of database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
5.增加listener,并重启
$vi $ORACLE_HOME/network/admin/listener.ora
# LISTENER.ORA Network Configuration File: /oracle/ora9/product/9.2/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.103.4)(PORT = 1521))
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = dbph)
(ORACLE_HOME = /oracle/ora9/product/9.2)
(SID_NAME = dbph)
)
(SID_DESC =
(GLOBAL_DBNAME = dbpp)
(ORACLE_HOME = /oracle/ora9/product/9.2)
(SID_NAME = dbpp)
)
)
$lsnrctl stop
$lsnrctl start
状况2:
target DB坏掉(controlfiles,datafile,pfile不能读取),当天的归档日志亦不能从磁盘上找到
Catalog DB也坏掉,且没有备份,Catalog没法恢复
只有前一天夜里的全备份,含当时的归档日志
OS重做后,oracle software重安装
a full backup includethe datafiles,control file, andcurrent server parameter file(if the instance is started with a server parameter file) to the default device type:
1.恢复控制文件和spfile
$export ORACLE_SID=DBPP
$ rman target /
Recovery Manager: Release
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database (not started)
RMAN> startup nomount
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/oracle/ora9/product/9.2/dbs/initDBPP.ora'
trying to start the Oracle instance without parameter files ...
Oracle instance started
Total System Global Area 160923376 bytes
Fixed Size 741104 bytes
Variable Size 109051904 bytes
Database Buffers 50331648 bytes
Redo Buffers 798720 bytes
RMAN> restore controlfile from '/oradata/backdump/cf_c-3220702298-20080305-02';
Starting restore at 11-MAR-08
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=9 devtype=DISK
channel ORA_DISK_1: restoring controlfile
channel ORA_DISK_1: restore complete
replicating controlfile
input filename=/oracle/ora9/product/9.2/dbs/cntrlDBPP.dbf
Finished restore at 11-MAR-08
RMAN> restore spfile from '/oradata/backdump/cf_c-3220702298-20080305-02';
Starting restore at 11-MAR-08
using channel ORA_DISK_1
channel ORA_DISK_1: autobackup found: /oradata/backdump/cf_c-3220702298-20080305-02
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 11-MAR-08
$ ls -l *DBPP*
-rw-r----- 1 oracle dba 1396736 Mar 11 15:51 cntrlDBPP.dbf
-rw-r----- 1 oracle dba 3584 Mar 11 15:55 spfileDBPP.ora
$ cp cntrlDBPP.dbf /oradata/dbpp/control01.ctl
$ cp cntrlDBPP.dbf /oradata/dbpp/control02.ctl
$ cp cntrlDBPP.dbf /oradata/dbpp/control03.ctl
$cd $ORACLE_HOME/dbs
$ orapwd file=orapwDBPP password=oracle entries=5
RMAN> startup force mount;
Oracle instance started
database mounted
Total System Global Area 320306472 bytes
Fixed Size &
导入论坛 引用链接 收藏 分享给好友 推荐到圈子 管理 举报
TAG:
标题搜索
日历
|
|||||||||
| 日 | 一 | 二 | 三 | 四 | 五 | 六 | |||
| 1 | 2 | 3 | 4 | ||||||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 | |||
| 12 | 13 | 14 | 15 | 16 | 17 | 18 | |||
| 19 | 20 | 21 | 22 | 23 | 24 | 25 | |||
| 26 | 27 | 28 | 29 | 30 | 31 | ||||
我的存档
数据统计
- 访问量: 139
- 日志数: 7
- 建立时间: 2008-05-16
- 更新时间: 2008-05-16

