2026-03-12 20:23:15
This commit is contained in:
BIN
timhall/.DS_Store
vendored
Normal file
BIN
timhall/.DS_Store
vendored
Normal file
Binary file not shown.
39
timhall/10g/active_session_waits.sql
Normal file
39
timhall/10g/active_session_waits.sql
Normal file
@@ -0,0 +1,39 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/active_session_waits.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information on the current wait states for all active database sessions.
|
||||
-- Requirements : Access to the V$ views.
|
||||
-- Call Syntax : @active_session_waits
|
||||
-- Last Modified: 21/12/2004
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 250
|
||||
SET PAGESIZE 1000
|
||||
|
||||
COLUMN username FORMAT A15
|
||||
COLUMN osuser FORMAT A15
|
||||
COLUMN sid FORMAT 99999
|
||||
COLUMN serial# FORMAT 9999999
|
||||
COLUMN wait_class FORMAT A15
|
||||
COLUMN state FORMAT A19
|
||||
COLUMN logon_time FORMAT A20
|
||||
|
||||
SELECT NVL(a.username, \'(oracle)\') AS username,
|
||||
a.osuser,
|
||||
a.sid,
|
||||
a.serial#,
|
||||
d.spid AS process_id,
|
||||
a.wait_class,
|
||||
a.seconds_in_wait,
|
||||
a.state,
|
||||
a.blocking_session,
|
||||
a.blocking_session_status,
|
||||
a.module,
|
||||
TO_CHAR(a.logon_Time,\'DD-MON-YYYY HH24:MI:SS\') AS logon_time
|
||||
FROM v$session a,
|
||||
v$process d
|
||||
WHERE a.paddr = d.addr
|
||||
AND a.status = \'ACTIVE\'
|
||||
ORDER BY 1,2;
|
||||
|
||||
SET PAGESIZE 14
|
||||
|
||||
19
timhall/10g/ash.sql
Normal file
19
timhall/10g/ash.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/ash.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays the minutes spent on each event for the specified time.
|
||||
-- Requirements : Access to the V$ views.
|
||||
-- Call Syntax : @active_session_waits (mins)
|
||||
-- Last Modified: 21/12/2004
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
SET VERIFY OFF
|
||||
|
||||
SELECT NVL(a.event, 'ON CPU') AS event,
|
||||
COUNT(*) AS total_wait_time
|
||||
FROM v$active_session_history a
|
||||
WHERE a.sample_time > SYSDATE - &1/(24*60)
|
||||
GROUP BY a.event
|
||||
ORDER BY total_wait_time DESC;
|
||||
|
||||
SET VERIFY ON
|
||||
26
timhall/10g/datapump_jobs.sql
Normal file
26
timhall/10g/datapump_jobs.sql
Normal file
@@ -0,0 +1,26 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/datapump_jobs.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information about all Data Pump jobs.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @datapump_jobs
|
||||
-- Last Modified: 28/01/2019
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 150
|
||||
|
||||
COLUMN owner_name FORMAT A20
|
||||
COLUMN job_name FORMAT A30
|
||||
COLUMN operation FORMAT A10
|
||||
COLUMN job_mode FORMAT A10
|
||||
COLUMN state FORMAT A12
|
||||
|
||||
SELECT owner_name,
|
||||
job_name,
|
||||
TRIM(operation) AS operation,
|
||||
TRIM(job_mode) AS job_mode,
|
||||
state,
|
||||
degree,
|
||||
attached_sessions,
|
||||
datapump_sessions
|
||||
FROM dba_datapump_jobs
|
||||
ORDER BY 1, 2;
|
||||
24
timhall/10g/db_usage_hwm.sql
Normal file
24
timhall/10g/db_usage_hwm.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/db_usage_hwm.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays high water mark statistics.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @db_usage_hwm
|
||||
-- Last Modified: 26-NOV-2004
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
COLUMN name FORMAT A40
|
||||
COLUMN highwater FORMAT 999999999999
|
||||
COLUMN last_value FORMAT 999999999999
|
||||
SET PAGESIZE 24
|
||||
|
||||
SELECT hwm1.name,
|
||||
hwm1.highwater,
|
||||
hwm1.last_value
|
||||
FROM dba_high_water_mark_statistics hwm1
|
||||
WHERE hwm1.version = (SELECT MAX(hwm2.version)
|
||||
FROM dba_high_water_mark_statistics hwm2
|
||||
WHERE hwm2.name = hwm1.name)
|
||||
ORDER BY hwm1.name;
|
||||
|
||||
COLUMN FORMAT DEFAULT
|
||||
19
timhall/10g/dynamic_memory.sql
Normal file
19
timhall/10g/dynamic_memory.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/dynamic_memory.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays the values of the dynamically memory pools.
|
||||
-- Requirements : Access to the V$ views.
|
||||
-- Call Syntax : @dynamic_memory
|
||||
-- Last Modified: 08-NOV-2004
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
COLUMN name FORMAT A40
|
||||
COLUMN value FORMAT A40
|
||||
|
||||
SELECT name,
|
||||
value
|
||||
FROM v$parameter
|
||||
WHERE SUBSTR(name, 1, 1) = '_'
|
||||
ORDER BY name;
|
||||
|
||||
COLUMN FORMAT DEFAULT
|
||||
22
timhall/10g/event_histogram.sql
Normal file
22
timhall/10g/event_histogram.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/event_histogram.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays histogram of the event waits times.
|
||||
-- Requirements : Access to the V$ views.
|
||||
-- Call Syntax : @event_histogram "(event-name)"
|
||||
-- Last Modified: 08-NOV-2005
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
SET VERIFY OFF
|
||||
COLUMN event FORMAT A30
|
||||
|
||||
SELECT event#,
|
||||
event,
|
||||
wait_time_milli,
|
||||
wait_count
|
||||
FROM v$event_histogram
|
||||
WHERE event LIKE '%&1%'
|
||||
ORDER BY event, wait_time_milli;
|
||||
|
||||
COLUMN FORMAT DEFAULT
|
||||
SET VERIFY ON
|
||||
25
timhall/10g/feature_usage.sql
Normal file
25
timhall/10g/feature_usage.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/feature_usage.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays feature usage statistics.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @feature_usage
|
||||
-- Last Modified: 26-NOV-2004
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
COLUMN name FORMAT A60
|
||||
COLUMN detected_usages FORMAT 999999999999
|
||||
|
||||
SELECT u1.name,
|
||||
u1.detected_usages,
|
||||
u1.currently_used,
|
||||
u1.version
|
||||
FROM dba_feature_usage_statistics u1
|
||||
WHERE u1.version = (SELECT MAX(u2.version)
|
||||
FROM dba_feature_usage_statistics u2
|
||||
WHERE u2.name = u1.name)
|
||||
AND u1.detected_usages > 0
|
||||
AND u1.dbid = (SELECT dbid FROM v$database)
|
||||
ORDER BY u1.name;
|
||||
|
||||
COLUMN FORMAT DEFAULT
|
||||
31
timhall/10g/flashback_db_info.sql
Normal file
31
timhall/10g/flashback_db_info.sql
Normal file
@@ -0,0 +1,31 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/flashback_db_info.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information relevant to flashback database.
|
||||
-- Requirements : Access to the V$ views.
|
||||
-- Call Syntax : @flashback_db_info
|
||||
-- Last Modified: 21/12/2004
|
||||
-- -----------------------------------------------------------------------------------
|
||||
PROMPT Flashback Status
|
||||
PROMPT ================
|
||||
select flashback_on from v$database;
|
||||
|
||||
PROMPT Flashback Parameters
|
||||
PROMPT ====================
|
||||
|
||||
column name format A30
|
||||
column value format A50
|
||||
select name, value
|
||||
from v$parameter
|
||||
where name in ('db_flashback_retention_target', 'db_recovery_file_dest','db_recovery_file_dest_size')
|
||||
order by name;
|
||||
|
||||
PROMPT Flashback Restore Points
|
||||
PROMPT ========================
|
||||
|
||||
select * from v$restore_point;
|
||||
|
||||
PROMPT Flashback Logs
|
||||
PROMPT ==============
|
||||
|
||||
select * from v$flashback_database_log;
|
||||
60
timhall/10g/generate_multiple_awr_reports.sql
Normal file
60
timhall/10g/generate_multiple_awr_reports.sql
Normal file
@@ -0,0 +1,60 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : http://www.oracle-base.com/dba/10g/generate_multiple_awr_reports.sql
|
||||
-- Author : DR Timothy S Hall
|
||||
-- Description : Generates AWR reports for all snapsots between the specified start and end point.
|
||||
-- Requirements : Access to the v$ views, UTL_FILE and DBMS_WORKLOAD_REPOSITORY packages.
|
||||
-- Call Syntax : Create the directory with the appropriate path.
|
||||
-- Adjust the start and end snapshots as required.
|
||||
-- @generate_multiple_awr_reports.sql
|
||||
-- Last Modified: 02/08/2007
|
||||
-- -----------------------------------------------------------------------------------
|
||||
CREATE OR REPLACE DIRECTORY awr_reports_dir AS '/tmp/';
|
||||
|
||||
DECLARE
|
||||
-- Adjust before use.
|
||||
l_snap_start NUMBER := 1;
|
||||
l_snap_end NUMBER := 10;
|
||||
l_dir VARCHAR2(50) := 'AWR_REPORTS_DIR';
|
||||
|
||||
l_last_snap NUMBER := NULL;
|
||||
l_dbid v$database.dbid%TYPE;
|
||||
l_instance_number v$instance.instance_number%TYPE;
|
||||
l_file UTL_FILE.file_type;
|
||||
l_file_name VARCHAR(50);
|
||||
|
||||
BEGIN
|
||||
SELECT dbid
|
||||
INTO l_dbid
|
||||
FROM v$database;
|
||||
|
||||
SELECT instance_number
|
||||
INTO l_instance_number
|
||||
FROM v$instance;
|
||||
|
||||
FOR cur_snap IN (SELECT snap_id
|
||||
FROM dba_hist_snapshot
|
||||
WHERE instance_number = l_instance_number
|
||||
AND snap_id BETWEEN l_snap_start AND l_snap_end
|
||||
ORDER BY snap_id)
|
||||
LOOP
|
||||
IF l_last_snap IS NOT NULL THEN
|
||||
l_file := UTL_FILE.fopen(l_dir, 'awr_' || l_last_snap || '_' || cur_snap.snap_id || '.htm', 'w', 32767);
|
||||
|
||||
FOR cur_rep IN (SELECT output
|
||||
FROM TABLE(DBMS_WORKLOAD_REPOSITORY.awr_report_html(l_dbid, l_instance_number, l_last_snap, cur_snap.snap_id)))
|
||||
LOOP
|
||||
UTL_FILE.put_line(l_file, cur_rep.output);
|
||||
END LOOP;
|
||||
UTL_FILE.fclose(l_file);
|
||||
END IF;
|
||||
l_last_snap := cur_snap.snap_id;
|
||||
END LOOP;
|
||||
|
||||
EXCEPTION
|
||||
WHEN OTHERS THEN
|
||||
IF UTL_FILE.is_open(l_file) THEN
|
||||
UTL_FILE.fclose(l_file);
|
||||
END IF;
|
||||
RAISE;
|
||||
END;
|
||||
/
|
||||
26
timhall/10g/job_chain_rules.sql
Normal file
26
timhall/10g/job_chain_rules.sql
Normal file
@@ -0,0 +1,26 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/job_chain_rules.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays scheduler information about job chain rules.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @job_chain_rules
|
||||
-- Last Modified: 26/10/2011
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 200
|
||||
COLUMN owner FORMAT A10
|
||||
COLUMN chain_name FORMAT A15
|
||||
COLUMN rule_owner FORMAT A10
|
||||
COLUMN rule_name FORMAT A15
|
||||
COLUMN condition FORMAT A25
|
||||
COLUMN action FORMAT A20
|
||||
COLUMN comments FORMAT A25
|
||||
|
||||
SELECT owner,
|
||||
chain_name,
|
||||
rule_owner,
|
||||
rule_name,
|
||||
condition,
|
||||
action,
|
||||
comments
|
||||
FROM dba_scheduler_chain_rules
|
||||
ORDER BY owner, chain_name, rule_owner, rule_name;
|
||||
23
timhall/10g/job_chain_steps.sql
Normal file
23
timhall/10g/job_chain_steps.sql
Normal file
@@ -0,0 +1,23 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/job_chain_steps.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays scheduler information about job chain steps.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @job_chain_steps
|
||||
-- Last Modified: 26/10/2011
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 200
|
||||
COLUMN owner FORMAT A10
|
||||
COLUMN chain_name FORMAT A15
|
||||
COLUMN step_name FORMAT A15
|
||||
COLUMN program_owner FORMAT A10
|
||||
COLUMN program_name FORMAT A15
|
||||
|
||||
SELECT owner,
|
||||
chain_name,
|
||||
step_name,
|
||||
program_owner,
|
||||
program_name,
|
||||
step_type
|
||||
FROM dba_scheduler_chain_steps
|
||||
ORDER BY owner, chain_name, step_name;
|
||||
24
timhall/10g/job_chains.sql
Normal file
24
timhall/10g/job_chains.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/job_chains.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays scheduler information about job chains.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @job_chains
|
||||
-- Last Modified: 26/10/2011
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 200
|
||||
COLUMN owner FORMAT A10
|
||||
COLUMN chain_name FORMAT A15
|
||||
COLUMN rule_set_owner FORMAT A10
|
||||
COLUMN rule_set_name FORMAT A15
|
||||
COLUMN comments FORMAT A15
|
||||
|
||||
SELECT owner,
|
||||
chain_name,
|
||||
rule_set_owner,
|
||||
rule_set_name,
|
||||
number_of_rules,
|
||||
number_of_steps,
|
||||
enabled,
|
||||
comments
|
||||
FROM dba_scheduler_chains;
|
||||
21
timhall/10g/job_classes.sql
Normal file
21
timhall/10g/job_classes.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/job_classes.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays scheduler information about job classes.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @job_classes
|
||||
-- Last Modified: 27/07/2005
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 200
|
||||
|
||||
COLUMN service FORMAT A20
|
||||
COLUMN comments FORMAT A40
|
||||
|
||||
SELECT job_class_name,
|
||||
resource_consumer_group,
|
||||
service,
|
||||
logging_level,
|
||||
log_history,
|
||||
comments
|
||||
FROM dba_scheduler_job_classes
|
||||
ORDER BY job_class_name;
|
||||
24
timhall/10g/job_programs.sql
Normal file
24
timhall/10g/job_programs.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/job_programs.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays scheduler information about job programs.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @job_programs
|
||||
-- Last Modified: 27/07/2005
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 250
|
||||
|
||||
COLUMN owner FORMAT A20
|
||||
COLUMN program_name FORMAT A30
|
||||
COLUMN program_action FORMAT A50
|
||||
COLUMN comments FORMAT A40
|
||||
|
||||
SELECT owner,
|
||||
program_name,
|
||||
program_type,
|
||||
program_action,
|
||||
number_of_arguments,
|
||||
enabled,
|
||||
comments
|
||||
FROM dba_scheduler_programs
|
||||
ORDER BY owner, program_name;
|
||||
23
timhall/10g/job_running_chains.sql
Normal file
23
timhall/10g/job_running_chains.sql
Normal file
@@ -0,0 +1,23 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/job_running_chains.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays scheduler information about job running chains.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @job_running_chains.sql
|
||||
-- Last Modified: 26/10/2011
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 200
|
||||
COLUMN owner FORMAT A10
|
||||
COLUMN job_name FORMAT A20
|
||||
COLUMN chain_owner FORMAT A10
|
||||
COLUMN chain_name FORMAT A15
|
||||
COLUMN step_name FORMAT A25
|
||||
|
||||
SELECT owner,
|
||||
job_name,
|
||||
chain_owner,
|
||||
chain_name,
|
||||
step_name,
|
||||
state
|
||||
FROM dba_scheduler_running_chains
|
||||
ORDER BY owner, job_name, chain_name, step_name;
|
||||
25
timhall/10g/job_schedules.sql
Normal file
25
timhall/10g/job_schedules.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/job_schedules.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays scheduler information about job schedules.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @job_schedules
|
||||
-- Last Modified: 27/07/2005
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 250
|
||||
|
||||
COLUMN owner FORMAT A20
|
||||
COLUMN schedule_name FORMAT A30
|
||||
COLUMN start_date FORMAT A35
|
||||
COLUMN repeat_interval FORMAT A50
|
||||
COLUMN end_date FORMAT A35
|
||||
COLUMN comments FORMAT A40
|
||||
|
||||
SELECT owner,
|
||||
schedule_name,
|
||||
start_date,
|
||||
repeat_interval,
|
||||
end_date,
|
||||
comments
|
||||
FROM dba_scheduler_schedules
|
||||
ORDER BY owner, schedule_name;
|
||||
22
timhall/10g/jobs.sql
Normal file
22
timhall/10g/jobs.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/jobs.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays scheduler job information.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @jobs
|
||||
-- Last Modified: 27/07/2005
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 200
|
||||
|
||||
COLUMN owner FORMAT A20
|
||||
COLUMN job_name FORMAT A30
|
||||
COLUMN job_class FORMAT A30
|
||||
COLUMN next_run_date FORMAT A36
|
||||
|
||||
SELECT owner,
|
||||
job_name,
|
||||
enabled,
|
||||
job_class,
|
||||
next_run_date
|
||||
FROM dba_scheduler_jobs
|
||||
ORDER BY owner, job_name;
|
||||
20
timhall/10g/jobs_running.sql
Normal file
20
timhall/10g/jobs_running.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/jobs_running.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays scheduler information for running jobs.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @jobs_running
|
||||
-- Last Modified: 27/07/2005
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 200
|
||||
|
||||
COLUMN owner FORMAT A20
|
||||
COLUMN elapsed_time FORMAT A30
|
||||
|
||||
SELECT owner,
|
||||
job_name,
|
||||
running_instance,
|
||||
elapsed_time,
|
||||
session_id
|
||||
FROM dba_scheduler_running_jobs
|
||||
ORDER BY owner, job_name;
|
||||
37
timhall/10g/lock_tree.sql
Normal file
37
timhall/10g/lock_tree.sql
Normal file
@@ -0,0 +1,37 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/lock_tree.sql
|
||||
-- Author : DR Timothy S Hall
|
||||
-- Description : Displays information on all database sessions with the username
|
||||
-- column displayed as a heirarchy if locks are present.
|
||||
-- Requirements : Access to the V$ views.
|
||||
-- Call Syntax : @lock_tree
|
||||
-- Last Modified: 18-MAY-2005
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 500
|
||||
SET PAGESIZE 1000
|
||||
|
||||
COLUMN username FORMAT A30
|
||||
COLUMN osuser FORMAT A10
|
||||
COLUMN machine FORMAT A25
|
||||
COLUMN logon_time FORMAT A20
|
||||
|
||||
SELECT level,
|
||||
LPAD(' ', (level-1)*2, ' ') || NVL(s.username, '(oracle)') AS username,
|
||||
s.osuser,
|
||||
s.sid,
|
||||
s.serial#,
|
||||
s.lockwait,
|
||||
s.status,
|
||||
s.module,
|
||||
s.machine,
|
||||
s.program,
|
||||
TO_CHAR(s.logon_Time,'DD-MON-YYYY HH24:MI:SS') AS logon_time
|
||||
FROM v$session s
|
||||
WHERE level > 1
|
||||
OR EXISTS (SELECT 1
|
||||
FROM v$session
|
||||
WHERE blocking_session = s.sid)
|
||||
CONNECT BY PRIOR s.sid = s.blocking_session
|
||||
START WITH s.blocking_session IS NULL;
|
||||
|
||||
SET PAGESIZE 14
|
||||
29
timhall/10g/scheduler_attributes.sql
Normal file
29
timhall/10g/scheduler_attributes.sql
Normal file
@@ -0,0 +1,29 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/scheduler_attributes.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays the top-level scheduler parameters.
|
||||
-- Requirements : Access to the DBMS_SCHEDULER package and the MANAGE SCHEDULER privilege.
|
||||
-- Call Syntax : @scheduler_attributes
|
||||
-- Last Modified: 13-DEC-2016
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
SET SERVEROUTPUT ON
|
||||
DECLARE
|
||||
PROCEDURE display(p_param IN VARCHAR2) AS
|
||||
l_result VARCHAR2(50);
|
||||
BEGIN
|
||||
DBMS_SCHEDULER.get_scheduler_attribute(
|
||||
attribute => p_param,
|
||||
value => l_result);
|
||||
DBMS_OUTPUT.put_line(RPAD(p_param, 30, ' ') || ' : ' || l_result);
|
||||
END;
|
||||
BEGIN
|
||||
display('current_open_window');
|
||||
display('default_timezone');
|
||||
display('email_sender');
|
||||
display('email_server');
|
||||
display('event_expiry_time');
|
||||
display('log_history');
|
||||
display('max_job_slave_processes');
|
||||
END;
|
||||
/
|
||||
74
timhall/10g/segment_advisor.sql
Normal file
74
timhall/10g/segment_advisor.sql
Normal file
@@ -0,0 +1,74 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/segment_advisor.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays segment advice for the specified segment.
|
||||
-- Requirements : Access to the DBMS_ADVISOR package.
|
||||
-- Call Syntax : Object-type = "tablespace":
|
||||
-- @segment_advisor.sql tablespace (tablespace-name) null
|
||||
-- Object-type = "table" or "index":
|
||||
-- @segment_advisor.sql (object-type) (object-owner) (object-name)
|
||||
-- Last Modified: 08-APR-2005
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET SERVEROUTPUT ON SIZE 1000000
|
||||
SET LINESIZE 200
|
||||
SET VERIFY OFF
|
||||
|
||||
DECLARE
|
||||
l_object_id NUMBER;
|
||||
l_task_name VARCHAR2(32767) := 'SEGMENT_ADVISOR_TASK';
|
||||
l_object_type VARCHAR2(32767) := UPPER('&1');
|
||||
l_attr1 VARCHAR2(32767) := UPPER('&2');
|
||||
l_attr2 VARCHAR2(32767) := UPPER('&3');
|
||||
BEGIN
|
||||
IF l_attr2 = 'NULL' THEN
|
||||
l_attr2 := NULL;
|
||||
END IF;
|
||||
|
||||
DBMS_ADVISOR.create_task (
|
||||
advisor_name => 'Segment Advisor',
|
||||
task_name => l_task_name);
|
||||
|
||||
DBMS_ADVISOR.create_object (
|
||||
task_name => l_task_name,
|
||||
object_type => l_object_type,
|
||||
attr1 => l_attr1,
|
||||
attr2 => l_attr2,
|
||||
attr3 => NULL,
|
||||
attr4 => 'null',
|
||||
attr5 => NULL,
|
||||
object_id => l_object_id);
|
||||
|
||||
DBMS_ADVISOR.set_task_parameter (
|
||||
task_name => l_task_name,
|
||||
parameter => 'RECOMMEND_ALL',
|
||||
value => 'TRUE');
|
||||
|
||||
DBMS_ADVISOR.execute_task(task_name => l_task_name);
|
||||
|
||||
|
||||
FOR cur_rec IN (SELECT f.impact,
|
||||
o.type,
|
||||
o.attr1,
|
||||
o.attr2,
|
||||
f.message,
|
||||
f.more_info
|
||||
FROM dba_advisor_findings f
|
||||
JOIN dba_advisor_objects o ON f.object_id = o.object_id AND f.task_name = o.task_name
|
||||
WHERE f.task_name = l_task_name
|
||||
ORDER BY f.impact DESC)
|
||||
LOOP
|
||||
DBMS_OUTPUT.put_line('..');
|
||||
DBMS_OUTPUT.put_line('Type : ' || cur_rec.type);
|
||||
DBMS_OUTPUT.put_line('Attr1 : ' || cur_rec.attr1);
|
||||
DBMS_OUTPUT.put_line('Attr2 : ' || cur_rec.attr2);
|
||||
DBMS_OUTPUT.put_line('Message : ' || cur_rec.message);
|
||||
DBMS_OUTPUT.put_line('More info : ' || cur_rec.more_info);
|
||||
END LOOP;
|
||||
|
||||
DBMS_ADVISOR.delete_task(task_name => l_task_name);
|
||||
EXCEPTION
|
||||
WHEN OTHERS THEN
|
||||
DBMS_OUTPUT.put_line('Error : ' || DBMS_UTILITY.format_error_backtrace);
|
||||
DBMS_ADVISOR.delete_task(task_name => l_task_name);
|
||||
END;
|
||||
/
|
||||
16
timhall/10g/services.sql
Normal file
16
timhall/10g/services.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/monitoring/services.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information about database services.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @services
|
||||
-- Last Modified: 05/11/2004
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 200
|
||||
COLUMN name FORMAT A30
|
||||
COLUMN network_name FORMAT A50
|
||||
|
||||
SELECT name,
|
||||
network_name
|
||||
FROM dba_services
|
||||
ORDER BY name;
|
||||
27
timhall/10g/session_waits.sql
Normal file
27
timhall/10g/session_waits.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/session_waits.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information on all database session waits.
|
||||
-- Requirements : Access to the V$ views.
|
||||
-- Call Syntax : @session_waits
|
||||
-- Last Modified: 11/03/2005
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 200
|
||||
SET PAGESIZE 1000
|
||||
|
||||
COLUMN username FORMAT A20
|
||||
COLUMN event FORMAT A30
|
||||
COLUMN wait_class FORMAT A15
|
||||
|
||||
SELECT NVL(s.username, '(oracle)') AS username,
|
||||
s.sid,
|
||||
s.serial#,
|
||||
sw.event,
|
||||
sw.wait_class,
|
||||
sw.wait_time,
|
||||
sw.seconds_in_wait,
|
||||
sw.state
|
||||
FROM v$session_wait sw,
|
||||
v$session s
|
||||
WHERE s.sid = sw.sid
|
||||
ORDER BY sw.seconds_in_wait DESC;
|
||||
24
timhall/10g/sga_buffers.sql
Normal file
24
timhall/10g/sga_buffers.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : http://www.oracle-base.com/dba/10g/sga_buffers.sql
|
||||
-- Author : DR Timothy S Hall
|
||||
-- Description : Displays the status of buffers in the SGA.
|
||||
-- Requirements : Access to the v$ and DBA views.
|
||||
-- Call Syntax : @sga_buffers
|
||||
-- Last Modified: 27/07/2005
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 200
|
||||
COLUMN object_name FORMAT A30
|
||||
|
||||
SELECT t.name AS tablespace_name,
|
||||
o.object_name,
|
||||
SUM(DECODE(bh.status, 'free', 1, 0)) AS free,
|
||||
SUM(DECODE(bh.status, 'xcur', 1, 0)) AS xcur,
|
||||
SUM(DECODE(bh.status, 'scur', 1, 0)) AS scur,
|
||||
SUM(DECODE(bh.status, 'cr', 1, 0)) AS cr,
|
||||
SUM(DECODE(bh.status, 'read', 1, 0)) AS read,
|
||||
SUM(DECODE(bh.status, 'mrec', 1, 0)) AS mrec,
|
||||
SUM(DECODE(bh.status, 'irec', 1, 0)) AS irec
|
||||
FROM v$bh bh
|
||||
JOIN dba_objects o ON o.object_id = bh.objd
|
||||
JOIN v$tablespace t ON t.ts# = bh.ts#
|
||||
GROUP BY t.name, o.object_name;
|
||||
17
timhall/10g/sga_dynamic_components.sql
Normal file
17
timhall/10g/sga_dynamic_components.sql
Normal file
@@ -0,0 +1,17 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/sga_dynamic_components.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Provides information about dynamic SGA components.
|
||||
-- Requirements : Access to the v$ views.
|
||||
-- Call Syntax : @sga_dynamic_components
|
||||
-- Last Modified: 09/05/2017
|
||||
-- -----------------------------------------------------------------------------------
|
||||
COLUMN component FORMAT A30
|
||||
|
||||
SELECT component,
|
||||
ROUND(current_size/1024/1024) AS current_size_mb,
|
||||
ROUND(min_size/1024/1024) AS min_size_mb,
|
||||
ROUND(max_size/1024/1024) AS max_size_mb
|
||||
FROM v$sga_dynamic_components
|
||||
WHERE current_size != 0
|
||||
ORDER BY component;
|
||||
11
timhall/10g/sga_dynamic_free_memory.sql
Normal file
11
timhall/10g/sga_dynamic_free_memory.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/sga_dynamic_free_memory.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Provides information about free memory in the SGA.
|
||||
-- Requirements : Access to the v$ views.
|
||||
-- Call Syntax : @sga_dynamic_free_memory
|
||||
-- Last Modified: 23/08/2008
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
SELECT *
|
||||
FROM v$sga_dynamic_free_memory;
|
||||
25
timhall/10g/sga_resize_ops.sql
Normal file
25
timhall/10g/sga_resize_ops.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/sga_resize_ops.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Provides information about memory resize operations.
|
||||
-- Requirements : Access to the v$ views.
|
||||
-- Call Syntax : @sga_resize_ops
|
||||
-- Last Modified: 09/05/2017
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
SET LINESIZE 200
|
||||
|
||||
COLUMN parameter FORMAT A25
|
||||
|
||||
SELECT start_time,
|
||||
end_time,
|
||||
component,
|
||||
oper_type,
|
||||
oper_mode,
|
||||
parameter,
|
||||
ROUND(initial_size/1024/1024) AS initial_size_mb,
|
||||
ROUND(target_size/1024/1024) AS target_size_mb,
|
||||
ROUND(final_size/1024/1024) AS final_size_mb,
|
||||
status
|
||||
FROM v$sga_resize_ops
|
||||
ORDER BY start_time;
|
||||
16
timhall/10g/sysaux_occupants.sql
Normal file
16
timhall/10g/sysaux_occupants.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/sysaux_occupants.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information about the contents of the SYSAUX tablespace.
|
||||
-- Requirements : Access to the v$ views.
|
||||
-- Call Syntax : @sysaux_occupants
|
||||
-- Last Modified: 27/07/2005
|
||||
-- -----------------------------------------------------------------------------------
|
||||
COLUMN occupant_name FORMAT A30
|
||||
COLUMN schema_name FORMAT A20
|
||||
|
||||
SELECT occupant_name,
|
||||
schema_name,
|
||||
space_usage_kbytes
|
||||
FROM v$sysaux_occupants
|
||||
ORDER BY occupant_name;
|
||||
35
timhall/10g/test_calendar_string.sql
Normal file
35
timhall/10g/test_calendar_string.sql
Normal file
@@ -0,0 +1,35 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/10g/test_calendar_string.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays the schedule associated with a calendar string.
|
||||
-- Requirements : Access to the DBMS_SCHEDULER package.
|
||||
-- Call Syntax : @test_calendar_string (frequency) (interations)
|
||||
-- @test_calendar_string 'freq=hourly; byminute=0,30; bysecond=0;' 5
|
||||
-- Last Modified: 27/07/2005
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
SET SERVEROUTPUT ON;
|
||||
SET VERIFY OFF
|
||||
ALTER SESSION SET nls_timestamp_format = 'DD-MON-YYYY HH24:MI:SS';
|
||||
|
||||
DECLARE
|
||||
l_calendar_string VARCHAR2(100) := '&1';
|
||||
l_iterations NUMBER := &2;
|
||||
|
||||
l_start_date TIMESTAMP := TO_TIMESTAMP('01-JAN-2004 03:04:32',
|
||||
'DD-MON-YYYY HH24:MI:SS');
|
||||
l_return_date_after TIMESTAMP := l_start_date;
|
||||
l_next_run_date TIMESTAMP;
|
||||
BEGIN
|
||||
FOR i IN 1 .. l_iterations LOOP
|
||||
DBMS_SCHEDULER.evaluate_calendar_string(
|
||||
calendar_string => l_calendar_string,
|
||||
start_date => l_start_date,
|
||||
return_date_after => l_return_date_after,
|
||||
next_run_date => l_next_run_date);
|
||||
|
||||
DBMS_OUTPUT.put_line('Next Run Date: ' || l_next_run_date);
|
||||
l_return_date_after := l_next_run_date;
|
||||
END LOOP;
|
||||
END;
|
||||
/
|
||||
23
timhall/10g/window_groups.sql
Normal file
23
timhall/10g/window_groups.sql
Normal file
@@ -0,0 +1,23 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/monitoring/window_groups.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays scheduler information about window groups.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @window_groups
|
||||
-- Last Modified: 05/11/2004
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 250
|
||||
|
||||
COLUMN comments FORMAT A40
|
||||
|
||||
SELECT window_group_name,
|
||||
enabled,
|
||||
number_of_windows,
|
||||
comments
|
||||
FROM dba_scheduler_window_groups
|
||||
ORDER BY window_group_name;
|
||||
|
||||
SELECT window_group_name,
|
||||
window_name
|
||||
FROM dba_scheduler_wingroup_members
|
||||
ORDER BY window_group_name, window_name;
|
||||
19
timhall/10g/windows.sql
Normal file
19
timhall/10g/windows.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/monitoring/windows.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays scheduler information about windows.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @windows
|
||||
-- Last Modified: 05/11/2004
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 250
|
||||
|
||||
COLUMN comments FORMAT A40
|
||||
|
||||
SELECT window_name,
|
||||
resource_plan,
|
||||
enabled,
|
||||
active,
|
||||
comments
|
||||
FROM dba_scheduler_windows
|
||||
ORDER BY window_name;
|
||||
12
timhall/11g/admin_privs.sql
Normal file
12
timhall/11g/admin_privs.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/admin_privs.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays the users who currently have admin privileges.
|
||||
-- Requirements : Access to the V$ views.
|
||||
-- Call Syntax : @min_datafile_size
|
||||
-- Last Modified: 30/11/2011
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
SELECT *
|
||||
FROM v$pwfile_users
|
||||
ORDER BY username;
|
||||
48
timhall/11g/autotask_change_window_schedules.sql
Normal file
48
timhall/11g/autotask_change_window_schedules.sql
Normal file
@@ -0,0 +1,48 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/autotask_change_window_schedules.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Use this script to alter the autotask window schedules.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @autotask_change_window_schedules.sql
|
||||
-- Last Modified: 14-JUL-2016
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
DECLARE
|
||||
TYPE t_window_tab IS TABLE OF VARCHAR2(30)
|
||||
INDEX BY BINARY_INTEGER;
|
||||
|
||||
l_tab t_window_tab;
|
||||
l_repeat_interval VARCHAR2(100);
|
||||
l_duration NUMBER;
|
||||
BEGIN
|
||||
|
||||
-- Windows of interest.
|
||||
l_tab(1) := 'SYS.MONDAY_WINDOW';
|
||||
l_tab(2) := 'SYS.TUESDAY_WINDOW';
|
||||
l_tab(3) := 'SYS.WEDNESDAY_WINDOW';
|
||||
l_tab(4) := 'SYS.THURSDAY_WINDOW';
|
||||
l_tab(5) := 'SYS.FRIDAY_WINDOW';
|
||||
--l_tab(6) := 'SYS.SATURDAY_WINDOW';
|
||||
--l_tab(7) := 'SYS.SUNDAY_WINDOW';
|
||||
|
||||
-- Adjust as required.
|
||||
l_repeat_interval := 'freq=weekly; byday=mon; byhour=12; byminute=0; bysecond=0;';
|
||||
l_duration := 120; -- minutes
|
||||
|
||||
FOR i IN l_tab.FIRST .. l_tab.LAST LOOP
|
||||
DBMS_SCHEDULER.disable(name => l_tab(i), force => TRUE);
|
||||
|
||||
DBMS_SCHEDULER.set_attribute(
|
||||
name => l_tab(i),
|
||||
attribute => 'REPEAT_INTERVAL',
|
||||
value => l_repeat_interval);
|
||||
|
||||
DBMS_SCHEDULER.set_attribute(
|
||||
name => l_tab(i),
|
||||
attribute => 'DURATION',
|
||||
value => numtodsinterval(l_duration, 'minute'));
|
||||
|
||||
DBMS_SCHEDULER.enable(name => l_tab(i));
|
||||
END LOOP;
|
||||
END;
|
||||
/
|
||||
25
timhall/11g/autotask_job_history.sql
Normal file
25
timhall/11g/autotask_job_history.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/autotask_job_history.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays the job history for the automatic maintenance tasks.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @autotask_job_history.sql
|
||||
-- Last Modified: 14-JUL-2016
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
COLUMN client_name FORMAT A40
|
||||
COLUMN window_name FORMAT A20
|
||||
COLUMN job_start_time FORMAT A40
|
||||
COLUMN job_duration FORMAT A20
|
||||
COLUMN job_status FORMAT A10
|
||||
|
||||
SELECT client_name,
|
||||
window_name,
|
||||
job_start_time,
|
||||
job_duration,
|
||||
job_status,
|
||||
job_error
|
||||
FROM dba_autotask_job_history
|
||||
ORDER BY job_start_time;
|
||||
|
||||
COLUMN FORMAT DEFAULT
|
||||
19
timhall/11g/autotask_schedule.sql
Normal file
19
timhall/11g/autotask_schedule.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/autotask_schedule.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays the window schedule the automatic maintenance tasks.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @autotask_schedule.sql
|
||||
-- Last Modified: 14-JUL-2016
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
COLUMN window_name FORMAT A20
|
||||
COLUMN start_time FORMAT A40
|
||||
COLUMN duration FORMAT A20
|
||||
|
||||
SELECT *
|
||||
FROM dba_autotask_schedule
|
||||
ORDER BY start_time;
|
||||
|
||||
|
||||
COLUMN FORMAT DEFAULT
|
||||
18
timhall/11g/database_block_corruption.sql
Normal file
18
timhall/11g/database_block_corruption.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/database_block_corruption.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays the users who currently have admin privileges.
|
||||
-- Requirements : Access to the V$ and DBA views.
|
||||
-- Assumes a RMAN VALIDATE has been run against a datafile, tablespace
|
||||
-- or the whole database before this query is run.
|
||||
-- Call Syntax : @database_block_corruption
|
||||
-- Last Modified: 29/11/2018
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
COLUMN owner FORMAT A30
|
||||
COLUMN segment_name FORMAT A30
|
||||
|
||||
SELECT DISTINCT owner, segment_name
|
||||
FROM v$database_block_corruption dbc
|
||||
JOIN dba_extents e ON dbc.file# = e.file_id AND dbc.block# BETWEEN e.block_id and e.block_id+e.blocks-1
|
||||
ORDER BY 1,2;
|
||||
13
timhall/11g/default_passwords.sql
Normal file
13
timhall/11g/default_passwords.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/default_passwords.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays users with default passwords.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @default_passwords
|
||||
-- Last Modified: 26-NOV-2011
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
SELECT a.username, b.account_status
|
||||
FROM dba_users_with_defpwd a
|
||||
JOIN dba_users b ON a.username = b.username
|
||||
ORDER BY 1;
|
||||
14
timhall/11g/diag_info.sql
Normal file
14
timhall/11g/diag_info.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/diag_info.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays the contents of the v$diag_info view.
|
||||
-- Requirements : Access to the V$ views.
|
||||
-- Call Syntax : @diag_info
|
||||
-- Last Modified: 23/08/2008
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 200
|
||||
COLUMN name FORMAT A30
|
||||
COLUMN value FORMAT A110
|
||||
|
||||
SELECT *
|
||||
FROM v$diag_info;
|
||||
16
timhall/11g/extended_stats.sql
Normal file
16
timhall/11g/extended_stats.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/extended_stats.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Provides information about extended statistics.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @extended_stats
|
||||
-- Last Modified: 30/11/2011
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 200
|
||||
COLUMN owner FORMAT A20
|
||||
COLUMN extension_name FORMAT A15
|
||||
COLUMN extension FORMAT A50
|
||||
|
||||
SELECT owner, table_name, extension_name, extension
|
||||
FROM dba_stat_extensions
|
||||
ORDER by owner, table_name;
|
||||
25
timhall/11g/fda.sql
Normal file
25
timhall/11g/fda.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/fda.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information about flashback data archives.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @fda
|
||||
-- Last Modified: 06-JAN-2015
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
SET LINESIZE 150
|
||||
|
||||
COLUMN owner_name FORMAT A20
|
||||
COLUMN flashback_archive_name FORMAT A22
|
||||
COLUMN create_time FORMAT A20
|
||||
COLUMN last_purge_time FORMAT A20
|
||||
|
||||
SELECT owner_name,
|
||||
flashback_archive_name,
|
||||
flashback_archive#,
|
||||
retention_in_days,
|
||||
TO_CHAR(create_time, 'DD-MON-YYYY HH24:MI:SS') AS create_time,
|
||||
TO_CHAR(last_purge_time, 'DD-MON-YYYY HH24:MI:SS') AS last_purge_time,
|
||||
status
|
||||
FROM dba_flashback_archive
|
||||
ORDER BY owner_name, flashback_archive_name;
|
||||
23
timhall/11g/fda_tables.sql
Normal file
23
timhall/11g/fda_tables.sql
Normal file
@@ -0,0 +1,23 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/fda_tables.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information about flashback data archives.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @fda_tables
|
||||
-- Last Modified: 06-JAN-2015
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
SET LINESIZE 150
|
||||
|
||||
COLUMN owner_name FORMAT A20
|
||||
COLUMN table_name FORMAT A20
|
||||
COLUMN flashback_archive_name FORMAT A22
|
||||
COLUMN archive_table_name FORMAT A20
|
||||
|
||||
SELECT owner_name,
|
||||
table_name,
|
||||
flashback_archive_name,
|
||||
archive_table_name,
|
||||
status
|
||||
FROM dba_flashback_archive_tables
|
||||
ORDER BY owner_name, table_name;
|
||||
21
timhall/11g/fda_ts.sql
Normal file
21
timhall/11g/fda_ts.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/fda_ts.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information about flashback data archives.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @fda_ts
|
||||
-- Last Modified: 06-JAN-2015
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
SET LINESIZE 150
|
||||
|
||||
COLUMN flashback_archive_name FORMAT A22
|
||||
COLUMN tablespace_name FORMAT A20
|
||||
COLUMN quota_in_mb FORMAT A11
|
||||
|
||||
SELECT flashback_archive_name,
|
||||
flashback_archive#,
|
||||
tablespace_name,
|
||||
quota_in_mb
|
||||
FROM dba_flashback_archive_ts
|
||||
ORDER BY flashback_archive_name;
|
||||
14
timhall/11g/identify_trace_file.sql
Normal file
14
timhall/11g/identify_trace_file.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/identify_trace_file.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays the name of the trace file associated with the current session.
|
||||
-- Requirements : Access to the V$ views.
|
||||
-- Call Syntax : @identify_trace_file
|
||||
-- Last Modified: 23/08/2008
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 100
|
||||
COLUMN value FORMAT A60
|
||||
|
||||
SELECT value
|
||||
FROM v$diag_info
|
||||
WHERE name = 'Default Trace File';
|
||||
17
timhall/11g/job_credentials.sql
Normal file
17
timhall/11g/job_credentials.sql
Normal file
@@ -0,0 +1,17 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/job_credentials.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays scheduler information about job credentials.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @job_credentials
|
||||
-- Last Modified: 23/08/2008
|
||||
-- -----------------------------------------------------------------------------------
|
||||
COLUMN credential_name FORMAT A25
|
||||
COLUMN username FORMAT A20
|
||||
COLUMN windows_domain FORMAT A20
|
||||
|
||||
SELECT credential_name,
|
||||
username,
|
||||
windows_domain
|
||||
FROM dba_scheduler_credentials
|
||||
ORDER BY credential_name;
|
||||
42
timhall/11g/job_output_file.sql
Normal file
42
timhall/11g/job_output_file.sql
Normal file
@@ -0,0 +1,42 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/job_output_file.sql
|
||||
-- Author : DR Timothy S Hall
|
||||
-- Description : Displays scheduler job information for previous runs.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @job_output_file (job-name) (credential-name)
|
||||
-- Last Modified: 06/06/2014
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
SET VERIFY OFF
|
||||
|
||||
SET SERVEROUTPUT ON
|
||||
DECLARE
|
||||
l_clob CLOB;
|
||||
l_additional_info VARCHAR2(4000);
|
||||
l_external_log_id VARCHAR2(50);
|
||||
BEGIN
|
||||
SELECT additional_info, external_log_id
|
||||
INTO l_additional_info, l_external_log_id
|
||||
FROM (SELECT log_id,
|
||||
additional_info,
|
||||
REGEXP_SUBSTR(additional_info,'job[_0-9]*') AS external_log_id
|
||||
FROM dba_scheduler_job_run_details
|
||||
WHERE job_name = UPPER('&1')
|
||||
ORDER BY log_id DESC)
|
||||
WHERE ROWNUM = 1;
|
||||
|
||||
DBMS_OUTPUT.put_line('ADDITIONAL_INFO: ' || l_additional_info);
|
||||
DBMS_OUTPUT.put_line('EXTERNAL_LOG_ID: ' || l_external_log_id);
|
||||
|
||||
DBMS_LOB.createtemporary(l_clob, FALSE);
|
||||
|
||||
DBMS_SCHEDULER.get_file(
|
||||
source_file => l_external_log_id ||'_stdout',
|
||||
credential_name => UPPER('&2'),
|
||||
file_contents => l_clob,
|
||||
source_host => NULL);
|
||||
|
||||
DBMS_OUTPUT.put_line('stdout:');
|
||||
DBMS_OUTPUT.put_line(l_clob);
|
||||
END;
|
||||
/
|
||||
35
timhall/11g/job_run_details.sql
Normal file
35
timhall/11g/job_run_details.sql
Normal file
@@ -0,0 +1,35 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/job_run_details.sql
|
||||
-- Author : DR Timothy S Hall
|
||||
-- Description : Displays scheduler job information for previous runs.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @job_run_details (job-name | all)
|
||||
-- Last Modified: 06/06/2014
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 300 VERIFY OFF
|
||||
|
||||
COLUMN log_date FORMAT A35
|
||||
COLUMN owner FORMAT A20
|
||||
COLUMN job_name FORMAT A30
|
||||
COLUMN error FORMAT A20
|
||||
COLUMN req_start_date FORMAT A35
|
||||
COLUMN actual_start_date FORMAT A35
|
||||
COLUMN run_duration FORMAT A20
|
||||
COLUMN credential_owner FORMAT A20
|
||||
COLUMN credential_name FORMAT A20
|
||||
COLUMN additional_info FORMAT A30
|
||||
|
||||
SELECT log_date,
|
||||
owner,
|
||||
job_name,
|
||||
status
|
||||
error,
|
||||
req_start_date,
|
||||
actual_start_date,
|
||||
run_duration,
|
||||
credential_owner,
|
||||
credential_name,
|
||||
additional_info
|
||||
FROM dba_scheduler_job_run_details
|
||||
WHERE job_name = DECODE(UPPER('&1'), 'ALL', job_name, UPPER('&1'))
|
||||
ORDER BY log_date;
|
||||
17
timhall/11g/memory_dynamic_components.sql
Normal file
17
timhall/11g/memory_dynamic_components.sql
Normal file
@@ -0,0 +1,17 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/memory_dynamic_components.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Provides information about dynamic memory components.
|
||||
-- Requirements : Access to the v$ views.
|
||||
-- Call Syntax : @memory_dynamic_components
|
||||
-- Last Modified: 09/05/2017
|
||||
-- -----------------------------------------------------------------------------------
|
||||
COLUMN component FORMAT A30
|
||||
|
||||
SELECT component,
|
||||
ROUND(current_size/1024/1024) AS current_size_mb,
|
||||
ROUND(min_size/1024/1024) AS min_size_mb,
|
||||
ROUND(max_size/1024/1024) AS max_size_mb
|
||||
FROM v$memory_dynamic_components
|
||||
WHERE current_size != 0
|
||||
ORDER BY component;
|
||||
25
timhall/11g/memory_resize_ops.sql
Normal file
25
timhall/11g/memory_resize_ops.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/memory_resize_ops.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Provides information about memory resize operations.
|
||||
-- Requirements : Access to the v$ views.
|
||||
-- Call Syntax : @memory_resize_ops
|
||||
-- Last Modified: 09/05/2017
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
SET LINESIZE 200
|
||||
|
||||
COLUMN parameter FORMAT A25
|
||||
|
||||
SELECT start_time,
|
||||
end_time,
|
||||
component,
|
||||
oper_type,
|
||||
oper_mode,
|
||||
parameter,
|
||||
ROUND(initial_size/1024/1024) AS initial_size_mb,
|
||||
ROUND(target_size/1024/1024) AS target_size_mb,
|
||||
ROUND(final_size/1024/1024) AS final_size_mb,
|
||||
status
|
||||
FROM v$memory_resize_ops
|
||||
ORDER BY start_time;
|
||||
11
timhall/11g/memory_target_advice.sql
Normal file
11
timhall/11g/memory_target_advice.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/memory_target_advice.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Provides information to help tune the MEMORY_TARGET parameter.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @memory_target_advice
|
||||
-- Last Modified: 23/08/2008
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SELECT *
|
||||
FROM v$memory_target_advice
|
||||
ORDER BY memory_size;
|
||||
24
timhall/11g/network_acl_privileges.sql
Normal file
24
timhall/11g/network_acl_privileges.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/network_acl_privileges.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays privileges for the network ACLs.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @network_acl_privileges
|
||||
-- Last Modified: 30/11/2011
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 150
|
||||
|
||||
COLUMN acl FORMAT A50
|
||||
COLUMN principal FORMAT A20
|
||||
COLUMN privilege FORMAT A10
|
||||
|
||||
SELECT acl,
|
||||
principal,
|
||||
privilege,
|
||||
is_grant,
|
||||
TO_CHAR(start_date, 'DD-MON-YYYY') AS start_date,
|
||||
TO_CHAR(end_date, 'DD-MON-YYYY') AS end_date
|
||||
FROM dba_network_acl_privileges
|
||||
ORDER BY acl, principal, privilege;
|
||||
|
||||
SET LINESIZE 80
|
||||
18
timhall/11g/network_acls.sql
Normal file
18
timhall/11g/network_acls.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/network_acls.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information about network ACLs.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @network_acls
|
||||
-- Last Modified: 30/11/2011
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 150
|
||||
|
||||
COLUMN host FORMAT A40
|
||||
COLUMN acl FORMAT A50
|
||||
|
||||
SELECT host, lower_port, upper_port, acl
|
||||
FROM dba_network_acls
|
||||
ORDER BY host;
|
||||
|
||||
SET LINESIZE 80
|
||||
12
timhall/11g/result_cache_objects.sql
Normal file
12
timhall/11g/result_cache_objects.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/result_cache_objects.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information about the objects in the result cache.
|
||||
-- Requirements : Access to the V$ views.
|
||||
-- Call Syntax : @result_cache_objects
|
||||
-- Last Modified: 07/11/2012
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 1000
|
||||
|
||||
SELECT *
|
||||
FROM v$result_cache_objects;
|
||||
11
timhall/11g/result_cache_report.sql
Normal file
11
timhall/11g/result_cache_report.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/result_cache_report.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays the result cache report.
|
||||
-- Requirements : Access to the DBMS_RESULT_CACHE package.
|
||||
-- Call Syntax : @result_cache_report
|
||||
-- Last Modified: 07/11/2012
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
SET SERVEROUTPUT ON
|
||||
EXEC DBMS_RESULT_CACHE.memory_report(detailed => true);
|
||||
19
timhall/11g/result_cache_statistics.sql
Normal file
19
timhall/11g/result_cache_statistics.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/result_cache_statistics.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays result cache statistics.
|
||||
-- Requirements : Access to the V$ views.
|
||||
-- Call Syntax : @result_cache_statistics
|
||||
-- Last Modified: 07/11/2012
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
COLUMN name FORMAT A30
|
||||
COLUMN value FORMAT A30
|
||||
|
||||
SELECT id,
|
||||
name,
|
||||
value
|
||||
FROM v$result_cache_statistics
|
||||
ORDER BY id;
|
||||
|
||||
CLEAR COLUMNS
|
||||
10
timhall/11g/result_cache_status.sql
Normal file
10
timhall/11g/result_cache_status.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/result_cache_status.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays the status of the result cache.
|
||||
-- Requirements : Access to the DBMS_RESULT_CACHE package.
|
||||
-- Call Syntax : @result_cache_status
|
||||
-- Last Modified: 07/11/2012
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
SELECT DBMS_RESULT_CACHE.status FROM dual;
|
||||
19
timhall/11g/session_fix.sql
Normal file
19
timhall/11g/session_fix.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/session_fix.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Provides information about session fixes for the specified phrase and version.
|
||||
-- Requirements : Access to the V$ views.
|
||||
-- Call Syntax : @session_fix (session_id | all) (phrase | all) (version | all)
|
||||
-- Last Modified: 30/11/2011
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET VERIFY OFF
|
||||
SET LINESIZE 300
|
||||
|
||||
COLUMN sql_feature FORMAT A35
|
||||
COLUMN optimizer_feature_enable FORMAT A9
|
||||
|
||||
SELECT *
|
||||
FROM v$session_fix_control
|
||||
WHERE session_id = DECODE('&1', 'all', session_id, '&1')
|
||||
AND LOWER(description) LIKE DECODE('&2', 'all', '%', '%&2%')
|
||||
AND optimizer_feature_enable = DECODE('&3', 'all', optimizer_feature_enable, '&3');
|
||||
30
timhall/11g/statistics_global_prefs.sql
Normal file
30
timhall/11g/statistics_global_prefs.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/statistics_global_prefs.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays the top-level global statistics preferences.
|
||||
-- Requirements : Access to the DBMS_STATS package.
|
||||
-- Call Syntax : @statistics_global_prefs
|
||||
-- Last Modified: 13-DEC-2016
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
SET SERVEROUTPUT ON
|
||||
DECLARE
|
||||
PROCEDURE display(p_param IN VARCHAR2) AS
|
||||
l_result VARCHAR2(50);
|
||||
BEGIN
|
||||
l_result := DBMS_STATS.get_prefs (pname => p_param);
|
||||
DBMS_OUTPUT.put_line(RPAD(p_param, 30, ' ') || ' : ' || l_result);
|
||||
END;
|
||||
BEGIN
|
||||
display('AUTOSTATS_TARGET');
|
||||
display('CASCADE');
|
||||
display('DEGREE');
|
||||
display('ESTIMATE_PERCENT');
|
||||
display('METHOD_OPT');
|
||||
display('NO_INVALIDATE');
|
||||
display('GRANULARITY');
|
||||
display('PUBLISH');
|
||||
display('INCREMENTAL');
|
||||
display('STALE_PERCENT');
|
||||
END;
|
||||
/
|
||||
18
timhall/11g/system_fix.sql
Normal file
18
timhall/11g/system_fix.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/system_fix.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Provides information about system fixes for the specified phrase and version.
|
||||
-- Requirements : Access to the V$ views.
|
||||
-- Call Syntax : @system_fix (phrase | all) (version | all)
|
||||
-- Last Modified: 30/11/2011
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET VERIFY OFF
|
||||
SET LINESIZE 300
|
||||
|
||||
COLUMN sql_feature FORMAT A35
|
||||
COLUMN optimizer_feature_enable FORMAT A9
|
||||
|
||||
SELECT *
|
||||
FROM v$system_fix_control
|
||||
WHERE LOWER(description) LIKE DECODE('&1', 'all', '%', '%&1%')
|
||||
AND optimizer_feature_enable = DECODE('&2', 'all', optimizer_feature_enable, '&2');
|
||||
13
timhall/11g/system_fix_count.sql
Normal file
13
timhall/11g/system_fix_count.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/system_fix_count.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Provides information about system fixes per version.
|
||||
-- Requirements : Access to the V$ views.
|
||||
-- Call Syntax : @system_fix_count
|
||||
-- Last Modified: 30/11/2011
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SELECT optimizer_feature_enable,
|
||||
COUNT(*)
|
||||
FROM v$system_fix_control
|
||||
GROUP BY optimizer_feature_enable
|
||||
ORDER BY optimizer_feature_enable;
|
||||
10
timhall/11g/temp_free_space.sql
Normal file
10
timhall/11g/temp_free_space.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/11g/temp_free_space.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information about temporary tablespace usage.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @temp_free_space
|
||||
-- Last Modified: 23-AUG-2008
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SELECT *
|
||||
FROM dba_temp_free_space;
|
||||
23
timhall/12c/cdb_resource_plan_directives.sql
Normal file
23
timhall/12c/cdb_resource_plan_directives.sql
Normal file
@@ -0,0 +1,23 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/12c/cdb_resource_plan_directives.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays CDB resource plan directives.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @cdb_resource_plan_directives.sql (plan-name or all)
|
||||
-- Last Modified: 22-MAR-2014
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
COLUMN plan FORMAT A30
|
||||
COLUMN pluggable_database FORMAT A25
|
||||
SET LINESIZE 100 VERIFY OFF
|
||||
|
||||
SELECT plan,
|
||||
pluggable_database,
|
||||
shares,
|
||||
utilization_limit AS util,
|
||||
parallel_server_limit AS parallel
|
||||
FROM dba_cdb_rsrc_plan_directives
|
||||
WHERE plan = DECODE(UPPER('&1'), 'ALL', plan, UPPER('&1'))
|
||||
ORDER BY plan, pluggable_database;
|
||||
|
||||
SET VERIFY ON
|
||||
21
timhall/12c/cdb_resource_plans.sql
Normal file
21
timhall/12c/cdb_resource_plans.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/12c/cdb_resource_plans.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays CDB resource plans.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @cdb_resource_plans.sql
|
||||
-- Last Modified: 22-MAR-2014
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
COLUMN plan FORMAT A30
|
||||
COLUMN comments FORMAT A30
|
||||
COLUMN status FORMAT A10
|
||||
SET LINESIZE 100
|
||||
|
||||
SELECT plan_id,
|
||||
plan,
|
||||
comments,
|
||||
status,
|
||||
mandatory
|
||||
FROM dba_cdb_rsrc_plans
|
||||
ORDER BY plan;
|
||||
25
timhall/12c/cdb_resource_profile_directives.sql
Normal file
25
timhall/12c/cdb_resource_profile_directives.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/12c/cdb_resource_profile_directives.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays CDB resource profile directives.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @cdb_resource_profile_directives.sql (plan-name or all)
|
||||
-- Last Modified: 10-JAN-2017
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
COLUMN plan FORMAT A30
|
||||
COLUMN pluggable_database FORMAT A25
|
||||
COLUMN profile FORMAT A25
|
||||
SET LINESIZE 150 VERIFY OFF
|
||||
|
||||
SELECT plan,
|
||||
pluggable_database,
|
||||
profile,
|
||||
shares,
|
||||
utilization_limit AS util,
|
||||
parallel_server_limit AS parallel
|
||||
FROM dba_cdb_rsrc_plan_directives
|
||||
WHERE plan = DECODE(UPPER('&1'), 'ALL', plan, UPPER('&1'))
|
||||
ORDER BY plan, pluggable_database, profile;
|
||||
|
||||
SET VERIFY ON
|
||||
20
timhall/12c/clustering_dimensions.sql
Normal file
20
timhall/12c/clustering_dimensions.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/12c/clustering_dimensions.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Display clustering dimensions in the specified schema, or all schemas.
|
||||
-- Call Syntax : @clustering_dimensions (schema or all)
|
||||
-- Last Modified: 24/12/2020
|
||||
-- -----------------------------------------------------------------------------------
|
||||
set linesize 200 verify off trimspool on
|
||||
column owner form a30
|
||||
column table_name form a30
|
||||
column dimension_owner form a30
|
||||
column dimension_name form a30
|
||||
|
||||
select owner,
|
||||
table_name,
|
||||
dimension_owner,
|
||||
dimension_name
|
||||
from dba_clustering_dimensions
|
||||
where owner = decode(upper('&1'), 'ALL', owner, upper('&1'))
|
||||
order by owner, table_name;
|
||||
28
timhall/12c/clustering_joins.sql
Normal file
28
timhall/12c/clustering_joins.sql
Normal file
@@ -0,0 +1,28 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/12c/clustering_joins.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Display clustering joins in the specified schema, or all schemas.
|
||||
-- Call Syntax : @clustering_joins (schema or all)
|
||||
-- Last Modified: 24/12/2020
|
||||
-- -----------------------------------------------------------------------------------
|
||||
set linesize 260 verify off trimspool on
|
||||
column owner format a30
|
||||
column table_name form a30
|
||||
column tab1_owner form a30
|
||||
column tab1_name form a30
|
||||
column tab1_column form a30
|
||||
column tab2_owner form a30
|
||||
column tab2_name form a30
|
||||
column tab2_column form a31
|
||||
|
||||
select owner,
|
||||
table_name,
|
||||
tab1_owner,
|
||||
tab1_name,
|
||||
tab1_column,
|
||||
tab2_owner,
|
||||
tab2_name,
|
||||
tab2_column
|
||||
from dba_clustering_joins
|
||||
where owner = decode(upper('&1'), 'ALL', owner, upper('&1'))
|
||||
order by owner, table_name;
|
||||
24
timhall/12c/clustering_keys.sql
Normal file
24
timhall/12c/clustering_keys.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/12c/clustering_keys.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Display clustering keys in the specified schema, or all schemas.
|
||||
-- Call Syntax : @clustering_keys (schema or all)
|
||||
-- Last Modified: 24/12/2020
|
||||
-- -----------------------------------------------------------------------------------
|
||||
set linesize 200 verify off trimspool on
|
||||
column owner format a30
|
||||
column table_name format a30
|
||||
column detail_owner format a30
|
||||
column detail_name format a30
|
||||
column detail_column format a30
|
||||
|
||||
select owner,
|
||||
table_name,
|
||||
detail_owner,
|
||||
detail_name,
|
||||
detail_column,
|
||||
position,
|
||||
groupid
|
||||
from dba_clustering_keys
|
||||
where owner = decode(upper('&1'), 'ALL', owner, upper('&1'))
|
||||
order by owner, table_name;
|
||||
30
timhall/12c/clustering_tables.sql
Normal file
30
timhall/12c/clustering_tables.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/12c/clustering_tables.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Display clustering tables in the specified schema, or all schemas.
|
||||
-- Call Syntax : @clustering_tables (schema or all)
|
||||
-- Last Modified: 24/12/2020
|
||||
-- -----------------------------------------------------------------------------------
|
||||
set linesize 200 verify off trimspool on
|
||||
column owner format a30
|
||||
column table_name format a30
|
||||
column clustering_type format a25
|
||||
column on_load format a7
|
||||
column on_datamovement format a15
|
||||
column valid format a5
|
||||
column with_zonemap format a12
|
||||
column last_load_clst format a30
|
||||
column last_datamove_clst format a30
|
||||
|
||||
select owner,
|
||||
table_name,
|
||||
clustering_type,
|
||||
on_load,
|
||||
on_datamovement,
|
||||
valid,
|
||||
with_zonemap,
|
||||
last_load_clst,
|
||||
last_datamove_clst
|
||||
from dba_clustering_tables
|
||||
where owner = decode(upper('&1'), 'ALL', owner, upper('&1'))
|
||||
order by owner, table_name;
|
||||
17
timhall/12c/credentials.sql
Normal file
17
timhall/12c/credentials.sql
Normal file
@@ -0,0 +1,17 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/12c/credentials.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information about credentials.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @credentials
|
||||
-- Last Modified: 18/12/2013
|
||||
-- -----------------------------------------------------------------------------------
|
||||
COLUMN credential_name FORMAT A25
|
||||
COLUMN username FORMAT A20
|
||||
COLUMN windows_domain FORMAT A20
|
||||
|
||||
SELECT credential_name,
|
||||
username,
|
||||
windows_domain
|
||||
FROM dba_credentials
|
||||
ORDER BY credential_name;
|
||||
31
timhall/12c/host_aces.sql
Normal file
31
timhall/12c/host_aces.sql
Normal file
@@ -0,0 +1,31 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/12c/host_aces.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information about host ACEs.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @host_aces
|
||||
-- Last Modified: 10/09/2014
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 200
|
||||
|
||||
COLUMN host FORMAT A20
|
||||
COLUMN principal FORMAT A30
|
||||
COLUMN privilege FORMAT A30
|
||||
COLUMN start_date FORMAT A11
|
||||
COLUMN end_date FORMAT A11
|
||||
|
||||
SELECT host,
|
||||
lower_port,
|
||||
upper_port,
|
||||
ace_order,
|
||||
TO_CHAR(start_date, 'DD-MON-YYYY') AS start_date,
|
||||
TO_CHAR(end_date, 'DD-MON-YYYY') AS end_date,
|
||||
grant_type,
|
||||
inverted_principal,
|
||||
principal,
|
||||
principal_type,
|
||||
privilege
|
||||
FROM dba_host_aces
|
||||
ORDER BY host, ace_order;
|
||||
|
||||
SET LINESIZE 80
|
||||
24
timhall/12c/host_acls.sql
Normal file
24
timhall/12c/host_acls.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/12c/host_acls.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information about host ACLs.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @host_acls
|
||||
-- Last Modified: 10/09/2014
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 150
|
||||
|
||||
COLUMN acl FORMAT A50
|
||||
COLUMN host FORMAT A20
|
||||
COLUMN acl_owner FORMAT A10
|
||||
|
||||
SELECT HOST,
|
||||
LOWER_PORT,
|
||||
UPPER_PORT,
|
||||
ACL,
|
||||
ACLID,
|
||||
ACL_OWNER
|
||||
FROM dba_host_acls
|
||||
ORDER BY host;
|
||||
|
||||
SET LINESIZE 80
|
||||
37
timhall/12c/lockdown_profiles.sql
Normal file
37
timhall/12c/lockdown_profiles.sql
Normal file
@@ -0,0 +1,37 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/12c/lockdown_profiles.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information about lockdown profiles.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @lockdown_profiles
|
||||
-- Last Modified: 05/01/2019 - Increase the LINESIZE setting and include PDB ID and name.
|
||||
-- Switch to LEFT OUTER JOIN. Alter column order.
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 250
|
||||
|
||||
COLUMN pdb_name FORMAT A30
|
||||
COLUMN profile_name FORMAT A30
|
||||
COLUMN rule_type FORMAT A20
|
||||
COLUMN rule FORMAT A20
|
||||
COLUMN clause FORMAT A20
|
||||
COLUMN clause_option FORMAT A20
|
||||
COLUMN option_value FORMAT A20
|
||||
COLUMN min_value FORMAT A20
|
||||
COLUMN max_value FORMAT A20
|
||||
COLUMN list FORMAT A20
|
||||
|
||||
SELECT lp.con_id,
|
||||
p.pdb_name,
|
||||
lp.profile_name,
|
||||
lp.rule_type,
|
||||
lp.status,
|
||||
lp.rule,
|
||||
lp.clause,
|
||||
lp.clause_option,
|
||||
lp.option_value,
|
||||
lp.min_value,
|
||||
lp.max_value,
|
||||
lp.list
|
||||
FROM cdb_lockdown_profiles lp
|
||||
LEFT OUTER JOIN cdb_pdbs p ON lp.con_id = p.con_id
|
||||
ORDER BY 1, 3;
|
||||
27
timhall/12c/login.sql
Normal file
27
timhall/12c/login.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/12c/login.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Resets the SQL*Plus prompt when a new connection is made.
|
||||
-- Includes PDB:CDB.
|
||||
-- Call Syntax : @login
|
||||
-- Last Modified: 21/04/2014
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET FEEDBACK OFF
|
||||
SET TERMOUT OFF
|
||||
|
||||
COLUMN X NEW_VALUE Y
|
||||
SELECT LOWER(USER || '@' ||
|
||||
SYS_CONTEXT('userenv', 'con_name') || ':' ||
|
||||
SYS_CONTEXT('userenv', 'instance_name')) X
|
||||
FROM dual;
|
||||
SET SQLPROMPT '&Y> '
|
||||
|
||||
ALTER SESSION SET NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI:SS';
|
||||
ALTER SESSION SET NLS_TIMESTAMP_FORMAT='DD-MON-YYYY HH24:MI:SS.FF';
|
||||
|
||||
SET TERMOUT ON
|
||||
SET FEEDBACK ON
|
||||
SET LINESIZE 100
|
||||
SET TAB OFF
|
||||
SET TRIM ON
|
||||
SET TRIMSPOOL ON
|
||||
21
timhall/12c/pdb_spfiles.sql
Normal file
21
timhall/12c/pdb_spfiles.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/12c/pdb_spfiles.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information from the pdb_spfile$ table.
|
||||
-- Requirements : Access to pdb_spfile$ and v$pdbs.
|
||||
-- Call Syntax : @pdb_spfiles
|
||||
-- Last Modified: 04/05/2021
|
||||
-- -----------------------------------------------------------------------------------
|
||||
set linesize 120
|
||||
column pdb_name format a10
|
||||
column name format a30
|
||||
column value$ format a30
|
||||
|
||||
select ps.db_uniq_name,
|
||||
ps.pdb_uid,
|
||||
p.name as pdb_name,
|
||||
ps.name,
|
||||
ps.value$
|
||||
from pdb_spfile$ ps
|
||||
join v$pdbs p on ps.pdb_uid = p.con_uid
|
||||
order by 1, 2, 3;
|
||||
20
timhall/12c/pdbs.sql
Normal file
20
timhall/12c/pdbs.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/12c/pdbs.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information about all PDBs in the current CDB.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @pdbs
|
||||
-- Last Modified: 01/01/2019 - Added format for NAME column.
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
COLUMN pdb_name FORMAT A20
|
||||
|
||||
SELECT pdb_name, status
|
||||
FROM dba_pdbs
|
||||
ORDER BY pdb_name;
|
||||
|
||||
COLUMN name FORMAT A20
|
||||
|
||||
SELECT name, open_mode
|
||||
FROM v$pdbs
|
||||
ORDER BY name;
|
||||
20
timhall/12c/plugin_violations.sql
Normal file
20
timhall/12c/plugin_violations.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/12c/plugin_violations.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information about recent PDB plugin violations.
|
||||
-- Requirements :
|
||||
-- Call Syntax : @plugin_violations
|
||||
-- Last Modified: 09-JAN-2017
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
SET LINESIZE 200
|
||||
|
||||
COLUMN time FORMAT A30
|
||||
COLUMN name FORMAT A30
|
||||
COLUMN cause FORMAT A30
|
||||
COLUMN message FORMAT A30
|
||||
|
||||
SELECT time, name, cause, message
|
||||
FROM pdb_plug_in_violations
|
||||
WHERE time > TRUNC(SYSTIMESTAMP)
|
||||
ORDER BY time;
|
||||
23
timhall/12c/priv_captures.sql
Normal file
23
timhall/12c/priv_captures.sql
Normal file
@@ -0,0 +1,23 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/12c/priv_captures.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays privilege capture policies.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @priv_captures.sql
|
||||
-- Last Modified: 22-APR-2014
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
COLUMN name FORMAT A15
|
||||
COLUMN description FORMAT A30
|
||||
COLUMN roles FORMAT A20
|
||||
COLUMN context FORMAT A30
|
||||
SET LINESIZE 200
|
||||
|
||||
SELECT name,
|
||||
description,
|
||||
type,
|
||||
enabled,
|
||||
roles,
|
||||
context
|
||||
FROM dba_priv_captures
|
||||
ORDER BY name;
|
||||
36
timhall/12c/redaction_columns.sql
Normal file
36
timhall/12c/redaction_columns.sql
Normal file
@@ -0,0 +1,36 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/12c/redaction_columns.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information about columns related to redaction policies.
|
||||
-- Requirements : Access to the REDACTION_COLUMNS view.
|
||||
-- Call Syntax : @redaction_columns (schema | all) (object | all)
|
||||
-- Last Modified: 27-NOV-2014
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
SET LINESIZE 300 VERIFY OFF
|
||||
|
||||
COLUMN object_owner FORMAT A20
|
||||
COLUMN object_name FORMAT A30
|
||||
COLUMN column_name FORMAT A30
|
||||
COLUMN function_parameters FORMAT A30
|
||||
COLUMN regexp_pattern FORMAT A30
|
||||
COLUMN regexp_replace_string FORMAT A30
|
||||
COLUMN column_description FORMAT A20
|
||||
|
||||
SELECT object_owner,
|
||||
object_name,
|
||||
column_name,
|
||||
function_type,
|
||||
function_parameters,
|
||||
regexp_pattern,
|
||||
regexp_replace_string,
|
||||
regexp_position,
|
||||
regexp_occurrence,
|
||||
regexp_match_parameter,
|
||||
column_description
|
||||
FROM redaction_columns
|
||||
WHERE object_owner = DECODE(UPPER('&1'), 'ALL', object_owner, UPPER('&1'))
|
||||
AND object_name = DECODE(UPPER('&2'), 'ALL', object_name, UPPER('&2'))
|
||||
ORDER BY 1, 2, 3;
|
||||
|
||||
SET VERIFY ON
|
||||
25
timhall/12c/redaction_policies.sql
Normal file
25
timhall/12c/redaction_policies.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/12c/redaction_policies.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays redaction policy information.
|
||||
-- Requirements : Access to the REDACTION_POLICIES view.
|
||||
-- Call Syntax : @redaction_policies
|
||||
-- Last Modified: 27-NOV-2014
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
SET LINESIZE 200
|
||||
|
||||
COLUMN object_owner FORMAT A20
|
||||
COLUMN object_name FORMAT A30
|
||||
COLUMN policy_name FORMAT A30
|
||||
COLUMN expression FORMAT A30
|
||||
COLUMN policy_description FORMAT A20
|
||||
|
||||
SELECT object_owner,
|
||||
object_name,
|
||||
policy_name,
|
||||
expression,
|
||||
enable,
|
||||
policy_description
|
||||
FROM redaction_policies
|
||||
ORDER BY 1, 2, 3;
|
||||
22
timhall/12c/redaction_value_defaults.sql
Normal file
22
timhall/12c/redaction_value_defaults.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/12c/redaction_value_defaults.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information about redaction defaults.
|
||||
-- Requirements : Access to the REDACTION_VALUES_FOR_TYPE_FULL view.
|
||||
-- Call Syntax : @redaction_value_defaults
|
||||
-- Last Modified: 27-NOV-2014
|
||||
-- -----------------------------------------------------------------------------------
|
||||
|
||||
SET LINESIZE 250
|
||||
COLUMN char_value FORMAT A10
|
||||
COLUMN varchar_value FORMAT A10
|
||||
COLUMN nchar_value FORMAT A10
|
||||
COLUMN nvarchar_value FORMAT A10
|
||||
COLUMN timestamp_value FORMAT A27
|
||||
COLUMN timestamp_with_time_zone_value FORMAT A32
|
||||
COLUMN blob_value FORMAT A20
|
||||
COLUMN clob_value FORMAT A10
|
||||
COLUMN nclob_value FORMAT A10
|
||||
|
||||
SELECT *
|
||||
FROM redaction_values_for_type_full;
|
||||
18
timhall/12c/services.sql
Normal file
18
timhall/12c/services.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/monitoring/services.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information about database services.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @services
|
||||
-- Last Modified: 05/11/2004
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 200
|
||||
COLUMN name FORMAT A30
|
||||
COLUMN network_name FORMAT A50
|
||||
COLUMN pdb FORMAT A20
|
||||
|
||||
SELECT name,
|
||||
network_name,
|
||||
pdb
|
||||
FROM dba_services
|
||||
ORDER BY name;
|
||||
27
timhall/18c/lockdown_rules.sql
Normal file
27
timhall/18c/lockdown_rules.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/18c/lockdown_rules.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information about lockdown rules applis in the current container.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @lockdown_rules
|
||||
-- Last Modified: 06/01/2019 - Switch to OUTER JOIN and alter ORDER BY.
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 200
|
||||
|
||||
COLUMN rule_type FORMAT A20
|
||||
COLUMN rule FORMAT A20
|
||||
COLUMN clause FORMAT A20
|
||||
COLUMN clause_option FORMAT A20
|
||||
COLUMN pdb_name FORMAT A30
|
||||
|
||||
SELECT lr.rule_type,
|
||||
lr.rule,
|
||||
lr.status,
|
||||
lr.clause,
|
||||
lr.clause_option,
|
||||
lr.users,
|
||||
lr.con_id,
|
||||
p.pdb_name
|
||||
FROM v$lockdown_rules lr
|
||||
LEFT OUTER JOIN cdb_pdbs p ON lr.con_id = p.con_id
|
||||
ORDER BY 1, 2;
|
||||
24
timhall/18c/max_pdb_snapshots.sql
Normal file
24
timhall/18c/max_pdb_snapshots.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/18c/max_pdb_snapshots.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays the MAX_PDB_SNAPSHOTS setting for each container.
|
||||
-- Requirements : Access to the CDB views.
|
||||
-- Call Syntax : @max_pdb_snapshots
|
||||
-- Last Modified: 01/01/2019
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 150 TAB OFF
|
||||
|
||||
COLUMN property_name FORMAT A20
|
||||
COLUMN pdb_name FORMAT A10
|
||||
COLUMN property_value FORMAT A15
|
||||
COLUMN description FORMAT A50
|
||||
|
||||
SELECT pr.con_id,
|
||||
p.pdb_name,
|
||||
pr.property_name,
|
||||
pr.property_value,
|
||||
pr.description
|
||||
FROM cdb_properties pr
|
||||
JOIN cdb_pdbs p ON pr.con_id = p.con_id
|
||||
WHERE pr.property_name = 'MAX_PDB_SNAPSHOTS'
|
||||
ORDER BY pr.property_name;
|
||||
19
timhall/18c/pdb_snapshot_mode.sql
Normal file
19
timhall/18c/pdb_snapshot_mode.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/18c/pdb_snapshot_mode.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays the SNAPSHOT_MODE and SNAPSHOT_INTERVAL setting for each container.
|
||||
-- Requirements : Access to the CDB views.
|
||||
-- Call Syntax : @pdb_snapshot_mode
|
||||
-- Last Modified: 01/01/2019
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 150 TAB OFF
|
||||
|
||||
COLUMN pdb_name FORMAT A10
|
||||
COLUMN snapshot_mode FORMAT A15
|
||||
|
||||
SELECT p.con_id,
|
||||
p.pdb_name,
|
||||
p.snapshot_mode,
|
||||
p.snapshot_interval
|
||||
FROM cdb_pdbs p
|
||||
ORDER BY 1;
|
||||
22
timhall/18c/pdb_snapshots.sql
Normal file
22
timhall/18c/pdb_snapshots.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/18c/pdb_snapshots.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays the snapshots for all PDBs.
|
||||
-- Requirements : Access to the CDB views.
|
||||
-- Call Syntax : @pdb_snapshots
|
||||
-- Last Modified: 01/01/2019
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET LINESIZE 150 TAB OFF
|
||||
|
||||
COLUMN con_name FORMAT A10
|
||||
COLUMN snapshot_name FORMAT A30
|
||||
COLUMN snapshot_scn FORMAT 9999999
|
||||
COLUMN full_snapshot_path FORMAT A50
|
||||
|
||||
SELECT con_id,
|
||||
con_name,
|
||||
snapshot_name,
|
||||
snapshot_scn,
|
||||
full_snapshot_path
|
||||
FROM cdb_pdb_snapshots
|
||||
ORDER BY con_id, snapshot_scn;
|
||||
14
timhall/19c/auto_index_config.sql
Normal file
14
timhall/19c/auto_index_config.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/19c/auto_index_config.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays the auto-index configuration for each container.
|
||||
-- Requirements : Access to the CDB views.
|
||||
-- Call Syntax : @auto_index_config
|
||||
-- Last Modified: 04/06/2019
|
||||
-- -----------------------------------------------------------------------------------
|
||||
COLUMN parameter_name FORMAT A40
|
||||
COLUMN parameter_value FORMAT A40
|
||||
|
||||
SELECT con_id, parameter_name, parameter_value
|
||||
FROM cdb_auto_index_config
|
||||
ORDER BY 1, 2;
|
||||
26
timhall/19c/auto_indexes.sql
Normal file
26
timhall/19c/auto_indexes.sql
Normal file
@@ -0,0 +1,26 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/19c/auto_indexes.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays auto indexes for the specified schema or all schemas.
|
||||
-- Requirements : Access to the DBA views.
|
||||
-- Call Syntax : @auto_indexes (schema-name or all)
|
||||
-- Last Modified: 04/06/2019
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET VERIFY OFF LINESIZE 200
|
||||
|
||||
COLUMN owner FORMAT A30
|
||||
COLUMN index_name FORMAT A30
|
||||
COLUMN table_owner FORMAT A30
|
||||
COLUMN table_name FORMAT A30
|
||||
|
||||
SELECT owner,
|
||||
index_name,
|
||||
index_type,
|
||||
table_owner,
|
||||
table_name
|
||||
table_type
|
||||
FROM dba_indexes
|
||||
WHERE owner = DECODE(UPPER('&1'), 'ALL', owner, UPPER('&1'))
|
||||
AND auto = 'YES'
|
||||
ORDER BY owner, index_name;
|
||||
|
||||
25
timhall/21c/blockchain_tables.sql
Normal file
25
timhall/21c/blockchain_tables.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/21c/blockchain_tables.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Display blockchain tables in the specified schema, or all schemas.
|
||||
-- Call Syntax : @blockchain_tables (schema or all)
|
||||
-- Last Modified: 23/12/2020
|
||||
-- -----------------------------------------------------------------------------------
|
||||
set linesize 200 verify off trimspool on
|
||||
|
||||
column schema_name format a30
|
||||
column table_name format a30
|
||||
column row_retention format a13
|
||||
column row_retention_locked format a20
|
||||
column table_inactivity_retention format a26
|
||||
column hash_algorithm format a14
|
||||
|
||||
SELECT schema_name,
|
||||
table_name,
|
||||
row_retention,
|
||||
row_retention_locked,
|
||||
table_inactivity_retention,
|
||||
hash_algorithm
|
||||
FROM dba_blockchain_tables
|
||||
WHERE schema_name = DECODE(UPPER('&1'), 'ALL', schema_name, UPPER('&1'));
|
||||
|
||||
20
timhall/21c/certificates.sql
Normal file
20
timhall/21c/certificates.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/21c/certificates.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Display certificates in the specified schema, or all schemas.
|
||||
-- Call Syntax : @certificates (schema or all)
|
||||
-- Last Modified: 23/12/2020
|
||||
-- -----------------------------------------------------------------------------------
|
||||
set linesize 200 verify off trimspool on
|
||||
|
||||
column user_name format a10
|
||||
column distinguished_name format a30
|
||||
column certificate format a30
|
||||
|
||||
select user_name,
|
||||
certificate_guid,
|
||||
distinguished_name,
|
||||
substr(certificate, 1, 25) || '...' as certificate
|
||||
from dba_certificates
|
||||
where user_name = DECODE(UPPER('&1'), 'ALL', user_name, UPPER('&1'))
|
||||
order by user_name;
|
||||
23
timhall/21c/sql_macros.sql
Normal file
23
timhall/21c/sql_macros.sql
Normal file
@@ -0,0 +1,23 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/21c/sql_macros.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Displays information about SQL macros for the specific schema, or all schemas.
|
||||
-- Call Syntax : @sql_macros (schema or all)
|
||||
-- Last Modified: 27/12/2020
|
||||
-- -----------------------------------------------------------------------------------
|
||||
set linesize 150 verify off trimspool on
|
||||
column owner format a30
|
||||
column object_name format a30
|
||||
column procedure_name format a30
|
||||
column sql_macro format a9
|
||||
|
||||
select p.owner,
|
||||
o.object_type,
|
||||
p.sql_macro,
|
||||
p.object_name,
|
||||
p.procedure_name
|
||||
from dba_procedures p
|
||||
join dba_objects o on p.object_id = o.object_id
|
||||
where p.sql_macro != 'NULL'
|
||||
and p.owner = decode(upper('&1'), 'ALL', p.owner, upper('&1'))
|
||||
order by p.owner, o.object_type, p.sql_macro, p.object_name, p.procedure_name;
|
||||
6
timhall/README.md
Normal file
6
timhall/README.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# oracle-base.com scripts
|
||||
|
||||
Here are the scripts from my website [oracle-base.com](https://oracle-base.com/dba/scripts).
|
||||
|
||||
The scripts are maintained by a CMS, not Git, so the GitHub commit dates and comments may not reflect the specific changes made to the scripts. They are provided here for convenience only.
|
||||
|
||||
27
timhall/constraints/disable_chk.sql
Normal file
27
timhall/constraints/disable_chk.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/constraints/disable_chk.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Disables all check constraints for a specified table, or all tables.
|
||||
-- Call Syntax : @disable_chk (table-name or all) (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'ALTER TABLE "' || a.table_name || '" DISABLE CONSTRAINT "' || a.constraint_name || '";'
|
||||
FROM all_constraints a
|
||||
WHERE a.constraint_type = 'C'
|
||||
AND a.owner = UPPER('&2');
|
||||
AND a.table_name = DECODE(UPPER('&1'),'ALL',a.table_name,UPPER('&1'));
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
27
timhall/constraints/disable_fk.sql
Normal file
27
timhall/constraints/disable_fk.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/constraints/disable_fk.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Disables all Foreign Keys belonging to the specified table, or all tables.
|
||||
-- Call Syntax : @disable_fk (table-name or all) (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'ALTER TABLE "' || a.table_name || '" DISABLE CONSTRAINT "' || a.constraint_name || '";'
|
||||
FROM all_constraints a
|
||||
WHERE a.constraint_type = 'R'
|
||||
AND a.table_name = DECODE(Upper('&1'),'ALL',a.table_name,Upper('&1'))
|
||||
AND a.owner = Upper('&2');
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
27
timhall/constraints/disable_pk.sql
Normal file
27
timhall/constraints/disable_pk.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/constraints/disable_pk.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Disables the Primary Key for the specified table, or all tables.
|
||||
-- Call Syntax : @disable_pk (table-name or all) (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'ALTER TABLE "' || a.table_name || '" DISABLE PRIMARY KEY;'
|
||||
FROM all_constraints a
|
||||
WHERE a.constraint_type = 'P'
|
||||
AND a.owner = Upper('&2')
|
||||
AND a.table_name = DECODE(Upper('&1'),'ALL',a.table_name,Upper('&1'));
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
30
timhall/constraints/disable_ref_fk.sql
Normal file
30
timhall/constraints/disable_ref_fk.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/constraints/disable_ref_fk.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Disables all Foreign Keys referencing a specified table, or all tables.
|
||||
-- Call Syntax : @disable_ref_fk (table-name) (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'ALTER TABLE "' || a.table_name || '" DISABLE CONSTRAINT "' || a.constraint_name || '";' enable_constraints
|
||||
FROM all_constraints a
|
||||
WHERE a.owner = Upper('&2')
|
||||
AND a.constraint_type = 'R'
|
||||
AND a.r_constraint_name IN (SELECT a1.constraint_name
|
||||
FROM all_constraints a1
|
||||
WHERE a1.table_name = DECODE(Upper('&1'),'ALL',a.table_name,Upper('&1'))
|
||||
AND a1.owner = Upper('&2'));
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
27
timhall/constraints/enable_chk.sql
Normal file
27
timhall/constraints/enable_chk.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/constraints/enable_chk.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Enables all check constraints for a specified table, or all tables.
|
||||
-- Call Syntax : @enable_chk (table-name or all) (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'ALTER TABLE "' || a.table_name || '" ENABLE CONSTRAINT "' || a.constraint_name || '";'
|
||||
FROM all_constraints a
|
||||
WHERE a.constraint_type = 'C'
|
||||
AND a.owner = Upper('&2');
|
||||
AND a.table_name = DECODE(Upper('&1'),'ALL',a.table_name,UPPER('&1'));
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
27
timhall/constraints/enable_fk.sql
Normal file
27
timhall/constraints/enable_fk.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/constraints/enable_fk.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Enables all Foreign Keys belonging to the specified table, or all tables.
|
||||
-- Call Syntax : @enable_fk (table-name or all) (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'ALTER TABLE "' || a.table_name || '" ENABLE CONSTRAINT "' || a.constraint_name || '";'
|
||||
FROM all_constraints a
|
||||
WHERE a.constraint_type = 'R'
|
||||
AND a.table_name = DECODE(Upper('&1'),'ALL',a.table_name,Upper('&1'))
|
||||
AND a.owner = Upper('&2');
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
27
timhall/constraints/enable_pk.sql
Normal file
27
timhall/constraints/enable_pk.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/constraints/enable_pk.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Enables the Primary Key for the specified table, or all tables.
|
||||
-- Call Syntax : @disable_pk (table-name or all) (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'ALTER TABLE "' || a.table_name || '" ENABLE PRIMARY KEY;'
|
||||
FROM all_constraints a
|
||||
WHERE a.constraint_type = 'P'
|
||||
AND a.owner = Upper('&2')
|
||||
AND a.table_name = DECODE(Upper('&1'),'ALL',a.table_name,Upper('&1'));
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
30
timhall/constraints/enable_ref_fk.sql
Normal file
30
timhall/constraints/enable_ref_fk.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/constraints/enable_ref_fk.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Enables all Foreign Keys referencing a specified table, or all tables.
|
||||
-- Call Syntax : @enable_ref_fk (table-name) (schema-name)
|
||||
-- Last Modified: 28/01/2001
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'ALTER TABLE "' || a.table_name || '" ENABLE CONSTRAINT "' || a.constraint_name || '";'
|
||||
FROM all_constraints a
|
||||
WHERE a.owner = Upper('&2')
|
||||
AND a.constraint_type = 'R'
|
||||
AND a.r_constraint_name IN (SELECT a1.constraint_name
|
||||
FROM all_constraints a1
|
||||
WHERE a1.table_name = DECODE(Upper('&1'),'ALL',a.table_name,Upper('&1'))
|
||||
AND a1.owner = Upper('&2'));
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
27
timhall/miscellaneous/analyze_all.sql
Normal file
27
timhall/miscellaneous/analyze_all.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- -----------------------------------------------------------------------------------
|
||||
-- File Name : https://oracle-base.com/dba/miscellaneous/analyze_all.sql
|
||||
-- Author : Tim Hall
|
||||
-- Description : Outdated script to analyze all tables for the specified schema.
|
||||
-- Comment : Use DBMS_UTILITY.ANALYZE_SCHEMA or DBMS_STATS.GATHER_SCHEMA_STATS if your server allows it.
|
||||
-- Call Syntax : @ananlyze_all (schema-name)
|
||||
-- Last Modified: 26/02/2002
|
||||
-- -----------------------------------------------------------------------------------
|
||||
SET PAGESIZE 0
|
||||
SET FEEDBACK OFF
|
||||
SET VERIFY OFF
|
||||
|
||||
SPOOL temp.sql
|
||||
|
||||
SELECT 'ANALYZE TABLE "' || table_name || '" COMPUTE STATISTICS;'
|
||||
FROM all_tables
|
||||
WHERE owner = Upper('&1')
|
||||
ORDER BY 1;
|
||||
|
||||
SPOOL OFF
|
||||
|
||||
-- Comment out following line to prevent immediate run
|
||||
@temp.sql
|
||||
|
||||
SET PAGESIZE 14
|
||||
SET FEEDBACK ON
|
||||
SET VERIFY ON
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user