Oracle Rman Restore and Recovery Tutorial (iv) How to restore and restore databases in non-archive mode

Source: Internet
Author: User
Tags file system reset time limit oracle database backup

If the database is in Noarchivelog mode, we will recover the database from a full offline backup and it is not possible to achieve point-in-time recovery.

1, restore the preparation work

If you run the database in Noarchivelog mode and assume that you have a backup of the database, you can perform a full recovery of the database very easily. The first thing to do is clean up all the data files, as well as the old redo logs and control files. Not necessarily, but with the Noarchivelog model, we want to start all over again.

After you have cleaned up the data files, controlled the files, and redo the logs, you can start the recovery process. First, you can recover the control files from the most recently generated backup, or you can use the backup control files that were created at some point in time (after the backup was completed). If you use the Create Control File command, you need to have a file programming directory associated with Rman backups before restoring the database.

If you restore the server parameter files and control files, you can ignore the difference between using the recovery directory and not using the recovery directory. Therefore, we only describe recovery operations that do not use the recovery directory. In addition, there is no significant difference between the use of FRA and recovery operations that do not use FRA.

The Rman command for the restore operation is as follows:

Startup Mount;

Restore database;

Recover database Noredo; --If the online log exists, you can replace it with the recover database

Alter database open resetlogs;

This assumes that the server parameter file and the database control file have been restored. The first command, startup mount, loads the database, so orace reads the control files that are ready for the database restore operation. The second command restore database causes the Rman to start the restore operation of the databases.  The third command instructs Rman to perform the final recovery operation to prepare to open the database. The Noredo parameter is used in this command because it is Noarchivelog mode and does not apply any archived redo logs and the online redo log is lost. If there is a complete online redo log, you do not need to use the Noredo parameter. Finally, open the database using the ALTER DATABASE open Resetlogs command. Because the control file has been restored and the online redo log needs to be rebuilt, the resetlogs command must be used.

Resetlogs represents the end of a logical lifecycle of a database and the beginning of another logical lifecycle, and after using Resetlogs, the SCN is not reset, but the log sequence number is reset, and redo log is reset. To prevent log sequences from conflicting after incomplete recovery.

2, restore the database from the old backup

Something, we may need to restore multiple backups, and we want to recover the database from some backup from the latest backup. In this case, you need to use the SET command and other restore processes. The following is a restore database in a backup that is earlier than the default backup:

Startup Mount;

Run

{

Set until Time "to_date (' 2010-6-28 17:04:00 ', ' yyyy-mm-dd hh24:mi:ss ')";

Restore database;

Recover database Noredo;

Alter database open resetlogs;

}

The set until time command here is limited to the run code block. This requirement must be met if you want to use the set until Time command. The time we set is 2010-6-28 17:04:00,oracle will look for a time when the closest but no more than this setting is generated. If 3 backups were generated in 6-28 days. They are 8 points, 18 points, 22 points respectively. Then Rman chooses a 18-point backup.

If you do not use the run code block, you must set the time limit in the Restore command:

Startup Mount;

Restore database until Time "to_date (' 2010-6-28 17:04:00 ', ' yyyy-mm-dd hh24:mi:ss ')";

Recover database Noredo;

Alter database open resetlogs;

3. Restore the database at different locations

We do not always want to restore the database to the original file location of the Oracle file. For example, in a disaster recovery exercise, we can restore the database to a large file system.

RMAN defaults to restoring the data file to the original location of the data file at the time of the backup. If you want to replace the location, enter the set newname for datafile and the switch command. Such as:

Set newname for datafile ' d:/app/administrator/oradata/orcl/dave01.dbf ' to ' E:/APP/ADMINISTRATOR/ORADATA/ORCL ';

This defines the original location of the data file and the Rman should copy the files to the new location. Once you have executed the set newname for datafile command for all data files that you want to restore to different locations, you can use the Restore and recover commands. Finally, before you open the database, you must tell Oracle to permanently use the restored, relocated data files later. Here we can use the SWITHCH command.

The Switch command can modify the location of the data files in the database control file to reflect the new location of the Oracle database files. Typically, using the switch datafile All command, you can be knowledgeable about all data file locations in the Oracle transformation control file. The Switch datafile command can also convert the location of a specific data file.

If you use the set newname for datafile command but do not convert all restored data files, Rman treats the data files that are not converted as a copy of the data file, and Rman does not attempt to use the data files that are not converted when the database is restored. Examples include:

Startup Nomount;

Restore controlfile from Autobackup;

Alter database Mount;

Run

{

Set newname for datafile ' d:/app/administrator/oradata/orcl/dave01.dbf ' to ' e:/app/administrator/oradata/orcl/ DAVE01.DBF ';

Set newname for datafile ' d:/app/administrator/oradata/orcl/user01.dbf ' to ' e:/app/administrator/oradata/orcl/ USER01.DBF ';

Restore database;

Recover database Noredo;

Alter database open restlogs;

Switch datafile All; --Modify the location of the data file in the control file

}

Note that if the restore operation is unsuccessful, but the data file is successfully restored, the restored data file becomes a copy of the data file and is not deleted.

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.