数据库处于非归档状态,其联机日志循环覆盖使用,这意味着如果数据库需要进行介质恢复应用相关归档,又由于非归档导致归档文件不存在,那么此时数据库只能执行基于取消的恢复,回退整个数据库到上一次全备份状态。或者修改数据文件头部信息,来规避缺失归档。但不管怎么样都会丢失数据。
下面介绍非归档模式下几种常见故障处理方法。
一 非归档下的常用备份和恢复方法:
如何备份
Backing Up a Database in NOARCHIVELOG Mode You can only backup a database in NOARCHIVELOG mode when the database is closed and in a consistent state.
1 shutdown immediate
2 startup mount
3 backup database
如何恢复
注意 和归档模式下的恢复有如下不同点:
1 Only consistent backups can be used in restoring a database in NOARCHIVELOG mode.
2 Media recovery is not possible because no archived redo logs exist.
恢复步骤如下:
1 startup force mount;
2 restore database;
3 recover database until cancel;
4 alter database open resetlogs;
举例如下:
备份
SQL> archive log list;
Database log modeNo Archive Mode
Automatic archivalDisabled
Archive destination/oracle/archive
Oldest online log sequence1
Current log sequence2
RMAN> shutdown immediate;
using target database control file instead of recovery catalog
database closed
database dismounted
Oracle instance shut down
RMAN> startup mount;
connected to target database (not started)
Oracle instance started
database mounted
Total System Global Area1252663296 bytes
Fixed Size2226072 bytes
Variable Size1006635112 bytes
Database Buffers234881024 bytes
Redo Buffers8921088 bytes
RMAN> backup database;
Starting backup at 2013-02-03 13:26:36
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=63 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=129 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00004 name=/backup/users01.dbf
input datafile file number=00003 name=/oracle/CRM/undotbs3.dbf
input datafile file number=00006 name=/oracle/CRM/erp.dbf
input datafile file number=00007 name=/oracle/CRM/user01.dbf
channel ORA_DISK_1: starting piece 1 at 2013-02-03 13:26:38
channel ORA_DISK_2: starting full datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00001 name=/oracle/CRM/system01.dbf
input datafile file number=00002 name=/oracle/CRM/sysaux01.dbf
input datafile file number=00005 name=/oracle/CRM/pos.dbf
channel ORA_DISK_2: starting piece 1 at 2013-02-03 13:26:39
channel ORA_DISK_1: finished piece 1 at 2013-02-03 13:29:36
piece handle=/backup/20130203_fro11v4d_1_1 tag=TAG20130203T132637 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:02:59
channel ORA_DISK_2: finished piece 1 at 2013-02-03 13:29:38
piece handle=/backup/20130203_fso11v4e_1_1 tag=TAG20130203T132637 comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:02:59
Finished backup at 2013-02-03 13:29:38
Starting Control File and SPFILE Autobackup at 2013-02-03 13:29:38
piece handle=/backup/c-3599153036-20130203-00 comment=NONE
Finished Control File and SPFILE Autobackup at 2013-02-03 13:29:41
 
