Oracle 10g Database Backup Restore Test
Oracle 10g Database Backup Restore Test
Oracle 10g database restore/recovery - Test your tape backup - Part 1: Different dbid
Step-by-step instructions on how to using RMAN DUPLICATE to restore/duplicate a database
To test my backup and recovery procedures, I restore the Production database backup into the testing database
once a year, and conduct tests against the new database through the testing application. Since the DBID is
different, I can’t use RESTORE and RECOVER commands. RMAN DUPLICATE is used for restore/recovery instead.
Here I list steps instructions on how to using RMAN DUPLICATE to restore/duplicate a database on Windows and
UNIX servers, either on a new machine or local machine.
1) Make sure the operating system on the target and duplicate systems are the same.
2) Make sure the same Oracle software release is used on the target and duplicate databases.
3) Make sure you have the necessary backups of the target database. Ensure sure the backups, and the
archived redo logs if needed, are accessible from the duplicate site.
4) Exam your RMAN configuration. Login to target database as a user with sysdba privileges.
If you want to restore/duplicate the database to a new server, install Oracle Database software without the
starter database, and then patch it if needed.
3 Copy the appropriate tape backup files to Target database backup location using your tape management tool.
- On Windows:
$cd %ORACLE_HOME%\database
$orapwd file=pwdDUPL.ora password=xxxxxxxx force=y
(Note: Replace xxxxxxxxx with your actual password for the SYS user.)
- On UNIX:
$cd $ORACLE_HOME/dbs
$Orapwd file=pwdDUPL.ora password=xxxxxxxx force=y
(Note: Replace xxxxxxxxx with your actual password for the SYS user.)
5 Update tnsnames.ora and listener.ora of the Target database to add the duplicate database entries.
- On Windows:
SQL>create pfile=’<Oracle_home>\database\pfileDUPL.ora’ from spfile;
(Note- specify your Oracle home path to replace ‘<Oracle_home>’).
- On UNIX:
SQL>create pfile=’<Oracle_home>/dbs/pfileDUPL.ora’ from spfile;
(Note- specify your Oracle home path to replace ‘<Oracle_home>’).
db_name='DUPL'
control_files='E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPL\CONTROLFILE\CONTROL01.CTL', 'F:\ORACLE\
FLASH_RECOVERY_AREA\DEVL\CONTROLFILE\CONTROL02.CTL'
# Specify the location of the target DB datafiles followed by the duplicate location
db_file_name_convert='E:\oracle\product\10.2.0\oradata\TARG\DATAFILE', 'E:\oracle\Product\10.2.0\oradata\
DUPL\DATAFILE'
# Specify the location of the target DB online redo log files followed by the duplicate location
log_file_name_convert='E:\oracle\product\10.2.0\oradata\TARG\ONLINELOG', 'E:\oracle\product\10.2.0\oradata\
DUPL\ONLINELOG', 'F:\oracle\flash_recovery_area\TARG\ONLINELOG','F:\oracle\flash_recovery_area\DUPL\
ONLINELOG'
Modify some other parameters for DUPL such as adump, bdump, cdump, udump, and dpdump.
9 Create data directories where you want to store new data files.
Create directories for controlfile, datafile and onlinelog.
Now go to control panel>administrative tools, open services and see whether oracle services for DUPL is
running.
Change the Oracle DB Server account from local system to a user with administrative account. After the change
stop and start Oracle DB Services.
- On Windows:
SQL>shutdown immediate
SQL>startup nomount pfile=’<Oracle_home>\database\initDUPL.ora’;
SQL> create spfile from pfile=’<Oracle_home>\database\initDUPL.ora';
-- Restart the duplicate instance using the newly created SPFILE.
SQL>shutdown immediate;
SQL>startup mount;
- On UNIX:
SQL>shutdown immediate
SQL>startup nomount pfile=’<Oracle_home>/dbs/initDUPL.ora’;
SQL> create spfile from pfile=’<Oracle_home>/dbs/initDUPL.ora';
-- Restart the duplicate instance using the newly created SPFILE.
SQL>shutdown immediate;
SQL>startup mount;
12 Mount or open the target database TARG if it is not already mount or open.
13 Ensure you have the necessary backups and archived redo logs.
$rman target <user>/<password>@TARG
Rman>list backup summary
Rman>exit
RMAN>run {
allocate auxiliary channel ch1 type disk;
duplicate target database to DUPL;
}
- On UNIX
$cd $ORACLE_HOME/bin
$emca –config dbcontrol db
Enter SID, password for users sys, sysman, dbsnmp when prompted.
16 Modify settings in Application and the DUPL database to reflect the changes if necessary.
17 Test the duplicate database through Oracle tools and through the front-end application.
Reference:
Oracle® Database Backup and Recovery Advanced User’s Guide,
10g Release 2 (10.2), B14191-02
error is :
ORA-00202: control file: 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\DUPL\CONTROL01.CTL'
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) The system cannot find the file specified.
i guess this error is normal, because we have not created a control file for new DUPL db, am i right pls post me ba
trying your steps.
Ferhat Ozturk
Aug 10, 2008
i guess i solved the problem, before we use rman duplicate command, dupl db must be in nomount status, not mo
because rman will create control files from backup.
1) Make sure the operating system on the source and new servers are the same;
2) Make sure the same Oracle software release is used on the source and restored
databases.
3) Record the DBID for the source database. Get DBID. In order to start the oracle db
restore you need to know Oracle Database ID to start with. You can get DBID from the
control file backup, or by connecting to RMAN.
$rman
Recovery Manager: Release 10.2.0.3.0 - Production on Thu Jan 31 15:41:00 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
RMAN> connect target <user>/<password>@TARG
connected to target database: TARG (DBID=123456789)
4) Make sure you have the necessary backups of the source database. You will need data
file backup, Control file & SPFILE autobackup, and backups of archived log required to
recover the datafiles.
2 If Oracle Database software is not installed on the new host, install it without the starter
database.
Note down Oracle Home Directory. Install required patches if necessary.
3 Set ORACLE_HOME and ORACLE_SID on the new host to the same value on source host.
You can either locally do it every time by set commands or set it under environment
variable.
4 Copy Control file & SPFILE autobackup, database backup files and archive logs backup
files to locations from where you are restoring.
6 Copy tnsnames.ora to new host. Edit it with right server name and other information.
On Windows, copy it to %ORACLE_HOME%\network\admin.
7 Create data directories on the new host where you want to store new data files.
Create directories for controlfile, datafile and onlinelog on the new host.
Now go to control panel>administrative tools, open services and see whether oracle
services for TARG is running.
Change the Oracle DB Server account from local system to a user with administrative
account. After the change, stop and start this Oracle DB Services.
10 On the new host, invoke RMAN from command prompt and startup nomount.
$RMAN target / NOCATALOG
RMAN > SET DBID 123456789;
RMAN > Startup nomount
This is fine because the PFILE has not been restored from the auto backup yet. It will be
restored at next step. The instance is started with a dummy file.
11 Restore pfile from the control file and spfile auto backup.
- On Windows
RMAN> restore spfile to pfile \<Oracle_home>\database\initTARG.ora\ from ‘<path and
name of the Control file & SPFILE autobackup file>\;
- On UNIX
RMAN> restore spfile to pfile \<Oracle_home>/dbs/initTARG.ora\ from \<path and name of
the SPFILE and control file auto backup file>\;
channel ORA_DISK_1: autobackup found: <here you will see the path and name of the
SPFILE and control file auto backup file >
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 31-JAN-08
- On UNIX
RMAN> startup force nomount pfile=\<Oracle_home>/dbs/initTARG.ora\;
If the new host has different directory structure from the source host, you have to run ‘SET
NEWNAME’ commands before performing restore and recovery. Refer to the Reference for
details.
16 Login to database using sqlplus as sysdba, and create spfile from pfile.
- On Windows:
SQL>Create spfile from pfile =\<Oracle_home>\database\initTARG.ora\
-- Restart the restored instance using the newly created SPFILE.
SQL>shutdown immediate;
SQL>startup mount;
- On UNIX:
SQL>Create spfile from pfile =\<Oracle_home>/dbs/initTARG.ora\
-- Restart the restored instance using the newly created SPFILE.
SQL>shutdown immediate;
SQL>startup mount;
17 Test the restored database through EM and command line if you want to.
To create DB console for the restored database:
- On Windows
$cd %ORACLE_HOME%\bin
$emca –config dbcontrol db
- On UNIX
$cd $ORACLE_HOME/bin
$emca –config dbcontrol db
Enter SID, password for users sys, sysman and dbsnmp when prompted.
Reference:
Oracle® Database Backup and Recovery Advanced User’s Guide, 10g Release 2 (10.2),
B14191-02