This forum is currently locked. You can't register or post questions at this time. (read more)

Duplicating a Database with RMAN

All posts relating to Oracle database administration.

Moderator: Tim...

ssadoglu
Senior Member
Posts: 61
Joined: Wed Feb 02, 2011 10:59 am

Duplicating a Database with RMAN

Postby ssadoglu » Thu May 02, 2013 5:33 pm

Hi Tim,

I would like to duplicate to the same server Oracle Database with RMAN. I'm really confused about how to do that. Because in the some articles or books have below instructions. it is not very clear.
is there any missing/incorrect instruction? or Do you have an article about that?

2 - Let's say we have two different server running on RHEL. Here, what kind of method are used for that in the real world implementations? So If we are using SAN storage then what do you recommended?

Code: Select all

$ pwd
/u01/app/oracle/product/oradata
$ mkdir aux1
$ mkdir aux1/arch
$ cd ../admin
$ mkdir aux1
$ cd aux1
$ mkdir pfile bdump udump cdump
$ ls
bdump cdump pfile udump

SQL> connect / as sysdba
Connected.
SQL> create pfile='/u01/app/oracle/product/admin/aux1/pfile/init.ora'
from spfile;

audit_file_dest='/u01/app/oracle/product/admin/aux1/adump'
background_dump_dest='/u01/app/oracle/product/admin/aux1/bdump'
compatible='11.2.0.1.0'
control_files='/u01/app/oracle/product/oradata/aux1/control01.ctl',
'/u01/app/oracle/product/oradata/aux1/control02.ctl',
'/u01/app/oracle/product/oradata/aux1/control03.ctl'
core_dump_dest='/u01/app/oracle/product/admin/aux1/cdump'
db_block_size=8192
db_file_multiblock_read_count=16
db_name='aux1'
db_recovery_file_dest='/u01/app/oracle/product/flash_recovery_area'

db_recovery_file_dest_size=4294967296
dispatchers='(PROTOCOL=TCP) (SERVICE=aux1XDB)'
job_queue_processes=10
open_cursors=300
pga_aggregate_target=93323264
processes=150
remote_login_passwordfile='EXCLUSIVE'
sga_target=279969792
undo_management='AUTO'
undo_tablespace='UNDOTBS1'
user_dump_dest='/u01/app/oracle/product/admin/aux1/udump'
db_file_name_convert=('v112','aux1')
instance_name='aux1'

ORACLE_SID=aux1
export ORACLE_SID
sqlplus /nolog
sql>connect / as sysdba
SQL> startup nomount
pfile=/u01/app/oracle/product/admin/aux1/pfile/init.ora

$ lsnrctl reload

$ ORACLE_SID=aux1;export ORACLE_SID
$ rman target /
RMAN> connect auxiliary sys/ora10g@aux1
RMAN> duplicate target database to aux1
pfile=/u01/app/oracle/product/admin/aux1/pfile/init.ora
logfile
'/u01/app/oracle/product/oradata/aux1/redo01.dbf' size 100m,
'/u01/app/oracle/product/oradata/aux1/redo02.dbf' size 100m,
'/u01/app/oracle/product/oradata/aux1/redo03.dbf' size 100m;




Best Regards,

Tim...
Site Admin
Posts: 18437
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK
Contact:

Re: Duplicating a Database with RMAN

Postby Tim... » Fri May 03, 2013 6:43 am

Hi.

The process is the same, where you are duplicating to a host, using a different file system structure, or whether you are duplicating to the current host. Provided the *_CONVERT parameters are set correctly, the duplication will take place into the new location on the same host, rather than the same location on a different host.

http://www.oracle-base.com/articles/11g ... -11gr2.php

Cheers

Tim...
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog

ssadoglu
Senior Member
Posts: 61
Joined: Wed Feb 02, 2011 10:59 am

Re: Duplicating a Database with RMAN

Postby ssadoglu » Fri May 03, 2013 11:32 am

Hi,

Like you said I've done literally until PFILE creating. But I can't understand that (PFILE create) on the same host. What exactly require I do? So is there any sample PFILE? First do I have to create a PFILE from the SPFILE on the remote host and/or same host? Lastly can you please give me the examples for both status? Please clarify.

2 - do I have to create below folders on the remote host and/or same host?

Code: Select all

$> pwd
/u01/app/oracle/oradata
$> mkdir v112
$> cd ../admin
$> pwd
/u01/app/oracle/admin
$> mkdir v112
$> cd v112
$> mkdir pfile bdump udump cdump adump
$> ls
adump bdump cdump pfile udump


