In the development of the machine often encounter the problem of the reload system, before reloading if Oracle is not backed up in a timely manner after the reload of the tangled, data recovery is a headache.
All kinds of Niang can only find some Oracle installation and reinstall the system before the directory of the same solution, the directory is not the same as no recruit.
I'm using a oracle11g. The old version should be similar.
After my attempts, I found a few key points and now share them.
1. Control file Control01.ctl
There are two control files for the Oracle database, one in oradata\oradb, and the name is Control01.ctl
The other one is in Flash_recovery_area\sdms_demo, named Control01.ctl
The control file may also be Control02.ctl or control03.ctl
2. Datafile,tempfile,logfile in control files
The file path in the original database if it is inconsistent with the reload path, you need to modify these paths after all, the following steps:
One: Manually shut down all Oracle services after re-creating the Oracle Database
Second: Rename the newly created database directory in Oradata, d:\app\user\oradata\oradb, change to D:\app\user\oradata\oradb_new
Three: Copy the original database directory to this directory, the result of replication is oradata in the d:\app\user\oradata\oradb_new and d:\app\user\oradata\oradb two directories
D:\APP\USER\ORADATA\ORADB is the data folder of the database before reloading.
Four: Start each Oracle service
V: Enter the Oracle command with the Sqlplus/nolog command
Six: Use connect sys/change_on_install as SYSDBA; command to get system administrative privileges and log in.
Seven: Use select instance_name from v$instance; Verify that the current DB instance is correct, if it is not oradb need set Oracle_ Sid to modify the default Oracle instance (remember that this is the order you can ask Niang to check).
Eight: will be d:\app\user\oradata\oradb\CONTROL02. CTL control files are copied to D:\APP\USER\FLASH_RECOVERY_AREA\ORADB, replace the control files in the directory, note: Name is different, change the name.
Nine: Use startup Nomount to start the database in no-load mode.
Ten: Set the database for LOAD mode: Alter DB mount;
11: View Data File list: select name from V$datafile;
View Temporary file list: select name from V$tempfile;
View Log file list: SELECT * from V$logfile;
You will see the following results:
E:\APP\USER\ORADATA\ORADB\SYSTEM01. Dbf
E:\APP\USER\ORADATA\ORADB\SYSAUX01. Dbf
E:\APP\USER\ORADATA\ORADB\UNDOTBS01. Dbf
E:\APP\USER\ORADATA\ORADB\USERS01. Dbf
E:\APP\USER\ORADATA\ORADB\SDMS_DATA01. Dbf
12: Modify the data file path and execute the following command in turn:
sql> ALTER DATABASE Rename file ' E:\APP\USER\ORADATA\ORADB\SYSTEM01. DBF ' to ' D:\APP\USER\ORADATA\ORADB\SYSTEM01. DBF '
Note The log file changes a bit tangled when the file name is REDO01, because Oracle defaults to uppercase, I see as red001, has been modified not, the other, if you use SELECT * from V$logfile; only one log file was seen, It is recommended to modify a few of the original database.
sql> ALTER DATABASE Rename file ' E:\APP\USER\ORADATA\ORADB\REDO03. LOG ' to ' D:\APP\USER\ORADATA\ORADB\REDO03. LOG ';
13: Start database: Alter DB open;
OK, now you can connect the database with the client.
Restore DATABASE after Oracle reload, equivalent to SQL Server's additional database