• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2662
  • Last Modified:

Problem Restore database to a different instance, same machine, DB2 Copy/ same DB2 name but different aliases.

Hi All,

I am having this problem restoring backup image copy from instance1 to instance2. Both instances are on the same machine using the same DB2 copy, and both instances have the same database name but different database aliases. This restore is to setup my HADR test pair on my laptop. So I issue the following restore command:

>db2 RESTORE DATABASE GSDB FROM "C:\TEMP" TAKEN AT 20120909082454 WITH 2 BUFFERS BUFFER 1024 REPLACE HISTORY FILE PARALLELISM 1 WITHOUT PROMPTING

and I got the following error:

>SQL1005N  The database alias "GSDB" already exists in either the local database directory or system database directory.

A db2 list DB directory shows that I don't have any database with alias GSDB. But I have three cataloged DBs with the same name of GSDB.

So, how can I restore this database while avoiding the "SQL1005N  The database alias "GSDB" already exists" issue?

I'll appreciate any assistance on this issue.

Thank you
0
Enyinnaya
Asked:
Enyinnaya
  • 3
  • 2
2 Solutions
 
AngocACommented:
Hi

You have to uncatalog any matching db in the same instance before restoring:

db2 uncatalog db gsdb

If the problem persist, probably the database exists in the local instance, but it is not cataloged. You have to catalog the local database and then drop it.

db2 catalog db gsdb on local
db2 drop db gsdb on local

Once you have done that, you can retry you restore.
0
 
Tomas Helgi JohannssonCommented:
AngocA. You can have 2 or more instances on same server with the same database names however those databases cannot have the same underlying filesystem paths.

Regards,
    Tomas Helgi
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
AngocACommented:
Yes, I know that, but the original problem is to restore a database. Thus, there can be two possible reasons for that problema that I mentioned before.

1) There is a catalogation to an inexistant database or remote database -> uncatalog db.
2) There is database not cataloged in the current instance that prevents the restoration -> catalog the local not cataloged instance, and then drop it.

I do not care about other instances, because the issue is to restore the database, and that implies the restauration in a given instance.
0
 
Tomas Helgi JohannssonCommented:
The orginal problem is :
I am having this problem restoring backup image copy from instance1 to instance2.
as written in the first line of the question. :)

And the key is to use the redirect or make sure you are using the instance you want to restore to.
http://www.ibm.com/developerworks/data/library/techarticle/0211melnyk/0211melnyk.html


Regards,
   Tomas Helgi
0
 
EnyinnayaAuthor Commented:
Thanks guys...root cause of problem: "2 or more database names cannot have the same underlying filesystem paths"
0

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now