码迷,mamicode.com
首页 > 数据库 > 详细

oracle 操作实例(一)----redolog 损坏恢复

时间:2019-02-27 17:55:35      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:文件   eof   oracle   vim   active   开始   tar   fixed   mat   

一,实验前的准备

   数据库全备保证自己没成功还能补救一下

vim full.sh
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2/db_1
export ORACLE_SID=proc
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export PATH=$ORACLE_HOME/bin:$PATH
rman target / log /u01/backup/rman_full.log append<<EOF
run
{allocate channel c1 type disk;
allocate channel c2 type disk;
backup database filesperset 4 format /u01/backup/full_%d_%T_%s_%p;
sql alter system archive log current;
sql alter system archive log current;
sql alter system archive log current;
backup archivelog all format /u01/backup/arch_%d_%T_%s_%p delete input;
backup current controlfile format /u01/backup/ctl_%d_%T_%s_%p;
crosscheck backup;
crosscheck archivelog all;
delete noprompt obsolete;
delete noprompt  expired backup;
delete noprompt  expired archivelog all;
}
EOF

    查看日志组的状态

size_MB,members,archived,status,first_change#,to_char(FIRST_TIME,yyyy-mm-dd hh24:mi:ss) first_time from v$log;

技术图片

    日志文件位置

SELECT group#,member FROM v$logfile;

技术图片

    记录下来: 开始破坏

    第一步,关闭数据库技术图片

    第二步,删除或者移动一个rodo日志.

技术图片

二,恢复

  启动数据库报错

技术图片

   发现启动到mount状态后开始报错了 

  查看日志状态:

   技术图片

    哇,不行.

    现在关闭数据库

技术图片

    也报错了

    强制关闭

    shutdown abort

启动数据库到mount状态  

     技术图片

     查看日志状态:

技术图片

      有一个日志文件报错了

1 select a.group#,a.thread#,b.member,a.bytes/1024/1024 
2 size_MB,a.members,a.archived,a.status from v$log a,v$logfile b where a.group#=b.group#;

技术图片

  处理文件:

  alter database clear logfile group 3;技术图片

  开启数据库:

技术图片

   没有报错了

  

   加入日志成员全部删除了也是这样恢复的

    全部删除了,技术图片

  启动报错 

技术图片

  按照上文恢复

  好像并不能关闭了----

技术图片

技术图片
 1 SQL> startup mount
 2 ORACLE instance started.
 3 
 4 Total System Global Area 1803841536 bytes
 5 Fixed Size            2254144 bytes
 6 Variable Size         1577061056 bytes
 7 Database Buffers      218103808 bytes
 8 Redo Buffers            6422528 bytes
 9 Database mounted.
10 SQL>  select group#,thread#,sequence#,bytes/1024/1024
11  size_MB,members,archived,status,first_change#,to_char(FIRST_TIME,yyyy-mm-dd hh24:mi:ss) first_time from v$log;
12   2
13     GROUP#    THREAD#  SEQUENCE#    SIZE_MB    MEMBERS ARC STATUS
14 ---------- ---------- ---------- ---------- ---------- --- ----------------
15 FIRST_CHANGE# FIRST_TIME
16 ------------- -------------------
17      1        1       10749    512         1 NO  CURRENT
18      39958366 2019-02-27 17:17:59
19 
20      3        1           0    512         1 YES UNUSED
21      39938038 2019-02-27 16:47:59
22 
23      2        1       10747    512         1 YES INACTIVE
24      39938029 2019-02-27 16:47:59
25 
26 
27 SQL> alter database clear logfile group 3;^H^H^H^H^H^H
28   2
29 SQL> s^H^H
30 SP2-0042: unknown command " - rest of line ignored.
31 SQL>
32 SQL>
33 SQL>
34 SQL> alter database open;
35 alter database open
36 *
37 ERROR at line 1:
38 ORA-03113: end-of-file on communication channel
39 Process ID: 3292
40 Session ID: 1705 Serial number: 5
41 
42 
43 SQL> alter database clear logfile group 3;
44 ERROR:
45 ORA-03114: not connected to ORACLE
46 
47 
48 SQL> exit
49 Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
50 With the Partitioning, OLAP, Data Mining and Real Application Testing options
51 [oracle@dataknown prod]$ sqlplus / as sysdba
52 
53 SQL*Plus: Release 11.2.0.4.0 Production on Wed Feb 27 17:51:40 2019
54 
55 Copyright (c) 1982, 2013, Oracle.  All rights reserved.
56 
57 Connected to an idle instance.
58 
59 SQL> startup mount
60 ORACLE instance started.
61 
62 Total System Global Area 1803841536 bytes
63 Fixed Size            2254144 bytes
64 Variable Size         1577061056 bytes
65 Database Buffers      218103808 bytes
66 Redo Buffers            6422528 bytes
67 Database mounted.
68 SQL> alter database clear logfile group 3;
69 
70 Database altered.
71 
72 SQL> alter database open;
73 
74 Database altered.
75 
76 SQL>
View Code

技术图片

 

  

    

  

   

oracle 操作实例(一)----redolog 损坏恢复

标签:文件   eof   oracle   vim   active   开始   tar   fixed   mat   

原文地址:https://www.cnblogs.com/kingle-study/p/10445082.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!