0

I used IBM Data Studio to backup a test database named URCTEST.

Now, I want to restore it to the actual (empty) database, URCDB.

I've got little experience with IBM DB2, so I assumed this was something similar to SQL Server, where I can create a test database, perform some actions on without endangering the actual database, then, upon a satisfactory result, back up that test database and then restore it to the real one.

I right-clicked the URCTEST and created a back-up. It created a "URCTEST.0.DB2.DBPART000.20130318172034.001" file in C:\ (where I specified the back-up be saved).

How do I restore this to URCDB? I tried right-clicking URCDB, and clicking Restore. I set the Method for selecting a backup image to "Enter the information manually", and added a backup location set to C:\

It gives me the following error:

RESTORE DATABASE URCDB FROM "C:\" TAKEN AT 20130318093537 WITHOUT PROMPTING

Failed to execute command.  DAS returned the following error: sqlcode=-22220 output=SQL2542N  No match for a database image file was found based on the source 
database alias "URCDB" and timestamp "20130318093537" provided.
zack_falcon
  • 165
  • 2
  • 11

2 Answers2

1

I found the solution; It was a lot simpler than I thought, but at the same time, more complex and demanding than any database restoration I've encountered (so far).

I Right-clicked at the Database URCDB, clicked the Restore, and set the Method For Selecting A Back-up Image to Manual.

Then, in the resulting field, I checked Backup Image Is From Another Database, and put in "URCTEST" in the text field. Also, I've added a back-up location, and set it to C:\, where my back-up resides (I don't actually get to select the .001 file itself, just the directory).

By far, the most tedious and important thing I've done was set the date and time to the appropriate values - namely, the date and time I've done the back-up. By default (I think), when creating a back-up image, it uses the date and time as part of the name of the resulting .001 file.

I was lucky I decided NOT to rename the file.

After that, I just clicked Run and everything went smoothly, though slowly.

I'm using IBM Data Studio 3.2, and IBM DB2 10.1, on a Windows 7 32-bit System.

zack_falcon
  • 165
  • 2
  • 11
0

The syntax of the RESTORE DATABASE command is slightly different if you want to restore the URCTEST database into a database with a different name. I am not sure if you can do this with Data Studio, but you can certainly perform the restore manually at the command line.

Based on the name of the backup image, you are using DB2 10.1, so I'm going to assume that your database has automatic storage. You can execute the below command by starting a DB2 Command Window:

RESTORE DATABASE URCTEST FROM "C:\" INTO URCDB TAKEN AT 20130318093537 WITHOUT PROMPTING

If your database does not have automatic storage you would need to perform a redirected restore.

Ian Bjorhovde
  • 481
  • 2
  • 2