Create a Duplicate ORACLE Database on Windows

12
Creating a duplicate database using RMAN A practical primer September 2008 Nikos Plevris Principal Service Delivery Manager

description

Create a Duplicate Database on Windows environment

Transcript of Create a Duplicate ORACLE Database on Windows

Page 1: Create a Duplicate ORACLE Database on Windows

Creating a duplicate database using RMANA practical primerSeptember 2008

Nikos PlevrisPrincipal Service Delivery Manager

Page 2: Create a Duplicate ORACLE Database on Windows

<Insert Picture Here>

Agenda

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

Page 3: Create a Duplicate ORACLE Database on Windows

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

Page 4: Create a Duplicate ORACLE Database on Windows

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

Page 5: Create a Duplicate ORACLE Database on Windows

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

Page 6: Create a Duplicate ORACLE Database on Windows

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

Page 7: Create a Duplicate ORACLE Database on Windows

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 DEVpfile=d:\db92\database\initDEV.ora;

}

• Check the availability of temporary datafiles. If not present recreate them as: • CREATE TEMPORARY TABLESPACE TEMP tempfile ‘<temp_filename>;

Page 8: Create a Duplicate ORACLE Database on Windows

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.

Page 9: Create a Duplicate ORACLE Database on Windows

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"

Page 10: Create a Duplicate ORACLE Database on Windows

Accessible drive – Restoring to another machine3

Shared driveShared drive

Mapped Mapped networknetwork drivedrive

RMAN backups database plus archivelog all

RMAN duplicatesdatabasePrimary db: TDB

Duplicate db: DEV

Page 11: Create a Duplicate ORACLE Database on Windows

AQ&

Page 12: Create a Duplicate ORACLE Database on Windows