RMAN backup and recovery-parameter file Restoration

Source: Internet
Author: User

RMAN backup and recovery-parameter file Restoration

In RMAN, "restoration" and "restoration" have different meanings. "restoration" refers to accessing the previously generated backup set to obtain one or more objects, then restore these objects at a location on the disk. Detached from restoration. Recovery is an actual operation that allows a database to be opened at a given time point.

If all parameter files (spfile and pfile) are lost and automatic backup of control files is enabled (RMAN> configure controlfile autobackup on ;), we can recover the server's parameter files from the backup set of the automatic backup control file + parameter file. The parameter files and control files stored in automatic backup vary slightly in different operating systems:

Windows: $ Oracle_HOME % \ database

Linux/Unix: $ ORACLE_HOME/dbs

If there is an automatic backup control file + parameter file backup set, we only need to execute a simple statement: restore spfile from autobackup; statement to restore the parameter file. When this statement is executed, Oracle searches for the required backup set in the default location (or in the location defined by the allocate channel command). The backup set uses the default naming rule of Oracle (% F ), this naming rule is not applicable to FRA (FRA has its own naming rules ).

Example: Simulate parameter file loss (execute full database backup in the Offline state, and then remove all spfile and pfile files under $ ORACLE_HOME/dbs to the temporary directory)

Failed to start the database:

SQL> startup

ORA-01078: failure in processing system parameters

LRM-00109: cocould not open parameter file '/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/initorcl. ora'

Method 1: use the default configuration to restore the parameter file and Start RMAN to restore the parameter file: [oracle @ localhost ~] $ Set oracle_sid = orcl [oracle @ localhost ~] $ Rman target/RMAN> set DBID = 1405321682 RMAN> startup nomount RMAN> restore spfile from autobackup; Starting restore at 21:24:27 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID = 130 device type = DISK channel ORA_DISK_1: looking for AUTOBACKUP on day: 20150606 channel ORA_DISK_1: looking for AUTOBACKUP on day: 20150605 channel ORA_DISK_1: looking for AUTOBACKUP on day: 20150604 chan Nel ORA_DISK_1: looking for AUTOBACKUP on day: 20150603 channel ORA_DISK_1: looking for AUTOBACKUP on day: 20150602 channel ORA_DISK_1: looking for AUTOBACKUP on day: 20150601 channel ORA_DISK_1: looking for AUTOBACKUP on day: 20150531 channel ORA_DISK_1: no AUTOBACKUP in 7 days found RMAN-00571: ========================================================== ============================== RMAN-00569: =================== ERROR MESSAGE Stack follows ====================== RMAN-00571: ========================================================== ============================== RMAN-03002: failure of restore command at 06/06/2015 21:24:29 RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece Error Analysis recovery error, prompting that a valid backup set is not found. Cause Analysis: Normally, the database was fully standby and the configure autobackup on was set. The parameter file backup was supposed to exist, but why cannot it be found? By default, the recovery parameter file is configured. Oracle searches for a backup set with the specified name under $ ORACLE_HOME/dbs. According to the error message, by default, it searches for the control file backup set created in the past seven days in this directory (you can add maxseq and maxdays to change the default days). If it is not found, an error is returned. Go to the $ ORACLE_HOME/dbs directory and check that there is indeed no backup set. From the backup process, Oracle automatically saves the control file to FRA, in addition, the default command rules in FRA are used: starting Control File and SPFILE Autobackup at 21:22:36 piece handle =/home/oracle/app/flash_recovery_area/ORCL/autobackup/2015_06_06/o1_mf_s_881702383_bq5x0wq0 _. bkp comment = NONE Finished Control File and SPFILE Autobackup at 21:22:37 released channel: c1 because the database is started in nomount status, the parameter File is lost, so no parameter File is loaded Oracle won't be able to locate FRA, so Oracle won't look in FRA (tested to put the c-1405321682-20150606-01 in FRA, still cannot be restored ), go to $ ORACLE_HOME/dbs (note 2 ). Manually restore the parameter file to check the default configuration of RMAN and whether the default storage location of the control file is set (note that only the original configuration information of RMAN can be seen in nomount status, see Supplement 1 below. You cannot see the modified configuration information. You must start the database to the mount state.): RMAN> show all;


RMAN configuration parameters for database with db_unique_name ORCL are:
Configure retention policy to redundancy 1; # default
Configure backup optimization off; # default
Configure default device type to disk;
Configure controlfile autobackup on;
Configure controlfile autobackup format for device type disk to '% F'; # default
Configure device type disk parallelism 1 backup type to backupset; # default
....

