diff --git a/src/config.json b/src/config.json index d875cf7..4f8e73a 100644 --- a/src/config.json +++ b/src/config.json @@ -20,6 +20,17 @@ "type": "command", "content": "output=$(/opt/ticket-ai/src/scripts/db_version_info.sh) && echo \"$output\"" }, + { + "tag": "pga_diagnostics", + "type": "command", + "content": "output=$(/opt/ticket-ai/src/scripts/pga_diagnostics.sh) && echo \"$output\"" + }, + { + "tag": "sga_diagnostics", + "type": "command", + "content": "output=$(/opt/ticket-ai/src/scripts/sga_diagnostics.sh) && echo \"$output\"" + }, + { "tag": "apex_usage", "type": "command", @@ -45,6 +56,11 @@ "type": "command", "content": "output=$(/opt/ticket-ai/src/scripts/topRedoSQL.sh) && echo \"$output\"" }, + { + "tag": "dbparameters", + "type": "command", + "content": "output=$(/opt/ticket-ai/src/scripts/showdbparameter.sh) && echo \"$output\"" + }, { "tag": "top", "type": "command", diff --git a/src/scripts/pga_diagnostics.sh b/src/scripts/pga_diagnostics.sh new file mode 100755 index 0000000..809c9c2 --- /dev/null +++ b/src/scripts/pga_diagnostics.sh @@ -0,0 +1,139 @@ +#!/bin/bash + +# High PGA-Consuming Sessions +echo "=== High PGA-Consuming Sessions and SQL Statements ===" +echo "This query shows sessions and SQL statements consuming the most PGA memory, with values in MB." +su - oracle -s /bin/bash -c " +sqlplus -s / as sysdba < (SELECT VALUE FROM V\\\$PGASTAT WHERE NAME = 'total PGA allocated') / 10 +ORDER BY + p.PGA_ALLOC_MEM DESC; +EOF +" + +# PGA Usage Overview +echo "=== PGA Usage Overview ===" +echo "This query provides a summary of current PGA usage statistics, with values in MB." +su - oracle -s /bin/bash -c " +sqlplus -s / as sysdba < 0 +ORDER BY + ACTUAL_MEM_USED_MB DESC; +EOF +" + +# Top Resource-Consuming SQL Statements +echo "=== Top Resource-Consuming SQL Statements ===" +echo "This query highlights the SQL statements with the highest disk reads, buffer gets, and elapsed times, all in MB." +su - oracle -s /bin/bash -c " +sqlplus -s / as sysdba < 100 +ORDER BY + DISK_READS DESC FETCH FIRST 10 ROWS ONLY; +EOF +" diff --git a/src/scripts/sga_diagnostics.sh b/src/scripts/sga_diagnostics.sh new file mode 100755 index 0000000..8d1a52d --- /dev/null +++ b/src/scripts/sga_diagnostics.sh @@ -0,0 +1,110 @@ +#!/bin/bash + +# Overall SGA Usage +echo "=== Overall SGA Usage ===" +echo "This query shows the sizes of all major SGA components (e.g., buffer cache, shared pool, redo log) in MB." +su - oracle -s /bin/bash -c " +sqlplus -s / as sysdba < 10000 +ORDER BY + BUFFER_GETS DESC FETCH FIRST 10 ROWS ONLY; +EOF +" diff --git a/src/scripts/showdbparameter.sh b/src/scripts/showdbparameter.sh index 169b664..0af497e 100755 --- a/src/scripts/showdbparameter.sh +++ b/src/scripts/showdbparameter.sh @@ -11,12 +11,42 @@ chown oracle $OUTPUT_FILE su - oracle -s /bin/bash -c " sqlplus -s / as sysdba <> \"$OUTPUT_FILE\" whenever sqlerror exit sql.sqlcode; - set echo on - set heading on - set linesize 150 - set pagesize 100 - show parameters; + -- Set SQL*Plus Formatting + SET LINESIZE 200 + SET PAGESIZE 50 + COLUMN parameter_name FORMAT A35 + COLUMN current_value FORMAT A25 + COLUMN is_default FORMAT A12 + COLUMN is_sys_modifiable FORMAT A18 + COLUMN description FORMAT A80 + + -- SQL Query for Important Parameters + SELECT + name AS parameter_name, + value AS current_value, + isdefault AS is_default, + issys_modifiable AS is_sys_modifiable, + description + FROM + v\\\$parameter + WHERE + name IN ( + -- Memory Management + 'sga_target', 'sga_max_size', 'pga_aggregate_target', 'memory_target', + 'memory_max_target', 'db_cache_size', 'shared_pool_size', 'large_pool_size', + 'log_buffer', + -- Sessions and Processes + 'sessions', 'processes', 'transactions', + -- Cursors + 'open_cursors', 'session_cached_cursors', 'cursor_sharing', + -- Redo and Logs + 'log_checkpoint_interval', 'log_checkpoint_timeout', 'log_buffer', + -- Other Important Performance Parameters + 'db_block_size', 'optimizer_mode', 'parallel_max_servers' + ) + ORDER BY name; + exit; EOF