Deinstalling the Grid Infrastructure Software

You don’t have to manually remove directories.  There is a deinstall script in the grid home directory.  The deinstall checks and prompt questions to confirm before it performs a clean deinstallation (see below).

cd /apps/grid/11.2.0/grid/deinstall

LADB1 - oracle: ./deinstall
Checking for required files and bootstrapping ...
Please wait ...
Location of logs /tmp/deinstall2012-05-23_02-25-20PM/logs/

############ ORACLE DEINSTALL & DECONFIG TOOL START ############


######################### CHECK OPERATION START #########################
## [START] Install check configuration ##


Checking for existence of the Oracle home location /apps/11.2.0/grid
Oracle Home type selected for deinstall is: Oracle Grid Infrastructure for a Cluster
Oracle Base selected for deinstall is: /apps/oracle
Checking for existence of central inventory location /apps/oraInventory
Checking for existence of the Oracle Grid Infrastructure home /apps/11.2.0/grid
The following nodes are part of this cluster: dbsrvl100,dbsrvl101
Checking for sufficient temp space availability on node(s) : 'dbsrvl100,dbsrvl101'

## [END] Install check configuration ##

Traces log file: /tmp/deinstall2012-05-23_02-25-20PM/logs//crsdc.log

Network Configuration check config START

Network de-configuration trace file location: /tmp/deinstall2012-05-23_02-25-20PM/logs/netdc_check2012-05-23_02-25-48-PM.log

Specify all RAC listeners (do not include SCAN listener) that are to be de-configured [LISTENER]:

Network Configuration check config END

Asm Check Configuration START

ASM de-configuration trace file location: /tmp/deinstall2012-05-23_02-25-20PM/logs/asmcadc_check2012-05-23_02-37-14-PM.log

Automatic Storage Management (ASM) instance is detected in this Oracle home /apps/11.2.0/grid.
ASM Diagnostic Destination : /apps/oracle
ASM Diskgroups : +GI
ASM diskstring : /dev/oracleasm/disks
Diskgroups will be dropped
De-configuring ASM will drop all the diskgroups and it's contents at cleanup time. This will affect all of the databases and ACFS that use this ASM instance(s).
If you want to retain the existing diskgroups or if any of the information detected is incorrect, you can modify by entering 'y'. Do you  want to modify above information (y|n) [n]: y
Specify the ASM Diagnostic Destination [/apps/oracle]:
Specify the diskstring [/dev/oracleasm/disks]:
Specify the diskgroups that are managed by this ASM instance [+GI]:

De-configuring ASM will drop the diskgroups at cleanup time. Do you want deconfig tool to drop the diskgroups y|n [y]: y


######################### CHECK OPERATION END #########################


####################### CHECK OPERATION SUMMARY #######################
Oracle Grid Infrastructure Home is: /apps/11.2.0/grid
The cluster node(s) on which the Oracle home deinstallation will be performed are:dbsrvl100,dbsrvl101
Oracle Home selected for deinstall is: /apps/11.2.0/grid
Inventory Location where the Oracle home registered is: /apps/oraInventory
Following RAC listener(s) will be de-configured: LISTENER
ASM instance will be de-configured from this Oracle home
Do you want to continue (y - yes, n - no)? [n]: y
A log of this session will be written to: '/tmp/deinstall2012-05-23_02-25-20PM/logs/deinstall_deconfig2012-05-23_02-25-25-PM.out'
Any error messages from this session will be written to: '/tmp/deinstall2012-05-23_02-25-20PM/logs/deinstall_deconfig2012-05-23_02-25-25-PM.err'

######################## CLEAN OPERATION START ########################
ASM de-configuration trace file location: /tmp/deinstall2012-05-23_02-25-20PM/logs/asmcadc_clean2012-05-23_02-38-32-PM.log
ASM Clean Configuration START
ASM Clean Configuration END

Network Configuration clean config START

Network de-configuration trace file location: /tmp/deinstall2012-05-23_02-25-20PM/logs/netdc_clean2012-05-23_02-40-15-PM.log

De-configuring RAC listener(s): LISTENER

De-configuring listener: LISTENER
    Stopping listener: LISTENER
    Listener stopped successfully.
    Unregistering listener: LISTENER
    Listener unregistered successfully.
Listener de-configured successfully.

De-configuring Naming Methods configuration file on all nodes...
Naming Methods configuration file de-configured successfully.

De-configuring Local Net Service Names configuration file on all nodes...
Local Net Service Names configuration file de-configured successfully.

De-configuring Directory Usage configuration file on all nodes...
Directory Usage configuration file de-configured successfully.

