When the server is running for a long time, it is inevitable to accumulate a large number of log files and garbage files generated by running. In Linux, I use various tools or commands to maintain the server. During server maintenance, I accidentally deleted redo log files, which led to oracle startup failure.

su oracle
cd ~
source .bash_profile
sqlplus /nolog
connect sys/123456@sid as sysdba;
select GROUP#, SEQUENCE#, STATUS from v$log;
          GROUP#              SEQUENCE# STATUS
----------------- --------------------- -------------------------------------------------------
                 1                   45  CURRENT
                 3                   44  INACTIVE
                 2                   43  INACTIVE
select GROUP#, MEMER from v$logfile;
           GROUP# SEQUENCE#
----------------- -----------------------------------------------------------------------------
                3  /u01/app/oracle/oradata/sid/redo03.log
                1 /u01/app/oracle/oradata/sid/redo01.log
                2 /u01/app/oracle/oradata/sid/redo02.log
Copy the code

Let’s see the oracle log management, it can be seen from the above log tables GROUP# = = 1 is the log file of the current database is used, at the right moment, the file is mistakenly deleted, don’t live in the address specified in the file, if you want to restore the file is already impossible things, now I only restore the database log records management.

cd /u01/app/oracle/oradata/sid/ vi redo01.log ! wqCopy the code

After generating an empty log file, we need to modify the database logging information.

sqlplus /nolog connect sys/123456@sid as sysdba; Clear the log group that is currently in use. alter database clear logfile group 1; Delete unused log groups. alter database drop logfile group 2; alter database drop logfile group 3; Shutdown immediate; The database is not open, but the database is loaded successfully. startup normal; Total System Global Area 714014720 bytes Fixed Size 2231792 bytes Variable Size 578814480 bytes Database Buffers 125829120 bytes Redo Buffers 7139328 bytes Database normal. database not open... There will be a database open exception, which we will ignore for now. create pfile='/u01/app/oracle/corrupt.ora' from spfile; shutdown immediate; exit;Copy the code

Mysql > delete database not open; delete database not open; delete database not open; Then close the database and exit.

vim /u01/app/oracle/corrupt.ora *._allow_resetlogs_corruption=TRUE *.audit_file_dest='/u01/oracle/admin/elvis/adump' *. Audit_trail = 'db' *. Compatible = '11.2.0.0.0' *.control_files='/u01/oracle/oradata/elvis/control01.ctl','/u01/oracle/flash_recovery_area/elvis/control02.ctl' *.db_block_size=8192 *.db_domain='' *.db_name='sid' *.db_recovery_file_dest='/u01/oracle/flash_recovery_area' *.db_recovery_file_dest_size=4322230272 *.diagnostic_dest='/u01/app/oracle' *.dispatchers='(PROTOCOL=TCP) (SERVICE=sidDB)' *. Memory_target =716177408 *. Open_cursors =6000 *. Processes =300 *. Remote_login_passwordfile ='EXCLUSIVE' *. Undo_tablespace ='UNDOTBS1' *. Wq -- Save sqlplus /nolog connect sys/123456@sid as sysdba; startup mount pfile='/u01/app/oracle/corrupt.ora' Total System Global Area 714014720 bytes Fixed Size 2231792 bytes Variable Size 578814480 bytes Database Buffers 125829120 bytes Redo Buffers 7139328 bytes Database mounted; database not open; Alter database open resetlogs; Open the database and reset the log file. database altered;Copy the code

As long as the above alter database open resetlogs are held successfully, no error is reported, the database can be restored successfully, the data will not be lost, your environment is different, there may be slight differences in the process of holding rows, should check the Oracle exception log to resolve.

In the process of modifying corrupt. Ora, the database could not be started even after the database was saved, and the log was checked. It probably means that there are not enough processes, so change the parameter *.