Sun Java System Calendar Server 6 2005Q4 Administration Guide

Chapter 17 Backing Up and Restoring Calendar Server Data

If you have chosen not to use the automatic backup facility provided by Calendar Server (using csstored), then you need to implement a backup procedure to protect your data. This chapter describes how to use Calendar Server and other Sun tools to perform a manual backup and restore of calendar database files.

To back up and restore Calendar Server data in the /var/opt/SUNWics5/csdb directory, use these command-line utilities:


Note –

If you have an existing custom script that uses the Berkeley database tools (such as, db_recover), you might find that the tools do not work after upgrading to Calendar Server 6. Before Calendar Server 2004Q4, the tools were compiled with a static library. Since that release, they are compiled with a dynamic library.

To accommodate this change, alter your custom script to use the dynamic link library, as follows: Change the global variable LD_LIBRARY_PATH to the name of the dynamic library (libdb-4.2.so).


This chapter includes these sections:


Caution – Caution –

Calendar Server 2 data is not compatible with the current product. Do not try to restore calendar data backed up by the Calendar Server 2 backup utility, because data loss can occur.

If you have 2 calendar data that you want to move to the current release, you must contact technical support for the appropriate migration utilities.


Backing Up Calendar Server Data

The csbackup utility can back up the calendar database, a specified calendar, or a user’s default calendar. This section describes:

ProcedureTo Back Up the Calendar Database to a Directory

  1. Log in as the owner of the database files (such as icsuser).

  2. Use the csbackup utility database command.

    For example, to back up the calendar database to a directory named backupdir:


    csbackup -f database backupdir
  3. Verify the correct version of the database was backed up by checking the ics50caldb.conf version file in the backup directory.


    Note –

    The csbackup utility fails if the target backup directory already exists and you do not specify the -f option. For example, the following command fails if backupdir exists, even if the directory is empty:


    csbackup database backupdir

    Therefore, if you specify a target backup directory that already exists, include the -f option when you run csbackup.

    You can also specify a nonexistent target backup directory and let csbackup create the directory for you.


ProcedureTo Back Up a Specific Calendar to a File

  1. Login as the database owner (icsuser).

  2. To backup a calendar to a file in iCalendar or XML format, use the csbackup utility calendar command.

    The filename extension (.ics or .xml) of the backup file indicates the format.

    For example, to backup the calendar jsmithcal in iCalendar format (text/calendar MIME) to the file jsmith.ics in the backupdir directory:


    csbackup -c jsmithcal calendar backupdir/jsmith.ics

    Or, to backup the calendar jsmithcal in XML format (text/XML) to the file jsmith.xml in the backupdir directory:


    csbackup -c jsmithcal calendar backupdir/jsmith.xml

ProcedureTo Back Up a User’s Default Calendar to a File

  1. Login as the database owner (icsuser).

  2. To back up a user’s default calendar to a text file in iCalendar or XML format, use the csbackup utility defcal command. The filename extension (.ics or .xml) that you specify for the output file determines which format is used.

    For example, to back up calendar user jsmith’s default calendar in iCalendar (text/calendar MIME) format to a file named jsmith.ics in the backup directory:


    csbackup -a jsmith defcal backupdir/jsmith.ics

    Or, to back up calendar user jsmith’s default calendar in XML (text/xml MIME) format to a file named jsmith.xml in the backup directory:


    csbackup -a jsmith defcal backupdir/jsmith.xml

Restoring Calendar Server Data

The csrestore utility restores the calendar database, individual calendars, or a user’s default calendar that was saved using csbackup. You must run the csrestore utility on the local machine where Calendar Server is installed, and you must first stop Calendar Server. (Calendar Server can be running, however, when you backup the database.)

This section describes:

ProcedureTo Restore the Calendar Database

  1. Log in as the database owner (icsuser).

  2. To restore a calendar database that was saved to a backup directory using the csbackup utility, use the csrestore utility database command.

    For example, to restore the calendar database that was saved to a backup directory named backupdir:


    csrestore database backupdir

ProcedureTo Restore a Calendar From a Backup Directory

  1. Log in as the database owner (icsuser).

  2. To restore a specific calendar from a database that was saved to a backup directory using the csbackup utility, use the csrestore utility database command with the -c option.

    For example, to restore the calendar jsmithcal from the backup database directory backupdir:


    csrestore -c jsmithcal calendar backupdir

