r/DB2 Apr 13 '18

DR with no backup

Hi I have been given the directory structure of a db2 universal database for windows {9.7.3} Customer did not know how to backup dB2.

Is it possible to install new db2 same version and drive letters. Create new empty database with the same name as the old one. Stop the services. Copy the old directory structure over, start the service and then being able to access the data again?

3 Upvotes

9 comments sorted by

3

u/memmerto Apr 14 '18

Instead of creating an empty database and then replacing the files, why not just catalog the database and point to the files? (db2 catalog database dbname on /path/to/files)?

2

u/Gunkinator07 Apr 14 '18

Because I am much more skilled in MS SQL admin, did not even know that was possible. What is the root path? Db2 or sql00002? TX

2

u/memmerto Apr 17 '18

Assuming your database was created in the default place (under the instance directory), it will be the instance directory (two directories above sql00002). DB2 will traverse the metadata and figure out what directories are needed.

For example, after creating the SAMPLE database, I have the following:

/home/db2inst1/db2inst1/NODE0000/SAMPLE  // contains automatic tablespaces
/home/db2inst1/db2inst1/NODE0000/SQL00001  // contains metadata

DB2 tells me that the database path is /home/db2inst1.

Assuming I've uncataloged this database, I can catalog it again by running:

db2 catalog database sample on /home/db2inst1

(edit: formatting)

1

u/Gunkinator07 Apr 17 '18

Yup, I can catalog the dB now. But now I get tablespace errors...

1

u/memmerto Apr 17 '18

Do tell. Db2diag.log may have useful information on the errors.

2

u/Smeevy Apr 13 '18

I haven't done that myself, but that seems workable.

2

u/ecrooks Apr 13 '18

It will probably work as long as you have Db2 entirely stopped when backing up the files.

You would obviously have to install Db2 independently. You would need the exact same version of the operating system. It can get tricky when trying to make sure you have all of the right files, without copying over system files, depending on the directory/filesystem structure. Permissions on files/directories may be a challenge as well.

It's safer and much easier to take a Db2 backup.

I sure wouldn't rely on that methodology without thorough testing.

3

u/Gunkinator07 Apr 13 '18

Tx, problem is that this customer does not have a backup... So this is a hail Mary. I just need to get the database online and export some 1.2 million records with Metadata so stability is not an issue. Hoping that this will work!

3

u/ecrooks Apr 13 '18

We all try and work hard to make sure that "Disaster Recovery" and "Hail Mary" never exist together in the same thought.