MINI MINI MANI MO

Path : /opt/oracle/product/18c/dbhomeXE/rdbms/admin/
File Upload :
Current File : //opt/oracle/product/18c/dbhomeXE/rdbms/admin/showlibc.sql

Rem
Rem $Header: rdbms/admin/showlibc.sql /main/2 2017/05/28 22:46:10 stanaya Exp $
Rem
Rem showlibc.sql
Rem
Rem Copyright (c) 2000, 2017, Oracle and/or its affiliates. 
Rem All rights reserved.
Rem
Rem    NAME
Rem      showlibc.sql - SQL to display the parent/child/bind tree
Rem
Rem    DESCRIPTION
Rem      This simple SQL uses new views for oracle8i to display the
rem	 the sharing tree in the library cache
Rem	 
Rem
Rem    BEGIN SQL_FILE_METADATA
Rem    SQL_SOURCE_FILE: rdbms/admin/showlibc.sql
Rem    SQL_SHIPPED_FILE: rdbms/admin/showlibc.sql
Rem    SQL_PHASE: UTILITY
Rem    SQL_STARTUP_MODE: NORMAL
Rem    SQL_IGNORABLE_ERRORS: NONE
Rem    END SQL_FILE_METADATA
Rem    
Rem    MODIFIED   (MM/DD/YY)
Rem    sltam       02/07/01 - Merged sltam_dbmslibc_src
Rem    sltam       12/18/00 - Check-in
rem
rem    USAGE	
Rem	 Enter a fragment of the SQL to display the sharing tree.
rem	 Press return to report the tree for all SQL in the library cache.
rem 
rem    NOTES
rem    V$SQL2 is created by catlibc.sql to allow navigation to bind variables

spool showlibc
set pages 60 lines 72 echo off verify off feedback 4

col sql_text    format   a40 wrap  heading 'SQL text'
col hash_value  format   9999999999 heading 'hash value'
col address     format   99999999   heading 'parent'
col child_address format 99999999   heading 'child'
col optimizer_mode format a10       heading 'optimizer'
col executions  format   99999999   heading 'execution'
col object_status format a10 trunc  heading 'SQL status'
col parsing_user_id  format   9999  heading 'user id'
col parsing_schema_id  format 9999  heading 'schema id'
col datatype    format   a10	    heading 'data type'
col max_length  format   999999	    heading 'bind length'

break on sql_text on hash_value on address on child_address on optimizer_mode on object_status on executions on parsing_user_id on parsing_schema_id 
break on sql_text on hash_value on address on child_address skip 1

select 
  s.sql_text
, s.hash_value
, s.address
, s.child_address
, s.optimizer_mode
, s.object_status
, s.executions
, s.parsing_user_id
, s.parsing_schema_id
, decode(b.datatype
	,1, 'string'	
	,2, 'numeric'	  
	,3, 'integer'   		
	,4, 'float' 			
	,5, 'text' 	
	,6, 'number'	
	,7, 'decimal'		
	,8, 'long'			
	,9, 'string'	
	,10,'table'				
	,11,'row id'				
	,12,'date' 				
	,23,'RAW'	
	,24,'long RAW' 	
	,96,'fixed char'
	,b.datatype)datatype
, b.max_length
from v$sql2 s
,    v$sql_bind_metadata b
where 
s.sql_text like '%&SQL_TEXT_FRAGMENT%'
and s.child_address = b.address (+)
and s.sql_text not like '%decode(b.datatype%'
group by
  s.sql_text
, s.hash_value
, s.address
, s.child_address
, s.optimizer_mode
, s.object_status
, s.executions
, s.parsing_user_id
, s.parsing_schema_id
, decode(b.datatype
	,1, 'string'	
	,2, 'numeric'	  
	,3, 'integer'   		
	,4, 'float' 			
	,5, 'text' 	
	,6, 'number'	
	,7, 'decimal'		
	,8, 'long'			
	,9, 'string'	
	,10,'table'				
	,11,'row id'				
	,12,'date' 				
	,23,'RAW'	
	,24,'long RAW' 	
	,96,'fixed char'
	,b.datatype)
, b.max_length
order by
  s.sql_text
, s.hash_value
, s.address
, s.child_address
/
spool off


OHA YOOOO