The NORETRIEVE parameter of a Db2 ROLLFORWARD command is a powerful tool that can be used to recover data from a database during a disaster or other data loss event. When the NORETRIEVE parameter is specified, Db2 will roll forward the database to a defined point in time without actually retrieving any archived log files from their configured source. This can be useful when you need to restore a database quickly and need more time or resources (like a remote media server) to retrieve all transaction log files.

To use the NORETRIEVE parameter, you must first understand how the rollforward in db2 process works. The rollforward process is designed to bring a database to a consistent state by applying all of the transactions that have been logged since a specified point in time. By default, Db2 will retrieve all of the archived log files from the archive location (disk, enterprise backup solutions like NetBackup, etc.) that were generated between the start of the database backup and the point in time specified by the ROLLFORWARD command and apply the transactions to the database.

When the NORETRIEVE parameter is specified, Db2 will not retrieve the log files from the archive location. Instead, Db2 will only use log files located in the active log path or the overflow log path.

To use the NORETRIEVE parameter, the database must be in rollforward pending state. This generally only occurs after you restore a backup of the database. Once the restore is complete, you can use the ROLLFORWARD command with the NORETRIEVE parameter to keep the database consistent without retrieving all of the log files.

Here is an example of how to use the NORETRIEVE parameter:

$ db2 rollforward db sample to end of logs and stop NORETRIEVE

In this example, the ROLLFORWARD command is used to bring the sample database to the end of the log files without retrieving the data. The NORETRIEVE parameter is specified to indicate that Db2 should not retrieve the log files present in the archive location to bring the database to the defined point in time. It is important to note that some data may be lost when the NORETRIEVE parameter is used. This is because Db2 is not retrieving all of the data that has been changed or added since the backup occurred. Therefore, it is essential to carefully consider the implications of using the NORETRIEVE parameter before doing so.

In conclusion, the NORETRIEVE parameter of a Db2 ROLLFORWARD command can be a helpful tool for quickly restoring a database in the event of a disaster or other data loss event. However, make sure to carefully consider the implications of using this parameter before doing so, as some data may be lost.

For more information on this topic, or other Db2 questions, please reach out to us!

Share This