Jim Youmans
asked on
DB2 Restore a copy of the database to same server
DB2 10.5 on Windows 2008 R2
I have a database called "Orders" on Server1. I want to take a backup of Orders and restore it as OrdersHistory on Server1. I added a new drive for the OrdersHistory db.
I read a few blogs and the IBM docs and it seems like I should be able to generate a restore with redirect script by running this command.
But when I run this I get
SQL1005N The database alias "ORDERS" already exists in either the local
database directory or system database directory.
So can I only do that on a new server? how would I do Orders to OrdersHistory on same server? The database uses auto managed tablespaces and there are about 58 tablespaces. Three (data, index, lob) for each schema.
Any suggestions?
Jim
I have a database called "Orders" on Server1. I want to take a backup of Orders and restore it as OrdersHistory on Server1. I added a new drive for the OrdersHistory db.
I read a few blogs and the IBM docs and it seems like I should be able to generate a restore with redirect script by running this command.
RESTORE DATABASE ORDERS FROM X:\4531544\ORDERS.0.db2.DBPART000.20190324050206.001 TAKEN AT 20190324050206 REDIRECT GENERATE SCRIPT c:\temp\redirect.sql
But when I run this I get
SQL1005N The database alias "ORDERS" already exists in either the local
database directory or system database directory.
So can I only do that on a new server? how would I do Orders to OrdersHistory on same server? The database uses auto managed tablespaces and there are about 58 tablespaces. Three (data, index, lob) for each schema.
Any suggestions?
Jim
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
By combining Tomas and Kent's expert advice, I now understand this much much better and solved the issue. I want to give both Credit for helping me but I don't see that option. So I am noting it here.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi Jim,
You should be able to give both Kent and me credit by accepting the relevant comments from me or Kent as solutions to this question.
If you need help with that you can always ask a moderator.
Regards,
Tomas Helgi
You should be able to give both Kent and me credit by accepting the relevant comments from me or Kent as solutions to this question.
If you need help with that you can always ask a moderator.
Regards,
Tomas Helgi
ASKER
That worked. Thank you!
The simplest way is to create a new instance that uses the new drive.
That instance would then have empty db directory which you could restore the database to the new drive using the redirect-script.
To switch between instances you simply set the DB2INSTANCE env variable to the desired instance.
Note that each instance listens to a unique port.
https://www.ibm.com/support/knowledgecenter/en/SSEPGG_9.7.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0002057.html
https://www.ibm.com/support/knowledgecenter/en/SSYGQH_6.0.0/admin/install/t_create_multiple_db2_instances_on_windows.html
Regards,
Tomas Helgi