spdsbkup and spdsrstr Usage Examples

Backup and Restore Utility Example Scenario

The backup and restore examples in this scenario use Sunday, February 3, 2008 as the starting date for the backup cycle. The weekly schedule includes the following backup schedule:
  • a full backup of the SPD Server domain test every Sunday at 23:30
  • an incremental backup of the domain at 23:30 on the remaining days of the week

Example 1: Perform Exclusive SPD Server Full and Incremental Backups

You can use the SPD Server backup and restore utilities exclusively to perform full and incremental table backups and restores.
This example outlines the steps that you use to perform a full backup of your domain once a week, and to perform incremental backups the rest of the week. The incremental backups also fully back up any newly created tables.
  1. On Sunday, February 3, 2008 at 23:30, run the SPD Server backup utility to do a full backup of the domain test:
    spdsbkup -full -a -d test -h host -s serv -f backup
    The backup creates the backup data file backup_BK_05Feb2006_233000.0.0.0.spds and the backup table of contents file backup_TC_03Feb2008_233000. The backup file contains the full SPD Server backup for each table and for any ACL files in the domain. The table of contents file contains information about each table that was backed up.
  2. Archive the SPD Server backup file and the source that are in the table of contents file into a SAS table of contents table.
  3. On Monday night through Saturday night, use the SPD Server backup facility to perform incremental backups:
    spdsbkup -a -d test -h host -s serv -f backup
    This statement performs incremental SPD Server backups of tables that were previously backed up, performs a full backup of tables that were created after the previous night's backup, and backs up any ACL files that are in the domain.

Example 2: Perform SPD Server Incremental and Full Backups, and System Full Backups

You can use SPD Server utilities to perform incremental backups on data sets that you have previously archived, and to perform full backups on new data sets that have never been backed up. You can also back up your SPD Server data sets by using a system utility from your native operating environment. Which one should you use? The advantage to using system full backups is that a system utility does not parse the data set. Therefore, this type of backup usually runs faster than the SPD Server utility when you are doing a full backup. For example, system utilities often write directly to tape storage media. In contrast, the SPD Server utility first writes backup data to a file on the hard drive, and then the backup file is usually backed up to tape.
This example outlines the steps that you use to perform a full system backup of the domain test by using operating system utilities once a week, and then to use SPD Server to perform a domain back up on the remaining nights.
  1. On Sunday, February 3, 2008 at 23:30, run the SPD Server list utility spdsls -l to produce a listing of the tables that belong to the domain test in preparation for a full backup.
    spdsls -l -a <physical_path_of_domain> 
  2. On Monday, February 4, 2008 at 23:30, run the SPD Server backup utility spdsbkup and set the last full backup date to the previous night for the test tables. The utility performs an incremental backup of tables that have changed since the last full system backup, and it performs a full backup of tables that were created after the last full system backup was performed.
    spdsbkup -d test -h host -s serv -t 02/04/08:23:30:00 -f backup 
    The utility creates the backup data file backup_BK_04Feb2008_233000.0.0.0.spds and a backup table of contents file backup_TC_04Feb2008_233000.
    The backup file contains incremental changes for tables that were modified after 23:30:00 on February 3, 2008, and full backups of tables created after 23:30:00 on February 4, 2008. Only the tables that were modified or created since the last full backup date are included in the backup file. The table of contents file contains information about each table that was either incrementally or fully backed up.
  3. Archive the SPD Server backup file and source in the table of contents file into a SAS table of contents table.
  4. On Tuesday night through Saturday night, use the SPD Server backup facility to do incremental backups of previously backed up tables and full backups of the newly created tables:
    spdsbkup -d test -h host -s serv -f backup
    A last full backup date is not specified for the remaining week's incremental backups. The SPD Server backup utility performs incremental backups of tables that were previously backed up and full backups of tables that were created since the previous night's backup. Although the same filename prefix is specified each night, spdsbkup saves each night's backup to a different file and appends the date and time of the backup to the filename.
  5. Archive the incremental data file and source in the table of contents file into a SAS table of contents table.

Example 3: Restore a Single SPD Server Table

Use the following steps to restore a table that was accidentally deleted from the domain test on Friday, February 8, 2008.
  1. If the table was backed up fully by the operating system backup utility, use the system restore utility to restore the table. (Restore the table to its last full backup image, which was taken on February 3, 2008.) If the table was backed up fully by the SPD Server backup utility, skip this step.
  2. Run a SAS query on the backup table of contents table bkup.toc.
    select bk_file from foo.bkup_toc
    where domain = "test"
    and table = "results"
    and dttime >= '03Feb2008:23:30:00'd; 
    The query results indicate which SPD Server backup files are required to restore the table to its last full backup state.
  3. Restore the archived SPD Server backup files and any extensions that are required to restore the table.
  4. Run spdsrstr on each sequential SPD Server backup file to restore the table. The order runs from the oldest backup date to the most recent backup date. The example table was backed up fully using the SPD Server backup utility on Sunday, February 3, 2008. The table was then backed up incrementally on Tuesday, February 5, and on Thursday, February 7. The following order of the statements is required to restore the table:
    spdsrstr -d test -h host -s serv -f backup_BK_03Feb2008_233000.0.0.0.spds results
    
    spdsrstr -d test -h host-s serv -f backup_BK_05Feb2008_233000.0.0.0.spds results
    
    spdsrstr -d test -h host -s serv -f backup_BK_07Feb2008_233000.0.0.0.spds results
    
    Tip
    You can also use the -e option of spdsrstr and restore all of the files with one command:
    spdsrstr -d test -h hostname -s serv -e backup results 
    Note: When you restore a single table, you do not need to restore the ACL files, because they were not deleted.

Example 4: Restore an SPD Server Domain

Use the following steps to restore an SPD Server domain named test. This domain was lost due to a system media failure that occurred on Friday, February 15, 2008.
  1. If the domain was backed up fully using the system backup utility, use the system restore utility to restore the domain test to its state at the last full backup date of February 10, 2008. If the domain was backed up fully using the SPD Server utility, then skip this step.
  2. Use SAS to run a query on the backup table of contents table bkup_toc.
    select bk_file from foo.bkup_toc
    where domain = "test"
    and dttime >= '10FEB2008:23:30:00'd; 
    The query results identify which SPD Server backup files are required to restore the domain.
  3. Restore the archived SPD Server backup files required to restore the domain.
  4. Use the SPD Server restore utility to restore the domain test:
    spdsrstr -aforce -d test -h host -s serv -e backup
    The -aforce option causes the domain ACLs to be updated for each restore file. Therefore, the latest backup of the ACLs is restored.