Technical FAQs

Ask a Question

Sybase DB Recovery

Goals and Symptoms

Summary

This procedure describes how to recover from a Sybase database corruption using weekly full backups and daily incremental backups.

This article only pertains to PEGASYS software and ION Enterprise versions 3.0 to 4.5.

Causes and Fixes

 

If you have a single transaction log

If you have not deleted or restarted the transaction log since the last full backup, the transaction log contains everything since the last backup. Recovery involves four steps:

  • 1. Make a backup of the transaction log immediately. The database file is gone and the only record of the changes is in the transaction log.
    2. Move the pml_logs.db and pml_logs.log files from the last full backup to the PEGASYS_DB folder.
    3. Use the database engine with the “apply transaction log” (-a) switch to apply the transaction log and bring the database up to date. To do this, you need to open a DOS window and change directory to ..\PEGASYS_DB and type the following command: DBENG50.exe pml_logs.db -a pml_logs.log
    4. Start the Sybase database service followed by the Log Server service. The database engine will come up normally and any new activity will be appended to the current transaction log.

 

If you have multiple transaction logs

If you have archived and deleted the transaction log since the last full backup, you need to apply each transaction log since the full backup in sequence to bring the database up to date.

 

  • 1. Make a backup of all transaction logs immediately. The database file is gone and the only record of the changes is in the transaction logs.
    2. Move the pml_logs.db and pml_logs.log files from the last full backup to the PEGASYS_DB folder.
    3. Starting with the first transaction log after the full backup, apply each archived transaction log by starting the database engine with the apply transaction log (-a) switch. (For this example, assume that the last full backup was on Sunday and the database file was lost during the day on Thursday.)
    4. Use the database engine with the “apply transaction log” (-a) switch to apply the first transaction log to the database. To do this, you need to open a DOS window and change directory to ..\PEGASYS_DB and type the following command: DBENG50.exe pml_logs.db -a pml_logs.log

    Next you need to delete the pml_logs.log file from the …..\PEGASYS_DB folder and replace it with the next daily incremental backup file (Monday).

    • Type: DBENG50.exe pml_logs.db -a pml_logs.log

      Next you need to delete the pml_logs.log file from the …..\PEGASYS_DB folder and replace it with the next daily incremental backup file (Tuesday).

      Type: DBENG50.exe pml_logs.db -a pml_logs.log

      Next you need to delete the pml_logs.log file from the …..\PEGASYS_DB folder and replace it with the next daily incremental backup file (Wednesday).

      Type: DBENG50.exe pml_logs.db -a pml_logs.log

      Next you need to delete the pml_logs.log file from the …..\PEGASYS_DB folder and replace it with the next daily incremental backup file (Thursday).

      Now the database has been recovered to the point where it was last backed up. SQL Anywhere does not let you apply the transaction logs in the wrong order or to skip a transaction log in the sequence.

    5. Start the database in the normal way. The database engine will come up normally and any new activity will be appended to the current transaction log.

 

Original article#10702

All content © 1992-2005 Power Measurement

Was this helpful?
What can we do to improve the information ?