Calendar Server keeps many database files in multiple directories. You must protect your database files either by implementing the automatic back up process described in Chapter 10, Configuring Automatic Backups (csstored), or by implementing your own system of backups. You can administer the database files using the csdb utility.
This chapter describes how to manage Calendar Server databases using csdb, and includes the following sections:
To administer database files, use the Calendar Server utility csdb. This section contains topics:
The calendar database utility csdb treats the database files as three logical databases:
The caldb consists of all the .db files and the _db.*files found in the database directory. The following is the default location for the calendar database files (as well as the cld_cache and ldap_cache subdirectories):
/var/opt/SUNWics5/csdb
If you prefer, you can specify a different directory when running the Calendar Server configuration program (csconfigurator.sh). For information about the configuration program, refer to Chapter 3, Calendar Server Configuration Program (csconfigurator.sh)
The following table describes the calendar database (caldb) files:
Table 16–1 Calendar Server Database Files
File |
Description |
---|---|
ics50calprops.db |
Calendar properties for all calendars. Includes the calendar ID (calid), calendar name, Access Control List (ACL), and owner. |
ics50events.db |
Events for all calendars. |
ics50todos.db |
Todos (tasks) for all calendars. |
ics50alarms.db |
Alarms for all events and todos (tasks). |
ics50gse.db |
Queue of scheduling requests for the group scheduling engine (GSE). |
ics50journals.db |
Journals for calendars. Journals are not implemented in the current release. |
ics50caldb.conf |
Database version identifier. |
ics50recurring.db |
Recurring events. |
ics50deletelog.db |
Deleted events and todos (tasks). See also Chapter 18, Administering the Delete Log Database |
The session database consists of all files located in the following directories: /opt/SUNWics5/cal/lib/admin/session/ and /opt/SUNWics5/cal/lib/http/session/
The statistical database consists of all files found in the counter directory:
/opt/SUNWics5/cal/lib/counter/
The csdb utility -t option allows you to specify a target database:
-t caldb – calendar database
-t sessdb – session database
-t statdb – statistics database
If you do not include the -t option, csdb operates on all three databases, except for check and rebuild which operate only on the calendar database.
This section describes how to use the csdb utility to perform the following administrative tasks:
To run the csdb utility, you must log in as a user who has administrative rights to the system where Calendar Server is running. For more information, see Appendix D, Calendar Server Command-Line Utilities Reference.
To view the status of a database group (caldb, sessdb, statdb), use the csdb utility list command.
To list database status:
Log in as a user who has administration rights to the system where Calendar Server is installed.
Calendar Server can be either running or stopped; however, if possible, stop Calendar Server.
Change to the /sbin directory. For example, on Solaris Operating Systems, enter:
cd /opt/SUNWics5/cal/sbin |
Run the list command against one or all of the database groups. For example, to list the status and statistics for all three database groups:
./csdb list
The code that follows shows sample output:
Sleepycat Software: Berkeley DB 4.1.25: (December 19, 2002) Calendar database version: 3.0.0 [BerkeleyDB] Total database size in bytes: 57344 Session database version: 1.0.0 [BerkeleyDB] Total database size in bytes: 0 Counter database version: 1.0.0 [Memory Mapped Files] Total database size in bytes: 118792 |
Or, you can choose to use the verbose mode. For example:
./csdb -v list
The following sample code shows the verbose output:
Sleepycat Software: Berkeley DB 4.1.25: (December 19, 2002) Calendar database version: 3.0.0 [BerkeleyDB] Total database size in bytes: 57344 Total number of calendars: 2 Total number of events: 0 Total number of tasks: 0 Total number of alarms: 0 Total number of gse entries: 0 Total number of master component entries: 0 Total number of deletelog entries: 0 Total logfile size in bytes: 5779919 Session database version: 1.0.0 [BerkeleyDB] Total database size in bytes: 0 Total logfile size in bytes: 0 Counter database version: 1.0.0 [Memory Mapped Files] Total database size in bytes: 118792 |
Or, use the -t option to specify one target database group (caldb, sessdb, or statdb). For example, to view database status and statistics for only the calendar database:
csdb -t caldb list
Use the check command to scan for corruptions in the calendar database, including calendar properties (calprops) and events and todos (tasks). If the check command finds an inconsistency that cannot be resolved, it reports the situation in its output.
The check command does not check for corruption in the alarm or group scheduling engine (GSE) databases.
To check for database corruption:
Log in as a user who has administration rights to the system where Calendar Server is installed.
Calendar Server can be either running or stopped; however, if possible, stop Calendar Server.
Make a copy of your calendar database, if you haven’t already done so. Copy only the database (.db) files. You don’t need to copy any share (__db.*) or log (log.*) files.
Change to the cal_svr_base/SUNWics5/cal/sbin directory. For example, on Solaris Operating Systems, enter:
cd /opt/SUNWics5/cal/sbin |
Run the check command on the copy of your calendar database:
./csdb check dbdir \> /tmp/check.out 2\>&1 |
If you don’t specify dbdir, check uses the database in the current directory.
The check command can generate a lot of information, so consider redirecting all output, including stdout and stderr, to a file (as shown in the example).
When check has finished, review the output file.
If your database is corrupted, you can choose to replace it with your hot backup copy. Alternately, you can choose to try to rebuild the corrupted one by running the rebuild command.
To recover a damaged calendar database (caldb), use the csdb utility rebuild command. The rebuild command scans all of the calendar databases for corruption. If the rebuild command finds an inconsistency, it generates a rebuilt calendar database (.db files) in the cal_svr_base/SUNWics5/cal/sbin/rebuild_db directory.
The rebuild command can generate a lot of information, so consider redirecting all output, including stdout and stderr, to a file.
In the instructions that follow, the rebuild command does not rebuild the group scheduling engine (GSE) database.
To rebuild the calendar databases without the GSE database:
Log in as a user who has administration rights to the system where Calendar Server is installed.
Stop Calendar Server.
Make a copy of your calendar database, if you haven’t already done so. Copy the database (.db) files and the log (log.*) files. You don’t need to copy any share (__db.*) files.
Change to the cal_svr_base/SUNWics5/cal/sbin directory. For example, on Solaris Operating Systems, enter:
cd /opt/SUNWics5/cal/sbin |
If disk space is a problem for the sbin directory, run the rebuild command in a different directory.
Run the rebuild command on the copy of your calendar database:
./csdb rebuild /tmp/db /tmp/ |
If you don’t specify a database directory, rebuild uses the database in the current directory. In the preceding example, the /tmp/ parameter specifies the destination directory for the rebuilt database.
Always rebuild your calendar database using the latest backup copy.
However, if you have experienced a significant loss of data and you have periodically backed up your database and have more than one copy available, rebuild from the latest copy to the oldest one. (The only drawback is that calendar components that were deleted will reappear in the rebuilt database.)
For example, if you have three sets of backup calendar database files in directories db_0601, db_0615, and db_0629, run the rebuild command in the following sequence:
./csdb rebuild db_0629
Then check for corruption. If this backup copy is also corrupt, then run rebuild on the next backup copy.
./csdb rebuild db_0615
Then check for corruption. If this backup copy is also corrupt, then run rebuild on the next backup copy.
./csdb rebuild db_0601
... etc.
The rebuild command writes the rebuilt database to the cal_svr_base/SUNWics5/cal/sbin/rebuild_db directory.
When rebuild has finished, review the output in the rebuild.out file. If the rebuild was successful, the last line in the rebuild.out file should be:
Calendar database has been rebuilt |
After you have verified that rebuild was successful, copy the rebuilt database (.db) files from the rebuild_db directory to your production database.
If you have any share (__db.*) files from the corrupted database, move them to another directory.
Restart Calendar Server.
If you have implemented group scheduling at your site, then you should include the GSE database in the rebuild.
To rebuild both the calendar databases and the GSE database:
Determine if the GSE database has any entries by running the csschedule -v list command and then let the GSE finish processing the entries.
Log in as a user who has administration rights to the system where Calendar Server is installed.
Stop Calendar Server.
Make a copy of your calendar database, if you haven’t already done so.
Copy the database (.db) files and the log (log.*) files. You don’t need to copy any share (__db.*) files.
Change to the cal_svr_base/SUNWics5/cal/sbin directory.
For example, on Solaris Operating Systems, enter:
cd /opt/SUNWics5/cal/sbin
If disk space is a problem for the sbin directory, run the rebuild command in a different directory.
Run the rebuild command on the copy of your calendar database:
./csdb -g rebuild /tmp/db /tmp/
If you don’t specify a database directory, rebuild uses the database in the current directory. In the preceding example, the /tmp/ parameter specifies the destination directory for the rebuilt database.
Always rebuild your calendar database using the latest backup copy.
However, if you have experienced a significant loss of data and you have periodically backed up your database and have more than one copy available, rebuild from the latest copy to the oldest one. (The only drawback is that calendar components that were deleted will reappear in the rebuilt database.)
For example, if you have three sets of backup calendar database files in directories db_0601, db_0615, and db_0629, run the rebuild command in the following sequence:
./csdb rebuild db_0629 ./csdb rebuild db_0615 ./csdb rebuild db_0601 |
The rebuild command then writes the rebuilt database to the cal_svr_base/SUNWics5/cal/sbin/rebuild_db directory.
When rebuild has finished, review the output in the rebuild.out file.
If the rebuild was successful, the last line in the rebuild.out file should be:
Calendar database has been rebuilt |
After you have verified that rebuild was successful, copy the rebuilt database (.db) files from the rebuild_db directory to your production database.
If you have any share (__db.*) files from the corrupted database, move them to another directory.
Restart Calendar Server.
The sample output shows the events and the todos databases scanned twice each. This is not an error. It scans the first time to verify the information in the calprops database and then scans again to make sure calprops is accessible from the calendar database.
The following example shows the command and the output that it generated:
# ./csdb -g rebuild Building calprops based on component information. Please be patient, this may take a while... Scanning events database... 512 events scanned Scanning todos database... 34 todos scanned Scanning events database... 512 events scanned Scanning todos database... 34 todos scanned Scanning deletelog database... 15 deletelog entries scanned Scanning gse database... 21 gse entries scanned Scanning recurring database... 12 recurring entries scanned Successful components db scan Calendar database has been rebuilt Building components based on calprops information. Please be patient, this may take a while... Scanning calprops database to uncover events... 25 calendars scanned Scanning calprops database to uncover todos... 25 calendars scanned Successful calprops db scan Calendar database has been rebuilt |
To delete a calendar database, use the csdb utility delete command. Calendar Server must be stopped.
Use the -t option to specify the target database (caldb, sessdb, or statdb); otherwise, csdb deletes all three databases.
For example, to delete the calendar database:
csdb -t caldb delete
The csdb utility issues a warning before deleting the database.