#!/bin/sh
echo > done.out
for line in `cat data.txt`; do
echo
echo "#++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
user=`echo $line | awk -F':' '{print $1}'`
dir='/ftp/ccsftp/'`echo $line | awk -F':' '{print $2}'`
passwd=`mkpasswd -l 8 -d 2 -C 2 -s 0`
echo $user : $dir : $passwd >> done.out
echo useradd -g ccsftp -d $dir -s /usr/bin/rssh $user
echo "echo $passwd | passwd --stdin $user"
echo "pure-pw useradd $user -u 518 -g 519 -d ${dir} -N 4000"
echo "pure-pw usermod $user -d ${dir}"
echo "chown 518:519 ${dir}"
echo pure-pw mkdb
echo "#++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo
done
-
-
http://oracle.3dub.com/scripts/tcpdump.sh.txt
-
http://oracle.3dub.com/flex_function.sh.txt
-
#!/bin/bash # parmanand.patram; 2010-12-11 # create a single page to show all db /fra usage across the environment # SETUP LOGSDIR=/bb/bbvar/logs OUTFILE=/usr/local/bb/www/allfra/allfra.html TMPFILE=/usr/local/bb/www/allfra/fralines.tmp WORKDIR=/usr/local/bb/www/allfra cd $LOGSDIR #cleanup rm -f ${OUTFILE}* for file in `find . -name "*.disk" | sort`; do grep -i fra $file > $TMPFILE if [ -s "$TMPFILE" ]; then SERVER=`echo $file | sed 's/^..//' | awk -F'.' '{print $1}' | awk -F',' '{print $1}'` while read line do COLOR="green" #color the red ones if [ ! -z "`echo $line | grep -i '\&red'`" ]; then COLOR="red" echo "
' >> ${OUTFILE}.${SERVER}.red elif [ ! -z "`echo $line | grep -i '\&yellow'`" ]; then COLOR="yellow" echo "$SERVER $line " >> ${OUTFILE}.${SERVER}.red echo '
' >> ${OUTFILE}.${SERVER}.yellow else echo "$SERVER $line " >> ${OUTFILE}.${SERVER}.yellow echo '
' >> ${OUTFILE}.${SERVER}.green fi done < $TMPFILE fi done echo "$SERVER $line " >> ${OUTFILE}.${SERVER}.green echo '" > $OUTFILE # show red cd $WORKDIR for i in `ls *.red` do cat $i >> $OUTFILE done # show yellow cd $WORKDIR for i in `ls *.yellow` do cat $i >> $OUTFILE done #show green for i in `ls *.green` do cat $i >> $OUTFILE done echo "
" >> $OUTFILE -
#!/bin/sh # # $Revision: 1 # $Date: 11/09/2010 # $Author: Parm Patram # $Description: This scripts outputs the list of oracle databases to BBDISPLAY # $Instructions: Modify the variables BBHOME, LOG_HIST_COUNT and WARNCOLOR # to match your system and monitoring requirements. # # Shamelessly stolen from the bb-who.sh script # Add to the clients in $BBHOME/etc/bb-bbexttab like so: # localhost: : bb-which_dbs.sh # # Uncomment the line below to run manually # #DEBUG="Y" # # INITIALIZE VARIABLES WE'LL BE NEEDING # TEST="DBS" # THE NAME OF OUR TEST CHANGE_COLOR="red" # Color to turn when new DB is found # When we find a new DB on the system, how long aferwards # should we continue to holler? DELAY_COUNT=5 if test "$DEBUG" = "Y" then echo "*** DEBUG NOT IMPLEMENTED! ***" fi ################################################################# # # NO CONFIGURATION BEYOND THIS POINT # ################################################################# # # Check that we have a basic environment setup # if test "$BBHOME" = "" then echo ERROR: BBHOME variable not set exit 1 fi if test ! "$BBTMP" # GET DEFINITIONS IF NEEDED then # echo "*** LOADING BBDEF ***" . $BBHOME/etc/bbdef.sh # INCLUDE STANDARD DEFINITIONS fi # # Initialization line # MACHINE=`hostname | $SED 's/\./,/g'` COLOR="green" DATE=`date` SENDFILE=$BBTMP/$TEST TESTFILE=$BBTMP/${TEST}.test COUNTFILE=$BBTMP/${TEST}.count COUNT=`/bin/cat $COUNTFILE` NEWDBS=$BBTMP/${TEST}.new MISSDBS=$BBTMP/${TEST}.missing /bin/ps -ef | /bin/grep ora_smon| /bin/grep -v grep | /bin/awk -F'_' '{print $3}'|sort| sed 's/^/DB:/' > $TESTFILE # make sure we have a SENDFILE, newfile and missing file touch $SENDFILE $NEWDBS $MISSDBS # send stderr to DBCHANGES to cater for any errors or # for when the thing first starts up. DBCHANGES=`/usr/bin/diff $SENDFILE $TESTFILE 2>&1` # See if there are any changes in the list of DBs if [ ! -z "$DBCHANGES" ]; then echo "Changes!" echo $DBCHANGES # increment the counts echo "Current count: $COUNT" let COUNT=$COUNT+1 echo $COUNT > $COUNTFILE echo "New count: `/bin/cat $COUNTFILE`" # Let's see if it is time to stop hollering! if [ "$COUNT" -gt "$DELAY_COUNT" ]; then echo "COUNT $COUNT exceeds treshold $DELAY_COUNT" # update our sendfile /bin/cp -f $TESTFILE $SENDFILE # zero out the count echo 0 > $COUNTFILE # stop hollering COLOR="green" else # we are still in alarm mode, identify the new and/or missing DBs # generate new db list echo "NEW DATABASES ON SYSTEM:" > $NEWDBS /usr/bin/diff $SENDFILE $TESTFILE | /bin/grep ^\> | awk -F':' '{print $2}' >> $NEWDBS echo "++++++++++++++++++++++++++++++" >> $NEWDBS # generate missing db list echo "DATABASES MISSING FROM SYSTEM:" > $MISSDBS /usr/bin/diff $SENDFILE $TESTFILE | /bin/grep ^\< | awk -F':' '{print $2}' >> $MISSDBS echo "++++++++++++++++++++++++++++++" >> $MISSDBS echo "NEW: "; cat $NEWDBS echo "MISSING: "; cat $MISSDBS # check to see if the new and missing files are more than 2 lines # long (header and footer) if [ "`wc -l $MISSDBS | awk '{print $1}'`" -gt "2" ]; then COLOR="yellow" else #null the missing file cat /dev/null > $MISSDBS fi if [ "`wc -l $NEWDBS | awk '{print $1}'`" -gt "2" ]; then COLOR="red" else #null the new file cat /dev/null > $NEWDBS fi fi fi CMD_OUT="status $MACHINE.$TEST $COLOR $DATE CURRENT DBS: `/bin/cat $TESTFILE` ++++++++++++++++++++++++++++++++ `/bin/cat $NEWDBS` `/bin/cat $MISSDBS` " # # Send a status update to the Big Brother display unit # # # Debugging # if test "$DEBUG" = "Y" then echo "COLOR = ${COLOR}" `cat $BBTMP/$TEST` echo $CMD_OUT else echo $BB $BBDISP "$CMD_OUT" # SEND IT TO BBDISPLAY echo $BB $BBDISP "$CMD_OUT" >> /tmp/bb-which_dbs.out fi # cleanup section # /bin/rm -f $NEWDBS $MISSDBS # # END OF bb-which_dbs.sh # -
#!/bin/sh # # parmanand patram; 2010-11-25 # find and clear faulted VCS resource # # This script takes a list of VCS resource groups # and clears any FAULTED states in the cluster. # ex. # clear_VCS_faulted.sh 'GROUP1 GROUP2 ...' VCS_GROUPS=$1 VCS_BINPATH=/opt/VRTSvcs/bin for VCS_GROUP in ${VCS_GROUPS} do # hares will show all resources of this group that are faulted # but we will only need to clear based on the unique hostname for SYS in `${VCS_BINPATH}/hares -display -group ${VCS_GROUP} -attribute State | grep FAULTED | awk '{print $3}' | sort | uniq` do #echo ${VCS_BINPATH}/hares -display -group ${VCS_GROUP} -attribute State | grep FAULTED ${VCS_BINPATH}/hagrp -clear ${VCS_GROUP} -sys ${SYS} done done -
#!/bin/bash
#
# login to database and run a querySQL_HOME=WHERE
LOG_HOME=WHERE
SQL_USER=WHAT
SQL_PASS=WHAT
SQL_HOST=WHAT
SQL_DB=WHAT
SQL_PORT=1521
LOGFILE=${SQL_HOME}/output.logSQL_LOGIN_STR=”${SQL_HOME}/sqlplus -S ${SQL_USER}/${SQL_PASS}@${SQL_HOST}:${SQL_PORT}/${SQL_DB} ”
cd $SQL_HOME
RESULT=`${SQL_LOGIN_STR} << EOF
SET HEADING OFF
SELECT NAME FROM V\\$DATABASE;
exit;
EOF`if [ $RESULT == $SQL_DB ]; then
echo `date`”: OK: $RESULT” | sed ’s/\n//g’ >> $LOGFILE
else
echo `date`”: Got Error: $RESULT” | sed ’s/\n//g’ >> $LOGFILE
fi -
set pages 0
set long 999999
select dbms_metadata.get_ddl(’TABLE’, ‘EMP’, ‘SCOTT’) from dual;NOTE: all of the parameters must be uppercase or the query will fail.
Category:
- Administration
- APPS
- Articles
- Backup & Recovery
- Certification
- Configuration
- DATABASE STRUCTURE
- DATAGUARD
- Documentation
- EBS
- Enterprise Manager
- FLASHBACK
- HACKING
- HEADS UP
- Installation
- JDeveloper
- Linux
- Monitoring
- MQ
- NFS
- NXclient/server
- Online Resources
- PERL
- python
- RMAN
- Routing & Switching
- SAN – NAS
- Scripts
- Serial-Parallel-Port-Testers
- SNMP
- Software
- Solaris
- Spiritual
- SQL & PL/SQL
- SQLPLUS
- Startup/Shutdown
- Streams
- Tuning
- Version Control
- Vertias
- VMWare
- VNC
- Windows XP
- ZFS





