.com Solutions Inc. - logo  
Products - Header Buttons
.
Repgen bullet item 7b Installgen bullet item 7b FmPro Migratorbullet item 7b CGIScripter
.
.
.

.
.

Installgen - sol920 - Title Graphic

Installgen Features and Benefits

Installgen Demo Available for download...

Bookmark This Page

email a friend

.

#!/bin/sh
# script: /opt/server_scripts/rotateoraclefiles.sh
# Features: This shell script runs nightly via CRON job to remove/rotate Oracle files.
#
# Script Sequence#: 13
# ******** Rotate Server logs nightly at 11:55PM ********
# 55 23 * * 0-6 /opt/server_scripts/rotateoraclefiles.sh
# Used By: run automatically via CRON
# Copyright 2002 by .com Solutions Inc.
#
# ---------------------- Revision History ---------------
# Date By Changes
# 9-27-2001 dsimpson Initial Release
# 9-30-2001 dsimpson Added use of environment variables for paths
# 10-01-2002 dsimpson Replaced rotation of dbsnmpc.log and dbsnmpw.log
# files with dbsnmp.log files (for Oracle 9i).
# Added rotation of agntsrvc.log file rotation.
# Added stopping of intelligent agent and stopping only the listener
# logging (without stopping the listener itself) during log
# rotations.
# Added rotation of Oracle Agent.nohup file.

# This output file was created by Installgen version 1.38 on Sun Nov 10 14:20:50 2002. By .com Solutions Inc. www.dotcomsolutionsinc.net

# Note: The variables defined below must be used because CRON starts up early
# in the startup process of the system and will not generally have access to
# the environment variables defined in /etc/profile.
ORACLE_BASE=/u01/v901
ORACLE_HOME=/u01/v901
ORACLE_OWNER=oracle
ORACLE_OWNER_PATH=/export/oracle
ORACLE_GROUP=dba
ORACLE_HOME=/u01/v901
ORACLE_SID=prod1
LD_LIBRARY_PATH=/u01/v901/lib:/u01/v901/lib64:/usr/dt/lib
CLASSPATH=$ORACLE_HOME/jdbc/lib/classes111.zip
ORAENV_ASK=NO
TNS_ADMIN=$ORACLE_HOME/network/admin
PATH=/usr/sbin/:/bin:/usr/bin:/usr/ccs/bin:/usr/ucb/bin:/usr/ucb:/usr/openwin/bin:/usr/dt/bin:/usr/local/bin:/opt/bin:/usr/opt/SUNWmd/sbin:/usr/platform/sun4u/sbin:/opt/sfw/bin:.:/usr/local/sbin:/u01/v901/bin
TERM=vt100
NLS_LANG=AMERICAN_AMERICA.US7ASCII

export ORACLE_OWNER ORACLE_OWNER_PATH ORACLE_GROUP ORACLE_HOME ORACLE_SID ORA_BDUMP_DIR LD_LIBRARY_PATH PATH ORAENV_ASK TNS_ADMIN TERM NLS_LANG


ORA_BACKUP_DIR=/backup
ORA_ARCHIVE_DIR=/archive
ORA_BDUMP_DIR=/u01/bdump
ORA_CDUMP_DIR=/u01/cdump
ORA_UDUMP_DIR=/u01/udump

export ORA_BACKUP_DIR ORA_ARCHIVE_DIR ORA_BDUMP_DIR ORA_CDUMP_DIR ORA_UDUMP_DIR

# Remove ASET report files after 7 days
#find /usr/aset/reports -mtime +7 -exec rm -R {} \;

# Remove old Oracle backup files in /backup directory after 7 days
find $ORA_BACKUP_DIR -mtime +7 -exec rm {} \;

# Remove old Oracle archivelog files in /archive directory after 7 days
# There should only be current archivelog files for today if backups are working correctly
find $ORA_ARCHIVE_DIR -mtime +7 -exec rm {} \;

# Remove Oracle bdump,cdump,udump files after 7 days
find $ORA_BDUMP_DIR -mtime +7 -exec rm {} \;
find $ORA_UDUMP_DIR -mtime +7 -exec rm {} \;
find $ORA_CDUMP_DIR -mtime +7 -exec rm -R {} \;

