How to restore the ORACLE database after reinstalling the system

Source: Internet
Author: User
If a problem occurs in our operating system, how should we restore the ORACLE database after the system is reinstalled? The following describes how to restore the ORACLE database after reinstalling the system. We often use the ORACLE database restoration method. The following describes how to restore the ORACLE database after the system is reinstalled.

If a problem occurs in our operating system, how should we restore the ORACLE database after the system is reinstalled? The following describes how to restore the ORACLE database after reinstalling the system. We often use the ORACLE database restoration method. The following describes how to restore the ORACLE database after the system is reinstalled.

If a problem occurs in our operating system, how should we restore the ORACLE database after the system is reinstalled? The following describes how to restore the ORACLE database after reinstalling the system.

We often use the ORACLE database restoration method. The following describes how to restore the ORACLE database after the system is reinstalled. We hope this will help you learn about ORACLE Database restoration.

My computer suddenly crashes and I have to reinstall the system. However, my ORACLE is installed on the d drive, and all the files are still there. I believe it will be restored until the work is completed, I started to complete my database. It took me two days to finally recover and celebrate it. At the same time, I also summarized that I hope my friends who have encountered the same problem can solve this problem quickly.

First:
First, back up the data file in the database (X: \ oracle \ oradata) and rename it (otherwise, the sid will be prompted when the database is installed ). Reinstall the database. Of course, the database name is the name you want to restore. After the installation is complete, open the control panel and stop oracle services. Rename the new file (X: \ oracle \ oradata) and restore the file name in the original directory. Restart the oracle service and listener. Logging into the database with sys/as dba may prompt that the sqlnet under the (X: \ oracle \ ora92 \ network \ admin) folder is modified with insufficient permissions (ora-01031. add SQLNET. AUTHENTICATION_SERVICES = (ETS) to add permissions. After logging in, the system prompts that the table cannot be opened. Open the common page and execute the command alert database open; then refresh the table and find that the original table can be opened. Recovery successful. Use the common users of the original database. Everything is normal. So far, the success is achieved.

Second:

1. First, rename the original ORACLE folder. The original path is D:/oracle. I am changing it to D:/oracle_old. Find the ORACLE installation CD (I used ORACLE 9I) and install ORACLE in the original directory. This makes it easier to restore it, mainly because the Registry content does not need to be modified.

2. After the installation is complete, there is another ORACLE available in the system. At this time, we need to recover the original files and data. Step 1: First close all ORACLE projects that have been started and close them one by one in the "service. Then, rename the installation directory. I am using D:/oracle. Change to D:/oracle_new. Change D:/oracle_old to D:/oracle. In theory, ORACLE is restored physically. However, we found that ORACLE listeners and service programs cannot be started yet. We also need to solve it logically.

3. Execute a delete command in the dos environment: oradim-delete-sid mm. mm is the instance created during oracle creation. We recommend that you execute this command and restart the machine, after the instance is restarted, you can create an instance with the same name as the original Instance. Of course, you can do it without restarting, but your instance name cannot be the same as the original one.

4. Execute the oradim-new-sid mm-startmode a-pfile "D: \ oracle \ admin \ mm \ pfile \ initmm in the dos environment. ora "creates a new instance, where" mm "is the name of the new database.

5. Start the service, open the database, and then log in with the previous user name and password. Generally, the ORACLE database listeners use computer names to identify addresses, rather than 127.0.0.1 or localhost. Therefore, if we use different computer names when installing the system (for example, I used wm_mm. After re-installation, we use wenming_mm). Then we have to modify the file listener. ora. You can change the related items in it.
You need to be patient and careful. There may be a small difference in one step that will lead to some strange error prompts. Sometimes you need to adopt strategies based on the error prompts. In short, the principle is, first, install an identical ORACLE with the same installation directory and database name. This ensures that the registry does not need to be changed. Then, overwrite the physical file and re-instantiate the database. Then, open the database and go in.

Note: The following file a and initialization parameter file INIT must be available for recovery. ORA B. All data files. dbf c, all redo log files (online logs, archived logs) redo d, all control files crtl e, and internal password files

From: http://space.itpub.net/231499/viewspace-63722

WINDOWS is a very fragile system. It may crash in a few days after it is installed. If you have oracle installed in WINDOWS, how can you restore the database?

One method is to use IMP to import the original data after reinstalling the database, but the premise of using this method is that you have backed up the previous data, and this method has many shortcomings, if the backup is too old, many data may be lost and the imported data is too long.


In general, we can use the method of reusing the original database for restoration. Let's talk about the principles of this method before talking about the steps.

The data base corresponds to the instance. After the Database Service is started, we can use the SQLPLUS "/as sysdba" method to connect to an idle routine. When startup is executed to start the database, find the parameter file (PFILE or SPFILE) and password file corresponding to the current SID under % ORACLE_HOME %/database, start the routine, and find the control file based on the information recorded in the parameter file, read the information of the control file, which is the mount data database. Finally, open the database based on the control file information. This process is equivalent to a cold Backup recovery for the database.

The following steps: (we assume that all the relevant files in the original library exist)
1. Install database software
You only need to install database software of the same version without creating a database. It is best to install it in the same % ORACLE_HOME % as the original database, saving the trouble of modifying the parameter file path. (Directly overwrite the original oracle)
Once again, only install software and do not create a database. Otherwise, some old data files of the database software installed in the same directory will be overwritten, so that the database cannot be recovered.

2. Create an instance
Run
Oradim-new-sid oracle9i
Note that this SID name should be the same as your previous SID Name. Otherwise, you must specify pfile in the started data and re-create the password file, which is troublesome. (Of course, if you don't want to use the original SID, you can also change the name of the parameter file and password file to the name corresponding to the new SID ).

3. Start the database
After completing the above two steps, you can start the database.
Use net start to check whether the oracle service has been started. If the oracle service has not been started, run the following command in cmd:
Net start oracleserviceoracle9i
Set necessary environment variables and run them in the cmd window.
Set ORACLE_SID = oracle9i

Connect to the database
Sqlplus "/as sysdba"
Startup

If it is normal, the database should be able to get up.

4. Start the listener
Lsnrctl start

5. Follow-up work
After the preceding steps, oracle can be used, but it is inconvenient to use, for example, each time you start a database in cmd, you need to SET ORACLE_SID and add @ TNSNAME to connect to the database on the local machine. We can modify the registry and add ORACLE_SID information to avoid these troubles.

Create a new string value under HKEY_LOCAL_MACHINESOFTWAREORACLE in the registry, with the name ORACLE_SID and the value oracle9i.
You can also keep the following content as a file with the suffix reg (the file name can be started as needed), and then double-click the file to import the information to the Registry.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINESOFTWAREORACLE]
"ORACLE_SID" = "oracle9i"


Note that the preceding steps are discussed in the same way as % ORACLE_HOME % and % ORACLE_SID % of the original database. Although % ORACLE_HOME % and % ORACLE_SID % can be different from the original database, to reduce the trouble and error rate, we recommend that you do not change the value.

======================

1.2.3 use of ORADIM
ORADIM is a command line tool for Oracle on Windows. It is used for manual creation, modification, and deletion of Oracle services. ORADIM is easy to use. You can see common command examples in the Help file.
ORADIM is also often used in database recovery. Many friends have asked this question: on Windows, if the system crashes, the database software may be lost, however, data files, control files, and log files are still present. How can we restore the Oracle database?
In fact, the process is very simple. Generally, you only need to reinstall the Oracle software based on the original directory structure, and then re-build the service using the ORADIM tool, you can start the instance and load the database (of course, the related parameter files and password files must exist in the $ ORACLE_HOME \ database directory ).
See the following process. After a service is created through ORADIM, the instance starts:

C:\>oradim -new -sid eygle   

The instance has been created.
Run the "net" command to view the services started by the system. Then, you can see that the Oracle service has been started:

C:\>net start  
The following Windows Services have been started:
...............
OracleServiceeygle
Plug and Play
Print Spooler

The command is successfully completed.
If your system has installed some UNIX enhancement tools, you can use grep to filter them out:
C:\>net start |grep Oracle
OracleServiceeygle
After the ORADIM tool is used, a log file is generated in the $ ORACLE_HOME \ database directory.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.