Politics and Technology.

Wednesday, August 15, 2007

RHN Satellite Server Tasks

In playing with the Satellite server in preparation of my "formal" training with Red Hat, I've come across several nuggets worth mentioning.

First, the nightly tasks of sync'ing and saving.

For sync'ing the server, I have a cronjob that runs each night. This is right from the Satellite server's manual.

# Randomly sync the server's channels
0 23 * * * perl -le 'sleep rand 9000' && satellite-sync --email >/dev/null 2>/dev/null


Backing up the server is a little more involved. I wrote a short script called rhndb-backup.sh that gets executed through cron. Again, the manual from Red Hat is really handy here. They key to this script is the use of "db-control" that comes with the oracle install from Red Hat.

#!/bin/bash
# dump a copy of the Satellite DB into /opt/dj-dbbackup
# v1.0
# JBC 20070226
# v1.1
# Fixed db-control typo
# Added echos and date stamps

# JBC 20070227

/bin/echo "Starting DB backup process"

/bin/date
/sbin/service rhn-satellite stop
/bin/echo "Executing db-control backup script"

su --shell=/bin/bash - oracle -c "/usr/bin/db-control backup /opt/dj-dbbackup"

/sbin/service rhn-satellite start

su --shell=/bin/bash - oracle -c "/usr/bin/db-control report"
/bin/echo "Ending DB backup process"
/bin/date

Here's the cron entry. I keep a commented out entry that would email me the output in case I need to debug an ongoing issue. The important output comes from the report command sent to db-control. It's key in telling you if the DB's are filling up.

# Do a dump of the oracle DB of the Satellite server so that
# legato captures it for backing it up.

#0 6 * * * /usr/local/sbin/rhndb-backup.sh | /bin/mail -s "Nightly Satellite DB dump" jason.consorti@dowjones.com

0 6 * * * /usr/local/sbin/rhndb-backup.sh >/dev/null 2>/dev/null


A daily Legato backup takes care of dumping the DB dump to tape.

When I do find the tables in the Oracle Database filling up, following the manual's instructions, I extend the space.

[root@sbkrhelsatp01 ~]# su --shell=/bin/bash - oracle -c "/usr/bin/db-control report"
Tablespace Size Used Avail Use%

DATA_TBS 5.3G 5G 372.8M 93%

SYSTEM 250M 115.8M 134.1M 46%

TOOLS 128M 3M 124.9M 2%

UNDO_TBS 1000M 512.1M 487.8M 51%

USERS 128M 64K 127.9M 0%

[root@sbkrhelsatp01 ~]# su --shell=/bin/bash - oracle -c "/usr/bin/
db-control extend DATA_TBS"
Extending DATA_TBS... done.
[root@sbkrhelsatp01 ~]# su --shell=/bin/bash - oracle -c "/usr/bin/db-control report"
Tablespace Size Used Avail Use%

DATA_TBS 5.8G 5G 872.7M 85%

SYSTEM 250M 115.8M 134.1M 46%

TOOLS 128M 3M 124.9M 2%

UNDO_TBS 1000M 512.1M 487.8M 51%

USERS 128M 64K 127.9M 0%

[root@sbkrhelsatp01 ~]#

I look forward to learning more at the class!

1 comment:

Dan said...

WTF? Your blogs suck. Go back to night school, buddy.