DavidYahalom.com is an IT knowledgebase dedicated to the world of databses and RDBMS systems by David Yahalom. Here you'll find articles, views, news, tips and in-depth analysis about Oracle, DB2 LUW, Sql Server and MySql. I hope you'll enjoy your stay.

14th
JAN

Quickly clone a database

Posted by David Yahalom under DB2 LUW

[Digg] [Facebook] [Google] [Reddit] [Slashdot] [StumbleUpon]

I really like DB2s ability to quickly restore a backed up database into a new database with a different name in a different location. Just like in SQL server and easier to do then Oracle.

For example, if I have a database named prod_db which was backed up to the folder /storage/database/backups and I want to restore in as a database named dev_db into a different folder like /storage/database/development I can write the following command:

db2 restore db prod_db from /storage/database/backups TO /storage/database/development into dev_db

Quick, easy and painless!

Keep in mind that when restoring a database in DB2 you don’t specify the actual backup file in the command line. You only specify the directory and the DB2 DBM chooses the right backup file automatically. If you have several backup files in that directory you have to add the taken at parameter to the restore command.

taken at It she time stamp of the database backup image. The time stamp is displayed after successful completion of a backup operation, and is part of the path name for the backup image. It is specified in the form yyyymmddhhmmss. A partial time stamp can also be specified. For example, if two different backup images with time stamps 20021001010101 and 20021002010101 exist, specifying 20021002 causes the image with time stamp 20021002010101 to be used.

Leave a Reply

DavidYahalom.com - Oracle, Databases, SQL, news, views, articles and in-depth analysis is powered by Wordpress. Designed by Free WordPress Themes.