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:
Dig Deeper on IBM DB2 management
Related Q&A from Craig S. Mullins
Our expert suggests that the best way to pass the SAP BW exam is to have hands-on job experience. But that's not all he has to say about ... Continue Reading
To export data from a DB2 table to a flat file, you need to run an export specifying the proper file format. The export utility exports data from a ... Continue Reading
Craig Mullins recommends two specific resources for learning how to create and support Binary Large Objects (BLOB) in DB2. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.