Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is it possible to have db2 alternate restore on different system with a different path

1,276 views
Skip to first unread message

aarti...@gmail.com

unread,
Sep 29, 2016, 2:56:34 AM9/29/16
to
Prod db (source db2) : hosted on linux 6.X : installation : /home/db2inst1
Dev db (target db2) : hosted on linux 6.X : installation :/home/db2/db2inst1

Our requirement is to perform an alternate db2 restore from Sourcedb2 (/home/db2inst1) to target db2 (/home/db2/db2inst1).

Is such a restore supported by db2 as we are seeing following error?


SQL1277W A redirected restore operation is being performed. During a table
space restore, only table spaces being restored can have their paths
reconfigured. During a database restore, storage group storage paths and DMS
table space containers can be reconfigured.
DB20000I The RESTORE DATABASE command completed successfully.

[db2inst1@XXX scripts]$ db2 restore db sample continue
SQL1051N The path "/home/db2inst1" does not exist or is not valid.
SQLSTATE=57019


Thanks
Aarti

ox1d0

unread,
Sep 29, 2016, 2:50:35 PM9/29/16
to
Hello Aarti is complete possible even you can have several instance in several versions running into the same host

Are you sure that yours paths are correct during the redirect restore ?

or may you try something like this

db2 restore db <db> FROM "/some/CoOl/Path" taken at 2016blablablabla into <targetdb> with 4 buffers buffer 1024 parallelism 1 without rolling forward without prompting


aarti...@gmail.com

unread,
Sep 30, 2016, 5:46:59 AM9/30/16
to
Thanks so much for your reply,
We have a different challenge for out of place restore, We followed similar restore as mentioned by you however this doesn't solve our problem which is described below which we need help for?

1. Take backup from source db2 installed on /home/db2inst1 and
2. backup saved on e.g. /some/CoOl/Path
3. Dropped the "Sample" Db
4. Created "newDb" on a different path e.g. /opt/db2inst1/newDb
5. Restore the backup form path mentioned in step 2 to see file at newly created db "newDb"
but the restore is creating new files at default directoy i.e /home/db2inst1

Is the a way to get the db installed on a newly created db in above example path /opt/db2inst1/newDb and NOT the /home/db2inst1

Thanks once again
Aarti

aarti...@gmail.com

unread,
Sep 30, 2016, 5:47:51 AM9/30/16
to
On Thursday, September 29, 2016 at 12:26:34 PM UTC+5:30, aarti...@gmail.com wrote:

aarti...@gmail.com

unread,
Sep 30, 2016, 12:55:18 PM9/30/16
to
We managed to Take an out of place restore using ON = new restore loaction option on db2 Restore command

Thanks enveryone

Jeremy Rickard

unread,
Sep 30, 2016, 9:43:44 PM9/30/16
to
You didn't show your restore command. Did you want the database path moved into the new location as well or just the data storage paths?

You can see the database path (aka directory) by checking "Local database directory" entry from output of: db2 list db directory

Basically, it's a matter of understanding the restore command differences for the TO, ON and DBPATH ON clauses.

Regards, Jeremy

Lennart Jonsson

unread,
Oct 2, 2016, 4:04:54 AM10/2/16
to
On 09/29/2016 08:56 AM, aarti...@gmail.com wrote:
> Prod db (source db2) : hosted on linux 6.X : installation : /home/db2inst1
> Dev db (target db2) : hosted on linux 6.X : installation :/home/db2/db2inst1
>
> Our requirement is to perform an alternate db2 restore from Sourcedb2 (/home/db2inst1) to target db2 (/home/db2/db2inst1).
>
> Is such a restore supported by db2 as we are seeing following error?
>

In general I find it easiest to let db2 generate a script from the
backup image:

db2 restore db aa redirect generate script aa.sql

and then modify aa.sql so that it corresponds to the target

/Lennart

aarti...@gmail.com

unread,
Oct 3, 2016, 8:46:15 AM10/3/16
to
On Thursday, September 29, 2016 at 12:26:34 PM UTC+5:30, aarti...@gmail.com wrote:
Hi All

We have used a command to generate the script and then updated the "ON" param with destination directory path
db2 "restore db sample from /tmp/sample_Local/backup taken at 20160930022308 into test redirect generate script test.txt

and then re-run a command
db2 -tvf test.txt

Things to keep in mind are:
1. ensure the backup has been taken with the - permission = any
2. ensure the destination folder has permissions as that of the db2inst1 example:
ls -lrt /tmp/destination_restore/
total 4
drwxrwxr-x 3 db2inst1 db2iadm1 4096 Oct 3 13:33 db2inst1


0 new messages