Database recovery

xiaoxiao2021-03-06  47

Recently, a database recovery method has been summarized by experiments, which is very helpful for future work:

The database is non-archived. If there is only one week ago, the backup of the data file, no redolog, archive log, and ControlFile backups. This situation is one, but the database exits can only do incomplete recovery, it will lose a week ago to make a backup At that time, all the data in that, the specific recovery method is as follows:

The operating system is Solaris8, 2G, 2 CPUs.

Experimental procedure: $ sqlplus / nolog SQL> connect / as sysdbaSQL> archive log listDatabase log mode No Archive ModeAutomatic archival EnabledArchive destination / opt / oracle / arch / ORCLOldest online log sequence 895Current log sequence 897SQL> select file_name, tablespace_name from dba_data_files; FILE_NAME TABLESPACE_NAME -------------------------------------------------- ------------------------------ / OPT / Oracle / DB02 / ORADATA / ORCL / SYSTEM01.DBF System / OPT / Oracle / DB02 / ORADATA / ORCL / TOOLS01.DBF TOOLS / OPT / ORACLE / DB02 / ORADATA / ORCL / RBS01.DBF RBS / OPT / ORACLE / DB02 / ORADATA / ORCL / TEMP01.DBF TEMP / OPT / ORCLE / DB02 / ORADATA / ORCL / users01.dbf users / OPT / ORACLE / DB02 / ORADATA / ORCL / INDX01.DBF INDX / OPT / ORACLE / DB02 / ORADATA / ORCL / DRSYS01.DBF DRSYS / OPT / ORACLE / DB02 / ORADATA / ORCL / TEST.DBF TEST

Rows SELECTED.

SQL> SELECT * FROM V $ logfile;

Group # status --------------- MEMBER ---------------------------- -------------------------------------------------- -3 / OPT / ORACLE / DB04 / ORADATA / ORCL / REDO03.LOG2 / OPT / ORCL / DB03 / ORADATA / ORCL / Redo02.log1 / OPT / ORCLE / DB02 / ORADATA / ORCL / Redo01.log

SQL> SELECT * FROM V $ ControlFile;

Status ------- name ----------------------------------------- ---------------------------------------

/opt/oracle/db02/oradata/orcl/control01.ctl/opt/oracle/db03/oradata/orcl/control02.ctl/opt/oracle/db04/oradata/orcl/control03.ctl

SQL> alter database backup controlfile to trace; (backup control file, then generates a trace file $ ORACLE_BASE / admin / ORCL / udump directory) SQL> shutdown immediate (close the current database) Database closed.Database dismounted.ORACLE instance shut Down.sql> Quit Disconnected

Confirm the path of the data file, and do physical cold backup: $ TAR CVF /BACKUP/Full.tar / OPT / ORADATA / ORADATA / ORADATA / ORADATA / ORADATA / ORADATA / ORCL analog data loss:

Delete all current data files, control files, and redolog files:

$ RM -RF / OPT / ORACLE / DB02 / ORADATA / ORCL / * $ RM /OPT/Orcl/db03/oradata/orcl/redo02.log over - db03/oRadata/orcl/control02.ctl / r /opt/oracle/db04/oradata/orcl/redo03.log over /opt/oracle/db04/oradata/orcl/control03.ctl will do the backup Tar packet solution, restore backup:

$ tar xvf /backup/full.tar Removes all control files and log files, leaving only data files: $ rm /opt/oracle/db02/oradata/orcl/control01.ctl $ RM / OPT / ORACLE / DB03 / ORADATA /Orcl/control02.ctl $ r /opt/oracle/db04/oradata/orcl/control03.ctl $ RM /OPT/Orcle/db02/oradata/orcl/redo01.log full with full / OPT / ORACLE / DB03 / ORADATA / ORCL /RED02.log - DB04/Ordata/orcl/red03.log Because only DataFile, there is no redile and controlfile, the database can only be started to Nomount status: SQL> Startup Nomountoracle Instance Started.

Total system global area 1134141116 bytesfixed size 102076 bytesvariable size 311750656 bytesdatabase buffers 819200000 bytesredo buffers 3088384 BYtes 3088384 BYtes 3088384 BYtes

Edit the originated orclun directory in the udump directory, paste the part of the content that creates ControlFile is put in SQL: (Note Here to Be sure to rebuild the control file in the RESETLOGS mode, resetlogs will generate new redolog, and the current redofile the sequence is set to 1, otherwise create a control file fails): SQL> cREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS NOARCHIVELOG MAXLOGFILES 32 MAXLOGMEMBERS 2 MAXDATAFILES 254 MAXINSTANCES 8 MAXLOGHISTORY 907LOGFILE GROUP 1 '/ opt / oracle / db02 / oradata / Orcl / redo01.log 'size 50000k, group 2' /opt/oracle/db03/oradata/orcl/redo02.log 'size 50000k, group 3' /opt/oracle/db04/oradata/orcl/redo03.log 'size 5000KDatafile '/opt/oracle/db02/oradata/orcl/system01.dbf', '/opt/oracle/db02/oradata/orcl/tools01.dbf', '/opt/oracle/db02/oradata/orcl/rbs01.dbf' '/Opt/oracle/db02/oradata/orcl/temp01.dbf', '/opt/oracle/db02/oradata/orcl/users01.dbf', '/opt/oracle/db02/oradata/orcl/indx01.dbf ',' /Opt/oracle/db02/oradata/orcl/drsys01.dbf ',' /opt/oracle/db02/oradata/orcl/test.dbf' ,character set we8iso8859p1; control file created.sql> ALTER DATABASE OPEN RESETLOGS (Open the database in RESETLOGS) Database altered.

SQL> Select Status from V $ Instance; (check the status of the database) status ------- Open

SQL> Select * from v $ logfile; (check the status of logfile, found new redolog) Group # status ---------- ------- Member ------- -------------------------------------------------- ----------------------- 3 / OPT / ORACLE / DB04 / ORADATA / ORCL / Redo03.log

2 / OPT / ORACLE / DB03 / ORADATA / ORCL / Redo02.log

1 / OPT / ORACLE / DB02 / ORADATA / ORCL / Redo01.log

SQL> SELECT * FROM V $ controlfile; (check the status of the control file)

Status ------- name ----------------------------------------- ---------------------------------------

/opt/oracle/db02/oradata/orcl/control01.ctl

/ OPT / ORACLE / Nothing 03 / Ora Data / OR CL / Control02. Spring / Opt / Oracle / Nothing 04 / Ora Data / OR CL / Control03. Spring

转载请注明原文地址:https://www.9cbs.com/read-115917.html

New Post(0)