Learn All related Oracle DB and Oracle EBS APPS DBA than Cloud technology real time issue and fixing problem. Its very easy way to understand and step-by-step explained with practical.
Thursday, 20 February 2014
Wednesday, 19 February 2014
Easy Clone / Duplicate Oracle 10G database DBCA AND using OEM
Today I had a task to clone or duplicate a
Oracle 10g database. Being a novice, I took to google and looked for
answers. After some research came with a few ways:
- Using EM :: Maintenance ::
Deployments :: Clone Database option : The problem with it is
its needs "An open database in ARCHIVELOG mode" which
I dont have. Hence it requires a restart as mentioned in here.
Hence I left this option here itself.
- Duplicate database using RMAN : A nice article about it
is available in here.
I tried it and then spend another 2-3 hours to connect to the newly
created database. Thereafter I left this method to.
- The command line way : Its all using sqlplus and
is pretty technical. Details are available here.
It works but looked for an easy alternative.
- The DBCA way
: This I found to be the easiest and the
fastest option but sadly it not available in the top results of google.
Looks like its one of the least used way to duplicate an Oracle DB but its
the best one. To promote it I write this post.
Here's
how its done:
part-I
- Start the
Database Configuration Assistant (DBCA). Found at All Programs :: Oracle - OracleDb10g_home1
:: Configuration and Migration Tools :: Database Configuration Assistant.
The same can be invoked by typing in "dbca" at the command
prompt.
- On the
"Welcome" screen click the "Next" button.
- On the
"Operations" screen select the "Manage Templates"
option and click the "Next" button.
- On the
"Template Management" screen select the "Create a database
template" option and select the "From and existing database
(structure as well as data)" sub-option then click the
"Next" button.
- On the
"Source database" screen select the relevant database instance
and click the "Next" button.
- On the
"Template properties" screen enter a suitable name and
description for the template, confirm the location for the template files
and click the "Next" button.
- On the
"Location of database related files" screen choose either to
maintain the file locations or to convert to OFA structure
(recommended) and click the "Finish" button.
- On the
"Confirmation" screen click the "OK" button.
- Wait while
the Database Configuration Assistant progress screen gathers information
about the source database, backs up the database and creates the template.
now we have to using dbca create new database there we are going to
give creating templete:
- Depending upon the size of the
database it will take some time. For my 8 Gig database, it took like 8 mins.
Now we have a template created and we will use to create our new database.
- Click on "Next
Operation".
- Select "Create a
Database" option and click "Next".
- In "Select a template from
the following list to create a database" - select the template name
which you provided in Step 6 and click "Next".
- Provide the new Service Name
for the new database. The SID will automatically be set to the service
name entered above. Click "Next".
- Let the "Configure the
Database with Enterprise Manager" remain checked and "Use
Database Control for Database Management" remain checked. Click
"Next".
- Provide the sys password
and click "Next".
- Let the "File System"
option remain checked unless you want to use ASM or raw for your
new database.
- Let the "Use Database File
Locations from Template remain checked. This is important. Click
"Next".
- Let the default values for
Flash Recover Area remain as they are and click "Next".
- Let the "No Scripts to
run" remain checked an click "Next".
- You can keep the default values
for Memory and Sizing over here or change it as per your need and Click
"Next".
- You are now at the final screen
wherein you can all your configurations and verify that they are correct.
Clicking next, DBCA will do all your job and your DB should be
up and running in next 15-20 mins.
- Finally before logging in to
the new DB using EM, check the tnsnames.ora and see an entry is
created for the new database else add one. You can add a new listenere too
in you listener.ora if you want and the do a "lsnrctl reload"
to reload the listeners.
- Finally do a tnsping on
your new database to check all's fine.
- Log in using EM and you should
have you DB ready in Open mode.
- Note all user accounts besides
the system account are locked and expired so you need to unlock them to
allow users to connect to the new DB.
The
whole process took some 30-35 mins and it was all Gui and no scripts
or errors. Seem to be the best way out to duplicate an Oracle 10g database :)
differnt using DBCA & OEM:
When we using dbca via cloning it will create all OEM and network it will start all lsnrctl and tnsping all so its good way create cloning
when using cloning OEM via its not create oem automatically and all services we have to start maunally
=============================================================================
RMAN Cloning with OEM
RMAN Cloning Database Using
Enterprise Manager
It is possible to
clone the database directly from Oracle Enterprise Manager (OEM). By using the
OEM cloning feature, this makes it possible to clone the database with some
simple mouse clicks without running any RMAN script. Take a backup of the
database to the same host using Enterprise Manager.
Open OEM and switch
to the Maintenance tab and in the Data Movement section, select the Clone
Database link:
Figure 5.1:
Selection in the Maintenance Tab
As a source type,
select A running database instance and click Continue:
Figure 5.2:
Choice in Clone Database for Source Type
In this step,
provide the location for the working directory. The backup of the database will
be stored in this directory. If the working directory needs to be deleted after
the clone operation, select the first option. Below that, enter the username
and password of the user who owns the Oracle software and click Next.
Figure 5.3:
Clone Database: Source Working Directory Screen
In next screen,
enter the name of the new clone database and click Next:
Figure 5.4:
Clone Database: Select Destination Screen
Now provide the
destination for the database files of the clone database. If a different
directory needs to be given, then click the Customize button. Next,
select the network configuration file location and provide passwords for
specific users.
Figure 5.5:
Clone Database: Destination Options Screen
By clicking the
Customize button, a different directory for every file of the database will be
able to be provided as follows:
Figure 5.6:
Customize Destination Options Screen
Here, Oracle
schedules a job to clone the database. This job can be run immediately or be
made to run anytime that is desired. Just click Next to make it run
immediately.
Figure 5.7:
Clone Database: Schedule
This is the last
page of configuring the clone of the database. Just click the Submit Job button
and the clone processwill begin:
Figure 5.8:
Reviewing the Clone Database Process
Here, a message that
cloning has been started will appear:
Figure 5.9:
Clone Database Confirmation Message
The status of the
clone operation can be viewed by clicking on the View Status button:
Figure 5.10:
Viewing the Status of the Clone Operation
Click on the name of
the job to get more information about the job:
Figure 5.11:
Job Information Screen
Click on the status
of the job:
Figure 5.12:
Summary Status of the Job
As can be seen, the
clone operation has started and this shows that the steps that were performed
were successful. Now press F5 to refresh the pages and see that the steps are
performing automatically. At last, the final summary will appear and the cloning
process ends.
Figure 5.13:
Final Summary of the Clone Process
Now connect to the
db2 database and check the status of the instance to be sure that it was cloned
successfully.
$ export ORACLE_SID=db2
$ sqlplus "/ as sysdba"
sys@DB2>
select
status
from
v$instance;
status
------------
OPEN
$ sqlplus "/ as sysdba"
sys@DB2>
select
status
from
v$instance;
status
------------
OPEN
It can now be seen
that the production database was successfully cloned.
Pre & Post
Cloning Changes
·
To avoid the confusion
between the production and test/development databases, do not set the clone
database name as a production database name.
·
It is not mandatory to have
the initialization parameter's value of the cloned instancesimilar to the
production instance. Of course, the source, i.e. the production database,
must be in archivelog mode for the duration of the cloning.
·
It is not compulsory to
have the cloned instance in archivelog mode because unnecessary archivelog
files are generated which consume hard disk space.
·
If the cloned instance
crashes and needs to be recovered, it can easily be cloned again from the production
database.
·
After the clone, change the
system users' passwords, i.e. SYS and SYSTEM, and any critical and application
users' passwords.
·
Disable the jobs which are
not required to be run in the cloned instance.
·
Change any application
users' tables from the cloned database that are still referring the production
database, i.e. server IP, port details, printer details and such.
Post cloning:
Here i m facing not tnsname and listener than oem started so i have create manually.
>tnsping orcl1
Subscribe to:
Posts (Atom)