Q

Backing up a database with SQL

Read how using the export command or copy utility is the best way to backup a database with SQL.

How can I back up the whole database including the data into a SQL script in DB2? Or is it impossible to do in DB2 or other databases? Your reply is highly appreciated!

Simply using SQL is not the answer for backing up an entire database. You can use the export command (non-mainframe DB2 only) or the copy utility.

The export utility exports data from a database to an operating system file, which can be in one of several external file formats. An additional benefit of export is that the table definitions can be saved by using the IXF file format. The saved table (including its indexes) can then be recreated using the import utility. Import is also used to bring the data back.

The DB2 copy utility (mainframe) can be used to backup data to a flat file - and then the recover utility is used to bring the data back from the backup file (and the logs).

You might also want to consider an automated backup and recovery product that simplifies this process and guides you through the steps required to backup/recover a database. BMC Software offers SQL-BackTrack for distributed systems and Recovery Manager for mainframe systems. More information on these products can be found at:

Mainframe:
http://www.bmc.com/products/proddocview/0,2832,19052_19429_23335_8563,00.html

Distributed:
http://www.bmc.com/products/proddocview/0,2832,19052_19429_23230_7558,00.html

This was first published in November 2002

Dig deeper on IBM DB2 management

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchAWS

SearchContentManagement

SearchOracle

SearchSAP

SearchSOA

SearchSQLServer

Close