
Installgen
Features and Benefits
Installgen
Demo Available for download...

#! /bin/sh
# script: 41_sol_remove_oracle_1.sh
# Features: This shell script removes the UNIX account and group which
# own the Oracle database software on the server along with all files.
# and directories of oracle software and utilities installed as part.
# of the installation process.
#
# WARNING - This script is used for testing purposes only while testing
# installation scripts.
# Script Sequence#: 41
# Used By: run manually as root
# Copyright 2002 by .com Solutions Inc.
#
# ---------------------- Revision History ---------------
# Date By Changes
# 9-25-2001 dsimpson Initial Release
# 5-10-2002 dsimpson Added removal of zlib and prngd
# as part of sshd removal.
# Added removal of coraenv, dbhome files.
# This output file was created by Installgen version 1.0.5 on Thu May 30 06:05:58 2002. By .com Solutions Inc. www.dotcomsolutionsinc.net
# make sure the root user is running this script
if [ ! $LOGNAME = "root" ]
then
# the user running this script is not root - exit
echo "You must be logged in as the root user to run this script, exiting...."
# exit immediately!
exit
fi
# remove Solaris8 utilities which may have been installed.
echo "Remove top?(y/n)"
read answer
if [ "$answer" = "y" ]
then
# remove top
echo "Removing top..."
/usr/sbin/pkgrm SMCtop
fi
echo "Remove less?(y/n)"
read answer
if [ "$answer" = "y" ]
then
# remove less
echo "Removing less..."
/usr/sbin/pkgrm SUNWless
/usr/sbin/pkgrm SMCless
# remove ncurses
echo "Removing ncurses..."
/usr/sbin/pkgrm SMCncurs
fi
echo "Remove gcc?(y/n)"
read answer
if [ "$answer" = "y" ]
then
# remove gcc
echo "Removing gcc..."
# remove gcc
/usr/sbin/pkgrm SMCgcc301
# remove gnu make
/usr/sbin/pkgrm SMCmake
# remove binutils
/usr/sbin/pkgrm SMCbinut
fi
echo "Remove Perl?(y/n)"
read answer
if [ "$answer" = "y" ]
then
# remove perl
echo "Removing perl..."
/usr/sbin/pkgrm SMCprl561
fi
echo "Remove secure shell?(y/n)"
read answer
if [ "$answer" = "y" ]
then
# remove secure shell
echo "Removing secure shell..."
# remove openssl
/usr/sbin/pkgrm SMCosslc
/usr/sbin/pkgrm SMCossh
/usr/sbin/pkgrm SMCzlib
/usr/sbin/pkgrm SMCprngd
rm /usr/local/etc/prngd/prngd-seed
rm -R /var/spool/prngd
# remove openssh
rm /usr/local/etc/ssh_host_key
rm /usr/local/etc/ssh_host_key.pub
rm /usr/local/etc/ssh_host_dsa_key
rm /usr/local/etc/ssh_host_dsa_key.pub
# remove symbolic link
rm /etc/rc3.d/S44sshd
# remove the actual file
rm /etc/init.d/sshd
rm /usr/local/sbin/sshd
fi
# remove symbolic link to dbora
rm /etc/rc3.d/S88dbora
# remove the actual file
rm /etc/init.d/dbora
# reinstall backup copies of /etc/ files
if [ -f "/etc/orig-vfstab" ]
then
echo "Restoring original /etc/vfstab file"
rm /etc/vfstab
mv /etc/orig-vfstab /etc/vfstab
fi
if [ -f "/etc/orig-defaultrouter" ]
then
echo "Restoring original /etc/defaultrouter file"
rm /etc/defaultrouter
mv /etc/orig-defaultrouter /etc/defaultrouter
fi
if [ -f "/etc/orig-hosts" ]
then
echo "Restoring original /etc/hosts file"
rm /etc/hosts
mv /etc/orig-hosts /etc/hosts
fi
if [ -f "/etc/orig-profile" ]
then
echo "Restoring original /etc/profile file"
rm /etc/profile
mv /etc/orig-profile /etc/profile
fi
if [ -f "/etc/orig-nsswitch.conf" ]
then
echo "Restoring original /etc/nsswitch.conf file"
rm /etc/nsswitch.conf
mv /etc/orig-nsswitch.conf /etc/nsswitch.conf
fi
if [ -f "/etc/orig-system" ]
then
echo "Restoring original /etc/system"
rm /etc/system
mv /etc/orig-system /etc/system
fi
echo "Remove oracle account and everything else?(y/n)"
read answer
if [ "$answer" = "y" ]
then
echo "Kill all oracle account processes, then press the return key."
read answer
echo "Removing oracle home, /opt/server_scripts, /var/opt/oracle and oracle user and dba group..."
# remove the Oracle data directories and files
rm -R /u01
# remove the Oracle /backup and /archive directories and files
rm -R /backup
rm -R /archive
# remove the Oracle Home directory and files
rm -R /u01/v901
# remove the server_scripts directory and files
rm -R /opt/server_scripts
# remove the /var/opt/oracle directory and files
rm -R /var/opt/oracle
# remove the Oracle UNIX account directory and files
rm -R /export/oracle
# remove the oracle UNIX account
/usr/sbin/userdel oracle
# remove the dba UNIX group
/usr/sbin/groupdel dba
# remove coraenv, dbhome variables
rm /usr/local/bin/coraenv
rm /usr/local/bin/dbhome
rm /usr/local/bin/oraenv
fi