# turn off listener logging while rotating log file
$ORACLE_HOME/bin/lsnrctl set log_status off

# stop the intelligent agent while rotating log file
$ORACLE_HOME/bin/agentctl stop

# Rotate the Oracle listener.log log file nightly
LOG=listener.log
cd $ORACLE_HOME/network/log
test -f $LOG.5 && mv $LOG.5 $LOG.6
test -f $LOG.4 && mv $LOG.4 $LOG.5
test -f $LOG.3 && mv $LOG.3 $LOG.4
test -f $LOG.2 && mv $LOG.2 $LOG.3
test -f $LOG.1 && mv $LOG.1 $LOG.2
test -f $LOG.0 && mv $LOG.0 $LOG.1
mv $LOG $LOG.0

# Rotate the Oracle dbsnmp.log log file nightly
LOG=dbsnmp.log
cd $ORACLE_HOME/network/log
test -f $LOG.5 && mv $LOG.5 $LOG.6
test -f $LOG.4 && mv $LOG.4 $LOG.5
test -f $LOG.3 && mv $LOG.3 $LOG.4
test -f $LOG.2 && mv $LOG.2 $LOG.3
test -f $LOG.1 && mv $LOG.1 $LOG.2
test -f $LOG.0 && mv $LOG.0 $LOG.1
mv $LOG $LOG.0

# Rotate the Oracle agntsrvc.log log file nightly
LOG=agntsrvc.log
cd $ORACLE_HOME/network/log
test -f $LOG.5 && mv $LOG.5 $LOG.6
test -f $LOG.4 && mv $LOG.4 $LOG.5
test -f $LOG.3 && mv $LOG.3 $LOG.4
test -f $LOG.2 && mv $LOG.2 $LOG.3
test -f $LOG.1 && mv $LOG.1 $LOG.2
test -f $LOG.0 && mv $LOG.0 $LOG.1
mv $LOG $LOG.0

# Rotate the Oracle agntsrvc.nohup log file nightly
LOG=agntsrvc.nohup
cd $ORACLE_HOME/network/log
test -f $LOG.5 && mv $LOG.5 $LOG.6
test -f $LOG.4 && mv $LOG.4 $LOG.5
test -f $LOG.3 && mv $LOG.3 $LOG.4
test -f $LOG.2 && mv $LOG.2 $LOG.3
test -f $LOG.1 && mv $LOG.1 $LOG.2
test -f $LOG.0 && mv $LOG.0 $LOG.1
mv $LOG $LOG.0

# Rotate the Oracle nmiconf.log log file nightly
LOG=nmiconf.log
cd $ORACLE_HOME/network/log
test -f $LOG.5 && mv $LOG.5 $LOG.6
test -f $LOG.4 && mv $LOG.4 $LOG.5
test -f $LOG.3 && mv $LOG.3 $LOG.4
test -f $LOG.2 && mv $LOG.2 $LOG.3
test -f $LOG.1 && mv $LOG.1 $LOG.2
test -f $LOG.0 && mv $LOG.0 $LOG.1
mv $LOG $LOG.0

# Rotate the Oracle sqlnet.log log file nightly
LOG=sqlnet.log
cd $ORACLE_HOME/network/log
test -f $LOG.5 && mv $LOG.5 $LOG.6
test -f $LOG.4 && mv $LOG.4 $LOG.5
test -f $LOG.3 && mv $LOG.3 $LOG.4
test -f $LOG.2 && mv $LOG.2 $LOG.3
test -f $LOG.1 && mv $LOG.1 $LOG.2
test -f $LOG.0 && mv $LOG.0 $LOG.1
mv $LOG $LOG.0

# turn on listener logging
$ORACLE_HOME/bin/lsnrctl set log_status on

# re-start intelligent agent
$ORACLE_HOME/bin/agentctl start



.

hline

. .

.

. .
 

Home | Products | Services | Downloads | Order | Support | Contact

Legal Notices

.
.   .
.
Home Products Services Downloads Order Support Contact