De-configuring backup files on all nodes...
Backup files de-configured successfully.

The network configuration has been cleaned up successfully.

Network Configuration clean config END


---------------------------------------->

The deconfig command below can be executed in parallel on all the remote nodes. Execute the command on  the local node after the execution completes on all the remote nodes.

Run the following command as the root user or the administrator on node "dbsrvl101".

/tmp/deinstall2012-05-23_02-25-20PM/perl/bin/perl -I/tmp/deinstall2012-05-23_02-25-20PM/perl/lib -I/tmp/deinstall2012-05-23_02-25-20PM/crs/install /tmp/deinstall2012-05-23_02-25-20PM/crs/install/rootcrs.pl -force  -deconfig -paramfile "/tmp/deinstall2012-05-23_02-25-20PM/response/deinstall_Ora11g_gridinfrahome1.rsp"

Run the following command as the root user or the administrator on node "dbsrvl100".

/tmp/deinstall2012-05-23_02-25-20PM/perl/bin/perl -I/tmp/deinstall2012-05-23_02-25-20PM/perl/lib -I/tmp/deinstall2012-05-23_02-25-20PM/crs/install /tmp/deinstall2012-05-23_02-25-20PM/crs/install/rootcrs.pl -force  -deconfig -paramfile "/tmp/deinstall2012-05-23_02-25-20PM/response/deinstall_Ora11g_gridinfrahome1.rsp" -lastnode

Press Enter after you finish running the above commands

<----------------------------------------

Setting the force flag to false
Setting the force flag to cleanup the Oracle Base
Oracle Universal Installer clean START

Detach Oracle home '/apps/11.2.0/grid' from the central inventory on the local node : Done

Delete directory '/apps/11.2.0/grid' on the local node : Done

Delete directory '/apps/oraInventory' on the local node : Done

The Oracle Base directory '/apps/oracle' will not be removed on local node. The directory is not empty.

Detach Oracle home '/apps/11.2.0/grid' from the central inventory on the remote nodes 'dbsrvl101' : Done

Delete directory '/apps/11.2.0/grid' on the remote nodes 'dbsrvl101' : Done

Delete directory '/apps/oraInventory' on the remote nodes 'dbsrvl101' : Done

The Oracle Base directory '/apps/oracle' will not be removed on node 'dbsrvl101'. The directory is not empty.

Oracle Universal Installer cleanup was successful.

Oracle Universal Installer clean END


## [START] Oracle install clean ##

Clean install operation removing temporary directory '/tmp/deinstall2012-05-23_02-25-20PM' on node 'dbsrvl100'
Clean install operation removing temporary directory '/tmp/deinstall2012-05-23_02-25-20PM' on node 'dbsrvl101'

## [END] Oracle install clean ##


######################### CLEAN OPERATION END #########################


####################### CLEAN OPERATION SUMMARY #######################
ASM instance was de-configured successfully from the Oracle home
Following RAC listener(s) were de-configured successfully: LISTENER
Oracle Clusterware is stopped and successfully de-configured on node "dbsrvl101"
Oracle Clusterware is stopped and successfully de-configured on node "dbsrvl100"
Oracle Clusterware is stopped and de-configured successfully.
Successfully detached Oracle home '/apps/11.2.0/grid' from the central inventory on the local node.
Successfully deleted directory '/apps/11.2.0/grid' on the local node.
Successfully deleted directory '/apps/oraInventory' on the local node.
Successfully detached Oracle home '/apps/11.2.0/grid' from the central inventory on the remote nodes 'dbsrvl101'.
Successfully deleted directory '/apps/11.2.0/grid' on the remote nodes 'dbsrvl101'.
Successfully deleted directory '/apps/oraInventory' on the remote nodes 'dbsrvl101'.
Oracle Universal Installer cleanup was successful.


Run 'rm -rf /etc/oraInst.loc' as root on node(s) 'dbsrvl100,dbsrvl101' at the end of the session.

Run 'rm -rf /opt/ORCLfmap' as root on node(s) 'dbsrvl100,dbsrvl101' at the end of the session.
Oracle deinstall tool successfully cleaned up temporary directories.
#######################################################################


############# ORACLE DEINSTALL & DECONFIG TOOL END #############

strace - trace system calls and signals

 strace - trace system calls and signals.  It's a useful tool for diagnosis, debugging processes on Linux. 

To install:
 - root: yum install strace
Loaded plugins: rhnplugin, security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package strace.x86_64 0:4.5.18-11.el5_8 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
 Package     Arch        Version                Repository                 Size
