-- Description : Displays the default values where present for the specified table.
[oracle@MaxwellDBA monitoring]$ cat column_defaults.sql
-- -----------------------------------------------------------------------------------
-- File Name : /monitoring/column_defaults.sql
-- Author : Maxwell
-- Description : Displays the default values where present for the specified table.
-- Call Syntax : @column_defaults (table-name)
-- Last Modified: 06-AUG-2022
-- -----------------------------------------------------------------------------------
SET LINESIZE 100
SET VERIFY OFF
SELECT a.column_name "Column",
a.data_default "Default"
FROM all_tab_columns a
WHERE a.table_name = Upper('&1')
AND a.data_default IS NOT NULL
/
[oracle@MaxwellDBA monitoring]$ pwd
/home/oracle/oracledba/monitoring
[oracle@MaxwellDBA monitoring]$
-- Description : Displays information about controlfiles.
[oracle@MaxwellDBA monitoring]$ cat controlfiles.sql
-- -----------------------------------------------------------------------------------
-- File Name : /monitoring/controlfiles.sql
-- Author : Maxwell
-- Description : Displays information about controlfiles.
-- Requirements : Access to the V$ views.
-- Call Syntax : @controlfiles
-- Last Modified: 06-AUG-2022
-- -----------------------------------------------------------------------------------
SET LINESIZE 100
COLUMN name FORMAT A80
SELECT name,
status
FROM v$controlfile
ORDER BY name;
SET LINESIZE 80
[oracle@MaxwellDBA monitoring]$
SQL> @/home/oracle/oracledba/monitoring/controlfiles.sql
NAME STATUS
-------------------------------------------------------------------------------- -------
/opt/oracle/oradata/ORCLCDB/control01.ctl
/opt/oracle/oradata/ORCLCDB/control02.ctl
SQL>
-- Description : Displays information about datafiles.
[oracle@MaxwellDBA monitoring]$ cat datafiles.sql
-- -----------------------------------------------------------------------------------
-- File Name : /monitoring/datafiles.sql
-- Author : Maxwell
-- Description : Displays information about datafiles.
-- Requirements : Access to the V$ views.
-- Call Syntax : @datafiles
-- Last Modified: 06-AUG-2022
-- -----------------------------------------------------------------------------------
SET LINESIZE 200
COLUMN file_name FORMAT A70
SELECT file_id,
file_name,
ROUND(bytes/1024/1024/1024) AS size_gb,
ROUND(maxbytes/1024/1024/1024) AS max_size_gb,
autoextensible,
increment_by,
status
FROM dba_data_files
ORDER BY file_name;
[oracle@MaxwellDBA monitoring]$
SQL> @/home/oracle/oracledba/monitoring/datafiles.sql
FILE_ID FILE_NAME SIZE_GB MAX_SIZE_GB AUT INCREMENT_BY STATUS
---------- ---------------------------------------------------------------------- ---------- ----------- --- ------------ ---------
3 /opt/oracle/oradata/ORCLCDB/sysaux01.dbf 1 32 YES 1280 AVAILABLE
1 /opt/oracle/oradata/ORCLCDB/system01.dbf 1 32 YES 1280 AVAILABLE
4 /opt/oracle/oradata/ORCLCDB/undotbs01.dbf 0 32 YES 640 AVAILABLE
7 /opt/oracle/oradata/ORCLCDB/users01.dbf 0 32 YES 160 AVAILABLE
SQL>
-- Description : Displays a list of all cursors currently open.
[oracle@MaxwellDBA monitoring]$ cat open_cursors.sql
-- -----------------------------------------------------------------------------------
-- File Name : /monitoring/open_cursors.sql
-- Author : Maxwell
-- Description : Displays a list of all cursors currently open.
-- Requirements : Access to the V$ views.
-- Call Syntax : @open_cursors
-- Last Modified: 06-AUG-2022
-- -----------------------------------------------------------------------------------
SELECT a.user_name,
a.sid,
a.sql_text
FROM v$open_cursor a
ORDER BY 1,2
/
[oracle@MaxwellDBA monitoring]$
-- Description : Displays the SQL statement held for a specific SID.
[oracle@MaxwellDBA monitoring]$ cat open_cursors_by_sid.sql
-- -----------------------------------------------------------------------------------
-- File Name : /monitoring/open_cursors_by_sid.sql
-- Author : Maxwell
-- Description : Displays the SQL statement held for a specific SID.
-- Comments : The SID can be found by running session.sql or top_session.sql.
-- Requirements : Access to the V$ views.
-- Call Syntax : @open_cursors_by_sid (sid)
-- Last Modified: 05-AUG-2022
-- -----------------------------------------------------------------------------------
SET LINESIZE 500
SET PAGESIZE 1000
SET VERIFY OFF
SELECT oc.sql_text, cursor_type
FROM v$open_cursor oc
WHERE oc.sid = &1
ORDER BY cursor_type;
PROMPT
SET PAGESIZE 14
[oracle@MaxwellDBA monitoring]$
SQL> @/home/oracle/oracledba/monitoring/open_cursors_by_sid.sql 11
SQL_TEXT CURSOR_TYPE
------------------------------------------------------------ ----------------------------------------------------------------
insert into smon_scn_time (thread, time_mp, time_dp, scn, sc SESSION CURSOR CACHED
delete from smon_scn_time where scn = (select min(scn) from SESSION CURSOR CACHED
select f.file#, f.block#, f.ts#, f.length from fet$ f, ts$ t SESSION CURSOR CACHED
update smon_scn_time set time_mp=:1, time_dp=:2, scn=:3, scn SESSION CURSOR CACHED
select max(RETENTION) from SYS_FBA_FA SESSION CURSOR CACHED
SQL>
-- Description : Displays the SQL statement held for a specific SID.
[oracle@MaxwellDBA monitoring]$ cat open_cursors_full_by_sid.sql
-- -----------------------------------------------------------------------------------
-- File Name : /monitoring/open_cursors_full_by_sid.sql
-- Author : Maxwell
-- Description : Displays the SQL statement held for a specific SID.
-- Comments : The SID can be found by running session.sql or top_session.sql.
-- Requirements : Access to the V$ views.
-- Call Syntax : @open_cursors_full_by_sid (sid)
-- Last Modified: 05-AUG-2022
-- -----------------------------------------------------------------------------------
SET LINESIZE 500
SET PAGESIZE 1000
SET VERIFY OFF
SELECT st.sql_text
FROM v$sqltext st,
v$open_cursor oc
WHERE st.address = oc.address
AND st.hash_value = oc.hash_value
AND oc.sid = &1
ORDER BY st.address, st.piece;
PROMPT
SET PAGESIZE 14
[oracle@MaxwellDBA monitoring]$
SQL> @/home/oracle/oracledba/monitoring/open_cursors_full_by_sid.sql 11
SQL_TEXT
----------------------------------------------------------------
select f.file#, f.block#, f.ts#, f.length from fet$ f, ts$ t whe
re t.ts#=f.ts# and t.dflextpct!=0 and t.bitmapped=0
select max(RETENTION) from SYS_FBA_FA
update smon_scn_time set time_mp=:1, time_dp=:2, scn=:3, scn_wrp
=:4, scn_bas=:5, num_mappings=:6, tim_scn_map=:7 where scn = (
select min(scn) from smon_scn_time)
delete from smon_scn_time where scn = (select min(scn) from smo
n_scn_time)
insert into smon_scn_time (thread, time_mp, time_dp, scn, scn_wr
p, scn_bas, num_mappings, tim_scn_map) values (0, :1, :2, :3, :4
, :5, :6, :7)
11 rows selected.
SQL>
-- Description : Displays information about all database options.
[oracle@MaxwellDBA monitoring]$ cat options.sql
-- -----------------------------------------------------------------------------------
-- File Name : /monitoring/options.sql
-- Author : Maxwell
-- Description : Displays information about all database options.
-- Requirements : Access to the V$ views.
-- Call Syntax : @options
-- Last Modified: 05-AUG-2022
-- -----------------------------------------------------------------------------------
COLUMN value FORMAT A20
SELECT *
FROM v$option
ORDER BY parameter;
[oracle@MaxwellDBA monitoring]$
SQL> @/home/oracle/oracledba/monitoring/options.sql
PARAMETER VALUE CON_ID
---------------------------------------------------------------- -------------------- ----------
ASM Proxy Instance FALSE 0
Active Data Guard TRUE 0
Adaptive Execution Plans TRUE 0
Advanced Analytics TRUE 0
Advanced Compression TRUE 0
Advanced Index Compression TRUE 0
Advanced replication TRUE 0
Application Role TRUE 0
Automatic Data Optimization TRUE 0
Automatic Storage Management FALSE 0
Backup Encryption TRUE 0
PARAMETER VALUE CON_ID
---------------------------------------------------------------- -------------------- ----------
Basic Compression TRUE 0
Bit-mapped indexes TRUE 0
Block Change Tracking TRUE 0
Block Media Recovery TRUE 0
Cache Fusion Lock Accelerator TRUE 0
Centrally Managed User TRUE 0
Change Data Capture TRUE 0
Coalesce Index TRUE 0
Connection multiplexing TRUE 0
Connection pooling TRUE 0
Cross Transportable Backups TRUE 0
PARAMETER VALUE CON_ID
---------------------------------------------------------------- -------------------- ----------
DICOM TRUE 0
Data Mining TRUE 0
Data Redaction TRUE 0
Database queuing TRUE 0
Database resource manager TRUE 0
Deferred Segment Creation TRUE 0
Duplexed backups TRUE 0
Enterprise User Security TRUE 0
Exadata Discovery TRUE 0
Export transportable tablespaces TRUE 0
Fast-Start Fault Recovery TRUE 0
PARAMETER VALUE CON_ID
---------------------------------------------------------------- -------------------- ----------
File Mapping TRUE 0
Fine-grained Auditing TRUE 0
Fine-grained access control TRUE 0
Flashback Data Archive TRUE 0
Flashback Database TRUE 0
Flashback Table TRUE 0
Global Data Services TRUE 0
Heat Map TRUE 0
I/O Server FALSE 0
In-Memory Aggregation TRUE 0
In-Memory Column Store TRUE 0
PARAMETER VALUE CON_ID
---------------------------------------------------------------- -------------------- ----------
Incremental backup and recovery TRUE 0
Instead-of triggers TRUE 0
Java TRUE 0
Join index TRUE 0
Managed Standby TRUE 0
Management Database FALSE 0
Materialized view rewrite TRUE 0
OLAP TRUE 0
OLAP Window Functions TRUE 0
Objects TRUE 0
Online Index Build TRUE 0
PARAMETER VALUE CON_ID
---------------------------------------------------------------- -------------------- ----------
Online Redefinition TRUE 0
Oracle Data Guard TRUE 0
Oracle Database Vault FALSE 0
Oracle Label Security FALSE 0
Parallel backup and recovery TRUE 0
Parallel execution TRUE 0
Parallel load TRUE 0
Partitioning TRUE 0
Plan Stability TRUE 0
Point-in-time tablespace recovery TRUE 0
Privilege Analysis TRUE 0
PARAMETER VALUE CON_ID
---------------------------------------------------------------- -------------------- ----------
Proxy authentication/authorization TRUE 0
Real Application Clusters FALSE 0
Real Application Security TRUE 0
Real Application Testing TRUE 0
Result Cache TRUE 0
SQL Plan Management TRUE 0
Sample Scan TRUE 0
SecureFiles Encryption TRUE 0
Server Flash Cache TRUE 0
Snapshot time recovery TRUE 0
Spatial TRUE 0
PARAMETER VALUE CON_ID
---------------------------------------------------------------- -------------------- ----------
Streams Capture TRUE 0
Table Clustering TRUE 0
Transparent Application Failover TRUE 0
Transparent Data Encryption TRUE 0
Transparent Sensitive Data Protection TRUE 0
Trial Recovery TRUE 0
Unified Auditing FALSE 0
Unused Block Compression TRUE 0
XStream TRUE 0
Zone Maps TRUE 0
87 rows selected.
SQL>
-- Description : Predicts how changes to the buffer cache will affect physical reads.
[oracle@MaxwellDBA monitoring]$ cat db_cache_advice.sql
-- -----------------------------------------------------------------------------------
-- File Name : /monitoring/db_cache_advice.sql
-- Author : Maxwell
-- Description : Predicts how changes to the buffer cache will affect physical reads.
-- Requirements : Access to the V$ views.
-- Call Syntax : @db_cache_advice
-- Last Modified: 06-AUG-2022
-- -----------------------------------------------------------------------------------
COLUMN size_for_estimate FORMAT 999,999,999,999 heading 'Cache Size (MB)'
COLUMN buffers_for_estimate FORMAT 999,999,999 heading 'Buffers'
COLUMN estd_physical_read_factor FORMAT 999.90 heading 'Estd Phys|Read Factor'
COLUMN estd_physical_reads FORMAT 999,999,999,999 heading 'Estd Phys| Reads'
SELECT size_for_estimate,
buffers_for_estimate,
estd_physical_read_factor,
estd_physical_reads
FROM v$db_cache_advice
WHERE name = 'DEFAULT'
AND block_size = (SELECT value
FROM v$parameter
WHERE name = 'db_block_size')
AND advice_status = 'ON';
[oracle@MaxwellDBA monitoring]$
-- Description : Displays general information about the database.
[oracle@MaxwellDBA monitoring]$ cat db_info.sql
-- -----------------------------------------------------------------------------------
-- File Name : /monitoring/db_info.sql
-- Author : Maxwell
-- Description : Displays general information about the database.
-- Requirements : Access to the v$ views.
-- Call Syntax : @db_info
-- Last Modified: 06-AUG-2022
-- -----------------------------------------------------------------------------------
SET PAGESIZE 1000
SET LINESIZE 100
SET FEEDBACK OFF
SELECT *
FROM v$database;
SELECT *
FROM v$instance;
SELECT *
FROM v$version;
SELECT a.name,
a.value
FROM v$sga a;
SELECT Substr(c.name,1,60) "Controlfile",
NVL(c.status,'UNKNOWN') "Status"
FROM v$controlfile c
ORDER BY 1;
SELECT Substr(d.name,1,60) "Datafile",
NVL(d.status,'UNKNOWN') "Status",
d.enabled "Enabled",
LPad(To_Char(Round(d.bytes/1024000,2),'9999990.00'),10,' ') "Size (M)"
FROM v$datafile d
ORDER BY 1;
SELECT l.group# "Group",
Substr(l.member,1,60) "Logfile",
NVL(l.status,'UNKNOWN') "Status"
FROM v$logfile l
ORDER BY 1,2;
PROMPT
SET PAGESIZE 14
SET FEEDBACK ON
[oracle@MaxwellDBA monitoring]$
SQL> @/home/oracle/oracledba/monitoring/db_info.sql
DBID NAME
---------- --------------------------------------------------------------------------------
CREATED RESETLOGS_CHANGE# RESETLOGS_TIME PRIOR_RESETLOGS_CHANGE# PRIOR_RESETLOGS_TI
------------------ ----------------- ------------------ ----------------------- ------------------
LOG_MODE CHECKPOINT_CHANGE# ARCHIVE_CHANGE# CONTROL CONTROLFILE_CREATE CONTROLFILE_SEQUENCE#
------------ ------------------ --------------- ------- ------------------ ---------------------
CONTROLFILE_CHANGE# CONTROLFILE_TIME OPEN_RESETL VERSION_TIME OPEN_MODE
------------------- ------------------ ----------- ------------------ --------------------
PROTECTION_MODE PROTECTION_LEVEL REMOTE_A ACTIVATION# SWITCHOVER# DATABASE_ROLE
-------------------- -------------------- -------- ----------- ----------- ----------------
ARCHIVELOG_CHANGE# ARCHIVEL SWITCHOVER_STATUS DATAGUAR GUARD_S SUPPLEME SUP SUP
------------------ -------- -------------------- -------- ------- -------- --- ---
FORCE_LOGGING PLATFORM_ID
--------------------------------------- -----------
PLATFORM_NAME
----------------------------------------------------------------------------------------------------
RECOVERY_TARGET_INCARNATION# LAST_OPEN_INCARNATION# CURRENT_SCN FLASHBACK_ON SUP SUP
---------------------------- ---------------------- ----------- ------------------ --- ---
DB_UNIQUE_NAME STANDBY_BECAME_PRIMARY_SCN FS_FAILOVER_MODE FS_FAILOVER_STATUS
------------------------------ -------------------------- ------------------- ----------------------
FS_FAILOVER_CURRENT_TARGET FS_FAILOVER_THRESHOLD FS_FAIL
------------------------------ --------------------- -------
FS_FAILOVER_OBSERVER_HOST
----------------------------------------------------------------------------------------------------
CON PRIMARY_DB_UNIQUE_NAME SUP MIN_REQUIRED_CAPTURE_CHANGE# CDB CON_ID
--- ------------------------------ --- ---------------------------- --- ----------
PENDING_ROLE_CHANGE_TASKS
----------------------------------------------------------------------------------------------------
CON_DBID FOR SUP
---------- --- ---
2879679614 ORCLCDB
29-JUN-22 1920977 29-JUN-22 1 17-APR-19
NOARCHIVELOG 6561295 6443856 CURRENT 29-JUN-22 115474
6606029 06-AUG-22 NOT ALLOWED 29-JUN-22 READ WRITE
MAXIMUM PERFORMANCE UNPROTECTED ENABLED 2879716734 2879716734 PRIMARY
0 DISABLED NOT ALLOWED DISABLED NONE NO NO NO
NO 13
Linux x86 64-bit
2 2 6606060 NO NO NO
ORCLCDB 0 DISABLED DISABLED
0
NO NO YES 0
NOT APPLICABLE
2879679614 NO NO
INSTANCE_NUMBER INSTANCE_NAME HOST_NAME
--------------- ---------------- ----------------------------------------------------------------
VERSION VERSION_LEGACY VERSION_FULL STARTUP_TIME STATUS PAR THREAD#
----------------- ----------------- ----------------- ------------------ ------------ --- ----------
ARCHIVE LOG_SWITCH_WAIT LOGINS SHU DATABASE_STATUS INSTANCE_ROLE ACTIVE_ST BLO CON_ID
------- --------------- ---------- --- ----------------- ------------------ --------- --- ----------
INSTANCE_MO EDITION FAMILY
----------- ------- --------------------------------------------------------------------------------
DATABASE_TYPE
---------------
1 ORCLCDB MaxwellDBA
19.0.0.0.0 19.0.0.0.0 19.3.0.0.0 29-JUN-22 OPEN NO 1
STOPPED ALLOWED NO ACTIVE PRIMARY_INSTANCE NORMAL NO 0
REGULAR EE
SINGLE
BANNER
--------------------------------------------------------------------------------
BANNER_FULL
----------------------------------------------------------------------------------------------------
BANNER_LEGACY CON_ID
-------------------------------------------------------------------------------- ----------
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production 0
NAME VALUE
-------------------------------------------------------------------------------- ----------
Fixed Size ##########
Variable Size ##########
Database Buffers ##########
Redo Buffers ##########
Controlfile
----------------------------------------------------------------------------------------------------
Status
-------
/opt/oracle/oradata/ORCLCDB/control01.ctl
UNKNOWN
/opt/oracle/oradata/ORCLCDB/control02.ctl
UNKNOWN
Datafile
----------------------------------------------------------------------------------------------------
Status Enabled Size (M)
------- ---------- ----------------------------------------
/opt/oracle/oradata/ORCLCDB/ORCLPDB1/sysaux01.dbf
ONLINE READ WRITE 399.3
/opt/oracle/oradata/ORCLCDB/ORCLPDB1/system01.dbf
SYSTEM READ WRITE 286.7
/opt/oracle/oradata/ORCLCDB/ORCLPDB1/undotbs01.dbf
ONLINE READ WRITE 102.4
/opt/oracle/oradata/ORCLCDB/ORCLPDB1/users01.dbf
ONLINE READ WRITE 5.1
/opt/oracle/oradata/ORCLCDB/pdbseed/sysaux01.dbf
ONLINE READ WRITE 337.9
/opt/oracle/oradata/ORCLCDB/pdbseed/system01.dbf
SYSTEM READ WRITE 276.4
/opt/oracle/oradata/ORCLCDB/pdbseed/undotbs01.dbf
ONLINE READ WRITE 102.4
/opt/oracle/oradata/ORCLCDB/sysaux01.dbf
ONLINE READ WRITE 1310.7
/opt/oracle/oradata/ORCLCDB/system01.dbf
SYSTEM READ WRITE 962.5
/opt/oracle/oradata/ORCLCDB/undotbs01.dbf
ONLINE READ WRITE 302.0
/opt/oracle/oradata/ORCLCDB/users01.dbf
ONLINE READ WRITE 5.1
Group
----------
Logfile
----------------------------------------------------------------------------------------------------
Status
-------
1
/opt/oracle/oradata/ORCLCDB/redo01.log
UNKNOWN
2
/opt/oracle/oradata/ORCLCDB/redo02.log
UNKNOWN
3
/opt/oracle/oradata/ORCLCDB/redo03.log
UNKNOWN
SQL>
-- Description : Displays information on all database links.
[oracle@MaxwellDBA monitoring]$ cat db_links.sql
-- -----------------------------------------------------------------------------------
-- File Name : /monitoring/db_links.sql
-- Author : Maxwell
-- Description : Displays information on all database links.
-- Requirements : Access to the DBA views.
-- Call Syntax : @db_links
-- Last Modified: 06-AUG-2022
-- -----------------------------------------------------------------------------------
SET LINESIZE 150
COLUMN owner FORMAT A30
COLUMN db_link FORMAT A30
COLUMN username FORMAT A30
COLUMN host FORMAT A30
SELECT owner,
db_link,
username,
host
FROM dba_db_links
ORDER BY owner, db_link;
[oracle@MaxwellDBA monitoring]$
SQL> @/home/oracle/oracledba/monitoring/db_links.sql
OWNER DB_LINK USERNAME HOST
------------------------------ ------------------------------ ------------------------------ ------------------------------
SYS SYS_HUB SEEDDATA
1 row selected.
SQL>
-- Description : Displays information on all open database links.
[oracle@MaxwellDBA monitoring]$ cat db_links_open.sql
-- -----------------------------------------------------------------------------------
-- File Name : /monitoring/db_links_open.sql
-- Author : Maxwell
-- Description : Displays information on all open database links.
-- Requirements : Access to the V$ views.
-- Call Syntax : @db_links_open
-- Last Modified: 06-AUG-2022
-- -----------------------------------------------------------------------------------
SET LINESIZE 200
COLUMN db_link FORMAT A30
SELECT db_link,
owner_id,
logged_on,
heterogeneous,
protocol,
open_cursors,
in_transaction,
update_sent,
commit_point_strength
FROM v$dblink
ORDER BY db_link;
SET LINESIZE 80
[oracle@MaxwellDBA monitoring]$
-- Description : Displays all database property values.
[oracle@MaxwellDBA monitoring]$ cat db_properties.sql
-- -----------------------------------------------------------------------------------
-- File Name : /monitoring/db_properties.sql
-- Author : Maxwell
-- Description : Displays all database property values.
-- Call Syntax : @db_properties
-- Last Modified: 06-AUG-2022
-- -----------------------------------------------------------------------------------
COLUMN property_value FORMAT A50
SELECT property_name,
property_value
FROM database_properties
ORDER BY property_name;
[oracle@MaxwellDBA monitoring]$
-- Description : Lists all valid values for the specified parameter.
[oracle@MaxwellDBA monitoring]$ cat param_valid_values.sql
-- -----------------------------------------------------------------------------------
-- File Name : /monitoring/param_valid_values.sql
-- Author : Maxwell
-- Description : Lists all valid values for the specified parameter.
-- Call Syntax : @param_valid_values (parameter-name)
-- Requirements : Access to the v$views.
-- Last Modified: 06-AUG-2022
-- -----------------------------------------------------------------------------------
SET VERIFY OFF
COLUMN value FORMAT A50
COLUMN isdefault FORMAT A10
SELECT value,
isdefault
FROM v$parameter_valid_values
WHERE name = '&1';
[oracle@MaxwellDBA monitoring]$
SQL> @/home/oracle/oracledba/monitoring/param_valid_values.sql default_sharing
VALUE ISDEFAULT
-------------------------------------------------- ----------
NONE FALSE
METADATA FALSE
OBJECT FALSE
DATA FALSE
EXTENDED DATA FALSE
5 rows selected.
SQL>
-- Description : Displays parameter values that differ between the current value and the spfile.
[oracle@MaxwellDBA monitoring]$ cat parameter_diff.sql
-- -----------------------------------------------------------------------------------
-- File Name : /monitoring/parameter_diffs.sql
-- Author : Maxwell
-- Description : Displays parameter values that differ between the current value and the spfile.
-- Requirements : Access to the V$ views.
-- Call Syntax : @parameter_diffs
-- Last Modified: 06-AUG-2022
-- -----------------------------------------------------------------------------------
SET LINESIZE 120
COLUMN name FORMAT A30
COLUMN current_value FORMAT A30
COLUMN sid FORMAT A8
COLUMN spfile_value FORMAT A30
SELECT p.name,
i.instance_name AS sid,
p.value AS current_value,
sp.sid,
sp.value AS spfile_value
FROM v$spparameter sp,
v$parameter p,
v$instance i
WHERE sp.name = p.name
AND sp.value != p.value;
COLUMN FORMAT DEFAULT
[oracle@MaxwellDBA monitoring]$
-- Description : Displays a list of all the parameters.
[oracle@MaxwellDBA monitoring]$ cat parameters.sql
-- -----------------------------------------------------------------------------------
-- File Name : /monitoring/parameters.sql
-- Author : Maxwell
-- Description : Displays a list of all the parameters.
-- Requirements : Access to the v$ views.
-- Call Syntax : @parameters
-- Last Modified: 06-AUG-2022
-- -----------------------------------------------------------------------------------
SET LINESIZE 500
COLUMN name FORMAT A30
COLUMN value FORMAT A60
SELECT p.name,
p.type,
p.value,
p.isses_modifiable,
p.issys_modifiable,
p.isinstance_modifiable
FROM v$parameter p
ORDER BY p.name;
[oracle@MaxwellDBA monitoring]$
-- Description : Displays a list of all the non-default parameters.
[oracle@MaxwellDBA monitoring]$ cat parameters_non_default.sql
-- -----------------------------------------------------------------------------------
-- File Name : /monitoring/parameters_non_default.sql
-- Author : Maxwell
-- Description : Displays a list of all the non-default parameters.
-- Requirements : Access to the v$ views.
-- Call Syntax : @parameters_non_default
-- Last Modified: 06-AUG-2022
-- -----------------------------------------------------------------------------------
SET LINESIZE 150
COLUMN name FORMAT A50
COLUMN value FORMAT A50
SELECT name,
value
FROM v$parameter
WHERE isdefault = 'FALSE';
[oracle@MaxwellDBA monitoring]$
SQL> clea scre
SQL> @/home/oracle/oracledba/monitoring/parameters_non_default.sql
NAME VALUE
-------------------------------------------------- --------------------------------------------------
processes 300
nls_language AMERICAN
nls_territory AMERICA
memory_target 1509949440
control_files /opt/oracle/oradata/ORCLCDB/control01.ctl, /opt/or
acle/oradata/ORCLCDB/control02.ctl
db_block_size 8192
compatible 19.0.0
undo_tablespace UNDOTBS1
remote_login_passwordfile EXCLUSIVE
NAME VALUE
-------------------------------------------------- --------------------------------------------------
dispatchers (PROTOCOL=TCP) (SERVICE=ORCLCDBXDB)
local_listener LISTENER_ORCLCDB
audit_file_dest /opt/oracle/admin/ORCLCDB/adump
audit_trail DB
db_name ORCLCDB
open_cursors 300
diagnostic_dest /opt/oracle
enable_pluggable_database TRUE
17 rows selected.
SQL>
-- Description : Displays the default temporary and permanent tablespaces.
[oracle@MaxwellDBA monitoring]$ cat default_tablespaces.sql
-- -----------------------------------------------------------------------------------
-- File Name : /monitoring/default_tablespaces.sql
-- Author : Maxwell
-- Description : Displays the default temporary and permanent tablespaces.
-- Requirements : Access to the DATABASE_PROPERTIES views.
-- Call Syntax : @default_tablespaces
-- Last Modified: 06-AUG-2022
-- -----------------------------------------------------------------------------------
COLUMN property_name FORMAT A30
COLUMN property_value FORMAT A30
COLUMN description FORMAT A50
SET LINESIZE 200
SELECT *
FROM database_properties
WHERE property_name like '%TABLESPACE';
[oracle@MaxwellDBA monitoring]$
SQL> @/home/oracle/oracledba/monitoring/default_tablespaces.sql
PROPERTY_NAME PROPERTY_VALUE DESCRIPTION
------------------------------ ------------------------------ --------------------------------------------------
DEFAULT_PERMANENT_TABLESPACE USERS Name of default permanent tablespace
DEFAULT_TEMP_TABLESPACE TEMP Name of default temporary tablespace
2 rows selected.
SQL>
-- Description : Displays free space information about datafiles.
[oracle@MaxwellDBA monitoring]$ cat df_free_space.sql
-- -----------------------------------------------------------------------------------
-- File Name : /monitoring/df_free_space.sql
-- Author : Maxwell
-- Description : Displays free space information about datafiles.
-- Requirements : Access to the V$ views.
-- Call Syntax : @df_free_space.sql
-- Last Modified: 06-AUG-2022
-- -----------------------------------------------------------------------------------
SET LINESIZE 120
COLUMN file_name FORMAT A60
SELECT a.file_name,
ROUND(a.bytes/1024/1024) AS size_mb,
ROUND(a.maxbytes/1024/1024) AS maxsize_mb,
ROUND(b.free_bytes/1024/1024) AS free_mb,
ROUND((a.maxbytes-a.bytes)/1024/1024) AS growth_mb,
100 - ROUND(((b.free_bytes+a.growth)/a.maxbytes) * 100) AS pct_used
FROM (SELECT file_name,
file_id,
bytes,
GREATEST(bytes,maxbytes) AS maxbytes,
GREATEST(bytes,maxbytes)-bytes AS growth
FROM dba_data_files) a,
(SELeCT file_id,
SUM(bytes) AS free_bytes
FROM dba_free_space
GROUP BY file_id) b
WHERE a.file_id = b.file_id
ORDER BY file_name;
[oracle@MaxwellDBA monitoring]$
SQL> @/home/oracle/oracledba/monitoring/df_free_space.sql
FILE_NAME SIZE_MB MAXSIZE_MB FREE_MB GROWTH_MB PCT_USED
------------------------------------------------------------ ---------- ---------- ---------- ---------- ----------
/opt/oracle/oradata/ORCLCDB/sysaux01.dbf 1280 32768 106 31488 4
/opt/oracle/oradata/ORCLCDB/system01.dbf 940 32768 7 31828 3
/opt/oracle/oradata/ORCLCDB/undotbs01.dbf 295 32768 281 32473 0
/opt/oracle/oradata/ORCLCDB/users01.dbf 5 32768 2 32763 0
4 rows selected.
SQL>