NAVEEN

Wednesday, January 13, 2010

Remove Oracle from Linux

Standard Operating Procedure For Removing Oracle from UNIX


Procedure:
Completely remove 8i / 9i Database and Software from UNIX

Oracle Server - Enterprise Edition - Version: 8.1.7.4 to 9.2.0.7
HP-UX Itanium
AIX5L Based Systems (64-bit)
Red Hat Advanced Server
Linux Itanium
Red Hat Enterprise Linux Advanced Server Itanium
Red Hat Enterprise Linux Advanced Server x86-64 (AMD Opetron Architecture)
Solaris Operating System (SPARC 64-bit)
Linux x86
HP-UX PA-RISC (64-bit)
HP Tru64 UNIX
UnitedLinux (32-bit)

--- Identify all instances associated with the Oracle home.
--- Remove the Oracle Database.
--- Shut down processes.
--- Remove the Oracle software.
--- Cleanup OUI files (Optional).

Identifying All Instances

To identify all instances associated with the Oracle home that you want to remove; enter one of the following commands:

Solaris:
$ more /var/opt/oracle/oratab

Other operating systems:
$ more /etc/oratab

The output for this command contains entries similar to the following:
CUST:/u01/app/oracle/product/9.2.0:N

This entry shows CUST Oracle database instance are associated with the
/u01/app/oracle/product/9.2.0 Oracle Home Directory.





Remove an Oracle Database

To completely remove Oracle Database software, you must remove any installed databases.

To remove an Oracle database:
Note: Removing an Oracle database deletes all of the data in the database. If you want to keep this data, make sure that you back up the database before deleting it.
Log in as the oracle user:
$ su - oracle

Run the oraenv or coraenv script to set the environment for the database that you want to remove, for example:

Bourne, Bash, or Korn shell:
$ . /usr/local/bin/oraenv

C shell:
% source /usr/local/bin/coraenv

At the prompt, specify the SID for the database that you want to remove.
Start the Database Configuration Assistant (DBCA):

$ dbca (or dbassist for 8i)
-- Step 1 The Welcome window appears.
-- Step 2 Click Next.
-- Step 3 The Operations window appears.
-- Step 4 Select Delete a Database, and then click next.
-- Step 5 Select the database that you want to delete, then click Finish.
-- Step 6 In the window that appears, confirm that you want to delete the database.
-- Step 7 When the DBCA removes the database; you are prompted to choose whether you want to perform another operation.
-- Step 8 Click Yes to return to the Operations screen or click No to exit from DBCA.
If you want to remove another database, click Yes and repeat steps 6 to 8.

Shut down Processes

Stop any processes running in this Oracle home:
Process Name Command :
Database Control $ORACLE_HOME/bin/emctl stop dbconsole
Oracle Net listener $ORACLE_HOME/bin/lsnrctl stop
iSQL*Plus $ORACLE_HOME/bin/isqlplusctl stop
Ultra Search $ORACLE_HOME/bin/searchctl stop

To confirm that all processes have been stopped, use the following command as root:
# ps -ef | grep $ORACLE_HOME
Where $ORACLE_HOME above is the Oracle Home of the instance to be stopped.

If the above commands still return the running processes, kill the processes using the following command as root:
# kill -9 [pid]

Remove the Oracle software

Use the Oracle Universal Installer (OUI) to de-install the installation. The following steps describe how to use the Installer to remove Oracle software from an Oracle home:
Note: Always use the Oracle Universal Installer to remove Oracle software.
Do not delete any Oracle home directories without first using the Installer to remove the software.
log in as the oracle user:
$ su - oracle
Set ORACLE_HOME environment variable to specify the path of? Oracle home directory that you want to remove:

Bourne, Bash, or Korn shell:
$ ORACLE_HOME=/u01/app/oracle/product/9.2.0
$ export ORACLE_HOME

C shell:
% setenv ORACLE_HOME /u01/app/oracle/product/9.2.0

Start the Installer as follows:
-- $ORACLE_HOME/oui/bin/runInstaller
or cd /opt/oracle/oui/install
sh runInstaller.sh

--
-- In the Welcome window, click Deinstall Products.
-- The Inventory window appears, listing all of the Oracle homes on the system.
-- In the Inventory window, select the Oracle home and the products that you want to remove, then click Remove.
-- When the Installer displays a confirmation window asking you to confirm that you want to deinstall the products and their dependant components, click Yes.

The Installer displays a progress indicator as it removes the software. When the products have been deleted, click Cancel to exit from the Installer, then click Yes.

Manually remove the Oracle Home of the de-installed installation.
$ cd /u01/app/oracle/product/
$ rm -rf 9.2.0

Also, remove any reference to the Oracle Home from all environment variables.
Be sure to verify that any Oracle environment is not set in the .login or .profile, nor any other custom startup scripts.

Cleanup OUI files (Optional)

CAUTION: The following step should only be taken if no other Oracle products exists on the machine. Removing the following files and directories while other Oracle products exist, will result in ALL Oracle products on the system rendered unusable.

To identify all in Solaris:
$ more /var/opt/oracle/oraInst.loc

Other operating systems:
$ more /etc/oraInst.loc

inventory_loc=/u01/app/oracle/product/oraInventory
inst_group=oracle

$ cd /u01/app/oracle/product
$ rm -rf oui
$ rm -rf oraInventory
$ rm -rf jre

As user root do the following
# rm -rf /usr/local/bin/dbhome
# rm -rf /usr/local/bin/oraenv
# rm -rf /usr/local/bin/coraenv

Solaris:
# cd /var/opt/oracle
# rm -rf oracle

Other operating systems:
# rm -rf /etc/oratab
# rm -rf /etc/oraInst.loc


Completely remove 10g Database and Software from UNIX

Oracle Universal Installer - Version: 10.1.0.2 to 10.1.0.2
Oracle Server - Enterprise Edition - Version: 10.1.0.2 to 10.1.0.2
Solaris Operating System (SPARC 64-bit)
Linux x86
HP-UX PA-RISC (64-bit)
HP Tru64 UNIX
HP-UX Itanium
IBM S/390 Based Linux
AIX5L Based Systems (64-bit)
Red Hat Advanced Server
Linux Itanium
Red Hat Enterprise Linux Advanced Server

To completely remove all Oracle databases, instances, and software from an Oracle home directory, you must:

• Identify all instances associated with the Oracle home.
• Remove database and ASM instances.
• Shut down processes.
• Reconfigure the Oracle Cluster Synchronization Services Daemon, if necessary.
• Remove the Oracle software.

Identifying All Instances

To identify all instances associated with the Oracle home that you want to remove, enter one of the following commands:
Solaris:
$ more /var/opt/oracle/oratab
Other operating systems:
$ more /etc/oratab

The output for this command contains entries similar to the following:
+ASM:/u01/app/oracle/product/10.1.0/db_1:N
CUST:/u01/app/oracle/product/10.1.0/db_1:N

These entries show that the +ASM Automatic Storage Manager instance and the CUST Oracle database instance are associated with the /u01/app/oracle/product/10.1.0/db_1 Oracle home directory.

Removing an Oracle Database
To completely remove Oracle Database software, you must remove any installed databases. To remove an Oracle database:
Note: Removing an Oracle database deletes all of the data in the database. If you want to keep this data, make sure that you back up the database before deleting it.
Log in as the oracle user:
$ su - oracle

Run the oraenv or coraenv script to set the environment for the database that you want to remove, for example:
Bourne, Bash, or Korn shell:
$ . /usr/local/bin/oraenv
C shell:
% source /usr/local/bin/coraenv

At the prompt, specify the SID for the database that you want to remove.
Start the Database Configuration Assistant (DBCA):
$ dbca

The Welcome window appears.
Click Next.
The Operations window appears.
Select Delete a Database, then click Next.
Select the database that you want to delete, then click Finish.
In the window that appears, confirm that you want to delete the database.
When the DBCA removes the database, you are prompted to choose whether you want to perform another operation. Click Yes to return to the Operations screen or click No to exit from DBCA. If you want to remove another database, click Yes and repeat steps 6 to 8.

Removing an ASM Instance
To completely remove Oracle database software, you must also remove any ASM instances running in the Oracle home. To remove an ASM instance:
If necessary, log in as the oracle user:
$ su - oracle

Run the oraenv or coraenv script to set the environment for the ASM instance that you want to remove, for example:
Bourne, Bash, or Korn shell:
$ . /usr/local/bin/oraenv
C shell:
$ source /usr/local/bin/coraenv

At the prompt, specify the SID for the ASM instance that you want to remove.
Connect to the ASM instance as the SYS user:
$ sqlplus "SYS/SYS_PASSWORD AS SYSDBA"

