首页 > 应用开发 > IT综合 > vertias本机恢复过程
说明:
10.10.0.53 ctdb04 ,假设此为使用中重要DB ,通过veritas 全库备份至磁带机。
10.10.0.59 cdim ,veritas server软件服务器,(windows 2000)。
[@more@]说明:
1,53数据库有完整全备份在磁带机中(包括controlfile),其参数文件和controlfile也有第三方手段进行备份。
2,53数据库宕,需要用磁带机中的备份数据恢复至53服务器中。
操作流程如下:
1)
RMAN> run{
2> allocate channel c1 type 'sbt_tape';
3> restore database;
4> recover database;
5> release channel c1;}
即可以完成全数据库的还原与恢复。
说明:
1, 53数据库有完整全备份在磁带机中(包括controlfile),但丢失了第三放备份的控制文件。
2,数据库宕机,需要用将数据恢复至53服务器中。
1) 检查上一次完整全库RMAN备份的日志;
cat $ORACLE_HOME/testhot_database_backup.sh.out
2) 找到数据备份,归档日志备份,控制文件备份的备份集
…. RMAN-08522: input datafile fno=00003 name=/u01/app/oracle/oradata/southdb/rbs01.dbf
RMAN-08522: input datafile fno=00010 name=/u01/app/oracle/oradata/southdb/rbs02.dbf
RMAN-08522: input datafile fno=00011 name=/u01/app/oracle/oradata/southdb/rbs03.dbf
RMAN-08522: input datafile fno=00012 name=/u01/app/oracle/oradata/southdb/rbs04.dbf
RMAN-08522: input datafile fno=00001 name=/u01/app/oracle/oradata/southdb/system01.dbf
RMAN-08011: including current controlfile in backupset
RMAN-08522: input datafile fno=00006 name=/u01/app/oracle/oradata/southdb/indx01.dbf
RMAN-08522: input datafile fno=00007 name=/u01/app/oracle/oradata/southdb/drsys01.dbf
RMAN-08522: input datafile fno=00002 name=/u01/app/oracle/oradata/southdb/tools01.dbf
RMAN-08013: channel ch00: piece 1 created
RMAN-08503: piece handle=bk_u05iong12_s5_p1_t629915682 comment=A2.0,MMS Version 4.0.0.0
RMAN-08525: backup set complete, elapsed time: 00:06:47
……..
RMAN-08014: channel ch00: specifying archivelog(s) in backup set
RMAN-08504: input archivelog thread=1 sequence=1 recid=4 stamp=629916094
RMAN-08013: channel ch00: piece 1 created
RMAN-08503: piece handle=arch-s6-p1-t629916095 comment=API Version 2.0,MMS Version 4.0.0.0
RMAN-08525: backup set complete, elapsed time: 00:00:36
RMAN-08071: channel ch00: deleting archivelog(s)
RMAN-08514: archivelog filename=/u01/app/oracle/ 7/dbs/arch1_1.dbf recid=4 stamp=629916094
………
3) 进行还原恢复
SQL> startup nomount
ORACLE instance started.
Total System Global Area 735150240 bytes
Fixed Size 73888 bytes
Variable Size 256655360 bytes
Database Buffers 471859200 bytes
Redo Buffers 6561792 bytes
SQL> DECLARE
2 devtype varchar2(256);
3 done boolean;
4 BEGIN
5 devtype:=sys.dbms_backup_restore.deviceAllocate (type=>'SBT_TAPE',ident=>'t1');
6 sys.dbms_backup_restore.restoreSetDatafile;
7 sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>1,toname=>'/u01/…/system01.dbf');
8 sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>2,toname=>'/u01/…/tools01.dbf');
9 sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>3,toname=>'/u01/…/rbs01.dbf');
10 sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>6,toname=>'/u01/…/indx01.dbf');
11 sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>7,toname=>'/u01/…/drsys01.dbf');
12 sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>10,toname=>'/u01/…/rbs02.dbf');
13 sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>11,toname=>'/u01/…/rbs03.dbf');
14 sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>12,toname=>'/u01/…/rbs04.dbf');
15 sys.dbms_backup_restore.restoreControlfileTo(cfname=>'/u01/…/control.bak');
16 sys.dbms_backup_restore.restoreBackupPiece(done=>done,handle
=>'bk_u05iong12_s5_p1_t629915682', params=>null);
17 sys.dbms_backup_restore.restoreSetArchivedlog;
18 sys.dbms_backup_restore.restoreArchivedLogRange(0,281474976710655);
19 sys.dbms_backup_restore.restoreBackupPiece(done=>done,handle
=>'arch-s6-p1-t629916095', params=>NULL);
20 sys.dbms_backup_restore.deviceDeallocate;
21 END;
22 /
PL/SQL procedure successfully completed.
SQL> exit
Disconnected from Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
With the Partitioning option
JServer Release 8.1.7.4.0 - Production
[oracle@ctdb04 8.1.7]$ cd /u01/app/oracle/oradata/
arch1_482.dbf control.bak querydb southdb
[oracle@ctdb04 8.1.7]$ cd /u01/app/oracle/oradata/southdb/
[oracle@ctdb04 southdb]$ cp control.bak control01.ctl
[oracle@ctdb04 southdb]$ cp control.bak control02.ctl
[oracle@ctdb04 southdb]$ cp control.bak control03.ctl
[oracle@ctdb04 southdb]$ sqlplus /nolog
SQL*Plus: Release 8.1.7.0.0 - Production on Tue Aug 7 09:50:23 2007
(c) Copyright 2000 Oracle Corporation. All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> alter database mount;
Database altered.
SQL> recover database using backup controlfile until cancel;
ORA-00279: change 7324214789 generd at 08/06/2007 16:34:41 needed for thread1
Specify log: {
auto
ORA-00266: name of archived log file needed
SQL> alter database open resetlogs;
Database altered.
1,检查上一次完成RMAN全备份的日志,找到备份的控制文件的备份集,或找最进备份集
RMAN-03022: compiling command: backup
RMAN-03023: executing command: backup
RMAN-08008: channel ch00: starting full datafile backupset
RMAN-08502: set_count=7 set_stamp=629916131 creation_time=06-AUG-07
RMAN-08010: channel ch00: specifying datafile(s) in backupset
RMAN-08011: including current controlfile in backupset
RMAN-08013: channel ch00: piece 1 created
RMAN-08503: piece handle=bk_u07iongf3_s7_p1_t629916131 commt=APIon 2.0,MMS Version 4.0.0.0
RMAN-08525: backup set complete, elapsed time: 00:00:37
2,进行SQLPLUS进行还原恢复过程。
SQL> startup nomount
ORACLE instance started.
Total System Global Area 735150240 bytes
Fixed Size 73888 bytes
Variable Size 256655360 bytes
Database Buffers 471859200 bytes
Redo Buffers 6561792 bytes
SQL> DECLARE
2 devtype varchar2(256);
3 done boolean;
4 BEGIN
5 devtype:=sys.dbms_backup_restore.deviceAllocate(type=>'sbt_tape',ident=>'t1');
6 sys.dbms_backup_restore.restoreSetDatafile;
7 sys.dbms_backup_restore.restoreControlfileTo(cfname=>'/u01/app/oracle/oradata/control.bak');
8 sys.dbms_backup_restore.restoreBackupPiece(done=>done,handle
=>'bk_u07iongf3_s7_p1_t629916131',params=>null);
9 sys.dbms_backup_restore.deviceDeallocate;
10 END;
11 /
PL/SQL procedure successfully completed.
SQL> exit
Disconnected from Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
With the Partitioning option
JServer Release 8.1.7.4.0 - Production
[oracle@ctdb04 8.1.7]$ cp $ORACLE_BASE/oradata/control.bak /…/control01.ctl
[oracle@ctdb04 8.1.7]$ cp $ORACLE_BASE/oradata/control.bak /…/control02.ctl
[oracle@ctdb04 8.1.7]$ cp $ORACLE_BASE/oradata/control.bak /…/control03.ctl
[oracle@ctdb04 8.1.7]$ sqlplus /nolog
SQL*Plus: Release 8.1.7.0.0 - Production on Thu Aug 9 09:57:11 2007
(c) Copyright 2000 Oracle Corporation. All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> alter database mount;
Database altered.
SQL> exit
Disconnected from Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
With the Partitioning option
JServer Release 8.1.7.4.0 - Production
[oracle@ctdb04 8.1.7]$ rman nocatalog target /
Recovery Manager: Release 8.1.7.4.0 - Production
RMAN-06005: connected to target database: SOUTHDB (DBID=4120592817)
RMAN-06009: using target database controlfile instead of recovery catalog
RMAN> list backup of database;
RMAN-03022: compiling command: list
List of Backup Sets
Key Recid Stamp LV Set Stamp Set Count Completion Time
------- ---------- ---------- -- ---------- ---------- ----------------------
3 3 629916085 0 629915682 5 06-AUG-07
List of Backup Pieces
Key Pc# Cp# Status Completion Time Piece Name
------- --- --- ----------- ---------------------- ------------------------
3 1 1 AVAILABLE 06-AUG-07 bk_u05iong12_s5_p1_t629915682
List of Datafiles Included
File Name LV Type Ckp SCN Ckp Time
---- ------------------------------------- -- ---- ---------- -------------
1 /u01/app/oracle/oradata/southdb/system01.dbf 0 Full 7324214790 06-AUG-07
2 /u01/app/oracle/oradata/southdb/tools01.dbf 0 Full 7324214790 06-AUG-07
3 /u01/app/oracle/oradata/southdb/rbs01.dbf 0 Full 7324214790 06-AUG-07
6 /u01/app/oracle/oradata/southdb/indx01.dbf 0 Full 7324214790 06-AUG-07
7 /u01/app/oracle/oradata/southdb/drsys01.dbf 0 Full 7324214790 06-AUG-07
10 /u01/app/oracle/oradata/southdb/rbs02.dbf 0 Full 7324214790 06-AUG-07
11 /u01/app/oracle/oradata/southdb/rbs03.dbf 0 Full 7324214790 06-AUG-07
12 /u01/app/oracle/oradata/southdb/rbs04.dbf 0 Full 7324214790 06-AUG-07
RMAN> run{
2> allocate channel c1 type 'sbt_tape';
3> restore database;
4> recover database;
5> release channel c1;}
至此完成数据库的还原恢复工作.
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9925929/viewspace-973410/ ,如需转载,请注明出处,否则将追究法律责任。