使用旧版本RMAN备份要求目标与源数据库be a supported upgrade path
You can restore backups that were created using older versions of RMAN, up to Oracle Database 9i Release 2 (9.2.0.8). There must be a supported upgrade path between the Oracle Database version on which the backups were created and the Oracle software version on which you want to run the restored database.
In this example, the source database is an Oracle Database 11g Release 2 database and it is configured to use a server parameter file (spfile). The database runs in ARCHIVELOG mode and uses a fast recovery area. Control file autobackups are also configured. You then create RMAN backups of the source database, including the archived redo logs.
The destination host on which these backups are restored has Oracle Database 12c Release 1 installed.
To restore RMAN backups that were created using an RMAN version that is older than the current target database version:
- Verify that there is a supported upgrade path from the database version on which the backups were created to the Oracle server version on which you plan to restore the database.
For example, if your RMAN backups were created on Oracle Database 11g Release 2 (11.2.0.3) and you want to run the restored database on Oracle Database 12c Release 1 (12.1), then you must verify that there is a supported upgrade path from release 11.2.0.3 to release 12.1.
- Ensure that the source database backups are available at the destination host on which they must be restored.
You can either use an operating system utility to copy the backups to the destination host or store the backups in a shared location that is accessible to the destination host.
- Shut down the destination database.
- On the destination host, set the ORACLE_SID to the same value that was used on the source database.
$ setenv ORACLE_SID db112
- Start RMAN on the destination host and connect to the target database using operating system authentication and without a recovery catalog.
$ rman target / NOCATALOG
- Set the DBID to the same value as the source database.
RMAN> set DBID 699892390;
- Start the target database in nomount mode.
RMAN> startup nomount;
RMAN fails to find the server parameter file, which has not yet been restored. However, the instance is started with a “dummy” file
- Restore the server parameter file from the source database autobackup.
run {
set controlfile autobackup format for device type disk to '/scratch/fra/cf/%F.bck';
restore spfile to pfile '/dev3/oracle/network/init_db112.ora' from autobackup recovery area '/scratch /fra/cf' db_name 'DB112';
shutdown abort; }
- Edit the restored initialization parameter file and modify the required initialization parameters.
主要是配置相同compatible参数、deprecated参数以及一些路径相关参数
This includes the COMPATIBLE parameter, if the compatibility requirement for the target database is different from that set in the source database, and parameters that are deprecated in the target database release. Also update any location-specific parameters such as those ending with _DEST to reflect the new directory structure.
- Restart the instance with the edited initialization parameter file.
RMAN> startup force nomount pfile='/dev3/oracle/network/init_db112.ora';
- Restore the control file from an autobackup and then mount the database.
run {
set controlfile autobackup format for device type disk to '/scratch/fra/cf/%F.bck';
restore controlfile from autobackup recovery area '/scratch/fra/cf' db_name 'DB112';
alter database mount; }
- Catalog data file copies of the source database that were made available to the destination host.
RMAN> catalog start with '/scratch/fra/DB112/backupset';
- Restore and recover the source database.
run
{
set newname for database to '/ade/b/1885631999/oracle/dbs/%U.f';
alter database rename file '/dev1/oracle/dbs/redo01.log' to '/dev3/oracle/dbs/redo1.log';
alter database rename file '/dev1/oracle/dbs/redo02.log' to '/dev3/oracle/dbs/redo2.log';
set until scn 1092435;
restore database;
switch datafile all;
recover database;
}
- Open the restored database with the RESETLOGS and UPGRADE options.
RMAN> alter database open resetlogs upgrade;
Statement processed
RMAN-06900: WARNING: unable to generate V$RMAN_STATUS or V$RMAN_OUTPUT row
RMAN-06901: WARNING: disabling update of the V$RMAN_STATUS and V$RMAN_OUTPUT rows
ORACLE error from target database:
ORA-04023: Object SYS.STANDARD could not be validated or authorized
The error is caused by database packages that need to be revalidated as part of the upgrade process.
- Exit RMAN.
- Upgrade the target database to the desired Oracle release by performing the steps required to upgrade a database.