搜索: 标题内容作者  
  首页数据库Oracle
背景:
阅读新闻

ORACLE备份恢复方法

[日期:2007-07-22]   来源:互联网整理  作者:佚名   [字体: ]
    新闻简介: 第一章. 理解什么是数据库恢复 
当我们使用一个数据库时,总希望数据库的内容是可靠的、正确的,但由于计算机系统的故障(硬件故障、软件故障、网络故障、进程故障和系统故障)影响数据库系统的操作,影响数据库中数据的正确性,甚至破坏数据库,使数据库中全部或部分数据丢失。因此当发生上述故障后,希望能重构这个完整的数据库,该处理称为数据库恢复。恢复过程大致可以分为复原(Restore)与恢复(Restore)过程。 
数据库恢复可以分为以下两类: 
1.1实例故障的一致性恢复 
当实例意外地(如掉电、后台进程故障等)或预料地(发出SHUTDOUM ABORT语句)中止时出现实
        关 键 词:  

ORA-00280: change 1073856 for thread 1 is in sequence #312 
ORA-00278: log file ’D:oracleORADATATESTARCHIVETESTT001S00311.ARC’ no 
longer needed for this recovery 
ORA-00279: change 1073858 generated at 05/08/2003 09:11:43 needed for thread 1 
ORA-00289: suggestion : D:ORACLEORADATATESTARCHIVETESTT001S00313.ARC 
ORA-00280: change 1073858 for thread 1 is in sequence #313 
ORA-00278: log file ’D:ORACLEORADATATESTARCHIVETESTT001S00312.ARC’ no 
longer needed for this recovery 
ORA-00279: change 1073870 generated at 05/08/2003 09:11:46 needed for thread 1 
ORA-00289: suggestion : D:ORACLEORADATATESTARCHIVETESTT001S00314.ARC 
ORA-00280: change 1073870 for thread 1 is in sequence #314 
ORA-00278: log file ’D:ORACLEORADATATESTARCHIVETESTT001S00313.ARC’ no 
longer needed for this recovery 
Log applied. 
Media recovery complete. 
7、打开数据库,检查数据库的数据(完全恢复) 
SQL> alter database open; 
Database altered. 
SQL> select * from test; 

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


说明: 
1、只要有备份与归档存在,就可以实现数据库的完全恢复(不丢失数据) 
2、适合于丢失大量数据文件,或包含系统数据文件在内的数据库的恢复  [Page]
3、恢复过程在mount下进行,如果恢复成功,再打开数据库,down机时间可能比较长一些。 
4.3.2 RMAN备份方案 
RMAN备份归档模式下损坏(丢失)多个数据文件,进行整个数据库的恢复 
1、连接数据库,创建测试表并插入记录 
SQL*Plus: Release 8.1.6.0.0 - Production on Tue May 6 13:46:32 2003 
(c) Copyright 1999 Oracle Corporation. All rights reserved. 
SQL> connect internal/password as sysdba; 
Connected. 
SQL> create table test(a int); 
Table created 
SQL> insert into test values(1); 
1 row inserted 
SQL> commit; 
Commit complete 
2、备份数据库 
DOS下 C:> rman cmdfile=bakup.rcv msglog=backup.log; 
以下是backup.log内容。 
Recovery Manager: Release 8.1.6.0.0 - Production 
RMAN> # script:bakup.rcv 
2> # creater:chenjiping 
3> # date:5.8.2003 
4> # desc:backup all database datafile in archive with rman 
5>  
6> #connect database 
7> connect rcvcat rman/rman@back; 
8> connect target internal/virpure; 
9>  
10> #start backup database 
11> run{ 
12> allocate channel c1 type disk; 
13> backup full tag ’dbfull’ format ’d:backupfull%u_%s_%p’ database 
14> include current controlfile; 
15> sql ’alter system archive log current’; 
16> release channel c1; 
17> } 
18> #end 
19>  
RMAN-06008: connected to recovery catalog database 
RMAN-06005: connected to target database: TEST (DBID=1788174720) 
RMAN-03022: compiling command: allocate 
RMAN-03023: executing command: allocate 
RMAN-08030: allocated channel: c1 
RMAN-08500: channel c1: sid=15 devtype=DISK 
RMAN-03022: compiling command: backup 
RMAN-03023: executing command: backup 
RMAN-08008: channel c1: starting full datafile backupset  [Page]
RMAN-08502: set_count=4 set_stamp=494074368 creation_time=15-MAY-03 
RMAN-08010: channel c1: specifying datafile(s) in backupset 
RMAN-08522: input datafile fno=00002 name=D:ORACLEORADATATESTRBS01.DBF 
RMAN-08522: input datafile fno=00001 name=D:ORACLEORADATATESTSYSTEM01.DBF 
RMAN-08011: including current controlfile in backupset 
RMAN-08522: input datafile fno=00005 name=D:ORACLEORADATATESTTOOLS01.DBF 

If you believe an article violates your rights or the rights of others, please contact us.

收藏 推荐 打印 | 录入:admin | 阅读:
相关新闻      
友情链接
本文评论   [发表评论] 全部评论 (0)
赞助商广告
热门评论