Oracle Rman Restore and Recovery tutorial (i) How to restore a server parameter file

Source: Internet
Author: User
Tags manual naming convention backup

A The base of RMAN restoration and recovery

In the use of Rman, restore and restore are two different concepts.

Restore: Refers to accessing a previously generated backup, getting one or more objects, and then restoring those objects somewhere on the disk.

Recovery (Recover): The actual process by which a database is consistent with a given point in time to ensure that the database can be opened, usually through the application of redo (including online redo logs and archived redo logs).

The state of the data in the database is important to the database, which requires that the data be consistent with the given time state when the database is started. If the database is consistent, you can open the database, and if not, you cannot open it. By using the rollback segment, you can maintain this consistency when you start and run the database. When you close the database normally, the data file will be consistent again.

Oracle demands consistency in data. When we restart the database after recovering the data files, Oracle detects whether the data files are in an inconsistent state. Oracle tracks the current SCN in the header of each database data file and in the current SCN in the control file. When you open a database, Oracle undergoes 3 phases: not loaded, loaded, and opened. When the database is booted into the open phase, Oracle begins to attempt to open the database. When attempting to open a database, Oracle detects the SCN in the control file and the SCN in each data file, and if the SCN does not match, Oracle will know that there are some errors and inconsistencies in the database.

If the database is found to be inconsistent. Oracle needs to determine if the database can be recovered based on an online redo log, or if an archived redo log is required to complete the recovery operation. If Oracle can use the online redo log to perform a recovery operation, it performs a disaster recovery (or performs an instance recovery operation in a RAC environment). If Oracle cannot use online redo to ensure database consistency, it stops the startup process and notifies the report that it needs to perform a media restore operation.

Two Actions before RMAN restore and restore

When starting a database recovery, we must first restore the server parameter file and then recover the control file.

Supplemental Knowledge: First review the knowledge of control files and SPFile backups:

When we modify the automatic backup, the control files and initialization pfile are automatically backed up after each backup.

Rman> Show All;

CONFIGURE Controlfile autobackup on; --This parameter is closed by default

rman> backup Database;

......

Start Control File and SPFILE autobackup in 2 May-June-10

Duan Handle=d:/app/administrator/flash_recovery_area/orcl/autobackup/2010_06_25/o1

_mf_s_722604317_6288dyqf_. BKP Comment=none

Complete control File and SPFILE autobackup in 2 May-June-10

Some rules for configuring automatic backup of control file and parameter files:

(1) The control files and parameter files are automatically backed up when the backup or copy command for each rman is executed outside the Run program block.

(2) using the Run program block, and the last command of the block is not backup or copy, the control file and parameter file are backed up at the end of the run block.

In addition to the above 2 types of automatic file backup, we can also configure another special type of control file backup. This type occurs when the database changes, including adding new tablespaces, adding data files, adding online redo logs, and so on. These automatic backup types occur only on disk, and special options for using the Configure Controlfile autobackup command simplify the backup. Such as:

Configure controlfile autobackup format for device type disk to ' d:/backup/sid_%f ';

With this option, the RDBMS automatically backs up the control files when the data structure changes control the file's impact. Emphasize that only disks are supported.

Manual backup control files

Alter database backup Controlfile to ' D:/backup/orcl_backup.ctl ';

Manual Backup SPFile:

rman> backup SPFile;

Start Control File and SPFILE autobackup in 2 June-June-10

Duan Handle=d:/app/administrator/flash_recovery_area/orcl/autobackup/2010_06_26/o1

_mf_s_722706435_62cd44sn_. BKP Comment=none

Complete control File and SPFILE autobackup in 2 June-June-10

Third, restore the server parameter file

1. Recover server parameter files from automatic backup using Rman (without Fra)

ORACLE will default to create server parameter files and control files in the $oracle_home/dbs or $ORACLE _home/database directory.

The general process of restoring a server parameter file is to set the Oracle_sid and login RMAN first, and then set the dbid so that RMAN knows which database server parameter file to look for and must start the database instance at the same time as this operation.

After you start the database instance, if you use the default location to store automatic backups of the control files, you can simply execute: Restore spfile from autobackup so that Rman can find the control file backup set containing the latest server parameter backups. Once you have restored the server parameter file, you must close the Restart database instance. If you are using a non-default location, you need to assign a channel to that location, and then use the same method to restore the server parameter file.

When the restore SPFile from autobackup command is executed, Oracle finds automatic control file backup sets in the default location (or in the location defined by using the Allocate channel command). RMAN creates a control file automatic backup film, using the default naming convention: c-dbid-date-serial number. such as: c-1247395743-2010627-00. Note that this naming convention does not apply to FRA.

Note that if the recovery directory is not used (and this is possible without the use of control files), Oracle does not know the name of the latest control file backup slice, so Oracle constructs the name of the control file backup slice based on the default naming criteria for those backup sets. Oracle traverses the entire directory and looks backwards at the control file backup set of the database. By default, Oracle looks for a set of control file backups that have been created in the last 10 days. If Oracle America finds a control file backup set created during a specified time period, an error occurs. If Oracle discovers a valid set of control file backups, it restores the server parameter files to the user.

Use the MAXSEQ and maxdays parameters of the Restore command to modify the time period of the Rman lookup control file automatic backup.

Examples of using the default settings:

Set ORACLE_SID=ORCL

Rman Target Sys/pwd

Set dbid=1247395743

Startup Nomount;

Restore SPFile from Autobackup;

Shutdown immediate;

Examples that do not use the default settings:

Set ORACLE_SID=ORCL

Rman Target Sys/pwd

Set dbid=1247395743

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.