User Management Recovery
Oracle Recovery Architecture
Ii. Recovery type: instance recovery, media recovery
1, the premise of the recovery of the data files, control files and online logs are not damaged, fully automatic
2, media Recovery: In the case of physical damage to the file, restore, restore, and finally make the database open to the normal operation known as media recovery, human intervention
Third, Recovery mode: Full recovery, incomplete recovery
Iv. Recovery technologies: User Management recovery and Rman recovery
V. Full recovery cases
V$recover_file//Which file needs to be restored to select file#,change# from V$recover_file;
V$log//Online log Select min (first_change#) from V$log where status!= ' INACTIVE ';
V$archived_log//Archive Log Select min (first_change#) from V$archived_log;
V$recovery_log//needs which archvielog do the recovery
1, * * * Scenario 1: Recovery of database Shutdown (System,sysaux,undo,whole db): System tablespace for example (Lengbei)
SELECT * from V$dbfile;
Shutdown immediate;
cp-rf/u01/app/oracle/oradata/ocp/*/backup/cold--cold standby entire data file
Startup
Conn Gyj/gyj
INSERT into T1 values (4, ' gyj4 ');
Commit
alter system switch logfile; --Switch logs
RM-RF SYSTEM01.DBF--album in addition to system table space
Shutdown abort; --Abnormal shutdown
cp/backup/cold/system01.dbf/u01/app/oracle/oradata/ocp/--Restore first with backup
Startup --Will complain: ora-01157,ora-01110
Recover datafile 1; --Recovery
Always Enter
ALTER DATABASE open;
2, * * * Scenario 2: Recovery when the database is open take the table space of the user's data as an example (hot standby)
Create tablespace tp5 datafile '/u01/app/oracle/oradata/ocp/tp5.dbf ' size 10M;
Conn Gyj/gyj
CREATE TABLE T5 (ID int,name varchar2 ()) tablespace tp5;
INSERT into T5 values (1, ' gyj1 ');
Commit
Alter tablespace TP5 begin backup; --Hot standby
!cp/u01/app/oracle/oradata/ocp/tp5.dbf/backup/hot
Alter tablespace TP5 end backup;
Conn Gyj/gyj
INSERT into T5 values (2, ' gyj2 ');
Commit
RM-RF tp5.dbf;
ALTER DATABASE datafile 9 offline;
!cp/backup/hot/tp5.dbf/u01/app/oracle/oradata/ocp/--Restore first with backup
Recover DataFile 9; --Recovery
ALTER DATABASE datafile 9 online;
3, the control file recovery
Select controlfile_sequence# from v$database;--the serial number of the current control file record
Select Hxfil as file#,fhcsq from X$KCVFH;
Select controlfile_change# from V$database; --Control your own checkpoint
Select file#,checkpoint_change# from V$datafile_header;
Select checkpoint_change# from V$database; --Checkpoint of database
Select file#,checkpoint_change# from V$datafile; --The SCN read from the control file
(1) * * * Scene 1: Control file Not all bad, there is a good
RM-RF Control02.ctl
Shutdown abort;
CP Control01.ctl Control02.ctl
Startup