No backup, only archive log, how to recover data files?
System environment:
1, operating system: Windows 2000 Server, machine memory 128M
2, Database: Oracle 8i R2 (8.1.6) for NT Enterprise Edition
3, installation path: c: / oracle
Simulation:
You can recover the data files, provided that the archive log file is saved
first
Set the database to archive mode
SQL * Plus
Conn System / Manager
- Create an experimental table space
Create TableSpace Test DataFile
'c: /test.ora' size 5m
AutoExtend on Next 1M MaxSize Unlimited
Default Storage (Initial 128k Next 1M Pctincrease 0)
/
- Create an experimental user
Drop User Test Cascade;
Create User Test Identified by Test Default TableSpace Test;
Grant Connect, Resource to Test;
CONN Test / TEST
CREATE TABLE A (A Number);
INSERT INTO A VALUES (1);
INSERT INTO A SELECT * FROM A; - Repeated insertion, reaching 1 million
COMMIT;
- Close the database
SVRMGR> Connect Internal
SVRMGR> ALTER SYSTEM SWITCH LOGFILE; - Forced archiving
SVRMGR> ALTER System Switch logfile;
SVRMGR> ALTER System Switch logfile;
SVRMGR> Shutdown
- Delete Test.ora file under operating system
- Restart the database
SVRMGR> Connect Internal
SVRMGR> Startup
At this time, you can be on mount, but you can't open because the data file Test.ora does not exist.
The display error is as follows:
ORA-01157: ???? / ?????? 8 - ??? dbwr ????
ORA-01110: ???? 8: 'c: /test.ora'
SVRMGR> Connect Internal
SVRMGR> Startup Mount
SVRMGR> ALTER DATABASE CREATE DATAFILE 'C: /TEST.ORA';
SVRMGR> Set Autorecovery On
SVRMGR> Recover DataFile 'C: /Test.ora';
SVRMGR> ALTER DATABASE OPEN
CONN Test / TEST
Select count (*) from a; - Data Restore to 1 million
- Remove the experimental watch space
Conn System / Manager
Alter TableSpace Test Offline;
DROP TABLESPACE TEST INCLUDING CONTENTS;
DROP User Test;
- If it is a non-archive mode, you can also use the above method.
- Prerequisites: Entering the size of the record space does not exceed the size of all online log files
--Eping: recover with online log files