Backing up the DB2® database
You should back up the database on a regular basis to protect your data. Each backup is the copy of the entire database that can be restored in the case of corruption or malfunction.
Before you begin
- Users
To perform the backup, log in as the database instance owner.
- Space requirements
Ensure that enough storage space is available in the target directory. The backup file size depends on the number of computers that report to BigFix Inventory, and the amount of historical data that is stored in the database. Therefore, you cannot estimate the exact size of the backup file.
The backup file size can reach:- 2GB or more in the environments that consist of less than 100 computers.
- 50GB for 30000 computers.
- 75GB for 100000 computers.
You can use compression to significantly reduce the backup size.
Creating offline backups
You should back up the database on a regular basis to protect your data. Each backup is the copy of the entire database that can be restored in the case of corruption or malfunction. Choose offline backups if you can afford to deactivate the database during each backup.
About this task
Procedure
- Stop the BigFix Inventory server.
-
Terminate the connections and deactivate the database.
Note:
TEMADB
is the default database name. If you are unsure whether it applies to your database, see: Checking the database name.db2 terminate db2 deactivate db TEMADB
DB20000I The TERMINATE command completed successfully. DB20000I The DEACTIVATE DATABASE command completed successfully.
-
Make a full offline backup. The entire database is copied to a backup file in the specified
location.
db2 backup database TEMADB to <location>
Backup successful. The timestamp for this backup image is : xxxxxxxxxxxx
-
Verify that the backup file was correctly created.
db2ckbkp <backup file>
Image Verification Complete - successful.
-
Activate the database and restart the BigFix Inventory server to restore its connection to
the database.
db2 activate db TEMADB /etc/init.d/BFIserver restart
-
If DB2 is shared with the BigFix server,
restart the BigFix server to restore its
connection to the database.
For more information, see: Starting and stopping the BigFix server.
Creating online backups
Choose online backups if you back up your database frequently and cannot afford to deactivate it for each backup. Online backups allow you to maintain all connections to the database, but they require more disk space to store the history of transaction logs.
About this task
Procedure
-
Set up archive logging.
Note:
TEMADB
is the default database name. If you are unsure whether it applies to your database, see: Checking the database name. -
Make an online backup.
db2 backup database TEMADB online to /var/online_backup/ compress include logs
Whenever you create an online backup, all archive logs created up to this point are no longer needed. To restore a complete database, you need a backup file and subsequent archive logs.Backup successful. The timestamp for this backup image is : xxxxxxxxxxxx
-
Verify that the backup file was correctly created.
db2ckbkp <online backup file>
Image Verification Complete - successful.