================================================================================
Installing:
 strace      x86_64      4.5.18-11.el5_8        rhel-x86_64-server-5      177 k
Transaction Summary
================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)
Total download size: 177 k
Is this ok [y/N]: y
Downloading Packages:
strace-4.5.18-11.el5_8.x86_64.rpm                                                                                                                           | 177 kB     00:00    
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : strace  
 
  Installed:
    strace.x86_64 0:4.5.18-11.el5_8                                                                                                                                                 
 
Complete!

Some useful parameters:

-tt  If given twice, the time printed will include the microseconds.
-T  Show the time spent in system calls. This records the time difference between the beginning and the end of each system call.
-o  filename : Write the trace output to the file filename rather than to screen (stderr).
-p  PID   Attach to the process with the process ID pid and begin tracing. The trace may be terminated at any time by a keyboard interrupt signal (hit CTRL-C). strace will respond by detaching itself from the traced process(es) leaving it (them) to continue running. Multiple -p options can be used to attach to up to 32 processes in addition to command (which is optional if at least one -p option is given).

-s SIZE  Specify the maximum string size to print (the default is 32).

Examples: 

To trace an oracle process and see what it's doing..
strace -p 28446 -s 100 -o /tmp/orammnl.txt

to trace the open and read system calls
strace -e  trace=open,read -p 28446 -o /tmp/orammnl.debug

to trace the process spends time on system calls
strace -ttT -p 15878 -o /tmp/tracetiming.out

14:54:26.232457 open("/proc/15914/stat", O_RDONLY) = 26 <0.000028>
14:54:26.232584 read(26, "15914 (oracle) S 1 15914 15914 0"..., 999) = 243 <0.000049>
14:54:26.232884 close(26)               = 0 <0.000019>
14:54:26.233002 open("/proc/15916/stat", O_RDONLY) = 26 <0.000027>
14:54:26.233127 read(26, "15916 (oracle) S 1 15916 15916 0"..., 999) = 240 <0.000046>
14:54:26.233269 close(26)               = 0 <0.000019>
...
At 14:54:26.233127, it took 0.46 milisecond to read 240 bytes.
 

RDA TLsecure tool

RDA TLsecure tool can help identify potential database security risk.  See the list below for checking..

ovmrac01:/apps/oracle/product/11.2.0.3/RACDB/rda
LADB01 - oracle: ./rda.pl -vT secure
        Testing ...
Identification of Potential Security Risks ...
Identification of Potential Security Risks
  1   Users with a default password (11g)
  2   Users with a well known password
  3   Users not visible in dba_users
  4   Operating system authenticated user names with a password
  5   Users with SYSTEM as default tablespace
  6   Users and privileges from gv$pwfile_users
  7   Privileges not granted by their owner
  8   Listeners without a password
  9   Listeners with local operating system authentication (10g and later)
  10  Listeners modifiable at runtime
  11  AUTHENTICATION_SERVICES value in sqlnet.ora files
  12  Oracle executables owned by different users of a same group (UNIX only)
  *   Run all checks
Enter a menu item or . to end
> *

SQL Monitor , /*+ MONITOR */, DBMS_SQLTUNE.REPORT_SQL_MONITOR

The SQL monitor is introduced in Oracle 11g database is a very effective way to monitor long running SQL statements.  By default, SQL monitoring automatically starts when a SQL statement runs parallel, or when it has consumed at least 5 seconds of CPU or I/O time in a single execution.  The /*+MONITOR*/ hint enables monitoring for statements and the DBMS_SQLTUNE.REPORT_SQL_MONITOR package creates a monitoring report for a specific SQL statement.  It's interactive with the Enterprise Manager and statistics performance metrics are capture (elapsed time, CPU time, I/O time, reads/writes related, etc. 

Below are few examples:

Example1 /*+ MONITOR */ hint
------------------------------------------------
SQLPLUS >

select /*+ MONITOR */ emp_nbr from DBALAB.EMPLOYEE where emp_nbr is not null and rownum <=200;

set long 1000000
set longchunksize 1000000
set linesize 600
set pagesize 0
set trim on
set trimspool on

select dbms_sqltune.report_sql_monitor (session_id=>sys_context('userenv','sid'),  report_level=>'ALL') as report from dual;
SQL Monitoring Report

