SAP ASE Database Backup and Restore using Google Cloud Disk Snapshots

shubhamsrai
Staff

In today's data-driven world, ensuring the integrity and availability of critical business information is paramount. SAP ASE databases, the cornerstone of many SAP systems, hold immense value and require a robust backup and restore strategy to safeguard against data loss or system disruptions. Google Cloud disk snapshot can be used to perform seamless SAP ASE database backup and restore.

SAP ASE Database Backup using Google Cloud disk snapshots can provide the following benefits:

  • Utilize cloud-native features disk snapshots to streamline SAP ASE database backups
  • Expedite backup operations for large SAP databases
  • Rematerialize databases in HADR environment 

High level execution steps for performing backup and restore of SAP ASE databases on Google Cloud

Backup

Before taking a storage snapshot copy, the database is put into a consistent state by quiescing the user database and master database. The following steps show how to perform database backup by using a disk snapshot.

1. Put database in Quiesce mode

The commands QUIESCE DATABASE simply put the database in a state that allows an external backup of the database device files.

The QUIESCE DATABASE command blocks all write accesses to the database(s) and synchronizes the contents of the data cache(s) with the database devices on disk. Users connected to the database remain online and can perform read operations. Write operations are blocked until the DBA releases the database(s). Alternatively, PREPARE DATABASE command can be used to avoid blocking of write operation.  

Log on to SAP ASE as user sapsa and quiesce all non-temporary databases.

 

quiesce database <tag-name> hold master, model, <DBSID>, saptools, , sybsystemprocs, sybmgmtdb for external dump
go

 

Replace <DBSID> and <tag-name> in the above command with the name of your SAP database and some identifier for backup as tag name respectively.

2. Trigger Google Cloud Storage snapshot  

Perform the disk snapshot of the persistent volume to back up all the databases in quiesced mode. Perform disk snapshot for all data and log devices. 

Snapshots can be created from disks, even while they are attached to running instances. Snapshots are global resources, so they can be used to restore data to a new disk.

Review the instructions to take the snapshot in the link here.

 

gcloud compute snapshots create <snapshot-name> \
    --source-disk  <source-disk-name> \
    --snapshot-type  <snapshot-type> \
    --source-disk-zone <source-zone>

 

3. Confirm the snapshot and release databases for write access

Execute the following SQL command to release the quiesced databases to read/write access, after the external backup command has finished.

 

quiesce database <tag_name> release
go

 

Schedule the automatic log backup to disk or FileStore Enterprise as per SAP Note - 1588316

Restore

Perform restore of SAP ASE databases using disk snapshot as per below.

1. Create persistent disk from Google Cloud Storage snapshot

Create a persistent disk from the Google Cloud storage snapshot.

For more information on how to create a disk from a snapshot, see the link here.

2. Prepare the system for restore

  • Ensure ASE database is stopped
  • Unmount the existing database volumes (data and log)
  • Remove the corresponding fstab entry for the target volume
  • Deactivate the logical volumes and volume group
  • Detach the volumes from the VM
  • Attach the newly created disk to the VM
  • Activate the logical volumes and volume group (if not active)
  • Update the fstab entry for the target volume with the details of the new disk
  • Mount the provisioned volume on the VMs
  • Verify the permission and ownership of the filesystem

3. Restore the database

Start the SAP ASE in quiesce mode with the command line option ‘-q’ and apply transaction log dumps that have been saved after the databases were quiesced.

Example:

 

cd $SYBASE/$SYBASE_ASE/install
echo "-q \" >> RUN_<SERVER>

 

restart the server

 

startserver -f  RUN_<SERVER>
startserver -f RUN_<SERVER>_BS

 

If applicable, load the transaction log dumps to the SAP database using the command LOAD TRANSACTION.

Login to SAP ASE database using isql and run below commands

 

load transaction <DBNAME> from "/path"

 

Finally set all databases online using the SQL command:

 

online database <DBNAME>
go

 

Restart the SAP ASE server after removing the -q option from the RUN_<SERVER> file.

References 

1588316 - SYB: Configure automatic database and log backups
3338972 - Client running QUIESCE DATABASE does / does not output status messages - SAP ASE
1887068 - SYB: Using external backup and restore with SAP ASE
2613297 - QUIESCE DATABASE: Waiting for at least one transaction in 'master' database to complete - SAP ASE

Thanks for reading. If you have any questions, please leave a comment below! 

Authored by: