1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > 使用RMAN异机恢复磁带库的备份文件至文件系统

使用RMAN异机恢复磁带库的备份文件至文件系统

时间:2024-02-07 16:58:25

相关推荐

使用RMAN异机恢复磁带库的备份文件至文件系统

描述:原生产环境为Linux RAC+ASM+10.2.0.4,因存储故障,数据库无法启动;需使用第三方磁带库备份软件备份的文件进行数据库恢复。

恢复控制文件:

SET DBID 2240547690;

run {

allocate channel ch1 type 'sbt_tape' PARMS="SBT_LIBRARY=/opt/simpana/Base/libobk.so";

restore controlfile to '/home/oracle/control01.ctl' from autobackup ;

release channel ch1;

}

启动数据库至mount状态:

alter database mount;

restore database:

run {

allocate channel ch1 type 'sbt_tape' PARMS="SBT_LIBRARY=/opt/simpana/Base/libobk.so";

set newname for datafile 1 to '/oradata/orcl/system.256.769887829 ';

set newname for datafile 2 to '/oradata/orcl/undotbs1.258.769887829 ';

set newname for datafile 3 to '/oradata/orcl/sysaux.257.769887829 ';

set newname for datafile 4 to '/oradata/orcl/users.259.769887829 ';

set newname for datafile 5 to '/oradata/orcl/undotbs2.264.769887929 ';

set newname for datafile 6 to '/oradata/orcl/undotbs3.265.769887929 ';

set newname for datafile 7 to '/oradata/orcl/user01 ';

set newname for datafile 8 to '/oradata/orcl/user02 ';

restore database;

switch datafile all ;

release channel ch1;

}

recover database:

run {

allocate channel ch1 type 'sbt_tape' PARMS="SBT_LIBRARY=/opt/simpana/Base/libobk.so";

recover database;

release channel ch1;

}

更改redolog文件目录:

ALTER DATABASE RENAME FILE '+DATA01/orcl/onlinelog/group_2.262.769887895' TO '/oradata/orcl/group_2.262.769887895';

ALTER DATABASE RENAME FILE '+DATA01/orcl/onlinelog/group_1.261.769887889' TO '/oradata/orcl/group_1.261.769887889';

ALTER DATABASE RENAME FILE '+DATA01/orcl/onlinelog/group_5.266.769887971' TO '/oradata/orcl/group_5.266.769887971';

ALTER DATABASE RENAME FILE '+DATA01/orcl/onlinelog/group_6.267.769887977' TO '/oradata/orcl/group_6.267.769887977';

ALTER DATABASE RENAME FILE '+DATA01/orcl/onlinelog/group_3.268.769887983' TO '/oradata/orcl/group_3.268.769887983';

ALTER DATABASE RENAME FILE '+DATA01/orcl/onlinelog/group_4.269.769887989' TO '/oradata/orcl/group_4.269.769887989';

启动数据库至OPEN状态:

SQL> alter database open resetlogs;

Database altered.

删除原有的临时表空间文件:

alter database tempfile '+DATA01/orcl/tempfile/temp.263.769887907' offline;

alter database tempfile '+DATA01/orcl/tempfile/temp.263.769887907' drop;

添加新的临时表空间文件:

alter tablespace TEMPadd tempfile '/oradata/orcl/temp02' size 7636M autoextend on maxsize unlimited ;

参考MOS文章如下:

How To Restore Rman Backups On A Different Node When The Directory Structures Are Different (文档 ID 419137.1)

In this Document

APPLIES TO:

Oracle Database - Enterprise Edition - Version 10.1.0.2 and later

Information in this document applies to any platform.

***Checked for relevance on 20-July-***

GOAL

Restoring Rman backup on a different node with different backup directory structures and different database directory structures .

++RmanbackupofdatabaseisdoneonNODE1.

++ThedatabasehastobehastoberestoredfromtheRmanbackuponNODE2.

++ThedirectorystructuresforthebackupsandthedatabasefilesaredifferentonNODE2.

++TheRmanbackupshavetoputinnewdirectorystructureonNODE2unlikeastheywereonNODE1.

++AlsothedatabasehastoberestoredtoadifferentdirectorystructureonNODE2.

SOLUTION

ASSUMPTIONS

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

++ The backups on NODE 1 are done to '/node1/database/backup'

++ The database files on NODE 1 are in '/node1/database/prod'

++ The backups on NODE 2 will be in location '/node2/database/backup'

++ The database files on NODE 2 will be restored to '/node2/database/prod

Steps to acheive the goal:

1) Connect to the target database using rman and backup the database ---> ON NODE 1

$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Tue Feb 13 00:29:33

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

connected to target database: ORA10G (DBID=3932056136)

RMAN> backup database plus archivelog;

Starting backup at 13-FEB-07

current log archived

using channel ORA_DISK_1

channel ORA_DISK_1: starting archive log backupset

channel ORA_DISK_1: specifying archive log(s) in backup set

input archive log thread=1 sequence=143 recid=109 stamp=614392105

channel ORA_DISK_1: starting piece 1 at 13-FEB-07

channel ORA_DISK_1: finished piece 1 at 13-FEB-07

piece handle=/node1/database/backup/o1_mf_annnn_TAG0213T002825_2x21kbds

_.bkp tag=TAG0213T002825 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02

Finished backup at 13-FEB-07

Starting backup at 13-FEB-07

using channel ORA_DISK_1

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

input datafile fno=00003 name=/node1/database/prod/sysaux01.dbf

input datafile fno=00001 name=/node1/database/prod/system01.dbf

input datafile fno=00002 name=/node1/database/prod/undotbs01.dbf

input datafile fno=00004 name=/node1/database/prod/users01.dbf

input datafile fno=00005 name=/node1/database/prod/1.dbf

input datafile fno=00006 name=/node1/database/prod/sysaux02.dbf

input datafile fno=00007 name=/node1/database/prod/undotbs02.dbf

channel ORA_DISK_1: starting piece 1 at 13-FEB-07

channel ORA_DISK_1: finished piece 1 at 13-FEB-07

piece handle=/node1/database/backup/o1_mf_nnndf_TAG0213T002827_2x21kd12

_.bkp tag=TAG0213T002827 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:55

Finished backup at 13-FEB-07

Starting backup at 13-FEB-07

current log archived

using channel ORA_DISK_1

channel ORA_DISK_1: starting archive log backupset

channel ORA_DISK_1: specifying archive log(s) in backup set

input archive log thread=1 sequence=144 recid=110 stamp=614392165

channel ORA_DISK_1: starting piece 1 at 13-FEB-07

channel ORA_DISK_1: finished piece 1 at 13-FEB-07

piece handle=/node1/database/backup/o1_mf_annnn_TAG0213T002925_2x21m6ty

_.bkp tag=TAG0213T002925 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02

Finished backup at 13-FEB-07

Starting Control File and SPFILE Autobackup at 13-FEB-07

piece handle=/u01/oracle/product/ora10g/dbs/c-3932056136-0213-02 comment=NONE

Finished Control File and SPFILE Autobackup at 13-FEB-07

RMAN> exit

2) Move the following files to the NODE 2:

+ The database backup pieces to location '/node2/database/backup'

+ Controlfile backup piece to the location '/node2/database/backup'

+ The parameter file i.e init.ora file to the default location i.e $ORACLE_HOME/dbs

3) Edit the PFILE on NODE 2 to change the environment specific parameters like .

user_dump_dest=

background_dump_dest=

control_files=

4) Once the PFILE is suitably modified invoke Rman on the NODE 2 after setting the Oracle environment variables and start the database in nomount mode:

[oracle@test-brtest]$exportORACLE_HOME=/u01/oracle/product/ora10g

[oracle@test-brtest]$exportORACLE_SID=ora10g

[oracle@test-brtest]$exportPATH=$ORACLE_HOME/bin:$PATH

[oracle@test-brtest]$rmantarget/

RecoveryManager:Release10.2.0.1.0-ProductiononTueFeb1300:36:55

Copyright(c)1982,,Oracle.Allrightsreserved.

connectedtotargetdatabase(notstarted)

RMAN>startupnomount

Oracleinstancestarted

TotalSystemGlobalArea205520896bytes

FixedSize1218508bytes

VariableSize75499572bytes

DatabaseBuffers121634816bytes

RedoBuffers7168000bytes

5) Restore the controlfile from the backup piece.

RMAN>restorecontrolfilefrom'/node2/database/backup/c-3932056136-0213-02';

Startingrestoreat13-FEB-07

usingtargetdatabasecontrolfileinsteadofrecoverycatalog

allocatedchannel:ORA_DISK_1

channelORA_DISK_1:sid=155devtype=DISK

channelORA_DISK_1:restoringcontrolfile

channelORA_DISK_1:restorecomplete,

elapsedtime:00:00:02

outputfilename=/node2/database/prod/control01.ctl

Finishedrestoreat13-FEB-07

6) Mount the database

RMAN> alter database mount

7) Now catalog the backup pieces that were shipped from NODE 1

RMAN> catalog backuppiece '/node2/database/backup/o1_mf_annnn_TAG0213T002925_2x21m6ty_.bkp';

RMAN> catalog backuppiece '/node2/database/backup/o1_mf_annnn_TAG0213T002825_2x21kbds_.bkp';

RMAN> catalog backuppiece '/node2/database/backup/o1_mf_nnndf_TAG0213T002827_2x21kd12_.bkp';

This feature of cataloging backup pieces is available from ORACLE 10g versions. Prior to Oracle 10g we were not able to catalog the backup pieces. For more information on cataloging options refer themetalinknote 470463.1

8) Get to know the last sequence available in the archivelog backup using the following command.This will help us in recovering the database till that archivelog.

RMAN > list backup of archivelog all;

Let us assume the last sequence of last archivelog in the backup is 50.

9) Rename the Redolog files,so that they can be created in new locations when opened the database is opened in resetlogs

SQL>alterdatabaserenamefile'/node1/database/prod/redo01.log'to'/node2/database/prod/redo01.log'; ...... ...... ......

10) Now restore the datafiles to new locations and recover. Since we are recovering the database here till the archivelog sequence 50 the sequence number in the SET UNTIL SEQUENCE clause

RMAN>run { setuntilsequence51; setnewnamefordatafile1to'/node2/database/prod/sys01.dbf'; setnewnamefordatafile2to'/node2/database/prod/undotbs01.dbf'; setnewnamefordatafile3to'/node2/database/prod/sysaux01.dbf'; setnewnamefordatafile4to'/node2/database/prod/users01.dbf'; setnewnamefordatafile5to'/node2/database/prod/1.dbf'; setnewnamefordatafile6to'/node2/database/prod/sysaux02.dbf'; setnewnamefordatafile7to'/node2/database/prod/undotbs02.dbf'; restoredatabase; switchdatafileall; recoverdatabase; alterdatabaseopenresetlogs; }

If we are restoring the Rman backups from tapes,then we should ensure the same media manager variables that were used during backups are maintained during restore too.

The below article gives the information of various media manager Environment Variables.

NOTE.312737.1RMAN and Specific Media Managers Environment Variables.

11) Confirm your tempfiles

Confirm the location of your tempfiles, recreate them at the new location if required:

SQL> select * from v$tempfile;

SQL> ALTER TABLESPACE TEMP ADD TEMPFILE 'new tempfile path filename' REUSE;

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。