2026-03-12 20:23:15

This commit is contained in:
root
2026-03-12 21:23:47 +01:00
parent eab4b36eca
commit 93039b8489
3332 changed files with 699614 additions and 0 deletions

View 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

View 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;

View 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

View 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;

View 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;

View 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;

View 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;

View 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
View 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
View 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

View 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
View 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

View 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
View 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;

View 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;

View 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;

View 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

View 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;

View 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
View 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;