ORACLE 非归档模式下REDO日志丢失修复
admin
2023-05-02 23:04:51
0

第一步:全备datafile,controlfile,spfile/pfile

第二步:恢复日志。(原冷备的日志没有用,千万不要用!)

SQL> select member from v$logfile;                        

/ora/app/oracle/oradata/orcl/redo03.log
/ora/app/oracle/oradata/orcl/redo02.log
/ora/app/oracle/oradata/orcl/redo01.log

SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled       
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     10                       
Current log sequence           12                       
SQL> ho rm $ORACLE_BASE/oradata/orcl/redo*.log   --模拟日志文件丢失。       

SQL> ho ls $ORACLE_BASE/oradata/orcl/redo*.log
ls: cannot access /ora/app/oracle/oradata/orcl/redo*.log: No such file or directory

SQL> startup force
ORACLE instance started.

Total System Global Area 1536602112 bytes
Fixed Size                  2213616 bytes
Variable Size             956303632 bytes
Database Buffers          570425344 bytes
Redo Buffers                7659520 bytes
Database mounted.                        
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/ora/app/oracle/oradata/orcl/redo03.log'
ORA-27037: unable to obtain file status                                    
Linux-x86_64 Error: 2: No such file or directory                           
Additional information: 3  
SQL> alter database open resetlogs;        --第一步
alter database open resetlogs      
*                                  
ERROR at line 1:                   
ORA-01139: RESETLOGS option only valid after an incomplete database recovery


SQL> recover database using backup controlfile; --第二步
ORA-00279: change 1384991 generated at 05/22/2016 20:05:08 needed for thread 1
ORA-00289: suggestion : /ora/app/oracle/flash_recovery_area/ORCL/archivelog/2016_05_22/o1_mf_1_12_%u_.arc
ORA-00280: change 1384991 for thread 1 is in sequence #12                                                


Specify log: {=suggested | filename | AUTO | CANCEL}
                          --注意:非归档,什么也不做,直接回车。
ORA-00308: cannot open archived log '/ora/app/oracle/flash_recovery_area/ORCL/archivelog/2016_05_22/o1_mf_1_12_%u_.arc'
ORA-27037: unable to obtain file status                                                                                
Linux-x86_64 Error: 2: No such file or directory                                                                       
Additional information: 3   
SQL> alter database open resetlogs;          --第三步
alter database open resetlogs      
*                                  
ERROR at line 1:                   
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/ora/app/oracle/oradata/orcl/system01.dbf'
SQL> alter system set "_allow_resetlogs_corruption"=true scope=spfile;

System altered.                            --第四步,使用隐藏参数,不做一致性检查启动数据库。

SQL> startup force mount;                   --第五步,重启到MOUNT状态下。
ORACLE instance started. 

Total System Global Area 1536602112 bytes
Fixed Size                  2213616 bytes
Variable Size             956303632 bytes
Database Buffers          570425344 bytes
Redo Buffers                7659520 bytes
Database mounted.                        
SQL> alter database open;                    --第六步
alter database open                      
*                                        
ERROR at line 1:                         
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


SQL> alter database open resetlogs;          --第七步,一般情况下会正常恢复。
ERROR:                             
ORA-03114: not connected to ORACLE 
                                            
alter database open resetlogs
*                            
ERROR at line 1:             
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00600: internal error code, arguments: [2662], [0], [1384999], [0], [1385016], [4194432], [], [], [], [], [], []
Process ID: 28621                                                                                                   
Session ID: 125 Serial number: 5                                                                                    
                                           --由于隐藏参数导致的600错误。

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options                 
[oracle@test ~]$ sqlplus / as sysdba                                                          

SQL*Plus: Release 11.2.0.1.0 Production on Sun May 22 22:56:21 2016

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

Connected to an idle instance.

SQL> select status from v$instance;        --检查状态,数据库关闭了。
select status from v$instance
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0


SQL> startup mount;                           --再次启动
ORACLE instance started.

Total System Global Area 1536602112 bytes
Fixed Size                  2213616 bytes
Variable Size             956303632 bytes
Database Buffers          570425344 bytes
Redo Buffers                7659520 bytes
Database mounted.
SQL> alter database open;

Database altered.                               --启动成功。


SQL> ho ls $ORACLE_BASE/oradata/orcl/red*         --日志文件自动生成
/ora/app/oracle/oradata/orcl/redo01.log  /ora/app/oracle/oradata/orcl/redo02.log  /ora/app/oracle/oradata/orcl/redo03.log

SQL> alter system reset "_allow_resetlogs_corruption" scope=spfile sid='*';

System altered.                                --第八步,还原隐藏参数值。

SQL> startup force                              --第九步,重启数据库,使参数生效。


相关内容

热门资讯

卖“毒蛋”的人,抓到了 作者 | 何国胜 编辑 | 向现“(人)抓到了,目前案件正在侦办中。”7月28日晚间,苏州禁毒部门有...
尺素金声丨实施零关税国家达63... 海关总署发布的数据显示,今年5月1日起,我国对53个非洲建交国全面实施零关税举措,目前,我国实施零关...
职业索赔盯上基层诊所,倒逼用药... 文 | 布丁基层诊所正在被职业索赔盯上。据新京报,去年夏天,一男子走进河南南阳一家诊所,要求购买三瓶...
“西瓜我全买了”就可以肆意妄为... 拿西瓜砸了人,把瓜都买了,就能一走了之吗?事实证明,这套逻辑在法治社会行不通。7月28日晚,据海峡都...
科学家在日本广岛发现新物质,系... 在美国对日本广岛进行原子弹轰炸近81年后,科学家们在广岛的沙滩上发现了一种奇异且从未被发现过的新物质...
AI失控,反噬开始 作者 | 贺一 编辑 | 阿树近期,中国开源模型在美国频繁引发热议。7月28日,月之暗面发布Kimi...
“总统千金天价离婚”,分到43... 2026年7月24日下午,首尔高等法院,一场持续近十年的司法拉锯战终于接近尾声。法庭裁定SK集团会长...
巴基斯坦,又拿下一个历史性协议 全世界都没想到,接连的中东大战,巴基斯坦正成为最大赢家。去年以色列追杀哈马斯,空袭卡塔尔首都,阿拉伯...
汇正财经贺峰的一对一指导服务怎...   对于考虑购买证券投资顾问服务的投资者来说,'一对一指导服务怎么样'是一个重要的考量维度。需要首先...
重庆失联00后网格员龚宝冬确认...   重庆失联00后网格员龚宝冬确认遇难  【重庆失联00后网格员龚宝冬确认遇难】2026年7月29日...