470,872 Members | 1,744 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,872 developers. It's quick & easy.

db2 relocatedb or redirected restore?

Hi there,

Command Reference book stated for db2relocatedb command:
Copy the files/devices belonging to the databases being copied onto the
system where the new instance resides. The path names must be changed
as necessary. However, if there are already databases in the directory
where the database files are moved to, you can mistakenly overwrite the
existing sqldbdir file, thereby removing the references to the existing
databases. In this scenario, the db2relocatedb utility cannot be used.
Instead of db2relocatedb, an alternative is a redirected restore.

But I still cannot understand the difference between db2relocatedb and
redirected restore. For example,

Host: SysA, Instance: Inst1, Database: DB1, DB_PATH: /home/db2inst1
Host: SysB, Instance: Inst1, Database: DB2, DB_PATH: /home/db2inst1

I want to move DB1 from SysA to SysB, and which method should be used?
Any comments?

Dec 8 '06 #1
4 5373
I'd do neither. The simplest is to take a backup and use the RESTORE
command. Use the "INTO new-database-alias" parameter on the restore
command and you will have your database moved.

Lots of good information in the manuals.

Phil Sherman

Laurence wrote:
Hi there,

Command Reference book stated for db2relocatedb command:
Copy the files/devices belonging to the databases being copied onto the
system where the new instance resides. The path names must be changed
as necessary. However, if there are already databases in the directory
where the database files are moved to, you can mistakenly overwrite the
existing sqldbdir file, thereby removing the references to the existing
databases. In this scenario, the db2relocatedb utility cannot be used.
Instead of db2relocatedb, an alternative is a redirected restore.

But I still cannot understand the difference between db2relocatedb and
redirected restore. For example,

Host: SysA, Instance: Inst1, Database: DB1, DB_PATH: /home/db2inst1
Host: SysB, Instance: Inst1, Database: DB2, DB_PATH: /home/db2inst1

I want to move DB1 from SysA to SysB, and which method should be used?
Any comments?
Dec 8 '06 #2
Actually, I'd like to know how to differentiate db2relocatedb and
redirected restore? The objective between two seems the same...
could someone instruct me?

Dec 8 '06 #3
One difference i could see is

1. With RELOCATE DB command if you are moving from one HOST to another
HOST
you will copy all the contents of the DATABASE DIRECTORIES and YOU HAVE
TO COPY
then only your RELOCATE DB command will work or your db2inidb command
will work

For example

Host 1 to Host2

DB_NAME=x,y
DB_PATH=/home/db2inst1,/home/db2inst2
LOG_DIR=/xlog,/ylog
INSTANCE=db2inst1,db2inst2

Will be your relocate.cfg file.....but apart from this you will also
need to tar
the contents of /home/db2inst1/db2inst1/NODE0000 and have to REPLACE
them in
/home/db2inst2/db2inst2/NODE0000.

Then only u can issue db2inidb command

So in the above case all the other database directories in the db2inst2
are gone.
So that is why the command you referred to is telling you to use
RESTORE command in those cases....

With RESTORE ....you don't REPLACE the contents of

/home/db2inst2/db2inst2/NODE0000...you will only APPEND to it. So the
existing databases are safe.

i hope it is clear...

If both the SOURCE and TARGET databases are on the same host then the
above case is not valid.

Cheers...
Shashi Mannepalli

Laurence wrote:
Actually, I'd like to know how to differentiate db2relocatedb and
redirected restore? The objective between two seems the same...
could someone instruct me?
Dec 8 '06 #4
Hi there,

I found this URL
http://www-128.ibm.com/developerwork...amb/index.html,
and for people reference.

Dec 15 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by GL | last post: by
1 post views Thread by Jack | last post: by
7 posts views Thread by CCC via DBMonster.com | last post: by
11 posts views Thread by Chris | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.