Duplicating a Database on ODA

pete.sharman's picture

Introduction

Every so often, we get a request to duplicate a database for one of our customers using an Oracle Database Appliance (ODA). The process for doing that is relatively straightforward, but there are a couple of nuances along the way so I thought I’d write it up as a blog post in case it’s of use to others. Obviously, I have obfuscated any customer-specific information to protect their identity.

Configuration

The first nuance is to understand what database is being used as the source for the clone. Generally, a request for cloning will be something like this:

“We are creating a new environment which needs a new database to be set up. Please copy P1_SRV_T and restore as P1_SRV_F”.

The important thing to understand here is what the customer is providing is what they know – how they connect to the database. These are service names, not database names, so you need to be able to translate that into the relevant entities needed for cloning.

To do this, we have created two scripts in this environment that are invaluable – dbstatus (database status) and sstatus (service status) – as you can guess by the output below these are wrappers to various srvctl commands. Running dbstatus will show the following (output restricted to the part we require for brevity):

[oracle@oda1 ~]$ dbstatus
…
DB unique name: P1SRVT
Instance ABCSRVT is running on node oda2
…

Likewise, running sstatus returns:

[oracle@oda1 ~]$ sstatus
…
DB unique name: P1SRVT
Service P1_SRV_T is running on instance(s) ABCSRVT
…

From this information, you can see that the P1_SRV_T service referred to as the source for the first database to be cloned is running on oda2, with the instance name ABCSRVT. By logging onto that machine, we can also determine the database name:

[oracle@oda2 ~]$ . oraenv
ORACLE_SID = [oracle] ? ABCSRVT
The Oracle base has been set to /u01/app/oracle
[oracle@oda2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Feb 21 13:30:04 2018

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Advanced Analytics
and Real Application Testing options

SQL> SELECT name FROM v$database;

NAME
---------
ABCSRVT

So, to summarize, we now have:

Source DB name – ABCSRVT
Source DB Unique Name – P1SRVT
Source Service Names – P1_SRV_T
Source Server – oda2
Source SID – ABCSRVT

From that information, and the original request, we can surmise the target information to be:

Target DB name – ABCSRVF
Target DB Unique Name – P1SRVF
Target Service Name – P1_SRV_F
Target Server – oda2
Target SID – ABCSRVF

Finally, we know that in this environment, the backups are stored under /backup/[DATABASE_NAME], so for this exercise, the backup we use to duplicate the database is stored under /backup/ABCSRVT.

That is all the information we need to proceed with the cloning request.

Creating the Target Database

To create the target, we will be using the oakcli command. This provides the added benefit of creating the various dump directories etc. To use oakcli, you need to be logged on to node 1 of the ODA as the root user:

[root@oda1 ~]# oakcli create database -db ABCSRVF -oh OraDb12102_home3 -params srv
INFO: 2018-02-20 15:05:45: Please check the logfile  '/opt/oracle/oak/log/oda1/tools/12.1.2.10.0/createdb_ABCSRVF_26838.log’ for more details

Note in this command that the ORACLE_HOME has already been created, and we are passing a parameter file srv. srv actually maps to a file called srv.conf located under /opt/oracle/oak/install/dbconf. In this case, the file contains settings for parameters such as the database block size, language, character set and so forth. You can find more information on what can be included in this file in the Oracle documentation. Next, you will be prompted for the SYSASM password. In our scenario, we use the highly secured password “welcome1”. </p />
</p></div>
    <div class=»

To prevent automated spam submissions leave this field empty.