Oracle's archive log mode recovery work

Source: Internet
Author: User
Tags log connect oracle database sqlplus backup
oracle| resumes Learning and tests the Oracle database's recovery in the Open Archive log mode.
  
The system is Win2K server+oracle 8.1.7.
  
Refer to the Chinaunix.net and Itpub.com website related information. Thanks for helping me here.
  
Note that it is important to develop a good habit. Make a full system backup before you start the recovery and after the recovery is complete.
  
First, to turn on the Archive Log archive log mode
  
1. Close the database
  
2. Modify the Initsid.ora file. This file is usually in the $oracle_home/admin/$ORACLE _sid directory or in the $oracle_home/database directory.
  
Log_archive_start = True
log_archive_dest_1 = "Location=f:oraclearchive"
Log_archive_format = "Ora_%s.arc"
  
Note the usual Windows version and Unix/linux version of some of the parameters are different, please refer to the respective version of the technical documentation.
  
3. Start database to Mount state
  
Startup Mount
  
This loads the database file, but does not open the database.
  
4. Check the current archive log archive logging mode
  
Archive Log List
  
The information displayed is:
  
Database log mode No Archive mode
Automatic Archival Disabled
  
Then use the following command to open the archive log mode of the database
  
ALTER DATABASE Archivelog
  
Again using "Archive log List" To display information, should be:
  
Database Log Mode Archive mode
Automatic Archival Enabled
  
And then use the command ALTER DATABASE open.
  
After the work is done, then we can come to the test.
  
Before testing, let's familiarize ourselves with the Archive log archive logs.
  
Connect to the database by Sqlplus or SVRMGRL as SYSDBA, executing "alter system switch logfile;" We can see the archive log under the F:oraclearchive directory we specified.
  
The filename is the shape and "Ora_0379.arc" we specify, where 0379 is the ordinal number that the Oracle automatically takes. Before we do
  
Finally, we're going to test what's different about backup recovery in archive mode.
  
In non-archive mode, we usually do a database backup every day. The difference between cold and hot backups is only whether the database is closed or open at the time of the backup. In this way, we have a daily backup point, in other words, we can in the case of a database crash, through the backup media, Restores the database to a single backup point.
  
But obviously, such backups and restores are incomplete, and we cannot recover the data between the two backup points.
  
This is not the case when the archive mode is turned on. All system Redo_log the actions submitted in the Redo log are saved as archived logs before reuse of redo logs, i.e. All users are logged on to each operation of the database. So, in the case of maintaining our original database backup plan, we have all the historical operations records between two backup points in addition to a daily backup point.
  
In this way, combined with daily database backup and archive logs and online redo logs, we can accurately restore the database to the moment before the database crashed, with no data loss occurring.
  
The premise, of course, is that the database backup and archive logs cannot be corrupted or lost at the same time.
  
We assume that the environment is
  
>> Suppose there are 3 hard drives, C, D, E, System in C disk, data file in D disk, archived log in E disk. control files, online redo log has 3 groups and reused, placed in C, D and E disk.
  
>> It is now the case that we keep all the archived logs and keep the backup tapes 5 days ago (unfortunately, for a variety of reasons, nearly 5 days of backup did not succeed, but fortunately, the system and software configuration have not changed during this time).
  
>> Hard drive D was suddenly corrupted and the database crashed and everyone was unable to connect to the database.
  
>> in this case, we only consider the data file corruption, assuming all the control files, redo logs are normal.
  
We're going to start getting back to work now.
  
>> after contacting the hardware vendor, our new hard drive arrived, after installation, through the backup tapes 5 days ago, restore all the files on D disk.
  
>> Log on to Oracle with the system user via SVRMGRL or sqlplus
  
>> Open the database to Mount state, "startup Mount", at which point Oracle will prompt the database file corruption, need to fix
  
>> According to the prompt file, enter the command "Recover datafile ' d:oracledata01.dbf";
  
>> Oracle will automatically find the required archive logs and current redo_log to recover the data files, we only need to press the ENTER key after each prompt to determine the application of the archived log file displayed. Oracle will have prompt information when the restore is complete.
  
After the >> recovery is complete, you can try to open the database with the command "ALTER DATABASE open", and if there is a corrupted data file, Oracle will again be prompted to fix it. You only need to repeat the two steps above.
  
>> Repeat until all data files are restored. Use the command "ALTER DATABASE open" to open the database.
  
In this way, we basically complete the archive mode open in the case of the database recovery work, in this mode, the database can be restored to any moment (you can cancel the recovery process when the application archive log file is restored). And even if our daily database backups were not executed successfully because of an accident, We can still complete our database recovery process through cold/hot backup + Continuous archive log files a few days ago.
  
Alternatively, you can complete the recovery process directly through the command "recover database", but this feels like a lack of fulfillment. It is not recommended unless you have confidence in your backup or your own level.
  
The above test passes.

Related Article

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.