恢复
RMAN> startup force mount;
Oracle instance started
database mounted
Total System Global Area1252663296 bytes
Fixed Size2226072 bytes
Variable Size1006635112 bytes
Database Buffers234881024 bytes
Redo Buffers8921088 bytes
RMAN> restore database;
Starting restore at 2013-02-03 16:13:04
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=63 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=129 device type=DISK
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 00003 to /oracle/CRM/undotbs3.dbf
channel ORA_DISK_1: restoring datafile 00004 to /backup/users01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /oracle/CRM/erp.dbf
channel ORA_DISK_1: restoring datafile 00007 to /oracle/CRM/user01.dbf
channel ORA_DISK_1: reading from backup piece /backup/20130203_fro11v4d_1_1
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00001 to /oracle/CRM/system01.dbf
channel ORA_DISK_2: restoring datafile 00002 to /oracle/CRM/sysaux01.dbf
channel ORA_DISK_2: restoring datafile 00005 to /oracle/CRM/pos.dbf
channel ORA_DISK_2: reading from backup piece /backup/20130203_fso11v4e_1_1
channel ORA_DISK_1: piece handle=/backup/20130203_fro11v4d_1_1 tag=TAG20130203T132637
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:04:09
channel ORA_DISK_2: piece handle=/backup/20130203_fso11v4e_1_1 tag=TAG20130203T132637
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:04:11
Finished restore at 2013-02-03 16:17:17
RMAN> host;
[oracle@oracle ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Sun Feb 3 16:27:12 2013
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> recover database until cancel;
ORA-00279: change 2942346 generated at 02/03/2013 13:26:11 needed for thread 1
ORA-00289: suggestion : /oracle/archive/1_2_806264057.dbf
ORA-00280: change 2942346 for thread 1 is in sequence #2
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.
SQL> alter database open resetlogs;
Database altered.
SQL> select group#,archived,sequence#,status from v$Log;
GROUP# ARC SEQUENCE# STATUS
---------- --- ---------- ----------------
1 NO           1 CURRENT
2 YES          0 UNUSED
3 YES          0 UNUSED
4 YES          0 UNUSED
二 非归档无备份,单个文件丢失造成数据库无法打开
第一种方法:
SQL> startup ;
ORACLE instance started.
Total System Global Area 1252663296 bytes
Fixed Size2226072 bytes
Variable Size1006635112 bytes
Database Buffers234881024 bytes
Redo Buffers8921088 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 8 - see DBWR trace file
ORA-01110: data file 8: '/oracle/CRM/test.dbf'
SQL> alter database datafile 8 offline drop;
Database altered.
SQL> alter database open;
Database altered.
SQL> alter database create datafile '/oracle/CRM/test.dbf';
Database altered.
SQL> select hxfil,fhscn,fhrba_seq from x$kcvfh;
HXFIL FHSCN             FHRBA_SEQ
---------- ---------------- ----------
1 3078640                  37
2 3078640                  37
3 3078640                  37
4 3078640                  37
5 3078640                  37
6 3078640                  37
7 3078640                  37
8 3077425                  31
8 rows selected.
SQL> select group#,archived,sequence#,status from v$log;
GROUP# ARC SEQUENCE# STATUS
---------- --- ---------- ----------------
1 NO          37 CURRENT
2 NO          34 INACTIVE
3 NO          35 INACTIVE
4 NO          36 INACTIVE
由于是非归档则31、32、33号归档丢失,完全恢复已经不可能,只能执行基于取消的恢复,回退整个数据库。
SQL> startup force mount;
ORACLE instance started.
Total System Global Area 1252663296 bytes
Fixed Size2226072 bytes
Variable Size1006635112 bytes
Database Buffers234881024 bytes
Redo Buffers8921088 bytes
Database mounted.
SQL> recover database until cancel;
ORA-00279: change 3078640 generated at 02/20/2013 16:44:47 needed for thread 1
ORA-00289: suggestion : /oracle/archive/1_37_806501358.dbf
ORA-00280: change 3078640 for thread 1 is in sequence #37
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
ORA-10879: error signaled in parallel recovery slave
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/oracle/CRM/system01.dbf
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/oracle/CRM/system01.dbf'
SQL> alter system set "_allow_resetlogs_corruption"=true scope=spfile;
System altered.
SQL> startup force mount;
ORACLE instance started.
Total System Global Area 1252663296 bytes
Fixed Size2226072 bytes
Variable Size1006635112 bytes
Database Buffers234881024 bytes
Redo Buffers8921088 bytes
Database mounted.
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00600: internal error code, arguments: [2662], [0], [3078648], [0],
[3078665], [4194432], [], [], [], [], [], []
Process ID: 5678
Session ID: 191 Serial number: 3
这里通过重启规避ora-600 [2662]错误
SQL> startup;
ORACLE instance started.
Total System Global Area 1252663296 bytes
Fixed Size2226072 bytes
Variable Size1006635112 bytes
Database Buffers234881024 bytes
Redo Buffers8921088 bytes
Database mounted.
Database opened.
第二种方法
SQL> startup
ORACLE instance started.
Total System Global Area 1252663296 bytes
Fixed Size2226072 bytes
Variable Size1006635112 bytes
Database Buffers234881024 bytes
Redo Buffers8921088 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 8 - see DBWR trace file
ORA-01110: data file 8: '/oracle/CRM/test.dbf'
SQL> alter database create datafile '/oracle/CRM/test.dbf';
Database altered.
注意,当我们用 alter database create datafile 创建数据文件时,数据文件头部scn以及rba.seq号均取自于该数据文件创建时控制文件中记录的scn和rba.seq号,如下:
DATA FILE #8:
name #14: /oracle/CRM/test.dbf
Creation Checkpointed at scn: 0x0000.002d4053 02/03/2013 17:02:59
 thread:1 rba:(0x2.20d.10)
0x2d4053准换为10进制为2965587
 rba:(0x2.20d.10)则表示seq号为2.块525.偏移量10
SQL> select hxfil,fhscn,fhrba_seq,fhrba_bno from x$kcvfh;
HXFIL FHSCN             FHRBA_SEQ FHRBA_BNO
---------- ---------------- ---------- ----------
1 2967064                   9        807
2 2967064                   9        807
3 2967064                   9        807
4 2967064                   9        807
5 2967064                   9        807
6 2967064                   9        807
7 2967064                   9        807
8 2965587                   2        525
8 rows selected.
SQL> select group#,archived,sequence#,status from v$Log;
GROUP# ARC SEQUENCE# STATUS
---------- --- ---------- ----------------
1 NO           9 CURRENT
4 NO           8 INACTIVE
3 NO           7 INACTIVE
2 NO           6 INACTIVE
注意:结合8号数据文件头部rba.seq号为2以及数据库当前日志的seq为9,那么当我们用命令recover datafile 8进行介质恢复时,数据库需调用2、3、4、5号归档和联机日志6、7、8、9来完成恢复。但事实是,数据库处于非归档模式 2、3、4、5 号归档是不存在的,进行完全介质恢复已不可能。能够做的就是进行基于取消的恢复,或者修改数据 文件头部,使数据文件从9号联机日志处开始介质恢复或者调整该数据文件头部信息和其它数据文件保持一致,使介质恢复跳过归档和联机日志。但不过不管怎样,都会丢失数据。
三 非归档current组日志文件丢失
非归档模式 oracle当前联机日志文件的处理通常有两种处理方式如下:
1 启动数据库到mount状态,用命令alter database clear logfile group n 对丢失的当前日志组进行初始化
2 执行基于取消的恢复
方法一:用命令alter database clear logfile group n 初始化当前日志组
1 数据库的log_mode如下:
SQL> archive log list;
Database log modeNo Archive Mode
Automatic archivalDisabled
Archive destination/oracle/archive
Oldest online log sequence5
Current log sequence8
2 当前日志组信息如下:
SQL> select group#,archived,sequence#,status from v$log;
GROUP# ARC SEQUENCE# STATUS
---------- --- ---------- ----------------
1 NO           5 INACTIVE
2 NO           6 INACTIVE
3 NO           7 INACTIVE
4 NO           8 CURRENT
SQL> col member for a40
SQL> select group#,member from v$logfile;
GROUP# MEMBER
---------- ----------------------------------------
3 /oracle/CRM/redo03.log
2 /oracle/CRM/redo02.log
1 /oracle/CRM/redo01.log
4 /oracle/CRM/redo02.dbf
 
3 删除当前日志组    
SQL> host
[oracle@oracle ~]$ rm -rf /oracle/CRM/redo02.dbf
4 启动报错日志如下:
Errors in file /oracle/app/diag/rdbms/crm/CRM/trace/CRM_m000_5259.trc:
ORA-00313: open failed for members of log group 4 of thread 1
ORA-00312: online log 4 thread 1: '/oracle/CRM/redo02.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Dumping diagnostic data in directory=[cdmp_20130201163228], requested by (instance=1, osid=5257), summary=[abnormal instance termination].
USER (ospid: 5257): terminating the instance due to error 313
Instance terminated by USER, pid = 5257
5恢复过程
SQL> select group#,archived,sequence#,status from v$log;
GROUP# ARC SEQUENCE# STATUS
---------- --- ---------- ----------------
1 NO           5 INACTIVE
4 NO           8 CURRENT
3 NO           7 INACTIVE
2 NO           6 INACTIVE
SQL> alter database clear logfile group 4;
Database altered.
SQL> alter database open;
Database altered.
方法二:执行基于取消的恢复
1 数据库当前日志状态如下:
SQL> select group#,archived,sequence#,status from v$log;
GROUP# ARC SEQUENCE# STATUS
---------- --- ---------- ----------------
1 NO           9 INACTIVE
2 NO           6 INACTIVE
3 NO           7 INACTIVE
4 NO          10 CURRENT
SQL> col member for a40
SQL> select group#,member from v$logfile;
GROUP# MEMBER
---------- ----------------------------------------
3 /oracle/CRM/redo03.log
2 /oracle/CRM/redo02.log
1 /oracle/CRM/redo01.log
4 /oracle/CRM/redo02.dbf
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
2 删除当前联机日志文件
[oracle@oracle ~]$ rm -rf /oracle/CRM/redo02.dbf
3 恢复过程如下:
SQL> startup mount;
ORACLE instance started.
Total System Global Area 1252663296 bytes
Fixed Size2226072 bytes
Variable Size1006635112 bytes
Database Buffers234881024 bytes
Redo Buffers8921088 bytes
Database mounted.
SQL> recover database until cancel;
Media recovery complete.
SQL> alter database open resetlogs;
Database altered.
SQL> select group#,archived,sequence#,status from v$log;
GROUP# ARC SEQUENCE# STATUS
---------- --- ---------- ----------------
1 NO           1 CURRENT
2 YES          0 UNUSED
3 YES          0 UNUSED
4 YES          0 UNUSED
需要注意的是对于非归档数据库当前日志损坏的处理,我们可以直接对当前日志组用命令alter database clear logfile group n 进行处理 这点和归档模式下还是有区别的。
总结:
个人感觉如果数据库没更新,只是做查询用,数据库为非归档,做一次全备份即可。

非归档下oracle的备份和恢复相关推荐

  1. oracle ora 00283,【案例】Oracle报错ORA-16433非归档丢失redo无法启动的恢复过程

    天萃荷净 Oracle研究中心案例分析:运维DBA反映Oracle数据库处理非归档模式,redo文件损坏常规修复无法正常open数据库. 本站文章除注明转载外,均为本站原创: 转载自love wife ...

  2. Oracle数据备份和恢复

    文章目录 一.备份与恢复的概念 1.什么是备份 2.备份的方法 3.备份的策略 4.什么是恢复 5.恢复分类 二.逻辑备份和恢复 1.exp命令 2.imp命令 3.数据库实例导出和导入 4.用户的导 ...

  3. oracle数据备份 恢复,Oracle数据备份和恢复

    Oracle数据库的备份和恢复有很多种方法,是一个很大的话题,足可以写一本书,但是,本文只介绍采用exp和imp进行数据备份和恢复,这也是程序员最常用的方法. 本文涉及的备份与恢复的其它概念都是狭义的 ...

  4. ocr oracle,Oracle RAC备份和恢复OCR-Oracle

    Oracle RAC备份和恢复OCR Oracle RAC 备份和恢复OCR voting disks备份恢复参考: /database/201303/195593.html 1.OCR有两种备份方式 ...

  5. Oracle 无备份情况恢复ocr和olr

    Oracle 无备份情况恢复ocr和olr Oracle 11.2 GI中OLR损坏的修复方法 一.先关闭GI,命令不再贴出来了,参见: http://blog.csdn.net/msdnchina/ ...

  6. windows10 oracle自动备份,Windows系统下oracle 自动备份数据库

    Windows系统下oracle 自动备份数据库 1.创建批处理文件(.bat) 2.建立windows 定时任务 2.1创建任务 2.2 常规处 ->填写任务名称 2.3触发器 2.4 操作 ...

  7. 磁盘阵列掉电 oracle数据库,掉电导致磁盘坏,非归档下的redo全部丢失,数据库打开的恢复失败...

    1.环境 OS:sun solaris Database version:8.1.7 数据文件存放路径:/u01/oradata/bjtb/; /u02/oradata/bjtb/ 数据库为非归档 2 ...

  8. Oracle的奇葩设置之非归档模式与RMAN备份

    数据库归档模式与RMAN备份策略是保障数据库数据安全的基本手段,对于ORACLE数据库DBA来说,很清楚ORACLE的RMAN备份是基于数据库的归档模式,但对于主机维护人员及开发人员,他们可能很不清楚 ...

  9. oracle rman备份 归档模式,Oracle RMAN备份归档与非归档模式

    #非归档模式备份数据库: #设置非归档模式 SQL>shutdown immediate SQL>startup mount SQL>alter database noarchive ...

最新文章

  1. MFC给按钮添加皮肤
  2. csu 1804 有向无环图
  3. 交换机端口mtu值最大_大中型监控系统如何正确选择交换机
  4. 复旦高等代数 I(17级)每周一题
  5. 死磕java并发cas_死磕Java——CAS
  6. SAE去掉index.php实现自定义固定链接
  7. c++ template(9)trait和Policy
  8. 神经网络与深度学习——TensorFlow2.0实战(笔记)(二)(Anaconda软件介绍)
  9. 中resource文件夹的作用_冲突与碰撞:OpenStack中的虚拟机和裸机
  10. Gensee移动SDK之(一)结构组成
  11. Windows环境下安装Cassandra1.0.2
  12. [Linux]Ubuntu下用apt-get安装的应用程序位置
  13. 无监督端到端检索式问答系统方案实践
  14. 【CMAKE系列】CMAKE外部工程引用及编译打印
  15. leetcode -- Search Insert Position
  16. MySQL主从复制-基于GTID及多线程的复制
  17. 游戏开发需要懂几种语言?
  18. 量化投资之工具篇一:Backtrader从入门到精通(5)-Strategy类源代码解读
  19. meta标签下http-equiv 属性详解
  20. 原型工具——墨刀以及Axure的比较

热门文章

  1. Matlab | Matlab从入门到放弃(16)——二维图和三维图
  2. mysql的服务器在什么模式下工作_MySQL服务器的SQL模式 (转)
  3. 51单片机c语言应用开发三位一体实战精讲 pdf 119网盘,51单片机C语言应用开发三位一体实战精讲.pdf...
  4. 为最快动脉线诊断 铁科院联合第四范式完成高铁智能化巡检应用
  5. Python学习系列day2-python基础
  6. AGC002E Candy Piles
  7. 【NLP】21个经典深度学习句间关系模型|代码技巧
  8. 【论文解读】AAAI21最佳论文Informer:效果远超Transformer的长序列预测神器!
  9. 【职场】如何才能成功的创业,创业成功的本质是什么
  10. 【Python基础】字符串专题总结