Enter the following command to determine whether any Oracle database instance is using the ASM instance:

SQL> SELECT INSTANCE_NAME FROM V$ASM_CLIENT;

This command lists all of the database instances that are using this ASM instance.
Note: This command only lists database instances that are running. It is possible that other instances are associated with the ASM instance, but they are not currently running. If you removed a database from this Oracle home but the output from the command shows that this ASM instance is supporting a database instance in another Oracle home, do not remove the ASM instance or the Oracle home.

If there are no database instances associated with this ASM instance, drop the disk group associated with this instance as follows:
Note: Dropping the ASM disk group makes the disk device available for use with another ASM instance if required. However, all data in the disk group is lost. Make sure that no other database instance requires any data from this disk group before you drop it.

Identify the disk groups associated with the ASM instance:
SQL> SELECT NAME FROM V$ASM_DISKGROUP;

For each disk group that you want to delete, enter a command similar to the following:
SQL> DROP DISKGROUP name INCLUDING CONTENTS;

Enter the following command to shut down the ASM instance:
SQL> SHUTDOWN

Remove the entry for the ASM instance from the /etc/oratab file (or from the /var/opt/oracle/oratab file on Solaris).

Reconfiguring Oracle Cluster Synchronization Services

Oracle Cluster Synchronization Services (CSS) is a daemon process that is configured by the root.sh script when you install Oracle Database 10g for the first time. It is configured to start every time the system boots. This daemon process is required to enable synchronization between Oracle ASM and database instances. It must be running if an Oracle database is using ASM for database file storage.
Note: On cluster systems with Oracle Real Application Clusters (RAC) installations, the CSS daemon is configured during the Oracle Cluster Ready Services (CRS) installation. If the system is running Oracle CRS, see the Oracle Real Application Clusters Installation and Configuration Guide for information about removing RAC or CRS.
Before you remove an Oracle Database 10g Oracle home, you must determine whether the CSS daemon is running from that Oracle home and whether any other Oracle Database 10g Oracle homes exist on the system:
If the Oracle Database 10g Oracle home that you want to remove is the only Oracle Database 10g installation on the system, you can delete the CSS daemon configuration.
If the CSS daemon is running from the Oracle Database 10g Oracle home that you want to remove and other Oracle Database 10g installations exist on the system, you must reconfigure the CSS daemon to run from another Oracle Database 10g Oracle home.
The following subsections describe how to complete these tasks.
Identifying Oracle Database 10g Oracle Homes
To identify all of the Oracle Database 10g Oracle home directories, enter one of the following commands:
Solaris:
$ more /var/opt/oracle/oratab
Other operating systems:
$ more /etc/oratab

From the output, identify any Oracle home directories where Oracle Database 10g is installed. Oracle homes that contain Oracle Database 10g typically have paths similar to the following. However, they might use different paths.
/mount_point/app/oracle/product/10.1.0/db_n

If there is only one Oracle home directory that contains Oracle Database 10g, see the "Deleting the Oracle CSS Daemon Configuration" section for information about deleting the Oracle CSS daemon configuration.
If you identify more than one Oracle Database 10g Oracle home directory, see the following section for information about reconfiguring the Oracle CSS daemon.


Reconfiguring the Oracle CSS Daemon

To reconfigure the Oracle CSS daemon so that it runs from an Oracle home that you are not removing, follow these steps:

In all Oracle home directories on the system, stop all Oracle ASM instances and any Oracle Database instances that use ASM for database file storage.
Switch user to root.
Depending on your operating system, enter one of the following commands to identify the Oracle home directory being used to run the CSS daemon:
AIX and Linux:
# more /etc/oracle/ocr.loc
Other operating systems:
# more /var/opt/oracle/ocr.loc

The output from this command is similar to the following:
ocrconfig_loc=/u01/app/oracle/product/10.1.0/db_1/cdata/localhost/local.ocr
local_only=TRUE

The ocrconfig_loc parameter specifies the location of the Oracle Cluster Registry (OCR) used by the CSS daemon. The path up to the cdata directory is the Oracle home directory where the CSS daemon is running (/u01/app/oracle/product/10.1.0/db_1 in this example).
Note: If the value for the local_only parameter is FALSE, Oracle CRS is installed on this system. See the Oracle Real Application Clusters Installation and Configuration Guide for information about removing RAC or CRS.

If this Oracle home directory is not the Oracle home that you want to remove, you can continue to the "Removing Oracle Software" section.

