Procedure documentationRestoring the Database Instance Locate this document in the navigation structure

 

After a hardware or database error, you restore the data in the affected database instance by importing any data backups and log backups for that database instance.

You first display the backup history and determine the most recent complete data backup (see: Database Manager CLI, backup_history_open, backup_history_list) as well as any incremental data backups that have since been made. The information in the rows of the backup tell you when the respective backup was made and which pages it contains. The most recent entries are at the end of the file.

The next step is to import the complete data backup, followed by the incremental data backups (see: recover_start). After each imported data backup, the system tells you the next page to be imported.

You next display the restart information and determine whether the database instance is ready to be restarted as well as the page for which the log entries in the log area are still present (see: db_restartinfo).

If the next page to be imported following a data backup is still in the log area of the database instance, you now only have to restart the database instance (see: db_restart). The system imports the log entries from the log area and thus restores the database instance to its last consistent state. If you only want to restore a database instance up to a certain point in time, and not to its last consistent state, enter this time when you restart the database instance.

If the page to be imported after a data backup is lower than the lowest page number in the log area, look at the backup history to determine which backup contains the page. Import the relevant data or log backup and all subsequent backups in chronological order up to and including the one that contains at least the predecessor of the lowest page number in the log area (see: recover_replace). When this page has been imported, the system ends the import of the backup and starts the database instance using the entries still in the log area (restart).

You import the first backup with the DBM command recover_start and all subsequent backups with the DBM command recover_replace.

If you cancel the import of backups or make a mistake while entering the next command, the system automatically transfers the database instance to the OFFLINE operational state.

This means that you have to transfer the database instance back to the ADMIN operational state and reopen the database session. You then execute db_restartinfo again to determine which of the imported pages have already been persistently saved in the data and which pages need to be imported again. In this case, proceed with the import using recover_start to import the first page expected by the system according to the restart information and recover_replace to import all subsequent backups.

Scenario

You want to restore the database instance after a hardware error.

Your database instance must have at least two data volumes. You can display all available volumes with the DBM command param_getvolsall. If necessary, create an additional data volume with the name DISKD0002 under the path c:\documents and settings\all users\application data\sdb\data\demodb\data (see: Enlarging a Database Instance, section “scenario 3”).

Now transfer DEMODB to the ADMIN operational state. Simulate a hardware error by deleting data volume DISKD0002 using the operating system command.

The database instance is still in the ADMIN operational state, but all data previously in the data area has been lost. The database instance needs to be restored.

Prerequisites

You can find the prerequisites under Database Manager CLI, recover_start, recover_replace.

Procedure

