This post explains the steps which are used for RMAN: how to duplicate a database on the same host.

We need to duplicate a database. There are many possibilities to complete this task and I choose to use RMAN and its commands: in particular, I decided (to be honest it was just a poor notebook configuration to address my choice) to duplicate the target database to the same host. Perhaps I could spend my time on other possibilities offered by RMAN such as for example to duplicate the target database on a remote host.

I’m working with Oracle Database 11.2.0.1.0 on 64bit hosted by a CentOS virtualized machine: the target database is DB11G and the duplicated database will be DUP11G.

So this is what I did. First thing I have to do is to get a valid backup of DB11G.
The second thing is that I need to get some information about my machine because I’ve added and removed many virtual disks lately and I don’t remember where are exactly my datafiles… I just remember I have space problems.

Let’s start the instance (SQL is an alias for sqlplus / as sysdba and my ORACLE_SID is already set to DB11G)

I usually don’t run test database in archivelog mode, just let me check. Otherwise, I will set it on archivelog mode.

Let me see how much space I have on FRA.

I don’t have any space to get a valid backup

Let me check what is the size of DB11G datafiles.

Definitely, I have no space to host a duplicated database.
Let me point the FRA of DB11G to /u02.

Let me check if Oracle is able to write on that new FRA location:

Let me proceed with RMAN configuration:

Just before I execute the backup I notice there is only one directory under /u02/FRA11G/DB11G:

Perform a complete full database backup plus archivelog:

And now on file system I’ve backupset:

Now I have to add a new virtualized disk because you can see I have no space to create a duplicate database of a 4G target one.
Have a look to my current disk configuration:

After I’ve added a new virtualized disk of 10G I need to format and mount it.

Disk /dev/sdc doesn’t contain a valid partition table

I then edited /etc/fstab and added the following line:

Ok now I have space to continue. Now it’s time to add two dedicated local listeners (tns is an alias to go on the directory containing listener.ora and tnsnames.ora files):

Add the following information (adding of course DUP11G service) on tnsnames.ora:

Now it’s time to create a init.ora file for DUP11G.

I edited the spooled init file to accomplish my needing (and YES.. I know I don’t have to put on the same mount point all my control files!!

Let’s start DUP11G in nomount mode:

Let’s start the target database:

Now let’s try to execute the duplicate command:

Ok.. I forgot to start the listener with DUP11G information.

And let’s continue with the second attempt to duplicate DB11G to DUP11G (the scripts following the last command I issued “duplicate target database to DUP11G” are run by Oracle itself…. I mean automatically!!!

How many instances are running and are they the same ?

At this point, you can remove from DUP11G database any reference to db_file_name_convert and log_file_name_convert parameters.

Thank you for giving your valuable time to read the above information.

Source

For More Detail , You can join us follow:

LinkedIn Group: Oracle Cloud DBAAS

Facebook Page: OracleHelp

About The Author

Leave a Reply