8.4. Using RHN DB Control

RHN Satellite Server with Embedded Database requires a utility for managing that database. Red Hat provides just such a tool: RHN DB Control. This command line utility allows you to do everything from make, verify, and restore backups to obtain database status and restart it when necessary. You must be the oracle user to invoke RHN DB Control. To begin, switch to the oracle user:

su - oracle

Next, issue the following command:

db-control option

8.4.1. DB Control Options

RHN DB Control offers many command line options. To use them, as oracle insert the option and the appropriate value, if needed, after the db-control command.

OptionDescription
helpLists these db-control options with additional details.
backup DIRNAMEBacks up the database to the directory specified.
examine DIRNAMEExamines the contents of a backup directory. Returns the timestamp of backup creation and reports on its contents.
extendIncrease the RHN Oracle tablespace
reportReports on current usage of database space.
restore DIRNAMERestores the database from backup kept in DIRNAME. Database must be stopped for this command to run successfully.
startStarts the database instance. This can also be accomplished by issuing the service rhn-database start command as root.
statusShows the current status of the database, either "running" or "offline".
stopStops the database instance. This can also be accomplished by issuing the service rhn-database stop command as root.
tablesizesShow space report for each table
verify DIRNAMEVerifies the contents of the backup kept in DIRNAME. This command checks the md5sums of each of the files kept in the backup.

Table 8-1. RHN DB Control Options

8.4.2. Backing up the Database

Red Hat recommends performing nightly backups of the Embedded Database and moving the resulting directory to another system via NFS, SCP, FTP, etc. Preferably, this backup system resides off-site. To conduct a backup, shut down the database and related services first by issuing the following command as root:

service rhn-satellite stop

Then switch to the oracle user and issue this command to initiate the backup:

db-control backup DIRNAME

Backup files are stored in the directory specified. Note that this is a cold backup; the database must be stopped before running this command. This process takes several minutes. The first backup is a good indicator of how long subsequent backups will take.

Once the backup is complete, return to root user mode and restart the database and related services with the following command:

service rhn-satellite start

You should then copy that backup to another system using rsync or another file-transfer utility. Red Hat strongly recommends scheduling the backup process automatically using cron jobs. For instance, back up the system at 3 a.m. and then copy the backup to the separate repository (partition, disk, or system) at 6 a.m.

8.4.3. Verifying the Backup

Backing up the Embedded Database is useful only if you can ensure the integrity of the resulting backup. RHN DB Control provides two methods for reviewing backups, one brief, one more detailed. To conduct a quick check of the backup's timestamp and determine any missing files, issue this command as oracle:

db-control examine DIRNAME

To conduct a more thorough review, including checking the md5sum of each of the files in the backup, issue this command as oracle:

db-control verify DIRNAME

8.4.4. Restoring the Database

RHN DB Control makes Embedded Database restoration a relatively simple process. As in the creation of backups, you will need to shut down the database and related services first by issuing the following commands in this order as root:

service rhn-satellite stop

Then switch to the oracle user and issue this command, including the directory containing the backup, to begin the restoration:

db-control restore DIRNAME

This not only restores the Embedded Database but first verifies the contents of the backup directory using md5sums. Once the restoration is complete, return to root user mode and restart the database and related services with these commands in this order:

service rhn-satellite start