<<

CHAPTER 3

Database Backup and Restore

Backups of theCisco OER 1.0 database can be created without stopping operation of Cisco OER Master Controller Engine. Because Cisco OER 1.0 does not include customized programs to automate database backup and restore processes, they must be achieved manually. Before you start to execute backup or restore, complete these steps:

Step 1 Open a terminal window. Step 2 Login as root. Step 3 Execute the following commands: root@host(~): /bin/bash root@host(~): DAS_HOME=/opt/CSCOoer root@host(~): DAS_DB_OPTIONS="uid=DASadmin;=sql;eng=`hostid`DASDBServer;dbn=DASmain" root@host(~): . $DAS_HOME/bin/env.sh

Database Backup

Before you begin, create a directory named backup /opt/CSCOoer/ ( $DAS_HOME/ backup). The backup process creates -stamped directories under the backup directory. For example, 20040622-112258 represents a backup created on 2004-06-22 at 11:22:58.

Warning It is strongly suggested not to any configuration changes during backup.

Tip In order to limit the impact of backup on overall system performance, it is recommended that you run backups while the system is not busy.

Note Incremental backups can only be restored on top of full backups (with or without further incremental backups). Therefore, the first backup must always be a full backup.

Cisco OER Master Controller Engine, 1.0 User Guide OL-5689-01 3-1 Chapter 3 Database Backup and Restore Database Restore

Full Backup

The first backup should be a full backup.

Examples root@host(~): mkdir $DAS_HOME/backup root@host(~): $DAS_HOME/tools/sybase/SYBSsa8/bin/dbbackup -c "$DAS_DB_OPTIONS" $DAS_HOME/backup/`date+"%Y%m%d-%H%M%S"`-Full Adaptive Server Anywhere Backup Utility Version 8.0.2.4394 Directory "/opt/CSCOoer/backup/20040622-114737" does not exist. Create it? (Y/N) y (698 of 698 pages, 100% complete) (232 of 232 pages, 100% complete) (232 of 232 pages, 100% complete) (2 of 2 pages, 100% complete) Database backup completed

Incremental Backup

Subsequent backups can be either full backups or incremental backups. In the case of incremental backups, only the transaction log is saved as the backup.

Warning Whereas the to create incremental backup also resets the current transaction log, this command can only be executed once for the current date and time, otherwise the existing backup is overwritten.

Examples root@host(~): $DAS_HOME/tools/sybase/SYBSsa8/bin/dbbackup -t -r -c "$DAS_DB_OPTIONS" $DAS_HOME/backup/`date+"%Y%m%d-%H%M%S"` Adaptive Server Anywhere Backup Utility Version 8.0.2.4394 Directory "/opt/CSCOoer/backup/20040622-114754" does not exist. Create it? (Y/N) y (2 of 2 pages, 100% complete) Transaction log renamed to: 040622AG.log Database backup completed

Database Restore

Note Database restore can only be executed when Cisco OER 1.0 is NOT running.

Tip It is strongly suggested that you perform a backup of the current database before attempting to restore a previous database backup.

Database restore is achieved by restoring a full backup first, then applying all subsequent incremental backups (transaction logs).

Cisco OER Master Controller Engine, 1.0 User Guide 3-2 OL-5689-01 Chapter 3 Database Backup and Restore Notes

Examples root@host(~): $DAS_HOME/db root@host(/opt/CSCOoer/db): -rlt ../backup/ total 20 drwxr-xr-x 19 root root 4096 Jun 22 10:40 ../ drwxrwxr-x 5 root root 4096 Jun 22 12:17 ./ drwxrwxr-x 2 root root 4096 Jun 22 12:18 20040622-121828-Full/ drwxrwxr-x 2 root root 4096 Jun 22 12:19 20040622-121858/ drwxrwxr-x 2 root root 4096 Jun 22 12:19 20040622-121936/

In the above example, there are three backups which were created earlier. For example, to restore the system to the state as of 2004/06/22 12:19:36, the following backups have to be restored in this exact order: 20040622-121828-Full 20040622-121858 20040622-121936

Examples root@host(~): cd $DAS_HOME/db root@host(/opt/CSCOoer/db): ../bin/stop.sh stop.sh: Tue Jun 22 12:32:22 PDT 2004 root@host(/opt/CSCOoer/db): ../backup/20040622-121828-Full/DASmain.db . root@host(/opt/CSCOoer/db): ../tools/sybase/SYBSsa8/bin/dbsrv8 $DAS_HOME/db/DASmain.db -a ../backup/20040622-121858/DASmain.log

Sybase Adaptive Server Anywhere Network Server Version 8.0.2.4394

*** Copyright information ***

Database recovery in progress Last checkpoint at Tue Jun 22 2004 12:18 Checkpoint log... Transaction log: ../backup/20040622-121858/DASmain.log... Rollback log... Checkpointing... Starting checkpoint of "DASmain" (DASmain.db) at Tue Jun 22 2004 12:23 Finished checkpoint of "DASmain" (DASmain.db) at Tue Jun 22 2004 12:23 Recovery complete Database server stopped at Tue Jun 22 2004 12:23 root@host(/opt/CSCOoer/db): ../tools/sybase/SYBSsa8/bin/dbsrv8 $DAS_HOME/db/DASmain.db -a ../backup/20040622-121936/DASmain.log Sybase Adaptive Server Anywhere Network Server Version 8.0.2.4394

*** Response compressed ***

Notes

• If an incremental backup is corrupted, you can only restore the database to the incremental backup prior to the corrupted backup. • If a full backup is corrupted, you can only restore the database using a different full backup and all incremental backups based on this full backup.

Cisco OER Master Controller Engine, 1.0 User Guide OL-5689-01 3-3 Chapter 3 Database Backup and Restore Notes

Cisco OER Master Controller Engine, 1.0 User Guide 3-4 OL-5689-01