
Installgen
Features and Benefits
Installgen
Demo Available for download...
Bookmark This Page

#! /usr/local/bin/perl
# script: 41_win_remove_oracle_1.pl
# Features: This perl script removes the directories,services and utilities
of
# oracle software installed as part.of the Oracle installation process.
#
# WARNING - This script is used for testing purposes only while testing
# installation scripts.
# Script Sequence#: 41
# Used By: run manually as Administrator
# Copyright 2002 by .com Solutions Inc.
#
# ---------------------- Revision History ---------------
# Date By Changes
# 12-06-2001 dsimpson Initial Release
# 12-17-2001 dsimpson Added removal of Oracle Services
# 12-25-2001 dsimpson Corrected Services names, added removal of
# OLAP, and SNMP Services.
# 12-26-2001 dsimpson Added moving of oraclient9.dll and ociw32.dll
files,
# removal of OraInventory files.
# 12-28-2001 dsimpson Added use of orahome_name variable
# 08-08-2002 dsimpson Added note about Oracle registry entries needing
# removed manually.
# Added removal of Oracle OLAP and Agent services.
# Added removal of OracleMTSRecoveryService.
# Commented out removal of MinGW since it is no longer
# being installed.
# This output file was created by Installgen version 1.1.6 on Fri Aug
23 17:38:09 2002. By .com Solutions Inc. www.dotcomsolutionsinc.net
use strict;
use File::Path;
use Win32::Lanman;
use Win32::AdminMisc;
# list of program and command line parameters to execute via operating
system
my @proglist='';
# list of files to delete
my @filelist='';
my $answer='';
# make sure the Administrator user is running this script
my ($login_name) = Win32::LoginName;
if ($login_name ne "Administrator")
{
# the user running this script is not Administrator - exit
print "You must be logged in as the Administrator user to run this script,
exiting....";
# exit immediately!
die
}
print "\n\n";
print "Make sure that this script is not running from one of the\n";
print "directories which is about to be removed.\n";
print "\n\n";
print "Press the return key to continue.\n";
print "\n\n";
$answer = ;
#print "\n\n";
#print "Remove MinGW (gcc compiler for Windows)?(y/n)\n";
#print "\n\n";
#$answer = ;
#if ($answer eq "y" )
# {
# remove MinGW (gcc compiler for Windows)
# print "\n\n";
# print "Removing MinGW (gcc compiler for Windows)...\n";
# print "\n\n";
# remove MinGW (gcc compiler for Windows)
# rmtree ("c:\mingw",1,1);
# }
print "\n\n";
print "Remove Perl?(y/n)\n";
print "\n\n";
$answer = ;
if ($answer eq "y" )
{
# remove perl
print "\n\n";
print "Open the Control Panel, double-click on the Add/Remove programs
icon\n";
print "to remove Perl. \n";
print "\n";
print "Please press the Return key to continue.\n";
print "\n\n";
$answer = ;
}
print "\n\n";
print "Remove oracle directory and everything else?(y/n)\n";
print "\n\n";
$answer = ;
if ($answer eq "y" )
{
print "\n\n";
print "Kill all Oracle processes, then press the return key.\n";
print "(If all directories are not removed, restart the server and )\n";
print "(run this script again.)\n";
print "\n\n";
$answer = ;
print "\n\n";
print "Removing Oracle Home, c:\server_scripts...\n";
print "\n\n";
# remove the Oracle data directories and files
File::Path::rmtree ("c:\u01",1,1);
File::Path::rmtree ("c:\u02",1,1);
File::Path::rmtree ("c:\u03",1,1);
# remove the Oracle /backup and /archive directories and files
File::Path::rmtree ("c:\backup",1,1);
File::Path::rmtree ("c:\archive",1,1);
# move oraclient9.dll and ociw32.dll to allow removing Oracle Home
rename("c:\\v901\\bin\\oraclient9.dll","c:\\old-oraclient9.dll");
rename("c:\\v901\\bin\\ociw32.dll","c:\\old-ociw32.dll");
# remove the Oracle Home directory and files
File::Path::rmtree ("c:\v901 rmtree2",1,1);
# remove the server_scripts directory and files
File::Path::rmtree ("c:\\server_scripts\\",1,1);
# remove the Oracle directory and files
File::Path::rmtree ("c:\\oracle",1,1);
# remove the udump directory and files
File::Path::rmtree ("c:\\u01\\udump\\",1,1);
# remove the cdump directory and files
File::Path::rmtree ("c:\\u01\\cdump\\",1,1);
# remove the bdump directory and files
File::Path::rmtree ("c:\\u01\\bdump\\",1,1);
}
print "\n\n";
print "Remove c:\\Program Files\\Oracle\\Inventory directories?(y/n)\n";
print "\n\n";
$answer = ;
if ($answer eq "y" )
{
# remove OraInventory directories
# remove the Inventory directory and files
File::Path::rmtree ("c:\\Program Files\\Oracle\\Inventory",1,1);
File::Path::rmtree ("c:\\Program Files\\Oracle\\oraconfig",1,1);
File::Path::rmtree ("c:\\Program Files\\Oracle\\oui",1,1);
}
print "\n\n";
print "Remove the following Oracle Services?(y/n)\n";
print "Oraclev9012Agent\n";
print "Oraclev9012ClientCache\n";
print "Oraclev9012CMAdmin\n";
print "Oraclev9012CMan\n";
print "Oraclev9012DataGatherer\n";
print "Oraclev9012HTTPServer\n";
print "Oraclev9012ManagementServer\n";
print "Oraclev9012PagingServer\n";
print "Oraclev9012TNSListener\n";
print "Oracle OLAP 9.0.1.0.1\n";
print "Oraclev9012SNMPPeerEncapsulator\n";
print "Oraclev9012SNMPPeerMasterAgent\n";
print "OracleServicePROD3\n";
print "OracleRotateAlertLogPROD3\n";
print "OracleMTSRecoveryService\n";
$answer = ;
chop($answer);
if ($answer eq "y" )
{
print "\n\n";
print "Removing Oracle Services... \n";
print "\n\n";
# stop each service - before removing
Win32::Lanman::StopService('','',"Oraclev9012Agent");
Win32::Lanman::StopService('','',"Oraclev9012ClientCache");
Win32::Lanman::StopService('','',"Oraclev9012CMAdmin");
Win32::Lanman::StopService('','',"Oraclev9012CMan");
Win32::Lanman::StopService('','',"Oraclev9012DataGatherer");
Win32::Lanman::StopService('','',"Oraclev9012HTTPServer");
Win32::Lanman::StopService('','',"Oraclev9012ManagementServer");
Win32::Lanman::StopService('','',"Oraclev9012PagingServer");
Win32::Lanman::StopService('','',"Oraclev9012TNSListener");
Win32::Lanman::StopService('','',"Oraclev9012SNMPPeerEncapsulator");
Win32::Lanman::StopService('','',"Oraclev9012SNMPPeerMasterAgent");
Win32::Lanman::StopService('','',"OracleServicePROD3");
Win32::Lanman::StopService('','',"OracleRotateAlertLogPROD3");
Win32::Lanman::StopService('','',"Oracle OLAP 9.0.1.0.1");
Win32::Lanman::StopService('','',"Oracle OLAP Agent");
Win32::Lanman::StopService('','',"OracleMTSRecoveryService");
# remove each service
Win32::Lanman::DeleteService('','',"Oraclev9012Agent");
Win32::Lanman::DeleteService('','',"Oraclev9012ClientCache");
Win32::Lanman::DeleteService('','',"Oraclev9012CMAdmin");
Win32::Lanman::DeleteService('','',"Oraclev9012CMan");
Win32::Lanman::DeleteService('','',"Oraclev9012DataGatherer");
Win32::Lanman::DeleteService('','',"Oraclev9012HTTPServer");
Win32::Lanman::DeleteService('','',"Oraclev9012ManagementServer");
Win32::Lanman::DeleteService('','',"Oraclev9012PagingServer");
Win32::Lanman::DeleteService('','',"Oraclev9012TNSListener");
Win32::Lanman::DeleteService('','',"Oraclev9012SNMPPeerEncapsulator");
Win32::Lanman::DeleteService('','',"Oraclev9012SNMPPeerMasterAgent");
Win32::Lanman::DeleteService('','',"OracleServicePROD3");
Win32::Lanman::DeleteService('','',"OracleRotateAlertLogPROD3");
Win32::Lanman::DeleteService('','',"Oracle OLAP 9.0.1.0.1");
Win32::Lanman::DeleteService('','',"Oracle OLAP Agent");
Win32::Lanman::DeleteService('','',"OracleMTSRecoveryService");
}
File::Path::rmtree ("c:\backup",1,1);
File::Path::rmtree ("c:\archive",1,1);
# move oraclient9.dll and ociw32.dll to allow removing Oracle Home
rename("c:\\v901\\bin\\oraclient9.dll","c:\\old-oraclient9.dll");
rename("c:\\v901\\bin\\ociw32.dll","c:\\old-ociw32.dll");
# remove Environment Variables
Win32::AdminMisc::DelEnvVar("ORACLE_SID","ENV_SYSTEM",10);
Win32::AdminMisc::DelEnvVar("OLAP_HOME","ENV_SYSTEM",10);
print "\n\n";
print "Please check to determine whether the following directories have
been removed:\n";
print "\n";
print "c:\\Program Files\\Oracle\\Inventory\n";
print "c:\\Program Files\\Oracle\\oraconfig\n";
print "c:\\Program Files\\Oracle\\oui\n";
print "c:\\u01\\bdump\\\n";
print "c:\\u01\\cdump\\\n";
print "c:\\u01\\udump\\\n";
print "c:\\oracle\n";
print "c:\\server_scripts\\\n";
print "c:\\v901\n";
print "c:\\old-ociw32.dll\n";
print "c:\\old-oraclient9.dll\n";
print "Oracle registry entries for Oracle Home: c:\\v901\n";
print "\n";
print "Remove any of the above items manually if needed.\n";
print "\n";
print "Please press the return key to continue.\n";
print "\n\n";
$answer = ;
print "\n";
print "Note: Oracle registry entries under\n";
print "HKEY_LOCAL_MACHINE/Software/ORACLE have not\n";
print "been removed. These entries may be removed manually\n";
print "with regedit.\n";
print "\n";
print "Please press the return key to continue.\n";
print "\n\n";
$answer = ;