Change directory to the Oracle home directory for an Oracle Database 10g installation that you are not removing.

Set the ORACLE_HOME environment variable to specify the path to this Oracle home directory:
Bourne, Bash, or Korn shell:


# ORACLE_HOME=/u01/app/oracle/product/10.1.0/db_2; export ORACLE_HOME

C shell:
# setenv ORACLE_HOME /u01/app/oracle/product/10.1.0/db_2

Enter the following command to reconfigure the CSS daemon to run from this Oracle home:
# $ORACLE_HOME/bin/localconfig reset $ORACLE_HOME

The script stops the Oracle CSS daemon, reconfigures it in the new Oracle home, and then restarts it. When the system boots, the CSS daemon starts automatically from the new Oracle home.

To remove the original Oracle home directory, see the "Removing Oracle Software" section.

Deleting the Oracle CSS Daemon Configuration

To delete the Oracle CSS daemon configuration, follow these steps:
Note: Delete the CSS daemon configuration only if you are certain that no other Oracle Database 10g installation requires it.
Remove any databases or ASM instances associated with this Oracle home. See the preceding sections for information about how to complete these tasks.
Switch user to root.
Change directory to the Oracle home directory that you are removing.
Set the ORACLE_HOME environment variable to specify the path to this Oracle home directory:
Bourne, Bash, or Korn shell:
# ORACLE_HOME=/u01/app/oracle/product/10.1.0/db_1; export ORACLE_HOME
C shell:
# setenv ORACLE_HOME /u01/app/oracle/product/10.1.0/db_1

Enter the following command to delete the CSS daemon configuration from this Oracle home:
# $ORACLE_HOME/bin/localconfig delete

The script stops the Oracle CSS daemon, then deletes its configuration. When the system boots, the CSS daemon no longer starts.

Removing Oracle Software
The following steps describe how to use the Installer to remove Oracle software from an Oracle home:
Note: Always use the Oracle Universal Installer to remove Oracle software. Do not delete any Oracle home directories without first using the Installer to remove the software.
If necessary, log in as the oracle user:
$ su - oracle

Set the ORACLE_HOME environment variable to specify the path of the Oracle home directory that you want to remove:
Bourne, Bash, or Korn shell:
$ ORACLE_HOME=/u01/app/oracle/product/10.1.0/db_1
$ export ORACLE_HOME
C shell:
$ setenv ORACLE_HOME /u01/app/oracle/product/10.1.0/db_1

Remove any databases or ASM instances associated with this Oracle home and delete or reconfigure the Oracle CSS daemon.
See the preceding sections for information about how to complete these tasks.

Stop any processes running in this Oracle home:

Process Name Command
Database Control $ORACLE_HOME/bin/emctl stop dbconsole
Oracle Net listener $ORACLE_HOME/bin/lsnrctl stop
iSQL*Plus $ORACLE_HOME/bin/isqlplusctl stop
Ultra Search $ORACLE_HOME/bin/searchctl stop

Start the Installer as follows:
$ $ORACLE_HOME/oui/bin/runInstaller

In the Welcome window, click Deinstall Products. The Inventory window appears, listing all of the Oracle homes on the system. In the Inventory window, select the Oracle home and the products that you want to remove, then click Remove.

Note: If you choose to remove Oracle JVM, the Oracle Universal Installer removes all installed products that depend on Oracle JVM, including Oracle Database.

When the Installer displays a confirmation window asking you to confirm that you want to deinstall the products and their dependant components, click Yes. The Installer displays a progress indicator as it removes the software. When the products have been deleted, click

2 comments:

  1. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Oracle Solaris, kindly contact us http://www.maxmunus.com/contact
    MaxMunus Offer World Class Virtual Instructor led training on Oracle Solaris. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us:
    Name : Arunkumar U
    Email : arun@maxmunus.com
    Skype id: training_maxmunus
    Contact No.-+91-9738507310
    Company Website –http://www.maxmunus.com


    ReplyDelete
  2. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Oracle Pre _RAC Installation, kindly contact us http://www.maxmunus.com/contact
    MaxMunus Offer World Class Virtual Instructor led training on Oracle Pre _RAC Installation. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us:
    Name : Arunkumar U
    Email : arun@maxmunus.com
    Skype id: training_maxmunus
    Contact No.-+91-9738507310
    Company Website –http://www.maxmunus.com



    ReplyDelete