- or Like you said before ( within your articles) , is it enough below folders? BTW , as you know , I've been using FRA.

Code: Select all

$ mkdir -p /u01/app/oracle/oradata/DB11G
$ mkdir -p /u01/app/oracle/fast_recovery_area/DB11G
$ mkdir -p /u01/app/oracle/admin/DB11G/adump



Kind Regards,

Tim...
Site Admin
Posts: 18437
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK
Contact:

Re: Duplicating a Database with RMAN

Postby Tim... » Fri May 03, 2013 2:12 pm

Hi.

I'm a little bit confused by your question because if you are duplicating to the same machine, there is only one host. The one that is running both databases, the original and the duplicate. If you are doing a duplicate from a source DB to a destination DB, bot are on the same server...

With that in mind, all operations are done on the same server. The only difference to is you no *must* use the convert parameters, or you would be trying to duplicate over the top of the existing instance, which wouldn't work.

In the case of a duplicate to the same host, you will need to alter your SID and DB_NAME, so there is no clash with the existing instance.

The link at the bottom of the article points you to the Oracle docs. That chapter and the one that follows are good reading before you start.

Cheers

Tim...
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog

ssadoglu
Senior Member
Posts: 61
Joined: Wed Feb 02, 2011 10:59 am

Re: Duplicating a Database with RMAN

Postby ssadoglu » Fri May 03, 2013 4:28 pm

Hi,

Sorry I was not very clear in my last explanations. My questions are :

1 - How can I create PFILE on the same host? Can you give me an example PFILE file?
For example : there are two different PFILE file below. Which is correct for me? So I'm confused due to different PFILE files.

a )

Code: Select all

db_name = test1
db_block_size = 8192
compatible = 11.1.0.1.0
remote_login_passwordfile = exclusive
control_files = ('/u01/app/oracle/test1/control01.ctl',
'/u01/app/oracle/test1/control02.ctl')
db_file_name_convert = ('/u01/app/oracle/oradata/prod1',
'/u05/app/oracle/oradata/test1')
log_file_name_convert = ('/u01/app/oracle/oradata/prod1',
'/u05/app/oracle/oradata/test1')


b)

Code: Select all

audit_file_dest='/u01/app/oracle/product/admin/aux1/adump'
background_dump_dest='/u01/app/oracle/product/admin/aux1/bdump'
compatible='11.2.0.1.0'
control_files='/u01/app/oracle/product/oradata/aux1/control01.ctl',
'/u01/app/oracle/product/oradata/aux1/control02.ctl',
'/u01/app/oracle/product/oradata/aux1/control03.ctl'
core_dump_dest='/u01/app/oracle/product/admin/aux1/cdump'
db_block_size=8192
db_file_multiblock_read_count=16
db_name='aux1'
db_recovery_file_dest='/u01/app/oracle/product/flash_recovery_area'
db_recovery_file_dest_size=4294967296
dispatchers='(PROTOCOL=TCP) (SERVICE=aux1XDB)'
job_queue_processes=10
open_cursors=300
pga_aggregate_target=93323264
processes=150
remote_login_passwordfile='EXCLUSIVE'
sga_target=279969792
undo_management='AUTO'
undo_tablespace='UNDOTBS1'
user_dump_dest='/u01/app/oracle/product/admin/aux1/udump'
db_file_name_convert=('v112','aux1')
instance_name='aux1'


2 - Do I have to create below folders on the same host? Because you have not setup the folder.

Code: Select all

$> pwd
/u01/app/oracle/oradata
$> mkdir v112
$> cd ../admin
$> pwd
/u01/app/oracle/admin
$> mkdir v112
$> cd v112
$> mkdir pfile bdump udump cdump adump
$> ls
adump bdump cdump pfile udump


3- Let's say I'm using a Duplicate Database on a Remote Host with the Same File Structure. How can we create a PFILE for the duplicate database? So Which file need to copy to the duplicate database? Which ?
a) "$ORACLE_HOME/dbs/init.ora"
b) "/u01/app/oracle/admin/DB11G/pfile/init.ora.324201321241
please clarify.

Kind Regards,

Tim...
Site Admin
Posts: 18437
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK
Contact:

Re: Duplicating a Database with RMAN

Postby Tim... » Fri May 03, 2013 7:14 pm

Hi.