ProcedureTo Restore a Calendar From a File

  1. Log in as the database owner (icsuser).

  2. To restore a specific calendar that was saved to a backup file using the csbackup utility, use the csrestore utility calendar command with the -c option.

    The filename extension (.ics or .xml) of the backup file indicates the format in which the calendar was saved.

    For example, to restore the calendar jsmithcal that was saved in iCalendar (text/calendar MIME) format to the file jsmith.ics located in the backupdir directory:


    csrestore -c jsmithcal calendar backupdir/jsmith.ics

    Or, to restore the calendar jsmithcal that was saved in XML (text/calendar MIME) format to the file jsmith.xml located in the bcakupdir directory:


    csrestore -c jsmithcal calendar backupdir/jsmith.xml

ProcedureTo Restore a User’s Default Calendar

  1. Log in as the database owner (icsuser).

  2. To restore a user’s default calendar that was saved to a backup file using the csbackup utility, use the csrestore utility defcal command.

    The filename extension (.ics or .xml) of the backup file indicates the format in which the calendar was saved.

    For example, to restore calendar user jsmith’s default calendar that was saved in iCalendar (text/calendar MIME) format to a file named jsmith.ics located in the backup directory backupdir:


    csrestore -a jsmith defcal backupdir/jsmith.ics

    To restore calendar user jsmith’s default calendar that was saved in XML (text/xml MIME) format to a file named jsmith.xml located in the backup directory backupdir:


    csrestore -a jsmith defcal backupdir/jsmith.xml

Using Sun StorEdge Enterprise BackupTM or Legato Networker®

You can also use either Sun StorEdge Enterprise Backup software (formerly Solstice Backup) or Legato Networker to back up and restore Calendar Server data. The Sun StorEdge Enterprise Backup software and Legato Networker are similar, and the instructions in this section apply to both products.

Before attempting to backup Calendar Server, however, see the Sun StorEdge Enterprise Backup or Legato Networker documentation.

For the Sun StorEdge Enterprise Backup software documentation, see http://docs.sun.com.

This section describes:

StorEdge or Legato Tools

Calendar Server provides the following files in the /opt/SUNWics5/cal/sbin directory to use with the Sun StorEdge or Legato backup software:

icsasm

Calendar Server Application Specific Module (ASM). An ASM is a program that can be invoked by the Sun StorEdge or Legato backup software to back up and restore data.

legbackup.sh

Script that calls the csbackup utility.

legrestore.sh

–Script that calls the csrestore utility.

ProcedureTo Back Up Calendar Data Using Sun StorEdge Enterprise Backup software or Legato Networker

To backup the calendar database using the Sun StorEdge or Legato backup software:

  1. Copy the Sun StorEdge or Legato nsrfile binary file to the /usr/lib/nsr directory.

  2. Create these symbolic links in the /usr/lib/nsr directory:


    icsasm -\> /opt/SUNWics5/cal/sbin/icsasm nsrfile -\> /usr/lib/nsr/nsrfile
  3. Change to the /opt/SUNWics5/cal/sbin directory and run the csbackup utility with the -l option. For example:


    cd /opt/SUNWics5/cal/sbin ./csbackup -l

    The -l option creates a backup directory image under the current directory. The files in this directory are empty and are used only to provide information to the backup program about how calendars will be stored on the backup media. If the backup directory already exists, it is synchronized with the current directory structure.

  4. Use the save command to back up calendar data. For example:


    /usr/bin/nsr/save -s /opt/SUNWics5/cal/sbin/budir

    You can also use the Sun StorEdge or Legato backup GUI to schedule backups by setting up a client save set to periodically backup the database.

    Notes Do not modify the .nsr files. These generated files contain directives that are interpreted by the save command and the icsasm command during the backup process.

    Calendar Server does not support the incremental backup feature. Do not use this feature because the backup directory is only an image of the folder structure and contains no actual data.

    You cannot backup a calendar with a name that contains non-ASCII characters or the forward slash (/).

  5. Automate the backup procedure.

    The preceding steps describe how to run a backup manually. Set up the backup program’s backup command to run the Calendar Server csbackup command-line utility before the running the backup program’s save command to achieve an automated backup process.

ProcedureTo Restore Calendar Data Using Sun StorEdge Enterprise Backup Software or Legato Software

To restore calendar data:

  1. Use the Sun StorEdge Enterprise Backup software nwrestore feature or the recover command to restore backed-up calendar information.

    If you use nwrestore, you receive the message:


    "File already exists. Do you want to overwrite, skip, backup, or rename?"
  2. Choose overwrite.

    This message appears because the backup tree is just the directory hierarchy. That is, it consists of empty files and stays that way permanently.