[Reproduced] Restoring the database after Oracle reinstallation is equivalent to an additional database of sqlserver

On the development machine, the problem of reinstalling the system is often encountered. If ORACLE is not backed up in time before the reinstallation, it will be tangled after the reinstallation, and data restoration will be a headache.

Among all kinds of mothers, only some solutions can be found in the same directory before the Oracle installation and reinstallation of the system.

I am using 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 in the oracle database, one is in oradata\oradb, 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 the control file

If the file paths in the original database are inconsistent with the reloaded paths, you need to modify all these paths. The specific steps are as follows:

One: Manually shut down all oracle services after re-creating the oracle database

Two: Rename the newly created database directory in oradata, d:\app\user\oradata\oradb, to d:\app\user\oradata\oradb_new

Three: Copy the original database directory to this directory. The result after copying is that there are two directories in oradata: d:\app\user\oradata\oradb_new and d:\app\user\oradata\oradb

d:\app\user\oradata\oradb is the data folder of the database before reinstallation.

Four: Start various oracle services

Five: use the sqlplus /nolog command to enter the oracle command line

Six: Use the connect sys/change_on_install as sysdba; command to obtain system management authority and log in.

Seven: Use select instance_name from v$instance; to confirm whether the current database instance is correct, if it is not oracle, you need to use set oracle_sid to modify the default oracle instance (if I remember correctly, it should be this command, you can ask Du Niang to check).

Eight: Copy the d:\app\user\oradata\oradb\CONTROL02.CTL control file to d:\app\user\flash_recovery_area\oradb, and replace the original control file in the directory. Note: If the name is different, change the name .

Nine: Use startup nomount to start the database with no mount mode.

Ten: Set the database to mount mode: alter database mount;

Eleven: View the list of data files: select name from v$datafile;

View the list of temporary files: select name from v$tempfile;
View the list of log files: 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

Twelve: Modify the data file path and execute the following commands in sequence:

SQL> alter database rename file 'E:\APP\USER\ORADATA\ORADB\SYSTEM01.DBF' to 'D:\APP\USER\ORADATA\ORADB\SYSTEM01.DBF'

Note that when the log file is modified, the file name is redo01, because oracle defaults to uppercase, I think it is red001, and it has not been modified. The other one, if you use select * from v$logfile; you see only one log file, it is recommended Modify several of the original database.

SQL> alter database rename file 'E:\APP\USER\ORADATA\ORADB\REDO03.LOG' to'D:\APP\USER\ORADATA\ORADB\REDO03.LOG';

Thirteen: Start the database: alter database open;

Well, now you can use the client to connect to this database.

 

Reprinted: http://www.cnblogs.com/hawkon/p/3955913.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326346104&siteId=291194637