1) You should make a copy of the contents of the current databases SPFILE, then amend that, changing the paths accordingly, also the database name and adding the convert parameters. Neither of these look right to me as the first one has hardly any parameters in it and the second does on include the convert parameters, which are needed during the duplicate.

2) My article does create the data, admin and FRA directories. You only need to create directories that are referenced in the PFILE or SPFILE.

3) If this were a remote host I would not copy the SPFILE. As I have done in the article, I would create an almost empty pfile, like:

Code: Select all

# Minimum Requirement.
DB_NAME=DB11G

# Convert file names to allow for different directory structure if necessary.
#DB_FILE_NAME_CONVERT='/u01/app/oracle/oradata/DB11G/','/u01/app/oracle/oradata/NEWSID/'
#LOG_FILE_NAME_CONVERT='/u01/app/oracle/oradata/DB11G/','/u02/app/oracle/oradata/NEWSID/'


I would then duplicate the database using the "SPFILE" option, which duplicates the SPFILE also, so there was no need to do any manual copy.

Since you are doing a duplicate on the same host, I think I would create the SPFILE manually as an amended copy of the SPFILE for the current database, to make sure I don't overwrite something by mistake.

Note 1. I really hope you are doing this on a throwaway system (like a play VM), so you don't damage anything important if you make a mistake. I would certainly not let a novice do this on a real system I cared about!

Note 2. Don't expect me to be able to validate all your precise steps and settings. It is impossible for me to know exactly what you need for your system. I'm happy to guide, but I can;t give you bullet proof instructions. This is all about you using your brain. :)

Cheers

Tim...
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog

ssadoglu
Senior Member
Posts: 61
Joined: Wed Feb 02, 2011 10:59 am

Re: Duplicating a Database with RMAN

Postby ssadoglu » Fri May 03, 2013 9:05 pm

Hi,

'This is all about you using your brain.' very nice :) But I have still some questions.

My database is using SPFILE as shown below.

Code: Select all

SQL> SELECT DECODE(value, NULL, 'PFILE', 'SPFILE') "Init File Type"
       FROM sys.v_$parameter WHERE name = 'spfile

Code: Select all

SPFILE


My questions are:

1 - if my source database uses SPFILE then do I have create a PFILE from the SPFILE? If so , how can I do that?

2 -What do you mean by ' You only need to create directories that are referenced in the PFILE or SPFILE.' ? Which directories need to create?
Production Database : '/u01/app/oracle/oradata/DB11G/
My SPFILE (spfileDB11g.ora) :

Code: Select all

DB11G.__java_pool_size=4194304
DB11G.__large_pool_size=4194304
DB11G.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
DB11G.__pga_aggregate_target=155189248
DB11G.__sga_target=264241152
DB11G.__shared_io_pool_size=0
DB11G.__shared_pool_size=171966464
DB11G.__streams_pool_size=4194304
*.audit_file_dest='/u01/app/oracle/admin/DB11G/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/DB11G/control01.^AC^@^@C"^@^@^C^@^@^@^@^@^@^@^@^@^A^D5&^@^@ctl','/u01/app/oracle/oradata/DB11G/control02.ctl'#Restore Controlfile
*.db_block_size=8192
*.db_domain='localdomain'
*.db_flashback_retention_target=720
*.db_name='DB11G'
*.db_recovery_file_dest='/u01/app/oracle/fra'
*.db_recovery_file_dest_size=3221225472
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=DB11GXDB)'
*.log_archive_dest_1='location=/u01/app/oracle/archive_logs'
*.log_archive_format='db11g%r_%t_%s.arc'
*.memory_target=417333248
*.open_cursors=3^AC^@^@C"^@^@^D^@^@^@^@^@^@^@^@^@^A^DU^F^@^@00
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'


3 - if backup files are ( autobackup and backup set) in a different path on the source host ( not default FRA Path) then how to use duplicate command? BTW , Just flashback logs are in the default location.( /u01/app/oracle/fra/flashback')
Path : /u01/app/oracle/oradata/DB11G/autobackup and /u01/app/oracle/oradata/DB11G/backupset

Thanks for your patient,

Tim...
Site Admin
Posts: 18437
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK
Contact:

Re: Duplicating a Database with RMAN

Postby Tim... » Fri May 03, 2013 9:39 pm

Hi.

1) You keep asking the same questions over and over again. I've told you you need to create one. You know how to do this. You posted an example of the CREATE PFILE statement in your first post in this thread. I don't know what to do here. It seems like nothing I say is making any difference. You seem determined not to understand.

