• No results found

Cloning Oracle Database

N/A
N/A
Protected

Academic year: 2021

Share "Cloning Oracle Database"

Copied!
8
0
0

Loading.... (view fulltext now)

Full text

(1)
(2)

Cloning an Oracle Database

 

       

 

...

 

 

 1  

Table of Contents

...

2

1. Purpose of the document

...

3

2. Document Usage

...

3

3. Overview of the Procedure

...

3

3.1 Introduction

...

3

3.2 Environments

...

4

3.3 Assumption

...

4

3.4 Cloning Process

...

4

3.4.1 Steps to be followed in Primary database:

...

4

3.4.2 Steps to be followed in the Secondary database server:

...

5

(3)

1. Purpose of the document

This document illustrates a process to clone an Oracle database using hot backup. The following sections are covered in this document

Overview Environments Assumptions Cloning process

2. Document Usage

This document can be useful for any Oracle DBA for cloning an Oracle database. Generally cloning databases with the help of source database hot backup is a standard process to effectively and efficiently create a replica of the source database. The process illustrated in this document can be used by any DBA who wants to create a replica of an Oracle database with the help of hot backup and the associated archive logs.

3. Overview of the Procedure

3.1 Introduction

Cloning database is one of the routine DBA activities. Any DBA who administers various environments and is supporting the application development team for database activities has to periodically synchronize the acceptance/testing/development with the Production data.

This frequency of synchronization depends upon the business and application development teams requirements. Generally this process can be done with the below mentioned procedures

1) EXPORT/IMPORT utilities 2) DATA PUMP

3) Cold Backup Restoration 4) Hot Backup Recovery

(4)

3.2 Environments

1. Primary or the Source database system 2. Secondary or the Target database system

3.3 Assumption

Primary database operated in ARCHIVELOG mode.

Secondary database to be created by cloning in a different server Primary and Secondary environment Operating system are same.

3.4 Cloning Process

3.4.1 Steps to be followed in Primary database:

1)

Perform HOTBACKUP of all the data files 2) LSN number

Login as sys as sysdba

Sql> Alter system archive log current; Sql> Archive log list

Note down the Current Log Sequence 3) Control file trace

In Sql> prompt issue the statement

ALTER DATABASE BACKUP CONTROLFILE TO TRACE;

(5)

3.4.2 Steps to be followed in the Secondary database server:

1) If the secondary database is to be created in a different server

FTP the following to a temporary location in the secondary database server.

a)

hot backup of all the primary database data files

b)

all the archive log files generated in the primary database after you start hot backup c) control file trace of primary database

d) pfile of the primary database

2)

Edit the pfile as it would be for secondary database server locations

a)

Control_files- new locations

b)

instance_name – new name

c)

background_dump_dest – new location

d)

core_dump_dest- new location

e)

user_dump_dest – new location

f)

log_archive_dest- new location

Save the pfile as init_<SID>.ora in $ORACLE_HOME/dbs directory if UNIX $ORACLE_HOME\database if WINDOWS

Where SID is the instance name given above in the edited pfile

3)

In the control file trace Use the “SET #2. RESTLOGS case” CREATE CONTROLFILE section (Since we don’t use the primary database redolog files, we use this option). In that section Copy from “CREATE CONTROLFILE” to “CHARACTER SET <value>” to another file. Save the file as cr_control.sql

Edit the following section in cr_control.sql a) Use SET instead of REUSE

Old: CREATE CONTROLFILE REUSE DATABASE <"PRIMARY_DBNAME" >RESETLOGS

(6)

4)

Move the ftp ed Hot backup DATAFILE from temporary location of specific location as specified in the control file cr_control.sql

5)

Move the archived logs from temporary location to the location specified in log_archive_dest in pfile

6)

If Windows,

Create an oracle service using ORADIM utility

ORADIM -NEW -SID sid | -SRVC service [-INTPWD password] [-MAXUSERS number] [-STARTMODE a|m] [-PFILE file] [-TIMEOUT secs]

In the CMD prompt

SET ORACLE_SID=<NEW_SID> Sqlplus “/ as sysdba”

You will get a Connected to an idle instance message.

7)

If UNIX,

In the $ prompt give

EXPORT ORACLE_SID=<new_sid> Sqlplus “/ as sysdba”

You will get a Connected to an idle instance message.

8) In the SQL> Prompt give

STARTUP NOMOUNT

9) Run the cr_control.sql file in the SQL> prompt If Windows

@<path>/cr_control.sql If Unix

(7)

You should get a message like Control File created

9)

Recover the database using backup control file. In the SQL> prompt give

RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL;

Note: this can also be done with UNTIL TIME or UNTIL SCN provided you know the time or the SCN until which you want to perform the recovery

10)

The recovery process will keep prompting for archive logs. Give return for each prompt of archive log.

Since the required archive logs from Primary database are restored in archive_log_dest of secondary, it will get applied for every return you give in the prompt.

Once the recovery process prompts for the archive log with the LSN number noted in the Primary database, in step 2) of Steps to be done in Primary database section

Give CANCEL in the recovery sql prompt 11) Now you must get a message like

Media recovery cancelled.

12) Now in the SQL prompt give.

ALTER DATABASE OPEN RESETLOGS;

You should get a message like.

Database opened.

12) Bounce the database

SHUTDOWN IMMEDIATE; STARTUP;

13) Check for errors in bdump. 14) Check log switch.

(8)

5. Conclusion

Hot backup recovery is one of the best methods to clone database because there is no outage or down time required in the primary database and data is replicated in secondary database to the most recent time period.

References

Related documents

Therefore a focus group enable us to answer the research questions regarding potential reverse mortgage borrowers’ perceptions and fulfill the purpose of getting

Results analyzed via structural equation modeling suggest that automatic, but not controlled processing, during a modified flanker task, including a context-specific

The NDSS network design adopts Application Data Unit (ADU) to reduce the overheads in data transmission. Compared with overlay network, the NDSS design is named as underlay network.

Get off at “SAN NICOLA” stop, cross the CORSO FIRENZE road and take the left, following CORSO FIRENZE for 400 metres until the entrance of the public park of

To bal- ance this, it is true that most skills users will not be dealing with those who have profound psychological issues and, with good training, a counselling skills approach can

Guided tissue regeneration in intrabony periodontal defects following treatment with two bioabsorbable membranes in combination with bovine bone mineral graft. The

The engagement will include reviewing your unique candidate Oracle Database requirements, defining a target configuration to support the databases, provisioning of the Oracle

A closed database (cold) backup is an operating system backup of all data files, control files, redo log files, parameter files, and the password file that constitute an