

DEFINE search_string=&1

COLUMN name FORMAT A28 TRUNC
COLUMN description FORMAT A60 WORD_WRAP
COLUMN usage FORMAT A60 WORD_WRAP
COLUMN example FORMAT A56 WORD_WRAP
COLUMN tag FORMAT A20 WORD_WRAP


WITH q AS (
SELECT *
FROM (
SELECT 'sql_profile_hints.sql' AS name, 'Display SQL profile hints' AS description, '@sql_profile_hints.sql <sql_profile>
' AS Usage, '@sql_profile_hints.sql sqlprof_2v4h21kf9bz0h' AS Example, 'sqlprof hint' AS tag FROM dual UNION ALL 
SELECT 'awr_sqlid.sql' AS name, 'Display SQL text from AWR' AS description, '@awr_sqlid <sql_id>
' AS Usage, '@awr_sqlid 7q729nhdgtsqq' AS Example, 'awr sqltext' AS tag FROM dual UNION ALL 
SELECT 'sqlbinds.sql' AS name, 'Show captured binds from GV$SQL_BIND_CAPTURE' AS description, '@sqlbinds <sql_id> <child_number> <bindvar_name>
' AS Usage, '@sqlbinds 0qyu7wm1b2g1r % %' AS Example, 'bind' AS tag FROM dual UNION ALL 
SELECT 'awr_sql_binds.sql' AS name, 'Display SQL Binds from AWR' AS description, '@awr_sql_binds.sql <sql_id> <num_days> <where>
' AS Usage, '@awr_sql_binds.sql 0qyu7wm1b2g1r 7 "and 1=1"'||chr(10)||'@awr_sql_binds.sql 6qqf9bakz7j3n 7 "and plan_hash_value=2088506832"' AS Example, 'bind' AS tag FROM dual UNION ALL 
SELECT 'xlast.sql' AS name, 'Explain plan last SQL_ID' AS description, 'xlast.sql
' AS Usage, '' AS Example, 'explain' AS tag FROM dual UNION ALL 
SELECT 'colored_sql_id.sql' AS name, 'Show colored SQL_ID' AS description, 'colored_sql_id.sql
' AS Usage, '' AS Example, 'color' AS tag FROM dual UNION ALL 
SELECT 'xplan.sql' AS name, 'Explain plan from Library Cache' AS description, '@xplan <sql_id> <child_num>
' AS Usage, '@xplan.sql gy2zd0jzw3w6y 0' AS Example, 'explain' AS tag FROM dual UNION ALL 
SELECT 'sqlidtabstat.sql' AS name, 'Staleness tables/indexes in execution plan from Library Cache' AS description, '@sqlidtabstat.sql <sql_id>
' AS Usage, '@sqlidtabstat.sql 2bu78cxnrm4s7' AS Example, 'stale library cache' AS tag FROM dual UNION ALL 
SELECT 'awrsqlidtabstat.sql' AS name, 'Staleness tables/indexes in execution plan from AWR' AS description, '@awrsqlidtabstat.sql <sql_id>
' AS Usage, '@awrsqlidtabstat.sql 2bu78cxnrm4s7' AS Example, 'stale awr' AS tag FROM dual UNION ALL 
SELECT 'stale.sql' AS name, 'List DB stale tables' AS description, '@stale.sql
' AS Usage, '' AS Example, 'stale' AS tag FROM dual UNION ALL 
SELECT 'tab_details.sql' AS name, 'Table details' AS description, '@tab_details.sql <owner> <table_name>
' AS Usage, '@tab_details.sql SCOTT EMP' AS Example, 'table detail' AS tag FROM dual UNION ALL 
SELECT 'tabstat.sql' AS name, 'Stats details for non PARTITIONED table' AS description, '@tabstat.sql <OWNER> <TABLE>
' AS Usage, '@tabstat.sql SCOTT DEPT' AS Example, 'table stat' AS tag FROM dual UNION ALL 
SELECT 'tspstat.sql' AS name, 'Stats details for SUB-PARTITIONED table' AS description, '@tspstat.sql <owner> <table_name> <partition_name> <subpartition_name>
' AS Usage, '@tspstat.sql SCOTT EMP EMP1998 EMP EMP1998_ITALY'||chr(10)||'@tspstat.sql SCOTT EMP EMP1998 EMP %' AS Example, 'subpart stat' AS tag FROM dual UNION ALL 
SELECT 'tpstat.sql' AS name, 'Stats details for PARTITIONED table' AS description, '@tpstat.sql <OWNER> <TABLE> <PARTITION>
' AS Usage, '@tpstat.sql SCOTT EMP EMP1998' AS Example, 'part stat' AS tag FROM dual UNION ALL 
SELECT 'stats_history.sql' AS name, 'Display table statistics history' AS description, '@stats_history.sql <OWNER> <OBJ_NAME> <PART_NAME> <OBJ_TYPE>
' AS Usage, '@stats_history.sql XPS LOAD % %' AS Example, 'history stat' AS tag FROM dual UNION ALL 
SELECT 'stats_getpref_table.sql' AS name, 'Get table statistics prefs' AS description, '@stats_getpref_table.sql <owner> <table_name>
' AS Usage, '@stats_getpref_table.sql REPORT REP112' AS Example, 'pref stat' AS tag FROM dual UNION ALL 
SELECT 'stats_getpref_global.sql' AS name, 'Get GLOBAL statistics prefs' AS description, '@stats_getpref_global.sql 
' AS Usage, '' AS Example, 'pref stat' AS tag FROM dual UNION ALL 
SELECT 'sqltt_sqlid.sql' AS name, 'Create SQL Tuning Task for SQL_ID' AS description, '@sqltt_sqlid.sql <sql_id> <max_minutes>
' AS Usage, '@sqltt_sqlid.sql 70mfpusqy9jvj 5' AS Example, 'tuning task' AS tag FROM dual UNION ALL 
SELECT 'awr_snapshot.sql' AS name, 'Create AWR snapshot' AS description, '@awr_snapshot.sql
' AS Usage, '' AS Example, 'awr snapshot' AS tag FROM dual UNION ALL 
SELECT 'sql_profile.sql' AS name, 'Display all SQL Profiles' AS description, '@sql_profile.sql
' AS Usage, '' AS Example, 'sqlprofile' AS tag FROM dual UNION ALL 
SELECT 'sql_profile_detail.sql' AS name, 'Display SQL Profile detail' AS description, '@sql_profile_detail.sql <sql_profile>
' AS Usage, '@sql_profile_detail.sql sqlprof_2v4h21kf9bz0h' AS Example, 'sqlprofile' AS tag FROM dual UNION ALL 
SELECT 'create_spb_from_cur.sql' AS name, 'Create SQL Plan Baseline from Library Cache' AS description, '@create_spb_from_cur.sql <sql_id>
' AS Usage, '@create_spb_from_cur.sql g3sm89z3xb4zs' AS Example, 'baseline spb' AS tag FROM dual UNION ALL 
SELECT 'create_spb_from_awr.sql' AS name, 'Create SQL Plan Baseline from AWR' AS description, '@create_spb_from_awr.sql <sql_id>
' AS Usage, '@create_spb_from_awr.sql g3sm89z3xb4zs' AS Example, 'baseline spb awr' AS tag FROM dual UNION ALL 
SELECT 'sql_plan_baselines.sql' AS name, 'List SQL Plan Baselines' AS description, '@sql_plan_baselines.sql <where_clause>
' AS Usage, '@sql_plan_baselines.sql "1=1"'||chr(10)||'@sql_plan_baselines.sql "accepted=''YES'' and Last_Modified >(sysdate-1)"'||chr(10)||'@sql_plan_baselines.sql "plan_hash_value=237994299"'||chr(10)||'@sql_plan_baselines.sql "sql_id=''g3gwhhx6r00qc''"' AS Example, 'baseline spb' AS tag FROM dual UNION ALL 
SELECT 'sqlid_sign.sql' AS name, 'Display force matching signature of SQL_ID' AS description, '@sqlid_sign.sql <sql_id>
' AS Usage, '' AS Example, 'signature' AS tag FROM dual UNION ALL 
SELECT 'awrsign.sql' AS name, 'AWR history for this force matching signature' AS description, '@awrsign.sql <force_matching_signature> <from_date> <to_date>
' AS Usage, '' AS Example, 'signature' AS tag FROM dual UNION ALL 
SELECT 'awrsqlid.sql' AS name, 'AWR history of SQL_ID' AS description, '@awrsqlid.sql <force_matching_signature> <from_date> <to_date>
' AS Usage, '' AS Example, 'awr' AS tag FROM dual UNION ALL 
SELECT 'ashtop.sql' AS name, 'ASH time from GV$ACTIVE_SESSION_HISTORY grouped by dimensions' AS description, '@ashtop.sql <grouping_cols> <filters> <fromtime> <totime>
' AS Usage, '@ashtop.sql username,sql_id session_type=''FOREGROUND'' sysdate-1/24 sysdate' AS Example, 'ash' AS tag FROM dual UNION ALL 
SELECT 'dashtop.sql' AS name, 'ASH time from DBA_HIST_ACTIVE_SESS_HISTORY grouped by dimensions' AS description, '@dashtop.sql <grouping_cols> <filters> <fromtime> <totime>
' AS Usage, '@dashtop.sql sql_id 1=1 "TIMESTAMP''2024-02-06 09:10:35''" "TIMESTAMP''2024-02-06 12:20:50''"' AS Example, 'ash' AS tag FROM dual UNION ALL 
SELECT 'ash_wait_chains.sql' AS name, 'ASH wait chains GV$ACTIVE_SESSION_HISTORY' AS description, '@ash_wait_chains.sql <grouping_cols> <filters> <fromtime> <totime>
' AS Usage, '@ash_wait_chains.sql username||'':''||program2||event2 session_type=''FOREGROUND'' sysdate-1/24 sysdate' AS Example, 'ash wait chain' AS tag FROM dual UNION ALL 
SELECT 'dash_wait_chains.sql' AS name, 'ASH wait chains DBA_HIST_ACTIVE_SESS_HISTORY' AS description, '@dash_wait_chains.sql <grouping_cols> <filters> <fromtime> <totime>
' AS Usage, '@dash_wait_chains.sql username||'':''||program2||event2 session_type=''FOREGROUND'' "TIMESTAMP''2024-02-06 09:10:35''" "TIMESTAMP''2024-02-06 12:20:50''"' AS Example, 'ash wait chain' AS tag FROM dual UNION ALL 
SELECT 'asqlmon.sql' AS name, 'Report SQL-monitoring-style from ASH (GV$ACTIVE_SESSION_HISTORY)' AS description, '@asqlmon.sql <sqlid> <child#> <from_time> <to_time>
' AS Usage, '' AS Example, 'ash sqlmon' AS tag FROM dual UNION ALL 
SELECT 'dasqlmon.sql' AS name, 'Report SQL-monitoring-style from ASH (DBA_HIST_ACTIVE_SESS_HISTORY)' AS description, '@dasqlmon.sql <sqlid> <child#> <from_time> <to_time>
' AS Usage, '' AS Example, 'ash sqlmon' AS tag FROM dual UNION ALL 
SELECT 'transaction_long_running.sql' AS name, 'Long running transactions' AS description, '@transaction_long_running.sql <complement_where_clause>
' AS Usage, '@transaction_long_running.sql "and 1=1"'||chr(10)||'@transaction_long_running.sql "and sid=3198"' AS Example, 'trans' AS tag FROM dual UNION ALL 
SELECT 'pardef.sql' AS name, 'Table (and index) partitions definition' AS description, '@pardef.sql <owner> <table_name> <part_name>
' AS Usage, '@pardef.sql POC DEMO1 %' AS Example, 'part' AS tag FROM dual UNION ALL 
SELECT 'planx.sql' AS name, 'Carlos Sierra Explain Plan from LC/AWR' AS description, '@planx.sql <diag_pack_licence> <sql_id>
' AS Usage, '@planx.sql Y gy2zd0jzw3w6y' AS Example, 'explain cache library awr' AS tag FROM dual UNION ALL 
SELECT 's.sql' AS name, 'Display current Session Wait and SQL_ID' AS description, '@s.sql <list of sid>
' AS Usage, '@s.sql 52,110,225'||chr(10)||'@s.sql "select sid from v$session where username = ''XYZ''"'||chr(10)||'@s/sql &mysid' AS Example, 'session wait sql_id' AS tag FROM dual UNION ALL 
SELECT 'usess.sql' AS name, 'User session ldetails (SQL_ID, event, module etc.)' AS description, '@usess.sql <where_clause>
' AS Usage, '@usess.sql "1=1"'||chr(10)||'@usess.sql s.status=''ACTIVE'''||chr(10)||'@usess.sql "s.status=''ACTIVE'' and s.username=''STREAM_USER'' and s.module like ''%REPLI%''"' AS Example, 'session wait' AS tag FROM dual UNION ALL 
SELECT 'sess.sql' AS name, 'User session (idevelopment.info)' AS description, '@sess.sql
' AS Usage, '' AS Example, 'session' AS tag FROM dual UNION ALL 
SELECT 'sessa.sql' AS name, 'User active session (idevelopment.info)' AS description, '@sessa.sql
' AS Usage, '' AS Example, 'session active' AS tag FROM dual UNION ALL 
SELECT 'locked_objects.sql' AS name, 'Locked objects' AS description, '@locked_objects.sql <owner> <object_name> <object_type> <where_clause>
' AS Usage, '@locked_objects.sql % % % "and 1=1"'||chr(10)||'@locked_objects.sql SCOTT EMP % "and 1=1"'||chr(10)||'@locked_objects.sql % % % "and osuser!=''oracle'' and owner!=''SYS''"' AS Example, 'lock' AS tag FROM dual UNION ALL 
SELECT 'locks.sql' AS name, 'Displays currently locked objects in database' AS description, '@locks.sql
' AS Usage, '' AS Example, 'lock' AS tag FROM dual UNION ALL 
SELECT 'locks_blocking.sql' AS name, 'Displays blocking locks in database' AS description, '@locks_blocking.sql
' AS Usage, '' AS Example, 'lock block' AS tag FROM dual UNION ALL 
SELECT 'sid_details.sql' AS name, 'Display Session Details' AS description, '@sid_details.sql <sid> <indt_id>
' AS Usage, '@sid_details.sql 7531 3' AS Example, 'session' AS tag FROM dual UNION ALL 
SELECT 'nonshared.sql' AS name, 'Print reasons for non-shared child cursors from V$SQL_SHARED_CURSOR' AS description, '@nonshared.sql <sql_id>
' AS Usage, '@nonshared.sql 7gf6xg9xfv3vb' AS Example, 'shared cursor' AS tag FROM dual UNION ALL 
SELECT 'o.sql' AS name, 'Display object' AS description, '@o.sql <owner>.<object_name>
' AS Usage, '@o.sql SCOTT.EMP'||chr(10)||'@o.sql %.EMP%' AS Example, 'object' AS tag FROM dual UNION ALL 
SELECT 'xawr.sql' AS name, 'Execution plan from AWR' AS description, '@xawr.sql <sql_id> <phv>
' AS Usage, '@xawr.sql 6qqf9bakz7j3n 1522095726' AS Example, 'awr sql_id' AS tag FROM dual UNION ALL 
SELECT 'wrka.sql' AS name, 'PGA and TEMP usage' AS description, '@wrka.sql <where_clause>
' AS Usage, '@wrka.sql 1=1 '||chr(10)||'@wrka.sql sid=123'||chr(10)||'@wrka.sql username=''APPUSER'' '||chr(10)||'@wrka.sql @wrka "program LIKE ''%BatchRunner.exe%'' AND machine=''host123''"' AS Example, 'temp pga' AS tag FROM dual UNION ALL 
SELECT 'wrkasum.sql' AS name, 'Summary of PGA and TEMP' AS description, '@wrkasum.sql  <where_clause>
' AS Usage, '@wrkasum.sql sql_id=''7q729nhdgtsqq''' AS Example, 'temp pga' AS tag FROM dual UNION ALL 
SELECT 'arch_size_hourly.sql' AS name, 'Archivelog size history by DAY' AS description, '@arch_size_hourly.sql  <number_of_days>
' AS Usage, '@arch_size_hourly.sql 7' AS Example, 'arch' AS tag FROM dual UNION ALL 
SELECT 'arch_size_hourly_detail.sql' AS name, 'Archivelog size history by HOUR' AS description, '@arch_size_hourly_detail.sql  <number_of_days>
' AS Usage, '@arch_size_hourly_detail.sql 2' AS Example, 'arch' AS tag FROM dual UNION ALL 
SELECT 'arch_switch_hist.sql' AS name, 'Archivelog switch history by DAY+HOUR' AS description, '@arch_switch_hist.sql 
' AS Usage, '@arch_switch_hist.sql' AS Example, 'arch switch' AS tag FROM dual UNION ALL 
SELECT 'recovery_area_usage.sql' AS name, 'Display Recovery Area Usage' AS description, '@recovery_area_usage.sql 
' AS Usage, '@recovery_area_usage.sql' AS Example, 'recovery area recovery area fra' AS tag FROM dual UNION ALL 
SELECT 'log.sql' AS name, 'Show redo log layout' AS description, '@log.sql
' AS Usage, '@log.sql' AS Example, 'log redo standby' AS tag FROM dual UNION ALL 
SELECT 'tbs.sql' AS name, 'Tablespace usage' AS description, '@tbs.sql <tablespace_name>
' AS Usage, '@tbs.sql %'||chr(10)||'@tbs USERS' AS Example, 'tablespace' AS tag FROM dual UNION ALL 
SELECT 'dba_registry.sql' AS name, 'Database registry/components' AS description, '@dba_registry.sql
' AS Usage, '@dba_registry.sql' AS Example, 'registry component' AS tag FROM dual UNION ALL 
SELECT 'dba_invalid_objects.sql' AS name, 'List invalid objects' AS description, '@dba_invalid_objects.sql
' AS Usage, '@dba_invalid_objects.sql' AS Example, 'invalid' AS tag FROM dual UNION ALL 
SELECT 'tpardef.sql' AS name, 'Table only partitions definition' AS description, '@tpardef.sql <owner> <table_name> <part_name>
' AS Usage, '@tpardef.sql POC DEMO1 %' AS Example, 'part' AS tag FROM dual UNION ALL 
SELECT 'sqlid.sql' AS name, 'SQL_ID details from Library Cache' AS description, '@sqlid.sql <SQL_ID> <CHILD_NUMBER>
' AS Usage, '@sqlid.sql a5ks9fhw2v9s1 %'||chr(10)||'@sqlid.sql a5ks9fhw2v9s1 0' AS Example, 'sqlid cache library' AS tag FROM dual UNION ALL 
SELECT 'hint.sql' AS name, 'SQL Hint information' AS description, '@hint.sql <hint_pattern>
' AS Usage, '@hint.sql FULL'||chr(10)||'@hint.sql MERGE' AS Example, 'hint' AS tag FROM dual UNION ALL 
SELECT 'dblinks.sql' AS name, 'List database links' AS description, 'dblinks.sql
' AS Usage, '@dblinks.sql' AS Example, 'link' AS tag FROM dual UNION ALL 
SELECT 'dg_stats.sql' AS name, 'Dataguard Stats' AS description, '@dg_stats.sql
' AS Usage, '@dg_stats.sql' AS Example, 'dataguard standby' AS tag FROM dual UNION ALL 
SELECT 'otherxml.sql' AS name, 'Display other_xml value for a SQL_ID' AS description, '@otherxml.sql <sql_id> <child_number>
' AS Usage, '@otherxml.sql a5ks9fhw2v9s1 0' AS Example, 'other_xml otherxml other' AS tag FROM dual UNION ALL 
SELECT 'date.sql' AS name, 'Date (sysdate) in different formats' AS description, 'date.sql
' AS Usage, '@date.sql' AS Example, 'date sysdate' AS tag FROM dual UNION ALL 
SELECT 'fish.sql' AS name, 'Famous fish script of Tanel Poder' AS description, '@fish.sql
' AS Usage, '@fish.sql' AS Example, 'fish' AS tag FROM dual UNION ALL 
SELECT 'blockers.sql' AS name, 'Show blocked sessions and blockers' AS description, '@blockers <where clause> <w.COL1,COL2,...,b.COL1,b.COL2,...,f.COL1,f.COL2...>
' AS Usage, '@blockers 1=1 w.program2,w.sql_id,w.event,b.event,b.program'||chr(10)||'@blockers "w.sql_id=''23k2zf2urpwq0''" w.event,b.event,b.program,b.osuser' AS Example, 'blocker lock' AS tag FROM dual UNION ALL 
SELECT 'sed.sql' AS name, 'Show wait event descriptions' AS description, '@sed <event>
' AS Usage, '@sed "%db file%"'||chr(10)||'@sed "PX Deq: Execute Reply"' AS Example, 'event' AS tag FROM dual UNION ALL 
SELECT 'xb.sql' AS name, 'Tanel Poder eXplain Better' AS description, '1) alter session set statistics_level = all; (or user GATHER_PLAN_STATISTICS hint instead) 2) Run the statement you want to explain 3) @xb.sql
' AS Usage, '@xb' AS Example, 'explain plan better' AS tag FROM dual UNION ALL 
SELECT 'xbi.sql' AS name, 'Tanel Poder eXplain Better for an SQL_ID' AS description, '@xbi <sql_id> <child_number>
' AS Usage, '@xbi 23k2zf2urpwq0 0' AS Example, 'explain sql_id plan better' AS tag FROM dual
)
)
SELECT name,description,usage,example FROM q
WHERE
(upper(name)           LIKE upper ('%&search_string%') OR regexp_like(name, '&search_string', 'i'))
OR (upper(description) LIKE upper ('%&search_string%') OR regexp_like(description, '&search_string', 'i'))
OR (upper(tag)         LIKE upper ('%&search_string%') OR regexp_like(tag, '&search_string', 'i'))
ORDER BY
    name ASC
/


UNDEFINE search_string
CLEAR COLUMNS