2) What do you think I mean? Look at your pfile. If is full of directory references. The directories you will have in your new pfile will have to be present or the duplicate will fail.

I suggest you read the Oracle documentation a few times before you attempt to carry on. The fact you don't seem to understand what a PFILE or SPFILE contains suggests to me you aren't really ready to consider database duplications. Get confident with the basics before you try to move on.

Cheers

Tim...
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog

ssadoglu
Senior Member
Posts: 61
Joined: Wed Feb 02, 2011 10:59 am

Re: Duplicating a Database with RMAN

Postby ssadoglu » Sun May 05, 2013 7:40 am

Hi,
First off all, thanks for your response. As you mentioned I read Oracle Documentations which are related with Oracle Duplication. But When to applying 'startup nomount' ,I got the following error. BTW I've been using Oracle Database 11GR2 (with latest patch set update) running on RHEL(VirtualBox) and 1GB RAM installed.

Code: Select all

ORA-00845: MEMORY_TARGET not supported on this system


Code: Select all

[oracle@oracle ~]$ df -k /dev/shm
Filesystem           1K-blocks      Used Available Use% Mounted on
tmpfs                   510268    252916    257352  50% /dev/shm

[oracle@oracle ~]$ free
             total       used       free     shared    buffers     cached
Mem:       1020540     905796     114744          0       2316     267656
-/+ buffers/cache:     635824     384716
Swap:      2064376     481920    1582456

[oracle@oracle ~]$ cd $ORACLE_HOME/dbs
[oracle@oracle dbs]$ grep -i memory initCLONE.ora
*.memory_target=417333248
[oracle@oracle dbs]$


Kind regards,

Tim...
Site Admin
Posts: 18437
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK
Contact:

Re: Duplicating a Database with RMAN

Postby Tim... » Sun May 05, 2013 7:51 am

Hi.

So it looks like there is not enough shared memory file system available to use automatic memory management. You are probably using all of it with the first instance, so there is nothing left for the second instance. Your options are:

1) Make the shared memory file system bigger, assuming there is enough memory to do so.
2) Reduce the amount of memory used by the first instance to free some for the second instance.

This is explained in the first part of this article.

http://www.oracle-base.com/articles/11g ... -11gr1.php

Remember, the shared memory file system must be in memory, so you can't increase it if the amount of free memory in the server/VM is not big enough.

Cheers

Tim...
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog

ssadoglu
Senior Member
Posts: 61
Joined: Wed Feb 02, 2011 10:59 am

Re: Duplicating a Database with RMAN

Postby ssadoglu » Sun May 05, 2013 3:23 pm

Hi,

I can understand 1st option. But I can't understand 2nd option. Please clarify.
How to reduce the amount of memory used by the first instance to free some for the second instance?

Thanks in advance,

Regards,

Tim...
Site Admin
Posts: 18437
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK
Contact:

Re: Duplicating a Database with RMAN

Postby Tim... » Sun May 05, 2013 3:31 pm

Hi.

Reduce the memory_target on the first instance, so you free up some memory.

It surprises me you don't understand this, but feel experienced enough to start trying duplications. Perhaps you need to take a step back and learn the basics.

Cheers

Tim...
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog

ssadoglu
Senior Member
Posts: 61
Joined: Wed Feb 02, 2011 10:59 am

Re: Duplicating a Database with RMAN

Postby ssadoglu » Sun May 05, 2013 3:41 pm

Hi Tim,

Like you said ,I'm learning from end to start. it is very strange experience for me. :)

Thanks for you all help,

Tim...
Site Admin
Posts: 18437
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK
Contact:

Re: Duplicating a Database with RMAN

Postby Tim... » Sun May 05, 2013 5:27 pm

Hi.

It's good that you are trying to learn and I don't mean to discourage you, but I think it makes sense to learn the basics of oracle databases first, then as you move on you will be able to answer many of the questions for yourself. Basic information about memory management and parameter files is far more important than database cloning.

I suggest you buy the OCP certification kit and work your way through it. Even if you don't bother taking the exams, it will give you a good introduction to oracle.

Cheers

Tim...
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog

ssadoglu
Senior Member
Posts: 61
Joined: Wed Feb 02, 2011 10:59 am

Re: Duplicating a Database with RMAN

Postby ssadoglu » Sun May 05, 2013 6:09 pm

Thanks for your suggestions.

Regards,


Return to “Oracle Database Administration”

Who is online

Users browsing this forum: No registered users and 8 guests

cron