Recovery procedures

Use these procedures to ensure clean recovery after media failure.

StepsRecovering after media failure of the database file

  1. Make an extra backup copy of the current transaction log. If the database file is gone, the only record of changes since the last backup is in the transaction log.

  2. Create a recovery directory to hold the files you use during the recovery process.

  3. Copy the database file from the last full backup to the recovery directory. You can find the database file in the backup directory. It is named erssd_name.db.

  4. Copy the backup transaction log into the recovery directory. The backup transaction log, named erssd_name.log, is in the backup directory.

  5. Apply the transactions from the backup transaction log to the recovery database:

    dbsrv11 erssd_name.db -a erssd_name.log
    
  6. Copy the online transaction log into the recovery directory. The online transaction log, named erssd_name.log, is in the log directory.

  7. Apply the transactions from the online transaction log to the recovery database:

    dbsrv11 erssd_name.db -a erssd_name.log
    
  8. Make a post-recovery backup by making an extra copy of the database file.

  9. Move the database file to the production directory and restart the database. Use the command dbspawn from the Replication Server error log.

  10. Perform validity checks on the recovery database:

    dbvalid -c 
    "uid=primary_user_name;
    pwd=primary_user_password;eng=erssd_name
    LINKS=tcpip
    (DOBROAD=NONE;HOST=localhost;PORT=port)"
    
  11. Restart Replication Server.

StepsRecovering from media failure on the database transaction log

  1. Identify the corrupted file. You can do this by running the Log Translation utility on both the transaction log and its mirror to see which one generates an error message. In this example, the Log Translation utility, dbtran, translates a transaction log named erssd_name.log, saving the translated output in db_name.sql.

    dbtran erssd_name.log
    

    The Log Translation utility translates the intact file with no errors, but reports an error when translating the corrupt file.

  2. Copy the correct file over the corrupted file, so that the two files are identical.

  3. Restart the database, using command from the Replication Server error log.

  4. Restart Replication Server.

StepsResetting the database transaction log for ERSSD

If Replication Agent is running and there are existing routes, you can reset the database transaction log for the ERSSD after you recover from media failure on the log. This procedure uses the dblog, dbeng11, and dbstop SQL Anywhere commands that you must run at the system prompt.

  1. Shut down Replication Server using shut down. See “Shutting down Replication Server”.

  2. Reset the ERSSD database log at a system prompt:

    dblog -il erssd_name.db
    
  3. Start the ERSSD database server:

    dbeng11 erssd_name.db
    
  4. Reset the ERSSD database locator value to 0:

    1. Start isql.

    2. Execute rs_zeroltm on the ERSSD database:

      rs_zeroltm erssd_name, erssd_name
      
    3. Exit isql.

  5. Stop the ERSSD database at the system prompt:

    dbstop -c
    “eng=erssd_name;uid=primary_user_name;
    pwd=primary_user_password
  6. Start Replication Server. See “Starting Replication Server”.

See your SQL Anywhere documentation for more information on the SQL Anywhere commands.