SQL Text
------------------------------
select /*+ MONITOR */ emp_nbr from DBALAB.EMPLOYEE where emp_nbr is not null and rownum <=200
Global Information
------------------------------
Status              :  DONE (ALL ROWS)
Instance ID         :  1
Session             :  SYS (689:10593)
SQL ID              :  9hhhwr7ns2y9y
SQL Execution ID    :  16777216
Execution Started   :  05/04/2012 15:02:55
First Refresh Time  :  05/04/2012 15:02:55
Last Refresh Time   :  05/04/2012 15:02:55
Duration            :  .425631s
Module/Action       :  sqlplus@vmsrv01.la.com (TNS V1-V3)/-
Service             :  SYS$USERS
Program             :  sqlplus@vmsrv01.la.com (TNS V1-V3)
Fetch Calls         :  15
Global Stats
======================================================================================
| Elapsed |   Cpu   |    IO    | Cluster  |  Other   | Fetch | Buffer | Read | Read  |
| Time(s) | Time(s) | Waits(s) | Waits(s) | Waits(s) | Calls |  Gets  | Reqs | Bytes |
======================================================================================
|    0.43 |    0.00 |     0.41 |     0.00 |     0.01 |    15 |     23 |    3 | 112KB |
======================================================================================
SQL Plan Monitoring Details (Plan Hash Value=238925293)
==========================================================================================================================================================
| Id |      Operation       |    Name    |  Rows   | Cost |   Time    | Start  | Execs |   Rows   | Read | Read  | Activity |      Activity Detail       |
|    |                      |            | (Estim) |      | Active(s) | Active |       | (Actual) | Reqs | Bytes |   (%)    |        (# samples)         |
==========================================================================================================================================================
|  0 | SELECT STATEMENT     |            |         |      |         1 |     +0 |     1 |      200 |      |       |          |                            |
|  1 |   COUNT STOPKEY      |            |         |      |         1 |     +0 |     1 |      200 |      |       |          |                            |
|  2 |    TABLE ACCESS FULL | DBALAB.EMPLOYEE |     200 |    4 |         2 |     +0 |     1 |      200 |    3 | 112KB |   100.00 | db file scattered read (1) |
==========================================================================================================================================================



Example2:  DBMS_SQLTUNE.REPORT_SQL_MONITOR
-----------------------------------------------------------------
select sid, sql_id
from v$session
where status = 'ACTIVE';


 SID    SQL_ID
-------- -------------
     232 7fnqw0qww759d
     343
set long 1000000
set longchunksize 1000000
set linesize 600
set pagesize 0
set trim on
set trimspool on


select dbms_sqltune.report_sql_monitor(sql_id =>'7fnqw0qww759d', type=>'TEXT') as report from dual;
SQL Monitoring Report
SET LINESIZE 300
COLUMN sql_text FORMAT A100
SELECT sql_id, status, sql_text FROM v$sql_monitor;
acc988uzvjmmt DONE                delete from WRH$_SYSMETRIC_HISTORY tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :e
                                  nd_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b
                                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and
                                                     (tab.snap_id <= b.end_snap_id))
7fnqw0qww759d DONE                begin dbms_feature_usage_internal.exec_db_usage_sampling(:bind1); end;


SET LONG 1000000               
SET FEEDBACK OFF
SELECT DBMS_SQLTUNE.report_sql_monitor(sql_id =>'7fnqw0qww759d',type=> 'TEXT')
  2  AS report FROM dual;
SQL Monitoring Report
SQL Text
------------------------------
begin dbms_feature_usage_internal.exec_db_usage_sampling(:bind1); end;
Global Information
------------------------------
 Status              :  DONE
 Instance ID         :  1
 Session             :  (1600:2927)
 SQL ID              :  05s9358mm6vrr
 SQL Execution ID    :  16777218
 Execution Started   :  04/30/2012 21:37:39
 First Refresh Time  :  04/30/2012 21:37:43
 Last Refresh Time   :  04/30/2012 21:37:44
 Duration            :  5s
 Module/Action       :  MMON_SLAVE/0000010 FINISHED190
 Service             :  SYS$BACKGROUND
 Program             :  oracle@vmsrv01.la.com (M000)
Global Stats
==========================================================================================================================
| Elapsed |   Cpu   |    IO    | Application | Concurrency | Cluster  |  Other   | Buffer | Read | Read  | Write | Write |
| Time(s) | Time(s) | Waits(s) |  Waits(s)   |  Waits(s)   | Waits(s) | Waits(s) |  Gets  | Reqs | Bytes | Reqs  | Bytes |
==========================================================================================================================
|    4.22 |    2.16 |     1.19 |        0.01 |        0.03 |     0.07 |     0.77 |   204K | 1682 |  24MB |     4 | 32768 |
==========================================================================================================================
SQL>