The default backup directory is used. Why does the backup set be saved to FRA when the automatic backup control file and parameter file are used? It is really strange TO set the backup path manually: RMAN> configure controlfile autobackup format for device type disk to '% F'; RMAN> show all; RMAN configuration parameters for database with db_unique_name ORCL are: configure retention policy to redundancy 1; # default configure backup optimization off; # default configure default device type to disk; configure controlfile autobackup on; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT Device type disk to '% F'; configure device type disk parallelism 1 backup type to backupset; # default ..... Configure controlfile autobackup format for device type disk to '% F'; the default value does not exist, but the value remains unchanged. Execute a backup: RMAN> run

2> {
3> allocate channel c1 device type disk;
4> backup tablespace system format'/storage/database/oracle/backupset/online/backup _ % U. bkp ';
5> backup current controlfile;
6> release channel c1;
7>}
......
Starting Control File and SPFILE Autobackup at 10:24:00
Piece handle =/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/c-1405321682-20150607-01 comment = NONE
Finished Control File and SPFILE Autobackup at 10:24:01

Released channel: c1

Haha, the parameter file and the backup set of the control file are saved under the correct default path. In fact, this operation has not changed anything, but it is good to reset it. This should be an Oracle bug. Simulate the loss of the parameter file again and execute the restoration of the parameter file: RMAN> restore spfile from autobackup;

Starting restore at 13:33:27
Using channel ORA_DISK_1

Channel ORA_DISK_1: AUTOBACKUP found: c-1405321682-20150607-01
Channel ORA_DISK_1: restoring spfile from AUTOBACKUP c-1405321682-20150607-01
Channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 13:33:28

RMAN> shutdown immediate

Oracle instance shut down
RMAN> startup

Method 2: Use the specified backup set to restore [oracle @ localhost ~] $ Set oracle_sid = orcl [oracle @ localhost ~] $ Rman target/RMAN> set DBID = 1405321682 RMAN> startup nomount RMAN> restore spfile from '/home/oracle/app/flash_recovery_area/ORCL/autobackup/2015_06_06/recovery _. bkp '; RMAN> shutdown immediate method 3. Use the temporary parameter file for restoration. If you forget the DBID of the database to be restored, the above two methods will become invalid, you can use the temporary parameter file to restore the spfile, provided that the temporary parameter file is correctly configured. Because the temporary parameter file can specify the FRA location, Oracle will search for the restore spfile from autobackup in FRA. (No practice) [oracle @ localhost ~] $ Set oracle_sid = orcl [oracle @ localhost ~] $ Rman target/RMAN> startup nomount; -- load the temporary parameter file RMAN> restore spfile from autobackup; RMAN> shutdown immediate supplement: 1. default configuration information displayed in nomount status: RMAN> show all;

RMAN configuration parameters for database with db_unique_name DUMMY are:
Configure retention policy to redundancy 1; # default
Configure backup optimization off; # default
Configure default device type to disk; # default
Configure controlfile autobackup off; # default
Configure controlfile autobackup format for device type disk to '% F'; # default
Configure device type disk parallelism 1 backup type to backupset; # default
Configure datafile backup copies for device type disk to 1; # default
Configure archivelog backup copies for device type disk to 1; # default
Configure maxsetsize to unlimited; # default
Configure encryption for database off; # default
Configure encryption algorithm 'aes128 '; # default
Configure compression algorithm 'basic 'as of release 'default' optimize for load true; # DEFAULT
Configure archivelog deletion policy to none; # default 2. Why does Oracle search for control file backup sets under $ ORACLE_HOME/dbs? You're using Flash recovery area and Oracle managed files for backup without RMAN catalog. when you start your instance with startup force nomount, Oracle set instance with minimal parameters and doesn't have a clue about where your flash recovery area is located. oracle is looking for autobackup in "well" known locations (dbs on Unix, database on Windows) for a file that conforms to notation: c-IIIIIIIIII-YYYYMMDD-QQ (this is set with % F parameter ). in your case Oracle doesn't find one because it's not there.

-------------------------------------- Recommended reading --------------------------------------

RMAN: Configure an archive log deletion policy

Basic Oracle tutorial-copying a database through RMAN

Reference for RMAN backup policy formulation

RMAN backup learning notes

Oracle Database Backup encryption RMAN Encryption

-------------------------------------- Split line --------------------------------------

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.