Вы находитесь на странице: 1из 12

Creating a duplicate database using RMAN

A practical primer
September 2008

Nikos Plevris
Principal Service Delivery Manager
Agenda

• Database Duplication Overview <Insert Picture Here>

• Request for a Duplicate database


• Database duplication Tasks – The theory
• The practical steps
• Accessible drive – Restoring to another machine
• Summary
• Q&A
Database Duplication Overview

• To prepare for database duplication, you must first


create an auxiliary instance
• connect RMAN to both the target (primary) database
and an auxiliary instance started in NOMOUNT mode
• at least one auxiliary channel allocated on the
auxiliary instance through which RMAN:
• starts a server session on the duplicate host
• restores the necessary backups of the primary database
• uses them to create the duplicate database
• initiates recovery
Request for a Duplicate database

• Refresh the database tier of the Development


environment
• Apps and/or Concurrent tiers might need to be copied to
Development environment if any change
• Use target database backups while still retaining the
original target database
• Streamlined procedure based on RMAN tool
Database duplication Tasks – The
theory
• Task 1: Create an Oracle Password File for the Auxiliary
Instance
• Task 2: Ensure Oracle Net Connectivity to the Auxiliary Instance
• Task 3: Create an Initialization Parameter File for the Auxiliary
Instance
• Task 4: Start the Auxiliary Instance
• Task 5: Mount or Open the Target Database
• Task 6: Make Sure You Have the Necessary Backups and
Archived Redo Logs
• Task 7: Allocate Auxiliary Channels if Automatic Channels Are
Not Configured
The practical steps1

• Backup the target database to an accessible drive(*):


• RMAN>backup database format <dbf> PLUS ARCHIVELOG ALL format <arc>
• Set the environment to the duplicate db on a DOS prompt
• set ORACLE_SID=DEV; set ORACLE_HOME=<oracle_home>, set PATH=
%ORACLE_HOME%\bin;%PATH
• Edit and review %ORACLE_HOME%\database\initDEV.ora, special
considerations: Include the following parameters:
• DB_FILE_NAME_CONVERT= (Transforms target file names)
• LOG_FILE_NAME_CONVERT= (Transforms target redo names)
• Create service OracleDEV (if not present):
• Oradim –new –sid DEV –pfile %ORACLE_HOME%\database\initDEV.ora –
intpwd <sys pwd>
• Create password file:
• Orapwd file=pwdDEV.ora password=<sys pwd>
• Start service OracleDEV:
• Oradim –startup –sid DEV –pfile %ORACLE_HOME%\database\initDEV.ora
–starttype srvc
The practical steps2

• Startup auxiliary instance nomount


• RMAN>connect target /@<TNS> auxiliary /
• RMAN>run {
allocate auxiliary channel aux1 device type disk;
allocate auxiliary channel aux2 device type disk;
allocate auxiliary channel aux3 device type disk;
set newname for datafile <dbf> to <new_dbf>;
..
duplicate target database to DEV
pfile=d:\db92\database\initDEV.ora;
}
• Check the availability of temporary datafiles. If not present recreate
them as:
• CREATE TEMPORARY TABLESPACE TEMP tempfile
‘<temp_filename>;
Accessible drive – Restoring to
another machine1
• Environment configuration:
• MS Win Server A (where source database runs)
• MS Win Server B (where duplicate database will run)
• On the A machine create a shared drive:
• granting the user 'Administrator' FULL Control.
• use the Domain Administrator account to ensure that
passwords are the same across the various machines
• On the B machine map a network drive to the shared
drive on the A machine :
• When mapping this drive, use the Administrator
• verify the Administrator user has the same password of the
user that shared the drive on the A machine.
Accessible drive – Restoring to
another machine2
• On the B machine both the OracleTNSListener
Service and the OracleService<SID> services must
be configured to start using the Administrator account
(Oracle uses the Local System account by default.)
• Go to the Control Panel and then open up the Services panel.
• Double click on the appropriate service (TNSListener or
OracleService<SID>)
• Change the "Log on as" user from the "Local System
Account" to "This Account".
• Specify the service to log on as the Administrator user.
• Click on "OK"
Accessible drive – Restoring to
another machine3

RMAN duplicates
Primary db: TDB database

Shared drive Duplicate db: DEV


Mapped
network
drive

RMAN backups database


plus archivelog all
Q&
A

Вам также может понравиться