In the following example, explanations of the output are in bold and marked as comments with the number sign (#).

Displaying Backup Information

The first step is to display and evaluate information about the available backups.

  1. Call the Database Manager CLI in session mode, log on as operator OLEG with the password MONDAY, and connect to database instance DEMODB:

    >dbmcli -u OLEG,MONDAY -d DEMODB

    dbmcli on DEMODB>

  2. Open the backup history:

    dbmcli on demodb>backup_history_open

    OK

  3. Display the backup history:

    dbmcli on demodb>backup_history_list

    OK

    END

    ...

    # The most recent complete data backup is labeled DAT_000000002. This must be read first.

    # The next page must be 9531:

    | |

    43C7BBD1000B|DAT_000000002|SAVE WARM|2006-01-13 15:40:17|2006-01-13 15:40:17|200

    6-01-13 15:40:17|2006-01-13 15:40:17| 9531| |NO |DemoDataCompl

    | 384| 1| 0

    # Page 9531 is in the log backup with the label LOG_000000007. It must therefore be imported directly after the complete data backup.

    # This import includes pages 9531 - 11828; the next page to be imported is 11829:

    | |

    43C7BBE5000C|LOG_000000007|SAVE WARM|2006-01-13 15:40:23|2006-01-13 15:40:37|200

    6-01-13 15:40:37|2006-01-13 15:40:38| 9531| 11828| |DemoFileLog

    | 2096| 1| 0

    # Page 11829 is in the log backup with the label LOG_000000008. It must therefore be imported directly after the log backup with the label LOG_000000007.

    # This import includes pages 11829 - 14182; the next page to be imported is 14183:

    | |

    43C7BC01000D|LOG_000000008|SAVE WARM|2006-01-13 15:40:42|2006-01-13 15:40:46|200

    6-01-13 15:41:05|2006-01-13 15:41:06| 11829| 14182| |DemoFileLog

    | 2152| 1| 0

    # Page 14183 is in the log backup with the label LOG_000000009. It must therefore be imported directly after the log backup with the label LOG_000000008.

    # This import includes pages 14183 - 14358; the next page to be imported is 14359:

    | |

    43C7BC01000D|LOG_000000009|SAVE WARM|2006-01-13 15:40:46|2006-01-13 15:41:05|200

    6-01-13 15:41:06|2006-01-13 15:41:07| 14183| 14358| |DemoFileLog

    | 176| 1| 0

    # Page 14359 is in the log backup with the label LOG_000000010. It must therefore be imported directly after the log backup with the label LOG_000000009.

    # This import includes pages 14359 - 16712; the next page to be imported is 16713.

    | |

    43C7BC24000E|LOG_000000010|SAVE WARM|2006-01-13 15:41:17|2006-01-13 15:41:21|200

    6-01-13 15:41:40|2006-01-13 15:41:42| 14359| 16712| |DemoFileLog

    | 2152| 1| 0

    # Thereafter all log backups including the one with the label LOG_000000013 must be imported in chronological order.

    | |

    43C7BC24000E|LOG_000000011|SAVE WARM|2006-01-13 15:41:21|2006-01-13 15:41:25|200

    6-01-13 15:41:42|2006-01-13 15:41:43| 16713| 19065| |DemoFileLog

    | 2152| 1| 0

    | |

    43C7BC24000E|LOG_000000012|SAVE WARM|2006-01-13 15:41:25|2006-01-13 15:41:40|200

    6-01-13 15:41:43|2006-01-13 15:41:43| 19066| 19770| |DemoFileLog

    | 656| 1| 0

    # The log backup with the label LOG_000000013 contains the pages 19771 to 22124 and thus includes the predecessor to the first page in the log area as shown in the restart information (21452).

    # During the restore process, the system imports this entire log backup. Subsequent log backups do not need to be imported since the pages in them are still in the log area and can be restored by the system from the log area.

    | |

    43C7C497000F|LOG_000000013|SAVE WARM|2006-01-13 16:17:14|2006-01-13 16:17:17|200

    6-01-13 16:17:43|2006-01-13 16:17:45| 19771| 22124| |DemoFileLog

    | 2152| 1| 0

    | |

    43C7C497000F|LOG_000000014|SAVE WARM|2006-01-13 16:17:17|2006-01-13 16:17:22|200

    6-01-13 16:17:45|2006-01-13 16:17:46| 22125| 24478| |DemoFileLog

    | 2152| 1| 0

    | |

    43C7C497000F|LOG_000000015|SAVE WARM|2006-01-13 16:17:22|2006-01-13 16:17:43|200

    6-01-13 16:17:46|2006-01-13 16:17:48| 24479| 26748| |DemoFileLog

    | 2080| 1| 0

    | |

    43C7C5240010|LOG_000000016|SAVE WARM|2006-01-13 16:17:45|2006-01-13 16:20:04|200

    6-01-13 16:20:04|2006-01-13 16:20:05| 26749| 28510| |DemoFileLog

    | 1616| 1| 0

    | |

Restoring Data and Log Entries

You now have the information about the backups and can restore DEMODB.

  1. Transfer the database instance to the ADMIN operational state:

    dbmcli on demodb>db_admin

    OK

  2. Open a database session:

    dbmcli on demodb>db_connect

    OK

  3. Import the most recent complete data backup:

    dbmcli on demodb>recover_start DemoDataCompl

    OK

    Returncode 0

    Date 20060117

    Time 00114627

    Server GENUA

    Database DEMODB

    Kernel Version Kernel 7.6.00 Build 016-123-109-428

    Pages Transferred 384

    Pages Left 0

    Volumes 1

    Medianame DemoDataCompl

    Location Backups 2005\data\completeDataJan

    Errortext

    Label DAT_000000002

    Is Consistent true

    First LOG Page 9531

    # After the complete data backup, the system expects the log page with the number 9531.

    Last LOG Page

    DB Stamp 1 Date 20060113

    DB Stamp 1 Time 00154017

    DB Stamp 2 Date

    DB Stamp 2 Time

    Page Count 362

    Devices Used 1

    Database ID GENUA:DEMODB_20060113_153806

    Max Used Data Page 0

  4. Display the restart information:

    dbmcli on demodb>db_restartinfo

    OK

    Used LOG Page 28513

    First LOG Page 21452

    # The log area still contains all pages of numbers 21452 to 28513. To restart the database instance, pages 9531 to 21451 must be read from the backups.

    Restartable 1

    # The database instance is ready to be restarted. The log area is not damaged.

    Id Restart Record GENUA:DEMODB_20060113_153806

    Id LOG Info GENUA:DEMODB_20060113_153806

    Consistent 1

  5. Import the log backups

    1. Import the log backup with the label LOG_000000007:

      dbmcli on demodb>recover_start DemoFileLog LOG 007

      OK

      Returncode -8020

      # Return code -8020 tells you that the chronological backup must be imported using command recover_replace.

      Date 20060117

      Time 00143406

      Server GENUA

      Database DEMODB

      Kernel Version Kernel 7.6.00 Build 016-123-109-428

      Pages Transferred 2096

      Pages Left 0

      Volumes 1

      Medianame DemoFileLog

      Location Backups 2005\data\logBackup.007

      Errortext

      Label LOG_000000007

      Is Consistent

      First LOG Page 9531

      Last LOG Page 11828

      DB Stamp 1 Date 20060113

      DB Stamp 1 Time 00154023

      DB Stamp 2 Date 20060113

      DB Stamp 2 Time 00154037

      Page Count 2297

      Devices Used 1

      Database ID GENUA:DEMODB_20060113_153806

      Max Used Data Page

    2. Import the log backup with the label LOG_000000008 using command recover_replace:

      dbmcli on demodb>recover_replace DemoFileLog "C:\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\logBackup" 008

      OK

      Returncode -8020

      Date 20060117

      Time 00143406

      Server GENUA

      Database DEMODB

      Kernel Version Kernel 7.6.00 Build 016-123-109-428

      Pages Transferred 2152

      Pages Left 0

      Volumes 1

      Medianame DemoFileLog

      Location C:\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\logBackup.008

      Errortext

      Label LOG_000000008

      Is Consistent

      First LOG Page 11829

      Last LOG Page 14182

      DB Stamp 1 Date 20060113

      DB Stamp 1 Time 00154042

      DB Stamp 2 Date 20060113

      DB Stamp 2 Time 00154046

      Page Count 2353

      Devices Used 1

      Database ID GENUA:DEMODB_20060113_153806

      Max Used Data Page

    3. Import the log backup with the label LOG_000000009 using command recover_replace:

      dbmcli on demodb>recover_replace DemoFileLog "C:\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\logBackup" 009

      OK

      Returncode -8020

      Date 20060117

      Time 00143406

      Server GENUA

      Database DEMODB

      Kernel Version Kernel 7.6.00 Build 016-123-109-428

      Pages Transferred 176

      Pages Left 0

      Volumes 1

      Medianame DemoFileLog

      Location C:\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\logBackup.009

      Errortext

      Label LOG_000000009

      Is Consistent

      First LOG Page 14183

      Last LOG Page 14358

      DB Stamp 1 Date 20060113

      DB Stamp 1 Time 00154046

      DB Stamp 2 Date 20060113

      DB Stamp 2 Time 00154105

      Page Count 175

      Devices Used 1

      Database ID GENUA:DEMODB_20060113_153806

      Max Used Data Page

    4. Import the rest of the log backups with the labels LOG_000000010 - LOG_000000013 using command recover_replace (see sections a - c).

    # When the last required log backup has been imported and all pages whose number is lower than the first page in the log area are in the database system, the system automatically imports the rest of the pages from the log area and transfers the database instance to the ONLINE operational state.

Result

The database instance DEMODB has been restored; the manually deleted volume has been restored according to the information in the database parameter file and is again available at its original location on the hard disk.

The database instance again contains all pages that were in the data and log areas before the hardware error and these pages can be accessed.

The database instance is ready for operation and is in the ONLINE operational state.