-- -----------------------------------------------------------------------------------
-- File Name    : monitoring_off.sql
-- Author       : DBA Learning Hub
-- Description  : Sets monitoring off for the specified tables.
-- Call Syntax  : @monitoring_on (schema) (table-name or all)
-- Last Modified: 15/07/2025
-- -----------------------------------------------------------------------------------
SET PAGESIZE 0
SET FEEDBACK OFF
SET VERIFY OFF
SPOOL temp.sql

SELECT 'ALTER TABLE "' || owner || '"."' || table_name || '" NOMONITORING;'
FROM   dba_tables
WHERE  owner      = UPPER('&1')
AND    table_name = DECODE(UPPER('&2'), 'ALL', table_name, UPPER('&2'))
AND    monitoring = 'YES';

SPOOL OFF

SET PAGESIZE 18
SET FEEDBACK ON

@temp.sql

