├── .gitignore ├── 10g ├── active_session_waits.sql ├── ash.sql ├── datapump_jobs.sql ├── db_usage_hwm.sql ├── dynamic_memory.sql ├── event_histogram.sql ├── feature_usage.sql ├── flashback_db_info.sql ├── generate_multiple_awr_reports.sql ├── job_chain_rules.sql ├── job_chain_steps.sql ├── job_chains.sql ├── job_classes.sql ├── job_programs.sql ├── job_running_chains.sql ├── job_schedules.sql ├── jobs.sql ├── jobs_running.sql ├── lock_tree.sql ├── scheduler_attributes.sql ├── segment_advisor.sql ├── services.sql ├── session_waits.sql ├── sga_buffers.sql ├── sga_dynamic_components.sql ├── sga_dynamic_free_memory.sql ├── sga_resize_ops.sql ├── sysaux_occupants.sql ├── test_calendar_string.sql ├── window_groups.sql └── windows.sql ├── 11g ├── admin_privs.sql ├── autotask_change_window_schedules.sql ├── autotask_job_history.sql ├── autotask_schedule.sql ├── database_block_corruption.sql ├── default_passwords.sql ├── diag_info.sql ├── extended_stats.sql ├── fda.sql ├── fda_tables.sql ├── fda_ts.sql ├── identify_trace_file.sql ├── job_credentials.sql ├── job_output_file.sql ├── job_run_details.sql ├── memory_dynamic_components.sql ├── memory_resize_ops.sql ├── memory_target_advice.sql ├── network_acl_privileges.sql ├── network_acl_privileges_by_host.sql ├── network_acls.sql ├── result_cache_objects.sql ├── result_cache_report.sql ├── result_cache_statistics.sql ├── result_cache_status.sql ├── session_fix.sql ├── statistics_global_prefs.sql ├── system_fix.sql ├── system_fix_count.sql └── temp_free_space.sql ├── 12c ├── cdb_resource_plan_directives.sql ├── cdb_resource_plans.sql ├── cdb_resource_profile_directives.sql ├── clustering_dimensions.sql ├── clustering_joins.sql ├── clustering_keys.sql ├── clustering_tables.sql ├── credentials.sql ├── host_aces.sql ├── host_acls.sql ├── lockdown_profiles.sql ├── login.sql ├── pdb_spfiles.sql ├── pdbs.sql ├── plugin_violations.sql ├── priv_captures.sql ├── redaction_columns.sql ├── redaction_policies.sql ├── redaction_value_defaults.sql └── services.sql ├── 18c ├── lockdown_rules.sql ├── max_pdb_snapshots.sql ├── pdb_snapshot_mode.sql └── pdb_snapshots.sql ├── 19c ├── auto_index_config.sql └── auto_indexes.sql ├── 21c ├── blockchain_tables.sql ├── certificates.sql └── sql_macros.sql ├── LICENSE ├── README.md ├── constraints ├── disable_chk.sql ├── disable_fk.sql ├── disable_pk.sql ├── disable_ref_fk.sql ├── enable_chk.sql ├── enable_fk.sql ├── enable_pk.sql └── enable_ref_fk.sql ├── miscellaneous ├── analyze_all.sql ├── base64decode.sql ├── base64encode.sql ├── blob_to_clob.sql ├── blob_to_file.sql ├── clob_to_blob.sql ├── clob_to_file.sql ├── column_comments.sql ├── comments.sql ├── compile_all.sql ├── compile_all_bodies.sql ├── compile_all_funcs.sql ├── compile_all_procs.sql ├── compile_all_specs.sql ├── compile_all_trigs.sql ├── compile_all_views.sql ├── conversion_api.sql ├── csv.sql ├── date_api.sql ├── dict_comments.sql ├── digest_auth_api.sql ├── drop_all.sql ├── dsp.pkb ├── dsp.pks ├── err.pkb ├── err.pks ├── file_to_blob.sql ├── file_to_clob.sql ├── find_object.sql ├── ftp.pkb ├── ftp.pks ├── gen_health.sql ├── get_pivot.sql ├── get_stat.sql ├── login.sql ├── part_hv_to_date.sql ├── print_table.sql ├── proc_defs.sql ├── rebuild_index.sql ├── smart_quotes_api.sql ├── soap_api.sql ├── string_agg.sql ├── string_api.sql ├── switch_schema.sql ├── table_comments.sql ├── table_defs.sql ├── table_differences.sql ├── trc.pkb ├── trc.pks └── ts_move_api.sql ├── monitoring ├── access.sql ├── active_sessions.sql ├── active_user_sessions.sql ├── cache_hit_ratio.sql ├── call_stack.sql ├── code_dep.sql ├── code_dep_distinct.sql ├── code_dep_on.sql ├── code_dep_tree.sql ├── column_defaults.sql ├── controlfiles.sql ├── datafiles.sql ├── db_cache_advice.sql ├── db_info.sql ├── db_links.sql ├── db_links_open.sql ├── db_properties.sql ├── default_tablespaces.sql ├── df_free_space.sql ├── directories.sql ├── directory_permissions.sql ├── directory_permissions_all.sql ├── dispatchers.sql ├── error_stack.sql ├── errors.sql ├── explain.sql ├── file_io.sql ├── find_packaged_proc.sql ├── fk_columns.sql ├── fks.sql ├── free_space.sql ├── health.sql ├── hidden_parameters.sql ├── high_water_mark.sql ├── hot_blocks.sql ├── identify_trace_file.sql ├── index_extents.sql ├── index_monitoring_status.sql ├── index_partitions.sql ├── index_usage.sql ├── invalid_objects.sql ├── jobs.sql ├── jobs_running.sql ├── large_lob_segments.sql ├── large_segments.sql ├── latch_hit_ratios.sql ├── latch_holders.sql ├── latches.sql ├── library_cache.sql ├── license.sql ├── locked_objects.sql ├── locked_objects_internal.sql ├── logfiles.sql ├── longops.sql ├── lru_latch_ratio.sql ├── max_extents.sql ├── min_datafile_size.sql ├── monitor.sql ├── monitor_memory.sql ├── monitoring_status.sql ├── my_roles.sql ├── nls_params.sql ├── non_indexed_fks.sql ├── obj_lock.sql ├── object_privs.sql ├── object_status.sql ├── objects.sql ├── open_cursors.sql ├── open_cursors_by_sid.sql ├── open_cursors_full_by_sid.sql ├── options.sql ├── packaged_procs.sql ├── param_valid_values.sql ├── parameter_diffs.sql ├── parameters.sql ├── parameters_non_default.sql ├── part_tables.sql ├── patch_registry.sql ├── pga_target_advice.sql ├── pipes.sql ├── profiler_run_details.sql ├── profiler_runs.sql ├── profiles.sql ├── proxy_sessions.sql ├── proxy_users.sql ├── rbs_extents.sql ├── rbs_stats.sql ├── recovery_status.sql ├── recyclebin.sql ├── redo_by_day.sql ├── redo_by_hour.sql ├── redo_by_min.sql ├── registry_history.sql ├── role_privs.sql ├── roles.sql ├── search_source.sql ├── segment_size.sql ├── segment_stats.sql ├── segments_in_ts.sql ├── session_events.sql ├── session_events_by_sid.sql ├── session_events_by_spid.sql ├── session_io.sql ├── session_pga.sql ├── session_rollback.sql ├── session_stats.sql ├── session_stats_by_sid.sql ├── session_undo.sql ├── session_waits.sql ├── sessions.sql ├── sessions_by_machine.sql ├── sessions_by_osuser.sql ├── sessions_by_sid.sql ├── show_indexes.sql ├── show_space.sql ├── show_tables.sql ├── source.sql ├── spfile_parameters.sql ├── sql_area.sql ├── sql_text.sql ├── sql_text_by_sid.sql ├── statistics_prefs.sql ├── synonyms_to_missing_objects.sql ├── system_events.sql ├── system_parameters.sql ├── system_privs.sql ├── system_stats.sql ├── table_dep.sql ├── table_extents.sql ├── table_growth.sql ├── table_indexes.sql ├── table_partitions.sql ├── table_stats.sql ├── table_triggers.sql ├── tables_with_locked_stats.sql ├── tables_with_zero_rows.sql ├── tablespaces.sql ├── temp_extent_map.sql ├── temp_free_space.sql ├── temp_io.sql ├── temp_segments.sql ├── temp_usage.sql ├── tempfiles.sql ├── tempseg_usage.sql ├── top_latches.sql ├── top_sessions.sql ├── top_sql.sql ├── trace_run_details.sql ├── trace_runs.sql ├── ts_datafiles.sql ├── ts_extent_map.sql ├── ts_free_space.sql ├── ts_full.sql ├── ts_thresholds.sql ├── ts_thresholds_reset.sql ├── ts_thresholds_set_default.sql ├── tuning.sql ├── undo_segments.sql ├── unusable_indexes.sql ├── unused_space.sql ├── user_hit_ratio.sql ├── user_objects.sql ├── user_roles.sql ├── user_sessions.sql ├── user_system_privs.sql ├── user_temp_space.sql ├── user_ts_quotas.sql ├── user_undo_space.sql ├── users.sql ├── users_with_role.sql └── users_with_sys_priv.sql ├── rac ├── locked_objects_rac.sql ├── longops_rac.sql ├── monitor_memory_rac.sql ├── session_undo_rac.sql ├── session_waits_rac.sql └── sessions_rac.sql ├── resource_manager ├── active_plan.sql ├── consumer_group_usage.sql ├── consumer_groups.sql ├── plan_directives.sql └── resource_plans.sql ├── script_creation ├── backup.sql ├── build_api.sql ├── build_api2.sql ├── create_data.sql ├── db_link_ddl.sql ├── directory_ddl.sql ├── drop_cons_on_table.sql ├── drop_fks_on_table.sql ├── drop_fks_ref_table.sql ├── drop_indexes.sql ├── fks_on_table_ddl.sql ├── fks_ref_table_ddl.sql ├── index_monitoring_off.sql ├── index_monitoring_on.sql ├── job_ddl.sql ├── logon_as_user.sql ├── logon_as_user_orig.sql ├── monitoring_off.sql ├── monitoring_on.sql ├── network_acls_ddl.sql ├── object_grants.sql ├── profile_ddl.sql ├── rbs_structure.sql ├── recreate_table.sql ├── role_ddl.sql ├── sequence_ddl.sql ├── synonym_by_object_owner_ddl.sql ├── synonym_ddl.sql ├── synonym_public_remote_ddl.sql ├── table_constraints_ddl.sql ├── table_ddl.sql ├── table_grants_ddl.sql ├── table_indexes_ddl.sql ├── table_triggers_ddl.sql ├── tablespace_ddl.sql ├── tablespace_structure.sql ├── trigger_ddl.sql ├── user_ddl.sql └── view_ddl.sql ├── security ├── grant_delete.sql ├── grant_execute.sql ├── grant_insert.sql ├── grant_select.sql ├── grant_update.sql ├── package_synonyms.sql ├── schema_write_access.sql ├── sequence_synonyms.sql ├── table_synonyms.sql └── view_synonyms.sql └── weblogic ├── deploy_app.py.txt ├── deploy_app.sh ├── start-domain.sh ├── start-forms-reports.sh ├── start-node-manager.sh ├── stop-domain.sh ├── stop-forms-reports.sh └── stop-node-manager.sh /.gitignore: -------------------------------------------------------------------------------- 1 | # Website Files # 2 | ################# 3 | *.php 4 | *.zip 5 | -------------------------------------------------------------------------------- /10g/ash.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/10g/ash.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the minutes spent on each event for the specified time. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @active_session_waits (mins) 7 | -- Last Modified: 21/12/2004 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET VERIFY OFF 11 | 12 | SELECT NVL(a.event, 'ON CPU') AS event, 13 | COUNT(*) AS total_wait_time 14 | FROM v$active_session_history a 15 | WHERE a.sample_time > SYSDATE - &1/(24*60) 16 | GROUP BY a.event 17 | ORDER BY total_wait_time DESC; 18 | 19 | SET VERIFY ON -------------------------------------------------------------------------------- /10g/datapump_jobs.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/10g/datapump_jobs.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about all Data Pump jobs. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @datapump_jobs 7 | -- Last Modified: 28/01/2019 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 150 10 | 11 | COLUMN owner_name FORMAT A20 12 | COLUMN job_name FORMAT A30 13 | COLUMN operation FORMAT A10 14 | COLUMN job_mode FORMAT A10 15 | COLUMN state FORMAT A12 16 | 17 | SELECT owner_name, 18 | job_name, 19 | TRIM(operation) AS operation, 20 | TRIM(job_mode) AS job_mode, 21 | state, 22 | degree, 23 | attached_sessions, 24 | datapump_sessions 25 | FROM dba_datapump_jobs 26 | ORDER BY 1, 2; 27 | -------------------------------------------------------------------------------- /10g/db_usage_hwm.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/10g/db_usage_hwm.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays high water mark statistics. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @db_usage_hwm 7 | -- Last Modified: 26-NOV-2004 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | COLUMN name FORMAT A40 11 | COLUMN highwater FORMAT 999999999999 12 | COLUMN last_value FORMAT 999999999999 13 | SET PAGESIZE 24 14 | 15 | SELECT hwm1.name, 16 | hwm1.highwater, 17 | hwm1.last_value 18 | FROM dba_high_water_mark_statistics hwm1 19 | WHERE hwm1.version = (SELECT MAX(hwm2.version) 20 | FROM dba_high_water_mark_statistics hwm2 21 | WHERE hwm2.name = hwm1.name) 22 | ORDER BY hwm1.name; 23 | 24 | COLUMN FORMAT DEFAULT 25 | -------------------------------------------------------------------------------- /10g/dynamic_memory.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/10g/dynamic_memory.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the values of the dynamically memory pools. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @dynamic_memory 7 | -- Last Modified: 08-NOV-2004 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | COLUMN name FORMAT A40 11 | COLUMN value FORMAT A40 12 | 13 | SELECT name, 14 | value 15 | FROM v$parameter 16 | WHERE SUBSTR(name, 1, 1) = '_' 17 | ORDER BY name; 18 | 19 | COLUMN FORMAT DEFAULT 20 | -------------------------------------------------------------------------------- /10g/event_histogram.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/10g/event_histogram.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays histogram of the event waits times. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @event_histogram "(event-name)" 7 | -- Last Modified: 08-NOV-2005 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET VERIFY OFF 11 | COLUMN event FORMAT A30 12 | 13 | SELECT event#, 14 | event, 15 | wait_time_milli, 16 | wait_count 17 | FROM v$event_histogram 18 | WHERE event LIKE '%&1%' 19 | ORDER BY event, wait_time_milli; 20 | 21 | COLUMN FORMAT DEFAULT 22 | SET VERIFY ON -------------------------------------------------------------------------------- /10g/feature_usage.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/10g/feature_usage.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays feature usage statistics. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @feature_usage 7 | -- Last Modified: 26-NOV-2004 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | COLUMN name FORMAT A60 11 | COLUMN detected_usages FORMAT 999999999999 12 | 13 | SELECT u1.name, 14 | u1.detected_usages, 15 | u1.currently_used, 16 | u1.version 17 | FROM dba_feature_usage_statistics u1 18 | WHERE u1.version = (SELECT MAX(u2.version) 19 | FROM dba_feature_usage_statistics u2 20 | WHERE u2.name = u1.name) 21 | AND u1.detected_usages > 0 22 | AND u1.dbid = (SELECT dbid FROM v$database) 23 | ORDER BY u1.name; 24 | 25 | COLUMN FORMAT DEFAULT -------------------------------------------------------------------------------- /10g/job_chain_rules.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/10g/job_chain_rules.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays scheduler information about job chain rules. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @job_chain_rules 7 | -- Last Modified: 26/10/2011 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | COLUMN owner FORMAT A10 11 | COLUMN chain_name FORMAT A15 12 | COLUMN rule_owner FORMAT A10 13 | COLUMN rule_name FORMAT A15 14 | COLUMN condition FORMAT A25 15 | COLUMN action FORMAT A20 16 | COLUMN comments FORMAT A25 17 | 18 | SELECT owner, 19 | chain_name, 20 | rule_owner, 21 | rule_name, 22 | condition, 23 | action, 24 | comments 25 | FROM dba_scheduler_chain_rules 26 | ORDER BY owner, chain_name, rule_owner, rule_name; -------------------------------------------------------------------------------- /10g/job_chain_steps.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/10g/job_chain_steps.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays scheduler information about job chain steps. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @job_chain_steps 7 | -- Last Modified: 26/10/2011 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | COLUMN owner FORMAT A10 11 | COLUMN chain_name FORMAT A15 12 | COLUMN step_name FORMAT A15 13 | COLUMN program_owner FORMAT A10 14 | COLUMN program_name FORMAT A15 15 | 16 | SELECT owner, 17 | chain_name, 18 | step_name, 19 | program_owner, 20 | program_name, 21 | step_type 22 | FROM dba_scheduler_chain_steps 23 | ORDER BY owner, chain_name, step_name; -------------------------------------------------------------------------------- /10g/job_chains.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/10g/job_chains.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays scheduler information about job chains. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @job_chains 7 | -- Last Modified: 26/10/2011 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | COLUMN owner FORMAT A10 11 | COLUMN chain_name FORMAT A15 12 | COLUMN rule_set_owner FORMAT A10 13 | COLUMN rule_set_name FORMAT A15 14 | COLUMN comments FORMAT A15 15 | 16 | SELECT owner, 17 | chain_name, 18 | rule_set_owner, 19 | rule_set_name, 20 | number_of_rules, 21 | number_of_steps, 22 | enabled, 23 | comments 24 | FROM dba_scheduler_chains; -------------------------------------------------------------------------------- /10g/job_classes.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/10g/job_classes.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays scheduler information about job classes. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @job_classes 7 | -- Last Modified: 27/07/2005 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | 11 | COLUMN service FORMAT A20 12 | COLUMN comments FORMAT A40 13 | 14 | SELECT job_class_name, 15 | resource_consumer_group, 16 | service, 17 | logging_level, 18 | log_history, 19 | comments 20 | FROM dba_scheduler_job_classes 21 | ORDER BY job_class_name; 22 | -------------------------------------------------------------------------------- /10g/job_programs.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/10g/job_programs.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays scheduler information about job programs. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @job_programs 7 | -- Last Modified: 27/07/2005 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 250 10 | 11 | COLUMN owner FORMAT A20 12 | COLUMN program_name FORMAT A30 13 | COLUMN program_action FORMAT A50 14 | COLUMN comments FORMAT A40 15 | 16 | SELECT owner, 17 | program_name, 18 | program_type, 19 | program_action, 20 | number_of_arguments, 21 | enabled, 22 | comments 23 | FROM dba_scheduler_programs 24 | ORDER BY owner, program_name; 25 | -------------------------------------------------------------------------------- /10g/job_running_chains.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/10g/job_running_chains.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays scheduler information about job running chains. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @job_running_chains.sql 7 | -- Last Modified: 26/10/2011 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | COLUMN owner FORMAT A10 11 | COLUMN job_name FORMAT A20 12 | COLUMN chain_owner FORMAT A10 13 | COLUMN chain_name FORMAT A15 14 | COLUMN step_name FORMAT A25 15 | 16 | SELECT owner, 17 | job_name, 18 | chain_owner, 19 | chain_name, 20 | step_name, 21 | state 22 | FROM dba_scheduler_running_chains 23 | ORDER BY owner, job_name, chain_name, step_name; -------------------------------------------------------------------------------- /10g/job_schedules.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/10g/job_schedules.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays scheduler information about job schedules. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @job_schedules 7 | -- Last Modified: 27/07/2005 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 250 10 | 11 | COLUMN owner FORMAT A20 12 | COLUMN schedule_name FORMAT A30 13 | COLUMN start_date FORMAT A35 14 | COLUMN repeat_interval FORMAT A50 15 | COLUMN end_date FORMAT A35 16 | COLUMN comments FORMAT A40 17 | 18 | SELECT owner, 19 | schedule_name, 20 | start_date, 21 | repeat_interval, 22 | end_date, 23 | comments 24 | FROM dba_scheduler_schedules 25 | ORDER BY owner, schedule_name; 26 | -------------------------------------------------------------------------------- /10g/jobs.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/10g/jobs.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays scheduler job information. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @jobs 7 | -- Last Modified: 27/07/2005 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | 11 | COLUMN owner FORMAT A20 12 | COLUMN job_name FORMAT A30 13 | COLUMN job_class FORMAT A30 14 | COLUMN next_run_date FORMAT A36 15 | 16 | SELECT owner, 17 | job_name, 18 | enabled, 19 | job_class, 20 | next_run_date 21 | FROM dba_scheduler_jobs 22 | ORDER BY owner, job_name; 23 | -------------------------------------------------------------------------------- /10g/jobs_running.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/10g/jobs_running.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays scheduler information for running jobs. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @jobs_running 7 | -- Last Modified: 27/07/2005 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | 11 | COLUMN owner FORMAT A20 12 | COLUMN elapsed_time FORMAT A30 13 | 14 | SELECT owner, 15 | job_name, 16 | running_instance, 17 | elapsed_time, 18 | session_id 19 | FROM dba_scheduler_running_jobs 20 | ORDER BY owner, job_name; -------------------------------------------------------------------------------- /10g/services.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/services.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about database services. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @services 7 | -- Last Modified: 05/11/2004 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | COLUMN name FORMAT A30 11 | COLUMN network_name FORMAT A50 12 | 13 | SELECT name, 14 | network_name 15 | FROM dba_services 16 | ORDER BY name; -------------------------------------------------------------------------------- /10g/session_waits.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/10g/session_waits.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information on all database session waits. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @session_waits 7 | -- Last Modified: 11/03/2005 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | SET PAGESIZE 1000 11 | 12 | COLUMN username FORMAT A20 13 | COLUMN event FORMAT A30 14 | COLUMN wait_class FORMAT A15 15 | 16 | SELECT NVL(s.username, '(oracle)') AS username, 17 | s.sid, 18 | s.serial#, 19 | sw.event, 20 | sw.wait_class, 21 | sw.wait_time, 22 | sw.seconds_in_wait, 23 | sw.state 24 | FROM v$session_wait sw, 25 | v$session s 26 | WHERE s.sid = sw.sid 27 | ORDER BY sw.seconds_in_wait DESC; 28 | -------------------------------------------------------------------------------- /10g/sga_dynamic_components.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/10g/sga_dynamic_components.sql 3 | -- Author : Tim Hall 4 | -- Description : Provides information about dynamic SGA components. 5 | -- Requirements : Access to the v$ views. 6 | -- Call Syntax : @sga_dynamic_components 7 | -- Last Modified: 09/05/2017 8 | -- ----------------------------------------------------------------------------------- 9 | COLUMN component FORMAT A30 10 | 11 | SELECT component, 12 | ROUND(current_size/1024/1024) AS current_size_mb, 13 | ROUND(min_size/1024/1024) AS min_size_mb, 14 | ROUND(max_size/1024/1024) AS max_size_mb 15 | FROM v$sga_dynamic_components 16 | WHERE current_size != 0 17 | ORDER BY component; 18 | -------------------------------------------------------------------------------- /10g/sga_dynamic_free_memory.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/10g/sga_dynamic_free_memory.sql 3 | -- Author : Tim Hall 4 | -- Description : Provides information about free memory in the SGA. 5 | -- Requirements : Access to the v$ views. 6 | -- Call Syntax : @sga_dynamic_free_memory 7 | -- Last Modified: 23/08/2008 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SELECT * 11 | FROM v$sga_dynamic_free_memory; 12 | -------------------------------------------------------------------------------- /10g/sga_resize_ops.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/10g/sga_resize_ops.sql 3 | -- Author : Tim Hall 4 | -- Description : Provides information about memory resize operations. 5 | -- Requirements : Access to the v$ views. 6 | -- Call Syntax : @sga_resize_ops 7 | -- Last Modified: 09/05/2017 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET LINESIZE 200 11 | 12 | COLUMN parameter FORMAT A25 13 | 14 | SELECT start_time, 15 | end_time, 16 | component, 17 | oper_type, 18 | oper_mode, 19 | parameter, 20 | ROUND(initial_size/1024/1024) AS initial_size_mb, 21 | ROUND(target_size/1024/1024) AS target_size_mb, 22 | ROUND(final_size/1024/1024) AS final_size_mb, 23 | status 24 | FROM v$sga_resize_ops 25 | ORDER BY start_time; 26 | -------------------------------------------------------------------------------- /10g/sysaux_occupants.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/10g/sysaux_occupants.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about the contents of the SYSAUX tablespace. 5 | -- Requirements : Access to the v$ views. 6 | -- Call Syntax : @sysaux_occupants 7 | -- Last Modified: 27/07/2005 8 | -- ----------------------------------------------------------------------------------- 9 | COLUMN occupant_name FORMAT A30 10 | COLUMN schema_name FORMAT A20 11 | 12 | SELECT occupant_name, 13 | schema_name, 14 | space_usage_kbytes 15 | FROM v$sysaux_occupants 16 | ORDER BY occupant_name; 17 | -------------------------------------------------------------------------------- /10g/window_groups.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/window_groups.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays scheduler information about window groups. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @window_groups 7 | -- Last Modified: 05/11/2004 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 250 10 | 11 | COLUMN comments FORMAT A40 12 | 13 | SELECT window_group_name, 14 | enabled, 15 | number_of_windows, 16 | comments 17 | FROM dba_scheduler_window_groups 18 | ORDER BY window_group_name; 19 | 20 | SELECT window_group_name, 21 | window_name 22 | FROM dba_scheduler_wingroup_members 23 | ORDER BY window_group_name, window_name; 24 | -------------------------------------------------------------------------------- /10g/windows.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/windows.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays scheduler information about windows. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @windows 7 | -- Last Modified: 05/11/2004 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 250 10 | 11 | COLUMN comments FORMAT A40 12 | 13 | SELECT window_name, 14 | resource_plan, 15 | enabled, 16 | active, 17 | comments 18 | FROM dba_scheduler_windows 19 | ORDER BY window_name; 20 | -------------------------------------------------------------------------------- /11g/admin_privs.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/admin_privs.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the users who currently have admin privileges. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @min_datafile_size 7 | -- Last Modified: 30/11/2011 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SELECT * 11 | FROM v$pwfile_users 12 | ORDER BY username; -------------------------------------------------------------------------------- /11g/autotask_job_history.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/autotask_job_history.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the job history for the automatic maintenance tasks. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @autotask_job_history.sql 7 | -- Last Modified: 14-JUL-2016 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | COLUMN client_name FORMAT A40 11 | COLUMN window_name FORMAT A20 12 | COLUMN job_start_time FORMAT A40 13 | COLUMN job_duration FORMAT A20 14 | COLUMN job_status FORMAT A10 15 | 16 | SELECT client_name, 17 | window_name, 18 | job_start_time, 19 | job_duration, 20 | job_status, 21 | job_error 22 | FROM dba_autotask_job_history 23 | ORDER BY job_start_time; 24 | 25 | COLUMN FORMAT DEFAULT 26 | -------------------------------------------------------------------------------- /11g/autotask_schedule.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/autotask_schedule.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the window schedule the automatic maintenance tasks. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @autotask_schedule.sql 7 | -- Last Modified: 14-JUL-2016 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | COLUMN window_name FORMAT A20 11 | COLUMN start_time FORMAT A40 12 | COLUMN duration FORMAT A20 13 | 14 | SELECT * 15 | FROM dba_autotask_schedule 16 | ORDER BY start_time; 17 | 18 | 19 | COLUMN FORMAT DEFAULT 20 | -------------------------------------------------------------------------------- /11g/database_block_corruption.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/database_block_corruption.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the users who currently have admin privileges. 5 | -- Requirements : Access to the V$ and DBA views. 6 | -- Assumes a RMAN VALIDATE has been run against a datafile, tablespace 7 | -- or the whole database before this query is run. 8 | -- Call Syntax : @database_block_corruption 9 | -- Last Modified: 29/11/2018 10 | -- ----------------------------------------------------------------------------------- 11 | 12 | COLUMN owner FORMAT A30 13 | COLUMN segment_name FORMAT A30 14 | 15 | SELECT DISTINCT owner, segment_name 16 | FROM v$database_block_corruption dbc 17 | JOIN dba_extents e ON dbc.file# = e.file_id AND dbc.block# BETWEEN e.block_id and e.block_id+e.blocks-1 18 | ORDER BY 1,2; 19 | -------------------------------------------------------------------------------- /11g/default_passwords.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/default_passwords.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays users with default passwords. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @default_passwords 7 | -- Last Modified: 26-NOV-2011 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SELECT a.username, b.account_status 11 | FROM dba_users_with_defpwd a 12 | JOIN dba_users b ON a.username = b.username 13 | ORDER BY 1; 14 | -------------------------------------------------------------------------------- /11g/diag_info.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/diag_info.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the contents of the v$diag_info view. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @diag_info 7 | -- Last Modified: 23/08/2008 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | COLUMN name FORMAT A30 11 | COLUMN value FORMAT A110 12 | 13 | SELECT * 14 | FROM v$diag_info; 15 | -------------------------------------------------------------------------------- /11g/extended_stats.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/extended_stats.sql 3 | -- Author : Tim Hall 4 | -- Description : Provides information about extended statistics. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @extended_stats 7 | -- Last Modified: 30/11/2011 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | COLUMN owner FORMAT A20 11 | COLUMN extension_name FORMAT A15 12 | COLUMN extension FORMAT A50 13 | 14 | SELECT owner, table_name, extension_name, extension 15 | FROM dba_stat_extensions 16 | ORDER by owner, table_name; -------------------------------------------------------------------------------- /11g/fda.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/fda.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about flashback data archives. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @fda 7 | -- Last Modified: 06-JAN-2015 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET LINESIZE 150 11 | 12 | COLUMN owner_name FORMAT A20 13 | COLUMN flashback_archive_name FORMAT A22 14 | COLUMN create_time FORMAT A20 15 | COLUMN last_purge_time FORMAT A20 16 | 17 | SELECT owner_name, 18 | flashback_archive_name, 19 | flashback_archive#, 20 | retention_in_days, 21 | TO_CHAR(create_time, 'DD-MON-YYYY HH24:MI:SS') AS create_time, 22 | TO_CHAR(last_purge_time, 'DD-MON-YYYY HH24:MI:SS') AS last_purge_time, 23 | status 24 | FROM dba_flashback_archive 25 | ORDER BY owner_name, flashback_archive_name; 26 | -------------------------------------------------------------------------------- /11g/fda_tables.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/fda_tables.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about flashback data archives. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @fda_tables 7 | -- Last Modified: 06-JAN-2015 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET LINESIZE 150 11 | 12 | COLUMN owner_name FORMAT A20 13 | COLUMN table_name FORMAT A20 14 | COLUMN flashback_archive_name FORMAT A22 15 | COLUMN archive_table_name FORMAT A20 16 | 17 | SELECT owner_name, 18 | table_name, 19 | flashback_archive_name, 20 | archive_table_name, 21 | status 22 | FROM dba_flashback_archive_tables 23 | ORDER BY owner_name, table_name; 24 | -------------------------------------------------------------------------------- /11g/fda_ts.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/fda_ts.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about flashback data archives. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @fda_ts 7 | -- Last Modified: 06-JAN-2015 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET LINESIZE 150 11 | 12 | COLUMN flashback_archive_name FORMAT A22 13 | COLUMN tablespace_name FORMAT A20 14 | COLUMN quota_in_mb FORMAT A11 15 | 16 | SELECT flashback_archive_name, 17 | flashback_archive#, 18 | tablespace_name, 19 | quota_in_mb 20 | FROM dba_flashback_archive_ts 21 | ORDER BY flashback_archive_name; 22 | -------------------------------------------------------------------------------- /11g/identify_trace_file.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/identify_trace_file.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the name of the trace file associated with the current session. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @identify_trace_file 7 | -- Last Modified: 23/08/2008 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 100 10 | COLUMN value FORMAT A60 11 | 12 | SELECT value 13 | FROM v$diag_info 14 | WHERE name = 'Default Trace File'; -------------------------------------------------------------------------------- /11g/job_credentials.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/job_credentials.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays scheduler information about job credentials. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @job_credentials 7 | -- Last Modified: 23/08/2008 8 | -- ----------------------------------------------------------------------------------- 9 | COLUMN credential_name FORMAT A25 10 | COLUMN username FORMAT A20 11 | COLUMN windows_domain FORMAT A20 12 | 13 | SELECT credential_name, 14 | username, 15 | windows_domain 16 | FROM dba_scheduler_credentials 17 | ORDER BY credential_name; 18 | -------------------------------------------------------------------------------- /11g/memory_dynamic_components.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/memory_dynamic_components.sql 3 | -- Author : Tim Hall 4 | -- Description : Provides information about dynamic memory components. 5 | -- Requirements : Access to the v$ views. 6 | -- Call Syntax : @memory_dynamic_components 7 | -- Last Modified: 09/05/2017 8 | -- ----------------------------------------------------------------------------------- 9 | COLUMN component FORMAT A30 10 | 11 | SELECT component, 12 | ROUND(current_size/1024/1024) AS current_size_mb, 13 | ROUND(min_size/1024/1024) AS min_size_mb, 14 | ROUND(max_size/1024/1024) AS max_size_mb 15 | FROM v$memory_dynamic_components 16 | WHERE current_size != 0 17 | ORDER BY component; 18 | -------------------------------------------------------------------------------- /11g/memory_resize_ops.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/memory_resize_ops.sql 3 | -- Author : Tim Hall 4 | -- Description : Provides information about memory resize operations. 5 | -- Requirements : Access to the v$ views. 6 | -- Call Syntax : @memory_resize_ops 7 | -- Last Modified: 09/05/2017 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET LINESIZE 200 11 | 12 | COLUMN parameter FORMAT A25 13 | 14 | SELECT start_time, 15 | end_time, 16 | component, 17 | oper_type, 18 | oper_mode, 19 | parameter, 20 | ROUND(initial_size/1024/1024) AS initial_size_mb, 21 | ROUND(target_size/1024/1024) AS target_size_mb, 22 | ROUND(final_size/1024/1024) AS final_size_mb, 23 | status 24 | FROM v$memory_resize_ops 25 | ORDER BY start_time; 26 | -------------------------------------------------------------------------------- /11g/memory_target_advice.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/memory_target_advice.sql 3 | -- Author : Tim Hall 4 | -- Description : Provides information to help tune the MEMORY_TARGET parameter. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @memory_target_advice 7 | -- Last Modified: 23/08/2008 8 | -- ----------------------------------------------------------------------------------- 9 | SELECT * 10 | FROM v$memory_target_advice 11 | ORDER BY memory_size; -------------------------------------------------------------------------------- /11g/network_acls.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/network_acls.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about network ACLs. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @network_acls 7 | -- Last Modified: 30/11/2011 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 150 10 | 11 | COLUMN host FORMAT A40 12 | COLUMN acl FORMAT A50 13 | 14 | SELECT host, lower_port, upper_port, acl 15 | FROM dba_network_acls 16 | ORDER BY host; 17 | 18 | SET LINESIZE 80 -------------------------------------------------------------------------------- /11g/result_cache_objects.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/result_cache_objects.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about the objects in the result cache. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @result_cache_objects 7 | -- Last Modified: 07/11/2012 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 1000 10 | 11 | SELECT * 12 | FROM v$result_cache_objects; 13 | -------------------------------------------------------------------------------- /11g/result_cache_report.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/result_cache_report.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the result cache report. 5 | -- Requirements : Access to the DBMS_RESULT_CACHE package. 6 | -- Call Syntax : @result_cache_report 7 | -- Last Modified: 07/11/2012 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET SERVEROUTPUT ON 11 | EXEC DBMS_RESULT_CACHE.memory_report(detailed => true); 12 | -------------------------------------------------------------------------------- /11g/result_cache_statistics.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/result_cache_statistics.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays result cache statistics. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @result_cache_statistics 7 | -- Last Modified: 07/11/2012 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | COLUMN name FORMAT A30 11 | COLUMN value FORMAT A30 12 | 13 | SELECT id, 14 | name, 15 | value 16 | FROM v$result_cache_statistics 17 | ORDER BY id; 18 | 19 | CLEAR COLUMNS -------------------------------------------------------------------------------- /11g/result_cache_status.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/result_cache_status.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the status of the result cache. 5 | -- Requirements : Access to the DBMS_RESULT_CACHE package. 6 | -- Call Syntax : @result_cache_status 7 | -- Last Modified: 07/11/2012 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SELECT DBMS_RESULT_CACHE.status FROM dual; -------------------------------------------------------------------------------- /11g/session_fix.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/session_fix.sql 3 | -- Author : Tim Hall 4 | -- Description : Provides information about session fixes for the specified phrase and version. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @session_fix (session_id | all) (phrase | all) (version | all) 7 | -- Last Modified: 30/11/2011 8 | -- ----------------------------------------------------------------------------------- 9 | SET VERIFY OFF 10 | SET LINESIZE 300 11 | 12 | COLUMN sql_feature FORMAT A35 13 | COLUMN optimizer_feature_enable FORMAT A9 14 | 15 | SELECT * 16 | FROM v$session_fix_control 17 | WHERE session_id = DECODE('&1', 'all', session_id, '&1') 18 | AND LOWER(description) LIKE DECODE('&2', 'all', '%', '%&2%') 19 | AND optimizer_feature_enable = DECODE('&3', 'all', optimizer_feature_enable, '&3'); -------------------------------------------------------------------------------- /11g/system_fix.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/system_fix.sql 3 | -- Author : Tim Hall 4 | -- Description : Provides information about system fixes for the specified phrase and version. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @system_fix (phrase | all) (version | all) 7 | -- Last Modified: 30/11/2011 8 | -- ----------------------------------------------------------------------------------- 9 | SET VERIFY OFF 10 | SET LINESIZE 300 11 | 12 | COLUMN sql_feature FORMAT A35 13 | COLUMN optimizer_feature_enable FORMAT A9 14 | 15 | SELECT * 16 | FROM v$system_fix_control 17 | WHERE LOWER(description) LIKE DECODE('&1', 'all', '%', '%&1%') 18 | AND optimizer_feature_enable = DECODE('&2', 'all', optimizer_feature_enable, '&2'); -------------------------------------------------------------------------------- /11g/system_fix_count.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/system_fix_count.sql 3 | -- Author : Tim Hall 4 | -- Description : Provides information about system fixes per version. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @system_fix_count 7 | -- Last Modified: 30/11/2011 8 | -- ----------------------------------------------------------------------------------- 9 | SELECT optimizer_feature_enable, 10 | COUNT(*) 11 | FROM v$system_fix_control 12 | GROUP BY optimizer_feature_enable 13 | ORDER BY optimizer_feature_enable; -------------------------------------------------------------------------------- /11g/temp_free_space.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/11g/temp_free_space.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about temporary tablespace usage. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @temp_free_space 7 | -- Last Modified: 23-AUG-2008 8 | -- ----------------------------------------------------------------------------------- 9 | SELECT * 10 | FROM dba_temp_free_space; -------------------------------------------------------------------------------- /12c/cdb_resource_plan_directives.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/12c/cdb_resource_plan_directives.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays CDB resource plan directives. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @cdb_resource_plan_directives.sql (plan-name or all) 7 | -- Last Modified: 22-MAR-2014 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | COLUMN plan FORMAT A30 11 | COLUMN pluggable_database FORMAT A25 12 | SET LINESIZE 100 VERIFY OFF 13 | 14 | SELECT plan, 15 | pluggable_database, 16 | shares, 17 | utilization_limit AS util, 18 | parallel_server_limit AS parallel 19 | FROM dba_cdb_rsrc_plan_directives 20 | WHERE plan = DECODE(UPPER('&1'), 'ALL', plan, UPPER('&1')) 21 | ORDER BY plan, pluggable_database; 22 | 23 | SET VERIFY ON -------------------------------------------------------------------------------- /12c/cdb_resource_plans.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/12c/cdb_resource_plans.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays CDB resource plans. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @cdb_resource_plans.sql 7 | -- Last Modified: 22-MAR-2014 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | COLUMN plan FORMAT A30 11 | COLUMN comments FORMAT A30 12 | COLUMN status FORMAT A10 13 | SET LINESIZE 100 14 | 15 | SELECT plan_id, 16 | plan, 17 | comments, 18 | status, 19 | mandatory 20 | FROM dba_cdb_rsrc_plans 21 | ORDER BY plan; 22 | -------------------------------------------------------------------------------- /12c/cdb_resource_profile_directives.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/12c/cdb_resource_profile_directives.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays CDB resource profile directives. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @cdb_resource_profile_directives.sql (plan-name or all) 7 | -- Last Modified: 10-JAN-2017 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | COLUMN plan FORMAT A30 11 | COLUMN pluggable_database FORMAT A25 12 | COLUMN profile FORMAT A25 13 | SET LINESIZE 150 VERIFY OFF 14 | 15 | SELECT plan, 16 | pluggable_database, 17 | profile, 18 | shares, 19 | utilization_limit AS util, 20 | parallel_server_limit AS parallel 21 | FROM dba_cdb_rsrc_plan_directives 22 | WHERE plan = DECODE(UPPER('&1'), 'ALL', plan, UPPER('&1')) 23 | ORDER BY plan, pluggable_database, profile; 24 | 25 | SET VERIFY ON -------------------------------------------------------------------------------- /12c/clustering_dimensions.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/12c/clustering_dimensions.sql 3 | -- Author : Tim Hall 4 | -- Description : Display clustering dimensions in the specified schema, or all schemas. 5 | -- Call Syntax : @clustering_dimensions (schema or all) 6 | -- Last Modified: 24/12/2020 7 | -- ----------------------------------------------------------------------------------- 8 | set linesize 200 verify off trimspool on 9 | column owner form a30 10 | column table_name form a30 11 | column dimension_owner form a30 12 | column dimension_name form a30 13 | 14 | select owner, 15 | table_name, 16 | dimension_owner, 17 | dimension_name 18 | from dba_clustering_dimensions 19 | where owner = decode(upper('&1'), 'ALL', owner, upper('&1')) 20 | order by owner, table_name; 21 | -------------------------------------------------------------------------------- /12c/clustering_keys.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/12c/clustering_keys.sql 3 | -- Author : Tim Hall 4 | -- Description : Display clustering keys in the specified schema, or all schemas. 5 | -- Call Syntax : @clustering_keys (schema or all) 6 | -- Last Modified: 24/12/2020 7 | -- ----------------------------------------------------------------------------------- 8 | set linesize 200 verify off trimspool on 9 | column owner format a30 10 | column table_name format a30 11 | column detail_owner format a30 12 | column detail_name format a30 13 | column detail_column format a30 14 | 15 | select owner, 16 | table_name, 17 | detail_owner, 18 | detail_name, 19 | detail_column, 20 | position, 21 | groupid 22 | from dba_clustering_keys 23 | where owner = decode(upper('&1'), 'ALL', owner, upper('&1')) 24 | order by owner, table_name; 25 | -------------------------------------------------------------------------------- /12c/credentials.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/12c/credentials.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about credentials. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @credentials 7 | -- Last Modified: 18/12/2013 8 | -- ----------------------------------------------------------------------------------- 9 | COLUMN credential_name FORMAT A25 10 | COLUMN username FORMAT A20 11 | COLUMN windows_domain FORMAT A20 12 | 13 | SELECT credential_name, 14 | username, 15 | windows_domain 16 | FROM dba_credentials 17 | ORDER BY credential_name; -------------------------------------------------------------------------------- /12c/host_aces.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/12c/host_aces.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about host ACEs. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @host_aces 7 | -- Last Modified: 10/09/2014 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | 11 | COLUMN host FORMAT A20 12 | COLUMN principal FORMAT A30 13 | COLUMN privilege FORMAT A30 14 | COLUMN start_date FORMAT A11 15 | COLUMN end_date FORMAT A11 16 | 17 | SELECT host, 18 | lower_port, 19 | upper_port, 20 | ace_order, 21 | TO_CHAR(start_date, 'DD-MON-YYYY') AS start_date, 22 | TO_CHAR(end_date, 'DD-MON-YYYY') AS end_date, 23 | grant_type, 24 | inverted_principal, 25 | principal, 26 | principal_type, 27 | privilege 28 | FROM dba_host_aces 29 | ORDER BY host, ace_order; 30 | 31 | SET LINESIZE 80 -------------------------------------------------------------------------------- /12c/host_acls.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/12c/host_acls.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about host ACLs. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @host_acls 7 | -- Last Modified: 10/09/2014 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 150 10 | 11 | COLUMN acl FORMAT A50 12 | COLUMN host FORMAT A20 13 | COLUMN acl_owner FORMAT A10 14 | 15 | SELECT HOST, 16 | LOWER_PORT, 17 | UPPER_PORT, 18 | ACL, 19 | ACLID, 20 | ACL_OWNER 21 | FROM dba_host_acls 22 | ORDER BY host; 23 | 24 | SET LINESIZE 80 -------------------------------------------------------------------------------- /12c/login.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/12c/login.sql 3 | -- Author : Tim Hall 4 | -- Description : Resets the SQL*Plus prompt when a new connection is made. 5 | -- Includes PDB:CDB. 6 | -- Call Syntax : @login 7 | -- Last Modified: 21/04/2014 8 | -- ----------------------------------------------------------------------------------- 9 | SET FEEDBACK OFF 10 | SET TERMOUT OFF 11 | 12 | COLUMN X NEW_VALUE Y 13 | SELECT LOWER(USER || '@' || 14 | SYS_CONTEXT('userenv', 'con_name') || ':' || 15 | SYS_CONTEXT('userenv', 'instance_name')) X 16 | FROM dual; 17 | SET SQLPROMPT '&Y> ' 18 | 19 | ALTER SESSION SET NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI:SS'; 20 | ALTER SESSION SET NLS_TIMESTAMP_FORMAT='DD-MON-YYYY HH24:MI:SS.FF'; 21 | 22 | SET TERMOUT ON 23 | SET FEEDBACK ON 24 | SET LINESIZE 100 25 | SET TAB OFF 26 | SET TRIM ON 27 | SET TRIMSPOOL ON -------------------------------------------------------------------------------- /12c/pdb_spfiles.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/12c/pdb_spfiles.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information from the pdb_spfile$ table. 5 | -- Requirements : Access to pdb_spfile$ and v$pdbs. 6 | -- Call Syntax : @pdb_spfiles 7 | -- Last Modified: 04/05/2021 8 | -- ----------------------------------------------------------------------------------- 9 | set linesize 120 10 | column pdb_name format a10 11 | column name format a30 12 | column value$ format a30 13 | 14 | select ps.db_uniq_name, 15 | ps.pdb_uid, 16 | p.name as pdb_name, 17 | ps.name, 18 | ps.value$ 19 | from pdb_spfile$ ps 20 | join v$pdbs p on ps.pdb_uid = p.con_uid 21 | order by 1, 2, 3; 22 | -------------------------------------------------------------------------------- /12c/pdbs.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/12c/pdbs.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about all PDBs in the current CDB. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @pdbs 7 | -- Last Modified: 01/01/2019 - Added format for NAME column. 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | COLUMN pdb_name FORMAT A20 11 | 12 | SELECT pdb_name, status 13 | FROM dba_pdbs 14 | ORDER BY pdb_name; 15 | 16 | COLUMN name FORMAT A20 17 | 18 | SELECT name, open_mode 19 | FROM v$pdbs 20 | ORDER BY name; 21 | -------------------------------------------------------------------------------- /12c/plugin_violations.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/12c/plugin_violations.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about recent PDB plugin violations. 5 | -- Requirements : 6 | -- Call Syntax : @plugin_violations 7 | -- Last Modified: 09-JAN-2017 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET LINESIZE 200 11 | 12 | COLUMN time FORMAT A30 13 | COLUMN name FORMAT A30 14 | COLUMN cause FORMAT A30 15 | COLUMN message FORMAT A30 16 | 17 | SELECT time, name, cause, message 18 | FROM pdb_plug_in_violations 19 | WHERE time > TRUNC(SYSTIMESTAMP) 20 | ORDER BY time; -------------------------------------------------------------------------------- /12c/priv_captures.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/12c/priv_captures.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays privilege capture policies. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @priv_captures.sql 7 | -- Last Modified: 22-APR-2014 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | COLUMN name FORMAT A15 11 | COLUMN description FORMAT A30 12 | COLUMN roles FORMAT A20 13 | COLUMN context FORMAT A30 14 | SET LINESIZE 200 15 | 16 | SELECT name, 17 | description, 18 | type, 19 | enabled, 20 | roles, 21 | context 22 | FROM dba_priv_captures 23 | ORDER BY name; -------------------------------------------------------------------------------- /12c/redaction_policies.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/12c/redaction_policies.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays redaction policy information. 5 | -- Requirements : Access to the REDACTION_POLICIES view. 6 | -- Call Syntax : @redaction_policies 7 | -- Last Modified: 27-NOV-2014 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET LINESIZE 200 11 | 12 | COLUMN object_owner FORMAT A20 13 | COLUMN object_name FORMAT A30 14 | COLUMN policy_name FORMAT A30 15 | COLUMN expression FORMAT A30 16 | COLUMN policy_description FORMAT A20 17 | 18 | SELECT object_owner, 19 | object_name, 20 | policy_name, 21 | expression, 22 | enable, 23 | policy_description 24 | FROM redaction_policies 25 | ORDER BY 1, 2, 3; -------------------------------------------------------------------------------- /12c/redaction_value_defaults.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/12c/redaction_value_defaults.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about redaction defaults. 5 | -- Requirements : Access to the REDACTION_VALUES_FOR_TYPE_FULL view. 6 | -- Call Syntax : @redaction_value_defaults 7 | -- Last Modified: 27-NOV-2014 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET LINESIZE 250 11 | COLUMN char_value FORMAT A10 12 | COLUMN varchar_value FORMAT A10 13 | COLUMN nchar_value FORMAT A10 14 | COLUMN nvarchar_value FORMAT A10 15 | COLUMN timestamp_value FORMAT A27 16 | COLUMN timestamp_with_time_zone_value FORMAT A32 17 | COLUMN blob_value FORMAT A20 18 | COLUMN clob_value FORMAT A10 19 | COLUMN nclob_value FORMAT A10 20 | 21 | SELECT * 22 | FROM redaction_values_for_type_full; 23 | -------------------------------------------------------------------------------- /12c/services.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/services.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about database services. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @services 7 | -- Last Modified: 05/11/2004 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | COLUMN name FORMAT A30 11 | COLUMN network_name FORMAT A50 12 | COLUMN pdb FORMAT A20 13 | 14 | SELECT name, 15 | network_name, 16 | pdb 17 | FROM dba_services 18 | ORDER BY name; -------------------------------------------------------------------------------- /18c/lockdown_rules.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/18c/lockdown_rules.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about lockdown rules applis in the current container. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @lockdown_rules 7 | -- Last Modified: 06/01/2019 - Switch to OUTER JOIN and alter ORDER BY. 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | 11 | COLUMN rule_type FORMAT A20 12 | COLUMN rule FORMAT A20 13 | COLUMN clause FORMAT A20 14 | COLUMN clause_option FORMAT A20 15 | COLUMN pdb_name FORMAT A30 16 | 17 | SELECT lr.rule_type, 18 | lr.rule, 19 | lr.status, 20 | lr.clause, 21 | lr.clause_option, 22 | lr.users, 23 | lr.con_id, 24 | p.pdb_name 25 | FROM v$lockdown_rules lr 26 | LEFT OUTER JOIN cdb_pdbs p ON lr.con_id = p.con_id 27 | ORDER BY 1, 2; 28 | -------------------------------------------------------------------------------- /18c/max_pdb_snapshots.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/18c/max_pdb_snapshots.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the MAX_PDB_SNAPSHOTS setting for each container. 5 | -- Requirements : Access to the CDB views. 6 | -- Call Syntax : @max_pdb_snapshots 7 | -- Last Modified: 01/01/2019 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 150 TAB OFF 10 | 11 | COLUMN property_name FORMAT A20 12 | COLUMN pdb_name FORMAT A10 13 | COLUMN property_value FORMAT A15 14 | COLUMN description FORMAT A50 15 | 16 | SELECT pr.con_id, 17 | p.pdb_name, 18 | pr.property_name, 19 | pr.property_value, 20 | pr.description 21 | FROM cdb_properties pr 22 | JOIN cdb_pdbs p ON pr.con_id = p.con_id 23 | WHERE pr.property_name = 'MAX_PDB_SNAPSHOTS' 24 | ORDER BY pr.property_name; 25 | -------------------------------------------------------------------------------- /18c/pdb_snapshot_mode.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/18c/pdb_snapshot_mode.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the SNAPSHOT_MODE and SNAPSHOT_INTERVAL setting for each container. 5 | -- Requirements : Access to the CDB views. 6 | -- Call Syntax : @pdb_snapshot_mode 7 | -- Last Modified: 01/01/2019 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 150 TAB OFF 10 | 11 | COLUMN pdb_name FORMAT A10 12 | COLUMN snapshot_mode FORMAT A15 13 | 14 | SELECT p.con_id, 15 | p.pdb_name, 16 | p.snapshot_mode, 17 | p.snapshot_interval 18 | FROM cdb_pdbs p 19 | ORDER BY 1; 20 | -------------------------------------------------------------------------------- /18c/pdb_snapshots.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/18c/pdb_snapshots.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the snapshots for all PDBs. 5 | -- Requirements : Access to the CDB views. 6 | -- Call Syntax : @pdb_snapshots 7 | -- Last Modified: 01/01/2019 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 150 TAB OFF 10 | 11 | COLUMN con_name FORMAT A10 12 | COLUMN snapshot_name FORMAT A30 13 | COLUMN snapshot_scn FORMAT 9999999 14 | COLUMN full_snapshot_path FORMAT A50 15 | 16 | SELECT con_id, 17 | con_name, 18 | snapshot_name, 19 | snapshot_scn, 20 | full_snapshot_path 21 | FROM cdb_pdb_snapshots 22 | ORDER BY con_id, snapshot_scn; 23 | -------------------------------------------------------------------------------- /19c/auto_index_config.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/19c/auto_index_config.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the auto-index configuration for each container. 5 | -- Requirements : Access to the CDB views. 6 | -- Call Syntax : @auto_index_config 7 | -- Last Modified: 04/06/2019 8 | -- ----------------------------------------------------------------------------------- 9 | COLUMN parameter_name FORMAT A40 10 | COLUMN parameter_value FORMAT A40 11 | 12 | SELECT con_id, parameter_name, parameter_value 13 | FROM cdb_auto_index_config 14 | ORDER BY 1, 2; 15 | -------------------------------------------------------------------------------- /19c/auto_indexes.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/19c/auto_indexes.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays auto indexes for the specified schema or all schemas. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @auto_indexes (schema-name or all) 7 | -- Last Modified: 04/06/2019 8 | -- ----------------------------------------------------------------------------------- 9 | SET VERIFY OFF LINESIZE 200 10 | 11 | COLUMN owner FORMAT A30 12 | COLUMN index_name FORMAT A30 13 | COLUMN table_owner FORMAT A30 14 | COLUMN table_name FORMAT A30 15 | 16 | SELECT owner, 17 | index_name, 18 | index_type, 19 | table_owner, 20 | table_name 21 | table_type 22 | FROM dba_indexes 23 | WHERE owner = DECODE(UPPER('&1'), 'ALL', owner, UPPER('&1')) 24 | AND auto = 'YES' 25 | ORDER BY owner, index_name; 26 | 27 | -------------------------------------------------------------------------------- /21c/blockchain_tables.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/21c/blockchain_tables.sql 3 | -- Author : Tim Hall 4 | -- Description : Display blockchain tables in the specified schema, or all schemas. 5 | -- Call Syntax : @blockchain_tables (schema or all) 6 | -- Last Modified: 23/12/2020 7 | -- ----------------------------------------------------------------------------------- 8 | set linesize 200 verify off trimspool on 9 | 10 | column schema_name format a30 11 | column table_name format a30 12 | column row_retention format a13 13 | column row_retention_locked format a20 14 | column table_inactivity_retention format a26 15 | column hash_algorithm format a14 16 | 17 | SELECT schema_name, 18 | table_name, 19 | row_retention, 20 | row_retention_locked, 21 | table_inactivity_retention, 22 | hash_algorithm 23 | FROM dba_blockchain_tables 24 | WHERE schema_name = DECODE(UPPER('&1'), 'ALL', schema_name, UPPER('&1')); 25 | 26 | -------------------------------------------------------------------------------- /21c/certificates.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/21c/certificates.sql 3 | -- Author : Tim Hall 4 | -- Description : Display certificates in the specified schema, or all schemas. 5 | -- Call Syntax : @certificates (schema or all) 6 | -- Last Modified: 23/12/2020 7 | -- ----------------------------------------------------------------------------------- 8 | set linesize 200 verify off trimspool on 9 | 10 | column user_name format a10 11 | column distinguished_name format a30 12 | column certificate format a30 13 | 14 | select user_name, 15 | certificate_guid, 16 | distinguished_name, 17 | substr(certificate, 1, 25) || '...' as certificate 18 | from dba_certificates 19 | where user_name = DECODE(UPPER('&1'), 'ALL', user_name, UPPER('&1')) 20 | order by user_name; 21 | -------------------------------------------------------------------------------- /21c/sql_macros.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/21c/sql_macros.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about SQL macros for the specific schema, or all schemas. 5 | -- Call Syntax : @sql_macros (schema or all) 6 | -- Last Modified: 27/12/2020 7 | -- ----------------------------------------------------------------------------------- 8 | set linesize 150 verify off trimspool on 9 | column owner format a30 10 | column object_name format a30 11 | column procedure_name format a30 12 | column sql_macro format a9 13 | 14 | select p.owner, 15 | o.object_type, 16 | p.sql_macro, 17 | p.object_name, 18 | p.procedure_name 19 | from dba_procedures p 20 | join dba_objects o on p.object_id = o.object_id 21 | where p.sql_macro != 'NULL' 22 | and p.owner = decode(upper('&1'), 'ALL', p.owner, upper('&1')) 23 | order by p.owner, o.object_type, p.sql_macro, p.object_name, p.procedure_name; 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # oracle-base.com scripts 2 | 3 | Here are the scripts from my website [oracle-base.com](https://oracle-base.com/dba/scripts). 4 | 5 | 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. 6 | 7 | -------------------------------------------------------------------------------- /constraints/disable_chk.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/constraints/disable_chk.sql 3 | -- Author : Tim Hall 4 | -- Description : Disables all check constraints for a specified table, or all tables. 5 | -- Call Syntax : @disable_chk (table-name or all) (schema-name) 6 | -- Last Modified: 28/01/2001 7 | -- ----------------------------------------------------------------------------------- 8 | SET PAGESIZE 0 9 | SET FEEDBACK OFF 10 | SET VERIFY OFF 11 | 12 | SPOOL temp.sql 13 | 14 | SELECT 'ALTER TABLE "' || a.table_name || '" DISABLE CONSTRAINT "' || a.constraint_name || '";' 15 | FROM all_constraints a 16 | WHERE a.constraint_type = 'C' 17 | AND a.owner = UPPER('&2'); 18 | AND a.table_name = DECODE(UPPER('&1'),'ALL',a.table_name,UPPER('&1')); 19 | 20 | SPOOL OFF 21 | 22 | -- Comment out following line to prevent immediate run 23 | @temp.sql 24 | 25 | SET PAGESIZE 14 26 | SET FEEDBACK ON 27 | SET VERIFY ON 28 | -------------------------------------------------------------------------------- /constraints/disable_fk.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/constraints/disable_fk.sql 3 | -- Author : Tim Hall 4 | -- Description : Disables all Foreign Keys belonging to the specified table, or all tables. 5 | -- Call Syntax : @disable_fk (table-name or all) (schema-name) 6 | -- Last Modified: 28/01/2001 7 | -- ----------------------------------------------------------------------------------- 8 | SET PAGESIZE 0 9 | SET FEEDBACK OFF 10 | SET VERIFY OFF 11 | 12 | SPOOL temp.sql 13 | 14 | SELECT 'ALTER TABLE "' || a.table_name || '" DISABLE CONSTRAINT "' || a.constraint_name || '";' 15 | FROM all_constraints a 16 | WHERE a.constraint_type = 'R' 17 | AND a.table_name = DECODE(Upper('&1'),'ALL',a.table_name,Upper('&1')) 18 | AND a.owner = Upper('&2'); 19 | 20 | SPOOL OFF 21 | 22 | -- Comment out following line to prevent immediate run 23 | @temp.sql 24 | 25 | SET PAGESIZE 14 26 | SET FEEDBACK ON 27 | SET VERIFY ON 28 | -------------------------------------------------------------------------------- /constraints/disable_pk.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/constraints/disable_pk.sql 3 | -- Author : Tim Hall 4 | -- Description : Disables the Primary Key for the specified table, or all tables. 5 | -- Call Syntax : @disable_pk (table-name or all) (schema-name) 6 | -- Last Modified: 28/01/2001 7 | -- ----------------------------------------------------------------------------------- 8 | SET PAGESIZE 0 9 | SET FEEDBACK OFF 10 | SET VERIFY OFF 11 | 12 | SPOOL temp.sql 13 | 14 | SELECT 'ALTER TABLE "' || a.table_name || '" DISABLE PRIMARY KEY;' 15 | FROM all_constraints a 16 | WHERE a.constraint_type = 'P' 17 | AND a.owner = Upper('&2') 18 | AND a.table_name = DECODE(Upper('&1'),'ALL',a.table_name,Upper('&1')); 19 | 20 | SPOOL OFF 21 | 22 | -- Comment out following line to prevent immediate run 23 | @temp.sql 24 | 25 | SET PAGESIZE 14 26 | SET FEEDBACK ON 27 | SET VERIFY ON 28 | -------------------------------------------------------------------------------- /constraints/enable_chk.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/constraints/enable_chk.sql 3 | -- Author : Tim Hall 4 | -- Description : Enables all check constraints for a specified table, or all tables. 5 | -- Call Syntax : @enable_chk (table-name or all) (schema-name) 6 | -- Last Modified: 28/01/2001 7 | -- ----------------------------------------------------------------------------------- 8 | SET PAGESIZE 0 9 | SET FEEDBACK OFF 10 | SET VERIFY OFF 11 | 12 | SPOOL temp.sql 13 | 14 | SELECT 'ALTER TABLE "' || a.table_name || '" ENABLE CONSTRAINT "' || a.constraint_name || '";' 15 | FROM all_constraints a 16 | WHERE a.constraint_type = 'C' 17 | AND a.owner = Upper('&2'); 18 | AND a.table_name = DECODE(Upper('&1'),'ALL',a.table_name,UPPER('&1')); 19 | 20 | SPOOL OFF 21 | 22 | -- Comment out following line to prevent immediate run 23 | @temp.sql 24 | 25 | SET PAGESIZE 14 26 | SET FEEDBACK ON 27 | SET VERIFY ON 28 | -------------------------------------------------------------------------------- /constraints/enable_fk.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/constraints/enable_fk.sql 3 | -- Author : Tim Hall 4 | -- Description : Enables all Foreign Keys belonging to the specified table, or all tables. 5 | -- Call Syntax : @enable_fk (table-name or all) (schema-name) 6 | -- Last Modified: 28/01/2001 7 | -- ----------------------------------------------------------------------------------- 8 | SET PAGESIZE 0 9 | SET FEEDBACK OFF 10 | SET VERIFY OFF 11 | 12 | SPOOL temp.sql 13 | 14 | SELECT 'ALTER TABLE "' || a.table_name || '" ENABLE CONSTRAINT "' || a.constraint_name || '";' 15 | FROM all_constraints a 16 | WHERE a.constraint_type = 'R' 17 | AND a.table_name = DECODE(Upper('&1'),'ALL',a.table_name,Upper('&1')) 18 | AND a.owner = Upper('&2'); 19 | 20 | SPOOL OFF 21 | 22 | -- Comment out following line to prevent immediate run 23 | @temp.sql 24 | 25 | SET PAGESIZE 14 26 | SET FEEDBACK ON 27 | SET VERIFY ON 28 | -------------------------------------------------------------------------------- /constraints/enable_pk.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/constraints/enable_pk.sql 3 | -- Author : Tim Hall 4 | -- Description : Enables the Primary Key for the specified table, or all tables. 5 | -- Call Syntax : @disable_pk (table-name or all) (schema-name) 6 | -- Last Modified: 28/01/2001 7 | -- ----------------------------------------------------------------------------------- 8 | SET PAGESIZE 0 9 | SET FEEDBACK OFF 10 | SET VERIFY OFF 11 | 12 | SPOOL temp.sql 13 | 14 | SELECT 'ALTER TABLE "' || a.table_name || '" ENABLE PRIMARY KEY;' 15 | FROM all_constraints a 16 | WHERE a.constraint_type = 'P' 17 | AND a.owner = Upper('&2') 18 | AND a.table_name = DECODE(Upper('&1'),'ALL',a.table_name,Upper('&1')); 19 | 20 | SPOOL OFF 21 | 22 | -- Comment out following line to prevent immediate run 23 | @temp.sql 24 | 25 | SET PAGESIZE 14 26 | SET FEEDBACK ON 27 | SET VERIFY ON 28 | -------------------------------------------------------------------------------- /miscellaneous/analyze_all.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/miscellaneous/analyze_all.sql 3 | -- Author : Tim Hall 4 | -- Description : Outdated script to analyze all tables for the specified schema. 5 | -- Comment : Use DBMS_UTILITY.ANALYZE_SCHEMA or DBMS_STATS.GATHER_SCHEMA_STATS if your server allows it. 6 | -- Call Syntax : @ananlyze_all (schema-name) 7 | -- Last Modified: 26/02/2002 8 | -- ----------------------------------------------------------------------------------- 9 | SET PAGESIZE 0 10 | SET FEEDBACK OFF 11 | SET VERIFY OFF 12 | 13 | SPOOL temp.sql 14 | 15 | SELECT 'ANALYZE TABLE "' || table_name || '" COMPUTE STATISTICS;' 16 | FROM all_tables 17 | WHERE owner = Upper('&1') 18 | ORDER BY 1; 19 | 20 | SPOOL OFF 21 | 22 | -- Comment out following line to prevent immediate run 23 | @temp.sql 24 | 25 | SET PAGESIZE 14 26 | SET FEEDBACK ON 27 | SET VERIFY ON 28 | -------------------------------------------------------------------------------- /miscellaneous/base64encode.sql: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE FUNCTION base64encode(p_blob IN BLOB) 2 | RETURN CLOB 3 | -- ----------------------------------------------------------------------------------- 4 | -- File Name : https://oracle-base.com/dba/miscellaneous/base64encode.sql 5 | -- Author : Tim Hall 6 | -- Description : Encodes a BLOB into a Base64 CLOB. 7 | -- Last Modified: 09/11/2011 8 | -- ----------------------------------------------------------------------------------- 9 | IS 10 | l_clob CLOB; 11 | l_step PLS_INTEGER := 12000; -- make sure you set a multiple of 3 not higher than 24573 12 | BEGIN 13 | FOR i IN 0 .. TRUNC((DBMS_LOB.getlength(p_blob) - 1 )/l_step) LOOP 14 | l_clob := l_clob || UTL_RAW.cast_to_varchar2(UTL_ENCODE.base64_encode(DBMS_LOB.substr(p_blob, l_step, i * l_step + 1))); 15 | END LOOP; 16 | RETURN l_clob; 17 | END; 18 | / -------------------------------------------------------------------------------- /miscellaneous/column_comments.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/miscellaneous/column_comments.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays comments associate with specific tables. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @column_comments (schema) (table-name) 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET VERIFY OFF 10 | SET PAGESIZE 100 11 | COLUMN column_name FORMAT A20 12 | COLUMN comments FORMAT A50 13 | 14 | SELECT column_name, 15 | comments 16 | FROM dba_col_comments 17 | WHERE owner = UPPER('&1') 18 | AND table_name = UPPER('&2') 19 | ORDER BY column_name; 20 | -------------------------------------------------------------------------------- /miscellaneous/comments.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/miscellaneous/comments.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays all comments for the specified table and its columns. 5 | -- Call Syntax : @comments (table-name) (schema-name) 6 | -- Last Modified: 15/07/2000 7 | -- ----------------------------------------------------------------------------------- 8 | PROMPT 9 | SET VERIFY OFF 10 | SET FEEDBACK OFF 11 | SET LINESIZE 255 12 | SET PAGESIZE 1000 13 | 14 | SELECT a.table_name "Table", 15 | a.table_type "Type", 16 | Substr(a.comments,1,200) "Comments" 17 | FROM all_tab_comments a 18 | WHERE a.table_name = Upper('&1') 19 | AND a.owner = Upper('&2'); 20 | 21 | SELECT a.column_name "Column", 22 | Substr(a.comments,1,200) "Comments" 23 | FROM all_col_comments a 24 | WHERE a.table_name = Upper('&1') 25 | AND a.owner = Upper('&2'); 26 | 27 | SET VERIFY ON 28 | SET FEEDBACK ON 29 | SET PAGESIZE 14 30 | PROMPT 31 | -------------------------------------------------------------------------------- /miscellaneous/compile_all.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/miscellaneous/compile_all.sql 3 | -- Author : Tim Hall 4 | -- Description : Compiles all invalid objects for specified schema, or all schema. 5 | -- Requirements : Requires all other "Compile_All" scripts. 6 | -- Call Syntax : @compile_all (schema-name or all) 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | @Compile_All_Specs &&1 10 | @Compile_All_Bodies &&1 11 | @Compile_All_Procs &&1 12 | @Compile_All_Funcs &&1 13 | @Compile_All_Views &&1 14 | -------------------------------------------------------------------------------- /miscellaneous/compile_all_bodies.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/miscellaneous/compile_all_bodies.sql 3 | -- Author : Tim Hall 4 | -- Description : Compiles all invalid package bodies for specified schema, or all schema. 5 | -- Call Syntax : @compile_all_bodies (schema-name or all) 6 | -- Last Modified: 28/01/2001 7 | -- ----------------------------------------------------------------------------------- 8 | SET PAGESIZE 0 9 | SET FEEDBACK OFF 10 | SET VERIFY OFF 11 | 12 | SPOOL temp.sql 13 | 14 | SELECT 'ALTER PACKAGE ' || a.owner || '.' || a.object_name || ' COMPILE BODY;' 15 | FROM all_objects a 16 | WHERE a.object_type = 'PACKAGE BODY' 17 | AND a.status = 'INVALID' 18 | AND a.owner = Decode(Upper('&&1'), 'ALL',a.owner, Upper('&&1')); 19 | 20 | SPOOL OFF 21 | 22 | -- Comment out following line to prevent immediate run 23 | @temp.sql 24 | 25 | SET PAGESIZE 14 26 | SET FEEDBACK ON 27 | SET VERIFY ON 28 | -------------------------------------------------------------------------------- /miscellaneous/compile_all_funcs.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/miscellaneous/compile_all_funcs.sql 3 | -- Author : Tim Hall 4 | -- Description : Compiles all invalid functions for specified schema, or all schema. 5 | -- Call Syntax : @compile_all_funcs (schema-name or all) 6 | -- Last Modified: 28/01/2001 7 | -- ----------------------------------------------------------------------------------- 8 | SET PAGESIZE 0 9 | SET FEEDBACK OFF 10 | SET VERIFY OFF 11 | 12 | SPOOL temp.sql 13 | 14 | SELECT 'ALTER FUNCTION ' || a.owner || '.' || a.object_name || ' COMPILE;' 15 | FROM all_objects a 16 | WHERE a.object_type = 'FUNCTION' 17 | AND a.status = 'INVALID' 18 | AND a.owner = Decode(Upper('&&1'), 'ALL',a.owner, Upper('&&1')); 19 | 20 | SPOOL OFF 21 | 22 | -- Comment out following line to prevent immediate run 23 | @temp.sql 24 | 25 | SET PAGESIZE 14 26 | SET FEEDBACK ON 27 | SET VERIFY ON 28 | -------------------------------------------------------------------------------- /miscellaneous/compile_all_procs.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/miscellaneous/compile_all_procs.sql 3 | -- Author : Tim Hall 4 | -- Description : Compiles all invalid procedures for specified schema, or all schema. 5 | -- Call Syntax : @compile_all_procs (schema-name or all) 6 | -- Last Modified: 28/01/2001 7 | -- ----------------------------------------------------------------------------------- 8 | SET PAGESIZE 0 9 | SET FEEDBACK OFF 10 | SET VERIFY OFF 11 | 12 | SPOOL temp.sql 13 | 14 | SELECT 'ALTER PROCEDURE ' || a.owner || '.' || a.object_name || ' COMPILE;' 15 | FROM all_objects a 16 | WHERE a.object_type = 'PROCEDURE' 17 | AND a.status = 'INVALID' 18 | AND a.owner = Decode(Upper('&&1'), 'ALL',a.owner, Upper('&&1')); 19 | 20 | SPOOL OFF 21 | 22 | -- Comment out following line to prevent immediate run 23 | @temp.sql 24 | 25 | SET PAGESIZE 14 26 | SET FEEDBACK ON 27 | SET VERIFY ON 28 | -------------------------------------------------------------------------------- /miscellaneous/compile_all_specs.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/miscellaneous/compile_all_specs.sql 3 | -- Author : Tim Hall 4 | -- Description : Compiles all invalid package specifications for specified schema, or all schema. 5 | -- Call Syntax : @compile_all_specs (schema-name or all) 6 | -- Last Modified: 28/01/2001 7 | -- ----------------------------------------------------------------------------------- 8 | SET PAGESIZE 0 9 | SET FEEDBACK OFF 10 | SET VERIFY OFF 11 | 12 | SPOOL temp.sql 13 | 14 | SELECT 'ALTER PACKAGE ' || a.owner || '.' || a.object_name || ' COMPILE;' 15 | FROM all_objects a 16 | WHERE a.object_type = 'PACKAGE' 17 | AND a.status = 'INVALID' 18 | AND a.owner = Decode(Upper('&&1'), 'ALL',a.owner, Upper('&&1')); 19 | 20 | SPOOL OFF 21 | 22 | -- Comment out following line to prevent immediate run 23 | @temp.sql 24 | 25 | SET PAGESIZE 14 26 | SET FEEDBACK ON 27 | SET VERIFY ON 28 | -------------------------------------------------------------------------------- /miscellaneous/compile_all_trigs.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/miscellaneous/compile_all_trigs.sql 3 | -- Author : Tim Hall 4 | -- Description : Compiles all invalid triggers for specified schema, or all schema. 5 | -- Call Syntax : @compile_all_trigs (schema-name or all) 6 | -- Last Modified: 28/01/2001 7 | -- ----------------------------------------------------------------------------------- 8 | SET PAGESIZE 0 9 | SET FEEDBACK OFF 10 | SET VERIFY OFF 11 | 12 | SPOOL temp.sql 13 | 14 | SELECT 'ALTER TRIGGER ' || a.owner || '.' || a.object_name || ' COMPILE;' 15 | FROM all_objects a 16 | WHERE a.object_type = 'TRIGGER' 17 | AND a.status = 'INVALID' 18 | AND a.owner = Decode(Upper('&&1'), 'ALL',a.owner, Upper('&&1')); 19 | 20 | SPOOL OFF 21 | 22 | -- Comment out following line to prevent immediate run 23 | @temp.sql 24 | 25 | SET PAGESIZE 14 26 | SET FEEDBACK ON 27 | SET VERIFY ON 28 | -------------------------------------------------------------------------------- /miscellaneous/compile_all_views.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/miscellaneous/compile_all_views.sql 3 | -- Author : Tim Hall 4 | -- Description : Compiles all invalid views for specified schema, or all schema. 5 | -- Call Syntax : @compile_all_views (schema-name or all) 6 | -- Last Modified: 28/01/2001 7 | -- ----------------------------------------------------------------------------------- 8 | SET PAGESIZE 0 9 | SET FEEDBACK OFF 10 | SET VERIFY OFF 11 | 12 | SPOOL temp.sql 13 | 14 | SELECT 'ALTER VIEW ' || a.owner || '.' || a.object_name || ' COMPILE;' 15 | FROM all_objects a 16 | WHERE a.object_type = 'VIEW' 17 | AND a.status = 'INVALID' 18 | AND a.owner = Decode(Upper('&&1'), 'ALL',a.owner, Upper('&&1')); 19 | 20 | SPOOL OFF 21 | 22 | -- Comment out following line to prevent immediate run 23 | @temp.sql 24 | 25 | SET PAGESIZE 14 26 | SET FEEDBACK ON 27 | SET VERIFY ON 28 | -------------------------------------------------------------------------------- /miscellaneous/dict_comments.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/miscellaneous/dict_comments.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays comments associate with specific tables. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @dict_comments (table-name or partial match) 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | PROMPT 10 | SET VERIFY OFF 11 | SET FEEDBACK OFF 12 | SET LINESIZE 255 13 | SET PAGESIZE 1000 14 | 15 | SELECT a.table_name "Table", 16 | Substr(a.comments,1,200) "Comments" 17 | FROM dictionary a 18 | WHERE a.table_name LIKE Upper('%&1%'); 19 | 20 | SET VERIFY ON 21 | SET FEEDBACK ON 22 | SET PAGESIZE 14 23 | PROMPT 24 | -------------------------------------------------------------------------------- /miscellaneous/find_object.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/miscellaneous/find_object.sql 3 | -- Author : Tim Hall 4 | -- Description : Lists all objects with a similar name to that specified. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @find_object (object-name) 7 | -- Last Modified: 26-JUL-2016 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET VERIFY OFF LINESIZE 200 11 | 12 | COLUMN object_name FORMAT A30 13 | COLUMN owner FORMAT A20 14 | 15 | SELECT object_name, owner, object_type, status 16 | FROM dba_objects 17 | WHERE LOWER(object_name) LIKE '%' || LOWER('&1') || '%' 18 | ORDER BY 1, 2, 3; 19 | -------------------------------------------------------------------------------- /miscellaneous/gen_health.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/miscellaneous/gen_health.sql 3 | -- Author : Tim Hall 4 | -- Description : Miscellaneous queries to check the general health of the system. 5 | -- Call Syntax : @gen_health 6 | -- Last Modified: 15/07/2000 7 | -- ----------------------------------------------------------------------------------- 8 | SELECT file_id, 9 | tablespace_name, 10 | file_name, 11 | status 12 | FROM sys.dba_data_files; 13 | 14 | SELECT file#, 15 | name, 16 | status, 17 | enabled 18 | FROM v$datafile; 19 | 20 | SELECT * 21 | FROM v$backup; 22 | 23 | SELECT * 24 | FROM v$recovery_status; 25 | 26 | SELECT * 27 | FROM v$recover_file; 28 | 29 | SELECT * 30 | FROM v$recovery_file_status; 31 | 32 | SELECT * 33 | FROM v$recovery_log; 34 | 35 | SELECT username, 36 | command, 37 | status, 38 | module 39 | FROM v$session; 40 | 41 | -------------------------------------------------------------------------------- /miscellaneous/get_pivot.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/miscellaneous/get_pivot.sql 3 | -- Author : Tim Hall 4 | -- Description : Creates a function to produce a virtual pivot table with the specific values. 5 | -- Requirements : CREATE TYPE, CREATE PROCEDURE 6 | -- Call Syntax : @get_pivot.sql 7 | -- Last Modified: 13/08/2003 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | CREATE OR REPLACE TYPE t_pivot AS TABLE OF NUMBER; 11 | / 12 | 13 | CREATE OR REPLACE FUNCTION get_pivot(p_max IN NUMBER, 14 | p_step IN NUMBER DEFAULT 1) 15 | RETURN t_pivot AS 16 | l_pivot t_pivot := t_pivot(); 17 | BEGIN 18 | FOR i IN 0 .. TRUNC(p_max/p_step) LOOP 19 | l_pivot.extend; 20 | l_pivot(l_pivot.last) := 1 + (i * p_step); 21 | END LOOP; 22 | RETURN l_pivot; 23 | END; 24 | / 25 | SHOW ERRORS 26 | 27 | SELECT column_value 28 | FROM TABLE(get_pivot(17,2)); 29 | 30 | -------------------------------------------------------------------------------- /miscellaneous/login.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/miscellaneous/login.sql 3 | -- Author : Tim Hall 4 | -- Description : Resets the SQL*Plus prompt when a new connection is made. 5 | -- Call Syntax : @login 6 | -- Last Modified: 04/03/2004 7 | -- ----------------------------------------------------------------------------------- 8 | SET FEEDBACK OFF 9 | SET TERMOUT OFF 10 | 11 | COLUMN X NEW_VALUE Y 12 | SELECT LOWER(USER || '@' || SYS_CONTEXT('userenv', 'instance_name')) X FROM dual; 13 | SET SQLPROMPT '&Y> ' 14 | 15 | ALTER SESSION SET NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI:SS'; 16 | ALTER SESSION SET NLS_TIMESTAMP_FORMAT='DD-MON-YYYY HH24:MI:SS.FF'; 17 | 18 | SET TERMOUT ON 19 | SET FEEDBACK ON 20 | SET LINESIZE 100 21 | SET TAB OFF 22 | SET TRIM ON 23 | SET TRIMSPOOL ON 24 | -------------------------------------------------------------------------------- /miscellaneous/rebuild_index.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/miscellaneous/rebuild_index.sql 3 | -- Author : Tim Hall 4 | -- Description : Rebuilds the specified index, or all indexes. 5 | -- Call Syntax : @rebuild_index (index-name or all) (schema-name) 6 | -- Last Modified: 28/01/2001 7 | -- ----------------------------------------------------------------------------------- 8 | SET PAGESIZE 0 9 | SET FEEDBACK OFF 10 | SET VERIFY OFF 11 | 12 | SPOOL temp.sql 13 | 14 | SELECT 'ALTER INDEX ' || a.index_name || ' REBUILD;' 15 | FROM all_indexes a 16 | WHERE index_name = DECODE(Upper('&1'),'ALL',a.index_name,Upper('&1')) 17 | AND table_owner = Upper('&2') 18 | ORDER BY 1 19 | / 20 | 21 | SPOOL OFF 22 | 23 | -- Comment out following line to prevent immediate run 24 | @temp.sql 25 | 26 | SET PAGESIZE 14 27 | SET FEEDBACK ON 28 | SET VERIFY ON 29 | -------------------------------------------------------------------------------- /miscellaneous/table_comments.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/miscellaneous/table_comments.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays comments associate with specific tables. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @table_comments (schema or all) (table-name or partial match) 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET VERIFY OFF 10 | COLUMN table_name FORMAT A30 11 | COLUMN comments FORMAT A40 12 | 13 | SELECT table_name, 14 | comments 15 | FROM dba_tab_comments 16 | WHERE owner = DECODE(UPPER('&1'), 'ALL', owner, UPPER('&1')) 17 | AND table_name LIKE UPPER('%&2%') 18 | ORDER BY table_name; 19 | -------------------------------------------------------------------------------- /monitoring/access.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/access.sql 3 | -- Author : Tim Hall 4 | -- Description : Lists all objects being accessed in the schema. 5 | -- Call Syntax : @access (schema-name or all) (object-name or all) 6 | -- Requirements : Access to the v$views. 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 255 10 | SET VERIFY OFF 11 | 12 | COLUMN object FORMAT A30 13 | 14 | SELECT a.object, 15 | a.type, 16 | a.sid, 17 | b.serial#, 18 | b.username, 19 | b.osuser, 20 | b.program 21 | FROM v$access a, 22 | v$session b 23 | WHERE a.sid = b.sid 24 | AND a.owner = DECODE(UPPER('&1'), 'ALL', a.object, UPPER('&1')) 25 | AND a.object = DECODE(UPPER('&2'), 'ALL', a.object, UPPER('&2')) 26 | ORDER BY a.object; 27 | -------------------------------------------------------------------------------- /monitoring/call_stack.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/call_stack.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the current call stack. 5 | -- Requirements : Access to DBMS_UTILITY. 6 | -- Call Syntax : @call_stack 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET SERVEROUTPUT ON 10 | DECLARE 11 | v_stack VARCHAR2(2000); 12 | BEGIN 13 | v_stack := Dbms_Utility.Format_Call_Stack; 14 | Dbms_Output.Put_Line(v_stack); 15 | END; 16 | / 17 | -------------------------------------------------------------------------------- /monitoring/code_dep.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/code_dep.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays all dependencies of specified object. 5 | -- Call Syntax : @code_dep (schema-name or all) (object-name) 6 | -- Last Modified: 15/07/2000 7 | -- ----------------------------------------------------------------------------------- 8 | SET VERIFY OFF 9 | SET LINESIZE 255 10 | SET PAGESIZE 1000 11 | BREAK ON referenced_type SKIP 1 12 | 13 | COLUMN referenced_type FORMAT A20 14 | COLUMN referenced_owner FORMAT A20 15 | COLUMN referenced_name FORMAT A40 16 | COLUMN referenced_link_name FORMAT A20 17 | 18 | SELECT a.referenced_type, 19 | a.referenced_owner, 20 | a.referenced_name, 21 | a.referenced_link_name 22 | FROM all_dependencies a 23 | WHERE a.owner = DECODE(UPPER('&1'), 'ALL', a.referenced_owner, UPPER('&1')) 24 | AND a.name = UPPER('&2') 25 | ORDER BY 1,2,3; 26 | 27 | SET VERIFY ON 28 | SET PAGESIZE 22 -------------------------------------------------------------------------------- /monitoring/code_dep_on.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/code_dep_on.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays all objects dependant on the specified object. 5 | -- Call Syntax : @code_dep_on (schema-name or all) (object-name) 6 | -- Last Modified: 15/07/2000 7 | -- ----------------------------------------------------------------------------------- 8 | SET VERIFY OFF 9 | SET LINESIZE 255 10 | SET PAGESIZE 1000 11 | BREAK ON type SKIP 1 12 | 13 | COLUMN owner FORMAT A20 14 | 15 | SELECT a.type, 16 | a.owner, 17 | a.name 18 | FROM all_dependencies a 19 | WHERE a.referenced_owner = DECODE(UPPER('&1'), 'ALL', a.referenced_owner, UPPER('&1')) 20 | AND a.referenced_name = UPPER('&2') 21 | ORDER BY 1,2,3; 22 | 23 | SET PAGESIZE 22 24 | SET VERIFY ON -------------------------------------------------------------------------------- /monitoring/column_defaults.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/column_defaults.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the default values where present for the specified table. 5 | -- Call Syntax : @column_defaults (table-name) 6 | -- Last Modified: 15/07/2000 7 | -- ----------------------------------------------------------------------------------- 8 | SET LINESIZE 100 9 | SET VERIFY OFF 10 | 11 | SELECT a.column_name "Column", 12 | a.data_default "Default" 13 | FROM all_tab_columns a 14 | WHERE a.table_name = Upper('&1') 15 | AND a.data_default IS NOT NULL 16 | / -------------------------------------------------------------------------------- /monitoring/controlfiles.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/controlfiles.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about controlfiles. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @controlfiles 7 | -- Last Modified: 21/12/2004 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET LINESIZE 100 11 | COLUMN name FORMAT A80 12 | 13 | SELECT name, 14 | status 15 | FROM v$controlfile 16 | ORDER BY name; 17 | 18 | SET LINESIZE 80 -------------------------------------------------------------------------------- /monitoring/datafiles.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/datafiles.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about datafiles. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @datafiles 7 | -- Last Modified: 17-AUG-2005 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET LINESIZE 200 11 | COLUMN file_name FORMAT A70 12 | 13 | SELECT file_id, 14 | file_name, 15 | ROUND(bytes/1024/1024/1024) AS size_gb, 16 | ROUND(maxbytes/1024/1024/1024) AS max_size_gb, 17 | autoextensible, 18 | increment_by, 19 | status 20 | FROM dba_data_files 21 | ORDER BY file_name; 22 | -------------------------------------------------------------------------------- /monitoring/db_links.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/db_links.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information on all database links. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @db_links 7 | -- Last Modified: 11/05/2007 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 150 10 | 11 | COLUMN owner FORMAT A30 12 | COLUMN db_link FORMAT A30 13 | COLUMN username FORMAT A30 14 | COLUMN host FORMAT A30 15 | 16 | SELECT owner, 17 | db_link, 18 | username, 19 | host 20 | FROM dba_db_links 21 | ORDER BY owner, db_link; 22 | -------------------------------------------------------------------------------- /monitoring/db_links_open.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/db_links_open.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information on all open database links. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @db_links_open 7 | -- Last Modified: 11/05/2007 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | 11 | COLUMN db_link FORMAT A30 12 | 13 | SELECT db_link, 14 | owner_id, 15 | logged_on, 16 | heterogeneous, 17 | protocol, 18 | open_cursors, 19 | in_transaction, 20 | update_sent, 21 | commit_point_strength 22 | FROM v$dblink 23 | ORDER BY db_link; 24 | 25 | SET LINESIZE 80 26 | -------------------------------------------------------------------------------- /monitoring/db_properties.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/db_properties.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays all database property values. 5 | -- Call Syntax : @db_properties 6 | -- Last Modified: 15/09/2006 7 | -- ----------------------------------------------------------------------------------- 8 | COLUMN property_value FORMAT A50 9 | 10 | SELECT property_name, 11 | property_value 12 | FROM database_properties 13 | ORDER BY property_name; 14 | -------------------------------------------------------------------------------- /monitoring/default_tablespaces.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/default_tablespaces.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the default temporary and permanent tablespaces. 5 | -- Requirements : Access to the DATABASE_PROPERTIES views. 6 | -- Call Syntax : @default_tablespaces 7 | -- Last Modified: 04/06/2019 8 | -- ----------------------------------------------------------------------------------- 9 | COLUMN property_name FORMAT A30 10 | COLUMN property_value FORMAT A30 11 | COLUMN description FORMAT A50 12 | SET LINESIZE 200 13 | 14 | SELECT * 15 | FROM database_properties 16 | WHERE property_name like '%TABLESPACE'; 17 | -------------------------------------------------------------------------------- /monitoring/directories.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/directories.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about all directories. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @directories 7 | -- Last Modified: 04/10/2006 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 150 10 | 11 | COLUMN owner FORMAT A20 12 | COLUMN directory_name FORMAT A25 13 | COLUMN directory_path FORMAT A80 14 | 15 | SELECT * 16 | FROM dba_directories 17 | ORDER BY owner, directory_name; 18 | -------------------------------------------------------------------------------- /monitoring/directory_permissions.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/directory_permissions.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays permission information about all directories. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @directory_permissions (directory_name) 7 | -- Last Modified: 09/02/2016 8 | -- ----------------------------------------------------------------------------------- 9 | set linesize 200 10 | 11 | column grantee format a20 12 | column owner format a10 13 | column grantor format a20 14 | column privilege format a20 15 | 16 | column 17 | select * 18 | from dba_tab_privs 19 | where table_name = upper('&1'); 20 | -------------------------------------------------------------------------------- /monitoring/directory_permissions_all.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/directory_permissions_all.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays permissions on all directories. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @directory_permissions_all 7 | -- Last Modified: 27/03/2024 8 | -- ----------------------------------------------------------------------------------- 9 | column directory_name format a30 10 | column grantee format a30 11 | column privileges format a20 12 | 13 | select table_name as directory_name, 14 | grantee, 15 | listagg(privilege,',') as privileges 16 | from dba_tab_privs 17 | where table_name in (select directory_name from dba_directories) 18 | group by table_name, grantee 19 | order by 1, 2; 20 | -------------------------------------------------------------------------------- /monitoring/dispatchers.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/dispatchers.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays dispatcher statistics. 5 | -- Requirements : Access to the v$ views. 6 | -- Call Syntax : @dispatchers 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 500 10 | SET PAGESIZE 1000 11 | SET VERIFY OFF 12 | 13 | SELECT a.name "Name", 14 | a.status "Status", 15 | a.accept "Accept", 16 | a.messages "Total Mesgs", 17 | a.bytes "Total Bytes", 18 | a.owned "Circs Owned", 19 | a.idle "Total Idle Time", 20 | a.busy "Total Busy Time", 21 | Round(a.busy/(a.busy + a.idle),2) "Load" 22 | FROM v$dispatcher a 23 | ORDER BY 1; 24 | 25 | SET PAGESIZE 14 26 | SET VERIFY ON -------------------------------------------------------------------------------- /monitoring/error_stack.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/error_stack.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays contents of the error stack. 5 | -- Call Syntax : @error_stack 6 | -- Last Modified: 15/07/2000 7 | -- ----------------------------------------------------------------------------------- 8 | SET SERVEROUTPUT ON 9 | DECLARE 10 | v_stack VARCHAR2(2000); 11 | BEGIN 12 | v_stack := Dbms_Utility.Format_Error_Stack; 13 | Dbms_Output.Put_Line(v_stack); 14 | END; 15 | / 16 | -------------------------------------------------------------------------------- /monitoring/errors.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/errors.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the source line and the associated error after compilation failure. 5 | -- Comments : Essentially the same as SHOW ERRORS. 6 | -- Call Syntax : @errors (source-name) 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | SELECT To_Char(a.line) || ' - ' || a.text error 10 | FROM user_source a, 11 | user_errors b 12 | WHERE a.name = Upper('&&1') 13 | AND a.name = b.name 14 | AND a.type = b.type 15 | AND a.line = b.line 16 | ORDER BY a.name, a.line; -------------------------------------------------------------------------------- /monitoring/file_io.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/file_io.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the amount of IO for each datafile. 5 | -- Requirements : Access to the v$ views. 6 | -- Call Syntax : @file_io 7 | -- Last Modified: 15-JUL-2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET PAGESIZE 1000 10 | 11 | SELECT Substr(d.name,1,50) "File Name", 12 | f.phyblkrd "Blocks Read", 13 | f.phyblkwrt "Blocks Writen", 14 | f.phyblkrd + f.phyblkwrt "Total I/O" 15 | FROM v$filestat f, 16 | v$datafile d 17 | WHERE d.file# = f.file# 18 | ORDER BY f.phyblkrd + f.phyblkwrt DESC; 19 | 20 | SET PAGESIZE 18 -------------------------------------------------------------------------------- /monitoring/find_packaged_proc.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/find_packaged_proc.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays tablespaces the user has quotas on. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @find_packaged_proc {procedure_name} 7 | -- Last Modified: 16-JAN-2024 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | set verify off 11 | column owner format a30 12 | column object_name format a30 13 | column procedure_name format a30 14 | 15 | select owner, object_name, procedure_name 16 | from dba_procedures 17 | where object_type = 'PACKAGE' 18 | and procedure_name like '%' || upper('&1') || '%'; 19 | -------------------------------------------------------------------------------- /monitoring/health.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/health.sql 3 | -- Author : Tim Hall 4 | -- Description : Lots of information about the database so you can asses the general health of the system. 5 | -- Requirements : Access to the V$ & DBA views and several other monitoring scripts. 6 | -- Call Syntax : @health (username/password@service) 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | SPOOL Health_Checks.txt 10 | 11 | conn &1 12 | @db_info 13 | @sessions 14 | @ts_full 15 | @max_extents 16 | 17 | SPOOL OFF -------------------------------------------------------------------------------- /monitoring/identify_trace_file.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/identify_trace_file.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the name of the trace file associated with the current session. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @identify_trace_file 7 | -- Last Modified: 17-AUG-2005 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 100 10 | COLUMN trace_file FORMAT A60 11 | 12 | SELECT s.sid, 13 | s.serial#, 14 | pa.value || '/' || LOWER(SYS_CONTEXT('userenv','instance_name')) || 15 | '_ora_' || p.spid || '.trc' AS trace_file 16 | FROM v$session s, 17 | v$process p, 18 | v$parameter pa 19 | WHERE pa.name = 'user_dump_dest' 20 | AND s.paddr = p.addr 21 | AND s.audsid = SYS_CONTEXT('USERENV', 'SESSIONID'); -------------------------------------------------------------------------------- /monitoring/index_monitoring_status.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/index_monitoring_status.sql 3 | -- Author : Tim Hall 4 | -- Description : Shows the monitoring status for the specified table indexes. 5 | -- Call Syntax : @index_monitoring_status (table-name) (index-name or all) 6 | -- Last Modified: 04/02/2005 7 | -- ----------------------------------------------------------------------------------- 8 | SET VERIFY OFF 9 | 10 | SELECT table_name, 11 | index_name, 12 | monitoring 13 | FROM v$object_usage 14 | WHERE table_name = UPPER('&1') 15 | AND index_name = DECODE(UPPER('&2'), 'ALL', index_name, UPPER('&2')); 16 | -------------------------------------------------------------------------------- /monitoring/index_usage.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/index_usage.sql 3 | -- Author : Tim Hall 4 | -- Description : Shows the usage for the specified table indexes. 5 | -- Call Syntax : @index_usage (table-name) (index-name or all) 6 | -- Last Modified: 04/02/2005 7 | -- ----------------------------------------------------------------------------------- 8 | SET VERIFY OFF 9 | SET LINESIZE 200 10 | 11 | SELECT table_name, 12 | index_name, 13 | used, 14 | start_monitoring, 15 | end_monitoring 16 | FROM v$object_usage 17 | WHERE table_name = UPPER('&1') 18 | AND index_name = DECODE(UPPER('&2'), 'ALL', index_name, UPPER('&2')); 19 | -------------------------------------------------------------------------------- /monitoring/invalid_objects.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/invalid_objects.sql 3 | -- Author : Tim Hall 4 | -- Description : Lists all invalid objects in the database. 5 | -- Call Syntax : @invalid_objects 6 | -- Requirements : Access to the DBA views. 7 | -- Last Modified: 18/12/2005 8 | -- ----------------------------------------------------------------------------------- 9 | COLUMN owner FORMAT A30 10 | COLUMN object_name FORMAT A30 11 | 12 | SELECT owner, 13 | object_type, 14 | object_name, 15 | status 16 | FROM dba_objects 17 | WHERE status = 'INVALID' 18 | ORDER BY owner, object_type, object_name; 19 | -------------------------------------------------------------------------------- /monitoring/jobs_running.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/jobs_running.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about all jobs currently running. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @jobs_running 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 500 10 | SET PAGESIZE 1000 11 | SET VERIFY OFF 12 | 13 | SELECT a.job "Job", 14 | a.sid, 15 | a.failures "Failures", 16 | Substr(To_Char(a.last_date,'DD-Mon-YYYY HH24:MI:SS'),1,20) "Last Date", 17 | Substr(To_Char(a.this_date,'DD-Mon-YYYY HH24:MI:SS'),1,20) "This Date" 18 | FROM dba_jobs_running a; 19 | 20 | SET PAGESIZE 14 21 | SET VERIFY ON -------------------------------------------------------------------------------- /monitoring/large_segments.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/large_segments.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays size of large segments. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @large_segments (rows) 7 | -- Last Modified: 12/09/2017 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 500 VERIFY OFF 10 | COLUMN owner FORMAT A30 11 | COLUMN segment_name FORMAT A30 12 | COLUMN tablespace_name FORMAT A30 13 | COLUMN size_mb FORMAT 99999999.00 14 | 15 | SELECT * 16 | FROM (SELECT owner, 17 | segment_name, 18 | segment_type, 19 | tablespace_name, 20 | ROUND(bytes/1024/1024,2) size_mb 21 | FROM dba_segments 22 | ORDER BY 5 DESC) 23 | WHERE ROWNUM <= &1; 24 | 25 | SET VERIFY ON -------------------------------------------------------------------------------- /monitoring/latch_hit_ratios.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/latch_hit_ratios.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays current latch hit ratios. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @latch_hit_ratios 7 | -- Last Modified: 15-JUL-2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | 11 | COLUMN latch_hit_ratio FORMAT 990.00 12 | 13 | SELECT l.name, 14 | l.gets, 15 | l.misses, 16 | ((1 - (l.misses / l.gets)) * 100) AS latch_hit_ratio 17 | FROM v$latch l 18 | WHERE l.gets != 0 19 | UNION 20 | SELECT l.name, 21 | l.gets, 22 | l.misses, 23 | 100 AS latch_hit_ratio 24 | FROM v$latch l 25 | WHERE l.gets = 0 26 | ORDER BY 4 DESC; 27 | -------------------------------------------------------------------------------- /monitoring/latch_holders.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/latch_holders.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about all current latch holders. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @latch_holders 7 | -- Last Modified: 15-JUL-2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | 11 | SELECT l.name "Latch Name", 12 | lh.pid "PID", 13 | lh.sid "SID", 14 | l.gets "Gets (Wait)", 15 | l.misses "Misses (Wait)", 16 | l.sleeps "Sleeps (Wait)", 17 | l.immediate_gets "Gets (No Wait)", 18 | l.immediate_misses "Misses (Wait)" 19 | FROM v$latch l, 20 | v$latchholder lh 21 | WHERE l.addr = lh.laddr 22 | ORDER BY l.name; 23 | -------------------------------------------------------------------------------- /monitoring/latches.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/latches.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about all current latches. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @latches 7 | -- Last Modified: 15-JUL-2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | 11 | SELECT l.latch#, 12 | l.name, 13 | l.gets, 14 | l.misses, 15 | l.sleeps, 16 | l.immediate_gets, 17 | l.immediate_misses, 18 | l.spin_gets 19 | FROM v$latch l 20 | ORDER BY l.name; 21 | -------------------------------------------------------------------------------- /monitoring/library_cache.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/library_cache.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays library cache statistics. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @library_cache 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 500 10 | SET PAGESIZE 1000 11 | SET VERIFY OFF 12 | 13 | SELECT a.namespace "Name Space", 14 | a.gets "Get Requests", 15 | a.gethits "Get Hits", 16 | Round(a.gethitratio,2) "Get Ratio", 17 | a.pins "Pin Requests", 18 | a.pinhits "Pin Hits", 19 | Round(a.pinhitratio,2) "Pin Ratio", 20 | a.reloads "Reloads", 21 | a.invalidations "Invalidations" 22 | FROM v$librarycache a 23 | ORDER BY 1; 24 | 25 | SET PAGESIZE 14 26 | SET VERIFY ON -------------------------------------------------------------------------------- /monitoring/license.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/license.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays session usage for licensing purposes. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @license 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | SELECT * 10 | FROM v$license; 11 | -------------------------------------------------------------------------------- /monitoring/lru_latch_ratio.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/lru_latch_ratio.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays current LRU latch ratios. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @lru_latch_hit_ratio 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 500 10 | SET PAGESIZE 1000 11 | COLUMN "Ratio %" FORMAT 990.00 12 | 13 | PROMPT 14 | PROMPT Values greater than 3% indicate contention. 15 | 16 | SELECT a.child#, 17 | (a.SLEEPS / a.GETS) * 100 "Ratio %" 18 | FROM v$latch_children a 19 | WHERE a.name = 'cache buffers lru chain' 20 | ORDER BY 1; 21 | 22 | 23 | SET PAGESIZE 14 24 | -------------------------------------------------------------------------------- /monitoring/monitor_memory.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/monitor_memory.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays memory allocations for the current database sessions. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @monitor_memory 7 | -- Last Modified: 15-JUL-2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | 11 | COLUMN username FORMAT A20 12 | COLUMN module FORMAT A20 13 | 14 | SELECT NVL(a.username,'(oracle)') AS username, 15 | a.module, 16 | a.program, 17 | Trunc(b.value/1024) AS memory_kb 18 | FROM v$session a, 19 | v$sesstat b, 20 | v$statname c 21 | WHERE a.sid = b.sid 22 | AND b.statistic# = c.statistic# 23 | AND c.name = 'session pga memory' 24 | AND a.program IS NOT NULL 25 | ORDER BY b.value DESC; -------------------------------------------------------------------------------- /monitoring/monitoring_status.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/monitoring_status.sql 3 | -- Author : Tim Hall 4 | -- Description : Shows the monitoring status for the specified tables. 5 | -- Call Syntax : @monitoring_status (schema) (table-name or all) 6 | -- Last Modified: 21/03/2003 7 | -- ----------------------------------------------------------------------------------- 8 | SET VERIFY OFF 9 | 10 | SELECT table_name, monitoring 11 | FROM dba_tables 12 | WHERE owner = UPPER('&1') 13 | AND table_name = DECODE(UPPER('&2'), 'ALL', table_name, UPPER('&2')); 14 | -------------------------------------------------------------------------------- /monitoring/my_roles.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/my_roles.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays a list of all roles and privileges granted to the current user. 5 | -- Requirements : Access to the USER views. 6 | -- Call Syntax : @user_roles 7 | -- Last Modified: 26/06/2023 8 | -- ----------------------------------------------------------------------------------- 9 | set serveroutput on 10 | set verify off 11 | 12 | select a.granted_role, 13 | a.admin_option 14 | from user_role_privs a 15 | order by a.granted_role; 16 | 17 | select a.privilege, 18 | a.admin_option 19 | from user_sys_privs a 20 | order by a.privilege; 21 | 22 | set verify on 23 | -------------------------------------------------------------------------------- /monitoring/nls_params.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/nls_params.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays National Language Suppport (NLS) information. 5 | -- Requirements : 6 | -- Call Syntax : @nls_params 7 | -- Last Modified: 21-FEB-2005 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 100 10 | COLUMN parameter FORMAT A45 11 | COLUMN value FORMAT A45 12 | 13 | PROMPT *** Database parameters *** 14 | SELECT * FROM nls_database_parameters ORDER BY 1; 15 | 16 | PROMPT *** Instance parameters *** 17 | SELECT * FROM nls_instance_parameters ORDER BY 1; 18 | 19 | PROMPT *** Session parameters *** 20 | SELECT * FROM nls_session_parameters ORDER BY 1; -------------------------------------------------------------------------------- /monitoring/obj_lock.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/obj_lock.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays a list of locked objects. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @obj_lock 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | SELECT a.type, 10 | Substr(a.owner,1,30) owner, 11 | a.sid, 12 | Substr(a.object,1,30) object 13 | FROM v$access a 14 | WHERE a.owner NOT IN ('SYS','PUBLIC') 15 | ORDER BY 1,2,3,4 16 | / 17 | -------------------------------------------------------------------------------- /monitoring/object_privs.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/object_privs.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays object privileges on a specified object. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @object_privs (owner) (object-name) 7 | -- Last Modified: 27/07/2005 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 VERIFY OFF 10 | 11 | COLUMN owner FORMAT A30 12 | COLUMN object_name FORMAT A30 13 | COLUMN grantor FORMAT A30 14 | COLUMN grantee FORMAT A30 15 | 16 | SELECT owner, 17 | table_name AS object_name, 18 | grantor, 19 | grantee, 20 | privilege, 21 | grantable, 22 | hierarchy 23 | FROM dba_tab_privs 24 | WHERE owner = UPPER('&1') 25 | AND table_name = UPPER('&2') 26 | ORDER BY 1,2,3,4; 27 | 28 | SET VERIFY ON -------------------------------------------------------------------------------- /monitoring/object_status.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/object_status.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays a list of objects and their status for the specific schema. 5 | -- Requirements : Access to the ALL views. 6 | -- Call Syntax : @object_status (schema-name) 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET SERVEROUTPUT ON 10 | SET PAGESIZE 1000 11 | SET LINESIZE 255 12 | SET FEEDBACK OFF 13 | SET VERIFY OFF 14 | 15 | SELECT Substr(object_name,1,30) object_name, 16 | object_type, 17 | status 18 | FROM all_objects 19 | WHERE owner = Upper('&&1'); 20 | 21 | PROMPT 22 | SET FEEDBACK ON 23 | SET PAGESIZE 18 24 | -------------------------------------------------------------------------------- /monitoring/open_cursors.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/open_cursors.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays a list of all cursors currently open. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @open_cursors 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | SELECT a.user_name, 10 | a.sid, 11 | a.sql_text 12 | FROM v$open_cursor a 13 | ORDER BY 1,2 14 | / 15 | -------------------------------------------------------------------------------- /monitoring/open_cursors_by_sid.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/open_cursors_by_sid.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the SQL statement held for a specific SID. 5 | -- Comments : The SID can be found by running session.sql or top_session.sql. 6 | -- Requirements : Access to the V$ views. 7 | -- Call Syntax : @open_cursors_by_sid (sid) 8 | -- Last Modified: 15/07/2000 9 | -- ----------------------------------------------------------------------------------- 10 | SET LINESIZE 500 11 | SET PAGESIZE 1000 12 | SET VERIFY OFF 13 | 14 | SELECT oc.sql_text, cursor_type 15 | FROM v$open_cursor oc 16 | WHERE oc.sid = &1 17 | ORDER BY cursor_type; 18 | 19 | PROMPT 20 | SET PAGESIZE 14 -------------------------------------------------------------------------------- /monitoring/open_cursors_full_by_sid.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/open_cursors_full_by_sid.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the SQL statement held for a specific SID. 5 | -- Comments : The SID can be found by running session.sql or top_session.sql. 6 | -- Requirements : Access to the V$ views. 7 | -- Call Syntax : @open_cursors_full_by_sid (sid) 8 | -- Last Modified: 15/07/2000 9 | -- ----------------------------------------------------------------------------------- 10 | SET LINESIZE 500 11 | SET PAGESIZE 1000 12 | SET VERIFY OFF 13 | 14 | SELECT st.sql_text 15 | FROM v$sqltext st, 16 | v$open_cursor oc 17 | WHERE st.address = oc.address 18 | AND st.hash_value = oc.hash_value 19 | AND oc.sid = &1 20 | ORDER BY st.address, st.piece; 21 | 22 | PROMPT 23 | SET PAGESIZE 14 24 | -------------------------------------------------------------------------------- /monitoring/options.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/options.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about all database options. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @options 7 | -- Last Modified: 12/04/2013 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | COLUMN value FORMAT A20 11 | 12 | SELECT * 13 | FROM v$option 14 | ORDER BY parameter; 15 | -------------------------------------------------------------------------------- /monitoring/packaged_procs.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/packaged_procs.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays tablespaces the user has quotas on. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @packaged_procs {package_name} 7 | -- Last Modified: 16-JAN-2024 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | set verify off 11 | column owner format a30 12 | column object_name format a30 13 | column procedure_name format a30 14 | 15 | select owner, object_name, procedure_name 16 | from dba_procedures 17 | where object_type = 'PACKAGE' 18 | and object_name like '%' || upper('&1') || '%'; 19 | -------------------------------------------------------------------------------- /monitoring/param_valid_values.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/param_valid_values.sql 3 | -- Author : Tim Hall 4 | -- Description : Lists all valid values for the specified parameter. 5 | -- Call Syntax : @param_valid_values (parameter-name) 6 | -- Requirements : Access to the v$views. 7 | -- Last Modified: 14/05/2013 8 | -- ----------------------------------------------------------------------------------- 9 | SET VERIFY OFF 10 | 11 | COLUMN value FORMAT A50 12 | COLUMN isdefault FORMAT A10 13 | 14 | SELECT value, 15 | isdefault 16 | FROM v$parameter_valid_values 17 | WHERE name = '&1'; 18 | -------------------------------------------------------------------------------- /monitoring/parameter_diffs.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/parameter_diffs.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays parameter values that differ between the current value and the spfile. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @parameter_diffs 7 | -- Last Modified: 08-NOV-2004 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET LINESIZE 120 11 | COLUMN name FORMAT A30 12 | COLUMN current_value FORMAT A30 13 | COLUMN sid FORMAT A8 14 | COLUMN spfile_value FORMAT A30 15 | 16 | SELECT p.name, 17 | i.instance_name AS sid, 18 | p.value AS current_value, 19 | sp.sid, 20 | sp.value AS spfile_value 21 | FROM v$spparameter sp, 22 | v$parameter p, 23 | v$instance i 24 | WHERE sp.name = p.name 25 | AND sp.value != p.value; 26 | 27 | COLUMN FORMAT DEFAULT 28 | -------------------------------------------------------------------------------- /monitoring/parameters.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/parameters.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays a list of all the parameters. 5 | -- Requirements : Access to the v$ views. 6 | -- Call Syntax : @parameters 7 | -- Last Modified: 15-JUL-2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 500 10 | 11 | COLUMN name FORMAT A30 12 | COLUMN value FORMAT A60 13 | 14 | SELECT p.name, 15 | p.type, 16 | p.value, 17 | p.isses_modifiable, 18 | p.issys_modifiable, 19 | p.isinstance_modifiable 20 | FROM v$parameter p 21 | ORDER BY p.name; 22 | 23 | -------------------------------------------------------------------------------- /monitoring/parameters_non_default.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/parameters_non_default.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays a list of all the non-default parameters. 5 | -- Requirements : Access to the v$ views. 6 | -- Call Syntax : @parameters_non_default 7 | -- Last Modified: 11-JAN-2017 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 150 10 | 11 | COLUMN name FORMAT A50 12 | COLUMN value FORMAT A50 13 | 14 | SELECT name, 15 | value 16 | FROM v$parameter 17 | WHERE isdefault = 'FALSE'; 18 | -------------------------------------------------------------------------------- /monitoring/part_tables.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/part_tables.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about all partitioned tables. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @part_tables 7 | -- Last Modified: 21/12/2004 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SELECT owner, table_name, partitioning_type, partition_count 11 | FROM dba_part_tables 12 | WHERE owner NOT IN ('SYS', 'SYSTEM') 13 | ORDER BY owner, table_name; 14 | -------------------------------------------------------------------------------- /monitoring/patch_registry.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/patch_registry.sql 3 | -- Author : Tim Hall 4 | -- Description : Lists all patches applied. 5 | -- Call Syntax : @patch_registry 6 | -- Requirements : Access to the DBA views. 7 | -- Last Modified: 25/01/2024 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | set linesize 150 11 | column status format a10 12 | column action_time format a30 13 | 14 | select install_id, 15 | patch_id, 16 | patch_uid, 17 | patch_type, 18 | action, 19 | status, 20 | target_version, 21 | action_time 22 | from dba_registry_sqlpatch 23 | order by 1; 24 | -------------------------------------------------------------------------------- /monitoring/pga_target_advice.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/pga_target_advice.sql 3 | -- Author : Tim Hall 4 | -- Description : Predicts how changes to the PGA_AGGREGATE_TARGET will affect PGA usage. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @pga_target_advice 7 | -- Last Modified: 12/02/2004 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SELECT ROUND(pga_target_for_estimate/1024/1024) target_mb, 11 | estd_pga_cache_hit_percentage cache_hit_perc, 12 | estd_overalloc_count 13 | FROM v$pga_target_advice; -------------------------------------------------------------------------------- /monitoring/pipes.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/pipes.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays a list of all database pipes. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @pipes 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 100 10 | 11 | COLUMN name FORMAT A40 12 | 13 | SELECT ownerid, 14 | name, 15 | type, 16 | pipe_size 17 | FROM v$db_pipes 18 | ORDER BY 1,2; 19 | 20 | -------------------------------------------------------------------------------- /monitoring/profiler_runs.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/profiler_runs.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information on all profiler_runs. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @profiler_runs.sql 7 | -- Last Modified: 25/02/2005 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | SET TRIMOUT ON 11 | 12 | COLUMN runid FORMAT 99999 13 | COLUMN run_comment FORMAT A50 14 | 15 | SELECT runid, 16 | run_date, 17 | run_comment, 18 | run_total_time 19 | FROM plsql_profiler_runs 20 | ORDER BY runid; 21 | -------------------------------------------------------------------------------- /monitoring/profiles.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/profiles.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the specified profile(s). 5 | -- Call Syntax : @profiles (profile | part of profile | all) 6 | -- Last Modified: 28/01/2006 7 | -- ----------------------------------------------------------------------------------- 8 | 9 | SET LINESIZE 150 PAGESIZE 20 VERIFY OFF 10 | 11 | BREAK ON profile SKIP 1 12 | 13 | COLUMN profile FORMAT A35 14 | COLUMN resource_name FORMAT A40 15 | COLUMN limit FORMAT A15 16 | 17 | SELECT profile, 18 | resource_type, 19 | resource_name, 20 | limit 21 | FROM dba_profiles 22 | WHERE profile LIKE (DECODE(UPPER('&1'), 'ALL', '%', UPPER('%&1%'))) 23 | ORDER BY profile, resource_type, resource_name; 24 | 25 | CLEAR BREAKS 26 | SET LINESIZE 80 PAGESIZE 14 VERIFY ON 27 | -------------------------------------------------------------------------------- /monitoring/proxy_users.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/proxy_users.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about proxy users. 5 | -- Requirements : Access to the PROXY_USERS views. 6 | -- Call Syntax : @proxy_users.sql {username or %} 7 | -- Last Modified: 02/06/2020 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET VERIFY OFF 11 | 12 | COLUMN proxy FORMAT A30 13 | COLUMN client FORMAT A30 14 | 15 | SELECT proxy, 16 | client, 17 | authentication, 18 | flags 19 | FROM proxy_users 20 | WHERE proxy LIKE UPPER('%&1%'); 21 | -------------------------------------------------------------------------------- /monitoring/rbs_stats.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/rbs_stats.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays rollback segment statistics. 5 | -- Requirements : Access to the v$ & DBA views. 6 | -- Call Syntax : @rbs_stats 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 500 10 | SET PAGESIZE 1000 11 | SET VERIFY OFF 12 | 13 | SELECT b.name "Segment Name", 14 | Trunc(c.bytes/1024) "Size (Kb)", 15 | a.optsize "Optimal", 16 | a.shrinks "Shrinks", 17 | a.aveshrink "Avg Shrink", 18 | a.wraps "Wraps", 19 | a.extends "Extends" 20 | FROM v$rollstat a, 21 | v$rollname b, 22 | dba_segments c 23 | WHERE a.usn = b.usn 24 | AND b.name = c.segment_name 25 | ORDER BY b.name; 26 | 27 | SET PAGESIZE 14 28 | SET VERIFY ON -------------------------------------------------------------------------------- /monitoring/recovery_status.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/recovery_status.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the recovery status of each datafile. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @recovery_status 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 500 10 | SET PAGESIZE 500 11 | SET FEEDBACK OFF 12 | 13 | SELECT Substr(a.name,1,60) "Datafile", 14 | b.status "Status" 15 | FROM v$datafile a, 16 | v$backup b 17 | WHERE a.file# = b.file#; 18 | 19 | SET PAGESIZE 14 20 | SET FEEDBACK ON -------------------------------------------------------------------------------- /monitoring/recyclebin.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/recyclebin.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the contents of the recyclebin. 5 | -- Requirements : Access to the DBA views. Depending on DB version, different columns 6 | -- are available. 7 | -- Call Syntax : @recyclebin (owner | all) 8 | -- Last Modified: 15/07/2010 9 | -- ----------------------------------------------------------------------------------- 10 | SET LINESIZE 500 VERIFY OFF 11 | 12 | SELECT owner, 13 | original_name, 14 | object_name, 15 | operation, 16 | type, 17 | space AS space_blks, 18 | ROUND((space*8)/1024,2) space_mb 19 | FROM dba_recyclebin 20 | WHERE owner = DECODE(UPPER('&1'), 'ALL', owner, UPPER('&1')) 21 | ORDER BY 1, 2; 22 | 23 | SET VERIFY ON -------------------------------------------------------------------------------- /monitoring/redo_by_day.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/redo_by_day.sql 3 | -- Author : Tim Hall 4 | -- Description : Lists the volume of archived redo by day for the specified number of days. 5 | -- Call Syntax : @redo_by_day (days) 6 | -- Requirements : Access to the v$views. 7 | -- Last Modified: 11/10/2013 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET VERIFY OFF 11 | 12 | SELECT TRUNC(first_time) AS day, 13 | ROUND(SUM(blocks * block_size)/1024/1024/1024,2) size_gb 14 | FROM v$archived_log 15 | WHERE TRUNC(first_time) >= TRUNC(SYSDATE) - &1 16 | GROUP BY TRUNC(first_time) 17 | ORDER BY TRUNC(first_time); 18 | 19 | SET VERIFY ON -------------------------------------------------------------------------------- /monitoring/redo_by_hour.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/redo_by_hour.sql 3 | -- Author : Tim Hall 4 | -- Description : Lists the volume of archived redo by hour for the specified day. 5 | -- Call Syntax : @redo_by_hour (day 0=Today, 1=Yesterday etc.) 6 | -- Requirements : Access to the v$views. 7 | -- Last Modified: 11/10/2013 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET VERIFY OFF PAGESIZE 30 11 | 12 | WITH hours AS ( 13 | SELECT TRUNC(SYSDATE) - &1 + ((level-1)/24) AS hours 14 | FROM dual 15 | CONNECT BY level < = 24 16 | ) 17 | SELECT h.hours AS date_hour, 18 | ROUND(SUM(blocks * block_size)/1024/1024/1024,2) size_gb 19 | FROM hours h 20 | LEFT OUTER JOIN v$archived_log al ON h.hours = TRUNC(al.first_time, 'HH24') 21 | GROUP BY h.hours 22 | ORDER BY h.hours; 23 | 24 | SET VERIFY ON PAGESIZE 14 -------------------------------------------------------------------------------- /monitoring/redo_by_min.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/redo_by_min.sql 3 | -- Author : Tim Hall 4 | -- Description : Lists the volume of archived redo by min for the specified number of hours. 5 | -- Call Syntax : @redo_by_min (N number of minutes from now) 6 | -- Requirements : Access to the v$views. 7 | -- Last Modified: 11/10/2013 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET VERIFY OFF PAGESIZE 100 11 | 12 | WITH mins AS ( 13 | SELECT TRUNC(SYSDATE, 'MI') - (&1/(24*60)) + ((level-1)/(24*60)) AS mins 14 | FROM dual 15 | CONNECT BY level <= &1 16 | ) 17 | SELECT m.mins AS date_min, 18 | ROUND(SUM(blocks * block_size)/1024/1024,2) size_mb 19 | FROM mins m 20 | LEFT OUTER JOIN v$archived_log al ON m.mins = TRUNC(al.first_time, 'MI') 21 | GROUP BY m.mins 22 | ORDER BY m.mins; 23 | 24 | SET VERIFY ON PAGESIZE 14 -------------------------------------------------------------------------------- /monitoring/registry_history.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/registry_history.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays contents of the registry history 5 | -- Requirements : Access to the DBA role. 6 | -- Call Syntax : @registry_history 7 | -- Last Modified: 23/08/2008 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | 11 | COLUMN action_time FORMAT A20 12 | COLUMN action FORMAT A20 13 | COLUMN namespace FORMAT A20 14 | COLUMN version FORMAT A10 15 | COLUMN comments FORMAT A30 16 | COLUMN bundle_series FORMAT A10 17 | 18 | SELECT TO_CHAR(action_time, 'DD-MON-YYYY HH24:MI:SS') AS action_time, 19 | action, 20 | namespace, 21 | version, 22 | id, 23 | comments, 24 | bundle_series 25 | FROM sys.registry$history 26 | ORDER by action_time; -------------------------------------------------------------------------------- /monitoring/roles.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/roles.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays a list of all roles and privileges granted to the specified user. 5 | -- Requirements : Access to the USER views. 6 | -- Call Syntax : @roles 7 | -- Last Modified: 27/02/2018 8 | -- ----------------------------------------------------------------------------------- 9 | SET SERVEROUTPUT ON 10 | SET VERIFY OFF 11 | 12 | COLUMN role FORMAT A30 13 | 14 | SELECT a.role, 15 | a.password_required, 16 | a.authentication_type 17 | FROM dba_roles a 18 | ORDER BY a.role; 19 | 20 | SET VERIFY ON 21 | -------------------------------------------------------------------------------- /monitoring/search_source.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/search_source.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays a list of all code-objects that contain the specified word. 5 | -- Requirements : Access to the ALL views. 6 | -- Call Syntax : @search_source (text) (schema-name) 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | BREAK ON Name Skip 2 10 | SET PAGESIZE 0 11 | SET LINESIZE 500 12 | SET VERIFY OFF 13 | 14 | SPOOL Search_Source.txt 15 | 16 | SELECT a.name "Name", 17 | a.line "Line", 18 | Substr(a.text,1,200) "Text" 19 | FROM all_source a 20 | WHERE Instr(Upper(a.text),Upper('&&1')) != 0 21 | AND a.owner = Upper('&&2') 22 | ORDER BY 1,2; 23 | 24 | SPOOL OFF 25 | SET PAGESIZE 14 26 | SET VERIFY ON 27 | -------------------------------------------------------------------------------- /monitoring/segment_size.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/segment_size.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays size of specified segment. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @segment_size (owner) (segment_name) 7 | -- Last Modified: 15/07/2005 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 500 VERIFY OFF 10 | COLUMN segment_name FORMAT A30 11 | 12 | SELECT owner, 13 | segment_name, 14 | segment_type, 15 | tablespace_name, 16 | ROUND(bytes/1024/1024,2) size_mb 17 | FROM dba_segments 18 | WHERE owner = UPPER('&1') 19 | AND segment_name LIKE '%' || UPPER('&2') || '%' 20 | ORDER BY 1, 2; 21 | 22 | SET VERIFY ON -------------------------------------------------------------------------------- /monitoring/segment_stats.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : http://www.oracle-base.com/dba/monitoring/segment_stats.sql 3 | -- Author : DR Timothy S Hall 4 | -- Description : Displays statistics for segments in th specified schema. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @segment_stats 7 | -- Last Modified: 20/10/2006 8 | -- ----------------------------------------------------------------------------------- 9 | SELECT statistic#, 10 | name 11 | FROM v$segstat_name 12 | ORDER BY statistic#; 13 | 14 | ACCEPT l_schema char PROMPT 'Enter Schema: ' 15 | ACCEPT l_stat NUMBER PROMPT 'Enter Statistic#: ' 16 | SET VERIFY OFF 17 | 18 | SELECT object_name, 19 | object_type, 20 | value 21 | FROM v$segment_statistics 22 | WHERE owner = UPPER('&l_schema') 23 | AND statistic# = &l_stat 24 | ORDER BY value; 25 | -------------------------------------------------------------------------------- /monitoring/segments_in_ts.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/segments_in_ts.sql 3 | -- Author : Tim Hall 4 | -- Description : Lists the objects stored in a tablespace. 5 | -- Call Syntax : @objects_in_ts (tablespace-name) 6 | -- Last Modified: 15/06/2018 7 | -- ----------------------------------------------------------------------------------- 8 | 9 | SET PAGESIZE 20 10 | BREAK ON segment_type SKIP 1 11 | 12 | COLUMN segment_name FORMAT A30 13 | COLUMN partition_name FORMAT A30 14 | 15 | SELECT segment_type, 16 | segment_name, 17 | partition_name, 18 | ROUND(bytes/2014/1024,2) AS size_mb 19 | FROM dba_segments 20 | WHERE tablespace_name = UPPER('&1') 21 | ORDER BY 1, 2; 22 | 23 | CLEAR BREAKS 24 | -------------------------------------------------------------------------------- /monitoring/session_events.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/session_events.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information on all database session events. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @session_events 7 | -- Last Modified: 11/03/2005 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | SET PAGESIZE 1000 11 | SET VERIFY OFF 12 | 13 | COLUMN username FORMAT A20 14 | COLUMN event FORMAT A40 15 | 16 | SELECT NVL(s.username, '(oracle)') AS username, 17 | s.sid, 18 | s.serial#, 19 | se.event, 20 | se.total_waits, 21 | se.total_timeouts, 22 | se.time_waited, 23 | se.average_wait, 24 | se.max_wait, 25 | se.time_waited_micro 26 | FROM v$session_event se, 27 | v$session s 28 | WHERE s.sid = se.sid 29 | AND s.sid = &1 30 | ORDER BY se.time_waited DESC; 31 | -------------------------------------------------------------------------------- /monitoring/session_io.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/session_io.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays I/O information on all database sessions. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @session_io 7 | -- Last Modified: 21-FEB-2005 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 500 10 | SET PAGESIZE 1000 11 | 12 | COLUMN username FORMAT A15 13 | 14 | SELECT NVL(s.username, '(oracle)') AS username, 15 | s.osuser, 16 | s.sid, 17 | s.serial#, 18 | si.block_gets, 19 | si.consistent_gets, 20 | si.physical_reads, 21 | si.block_changes, 22 | si.consistent_changes 23 | FROM v$session s, 24 | v$sess_io si 25 | WHERE s.sid = si.sid 26 | ORDER BY s.username, s.osuser; 27 | 28 | SET PAGESIZE 14 29 | -------------------------------------------------------------------------------- /monitoring/session_rollback.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/session_rollback.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays rollback information on relevant database sessions. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @session_rollback 7 | -- Last Modified: 29/03/2005 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | 11 | COLUMN username FORMAT A15 12 | 13 | SELECT s.username, 14 | s.sid, 15 | s.serial#, 16 | t.used_ublk, 17 | t.used_urec, 18 | rs.segment_name, 19 | r.rssize, 20 | r.status 21 | FROM v$transaction t, 22 | v$session s, 23 | v$rollstat r, 24 | dba_rollback_segs rs 25 | WHERE s.saddr = t.ses_addr 26 | AND t.xidusn = r.usn 27 | AND rs.segment_id = t.xidusn 28 | ORDER BY t.used_ublk DESC; 29 | -------------------------------------------------------------------------------- /monitoring/session_stats.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/session_stats.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays session-specific statistics. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @session_stats (statistic-name or all) 7 | -- Last Modified: 03/11/2004 8 | -- ----------------------------------------------------------------------------------- 9 | SET VERIFY OFF 10 | 11 | SELECT sn.name, ss.value 12 | FROM v$sesstat ss, 13 | v$statname sn, 14 | v$session s 15 | WHERE ss.statistic# = sn.statistic# 16 | AND s.sid = ss.sid 17 | AND s.audsid = SYS_CONTEXT('USERENV','SESSIONID') 18 | AND sn.name LIKE '%' || DECODE(LOWER('&1'), 'all', '', LOWER('&1')) || '%'; 19 | 20 | -------------------------------------------------------------------------------- /monitoring/session_stats_by_sid.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : http://www.oracle-base.com/dba/monitoring/session_stats_by_sid.sql 3 | -- Author : DR Timothy S Hall 4 | -- Description : Displays session-specific statistics. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @session_stats_by_sid (sid) (statistic-name or all) 7 | -- Last Modified: 19/09/2006 8 | -- ----------------------------------------------------------------------------------- 9 | SET VERIFY OFF 10 | 11 | SELECT sn.name, ss.value 12 | FROM v$sesstat ss, 13 | v$statname sn 14 | WHERE ss.statistic# = sn.statistic# 15 | AND ss.sid = &1 16 | AND sn.name LIKE '%' || DECODE(LOWER('&2'), 'all', '', LOWER('&2')) || '%'; 17 | 18 | -------------------------------------------------------------------------------- /monitoring/session_undo.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/session_undo.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays undo information on relevant database sessions. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @session_undo 7 | -- Last Modified: 29/03/2005 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | 11 | COLUMN username FORMAT A15 12 | 13 | SELECT s.username, 14 | s.sid, 15 | s.serial#, 16 | t.used_ublk, 17 | t.used_urec, 18 | rs.segment_name, 19 | r.rssize, 20 | r.status 21 | FROM v$transaction t, 22 | v$session s, 23 | v$rollstat r, 24 | dba_rollback_segs rs 25 | WHERE s.saddr = t.ses_addr 26 | AND t.xidusn = r.usn 27 | AND rs.segment_id = t.xidusn 28 | ORDER BY t.used_ublk DESC; 29 | -------------------------------------------------------------------------------- /monitoring/session_waits.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/session_waits.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information on all database session waits. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @session_waits 7 | -- Last Modified: 11/03/2005 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | SET PAGESIZE 1000 11 | 12 | COLUMN username FORMAT A20 13 | COLUMN event FORMAT A30 14 | 15 | SELECT NVL(s.username, '(oracle)') AS username, 16 | s.sid, 17 | s.serial#, 18 | sw.event, 19 | sw.wait_time, 20 | sw.seconds_in_wait, 21 | sw.state 22 | FROM v$session_wait sw, 23 | v$session s 24 | WHERE s.sid = sw.sid 25 | ORDER BY sw.seconds_in_wait DESC; 26 | -------------------------------------------------------------------------------- /monitoring/sessions_by_machine.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/sessions_by_machine.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the number of sessions for each client machine. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @sessions_by_machine 7 | -- Last Modified: 20-JUL-2014 8 | -- ----------------------------------------------------------------------------------- 9 | SET PAGESIZE 1000 10 | 11 | SELECT machine, 12 | NVL(active_count, 0) AS active, 13 | NVL(inactive_count, 0) AS inactive, 14 | NVL(killed_count, 0) AS killed 15 | FROM (SELECT machine, status, count(*) AS quantity 16 | FROM v$session 17 | GROUP BY machine, status) 18 | PIVOT (SUM(quantity) AS count FOR (status) IN ('ACTIVE' AS active, 'INACTIVE' AS inactive, 'KILLED' AS killed)) 19 | ORDER BY machine; 20 | 21 | SET PAGESIZE 14 -------------------------------------------------------------------------------- /monitoring/show_tables.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/show_tables.sql 3 | -- Author : DR Timothy S Hall 4 | -- Description : Displays information about specified tables. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @show_tables (schema) 7 | -- Last Modified: 04/10/2006 8 | -- ----------------------------------------------------------------------------------- 9 | SET VERIFY OFF 10 | SET LINESIZE 200 11 | 12 | COLUMN owner FORMAT A20 13 | COLUMN table_name FORMAT A30 14 | 15 | SELECT t.table_name, 16 | t.tablespace_name, 17 | t.num_rows, 18 | t.avg_row_len, 19 | t.blocks, 20 | t.empty_blocks, 21 | ROUND(t.blocks * ts.block_size/1024/1024,2) AS size_mb 22 | FROM dba_tables t 23 | JOIN dba_tablespaces ts ON t.tablespace_name = ts.tablespace_name 24 | WHERE t.owner = UPPER('&1') 25 | ORDER BY t.table_name; 26 | -------------------------------------------------------------------------------- /monitoring/spfile_parameters.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/spfile_parameters.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays a list of all the spfile parameters. 5 | -- Requirements : Access to the v$ views. 6 | -- Call Syntax : @spfile_parameters 7 | -- Last Modified: 15-JUL-2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 500 10 | 11 | COLUMN name FORMAT A30 12 | COLUMN value FORMAT A60 13 | COLUMN displayvalue FORMAT A60 14 | 15 | SELECT sp.sid, 16 | sp.name, 17 | sp.value, 18 | sp.display_value 19 | FROM v$spparameter sp 20 | ORDER BY sp.name, sp.sid; 21 | -------------------------------------------------------------------------------- /monitoring/sql_area.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/sql_area.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the SQL statements for currently running processes. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @sql_area 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 500 10 | SET PAGESIZE 1000 11 | SET FEEDBACK OFF 12 | 13 | SELECT s.sid, 14 | s.status "Status", 15 | p.spid "Process", 16 | s.schemaname "Schema Name", 17 | s.osuser "OS User", 18 | Substr(a.sql_text,1,120) "SQL Text", 19 | s.program "Program" 20 | FROM v$session s, 21 | v$sqlarea a, 22 | v$process p 23 | WHERE s.sql_hash_value = a.hash_value (+) 24 | AND s.sql_address = a.address (+) 25 | AND s.paddr = p.addr; 26 | 27 | SET PAGESIZE 14 28 | SET FEEDBACK ON 29 | 30 | -------------------------------------------------------------------------------- /monitoring/sql_text.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/sql_text.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the SQL statement held at the specified address. 5 | -- Comments : The address can be found using v$session or Top_SQL.sql. 6 | -- Requirements : Access to the V$ views. 7 | -- Call Syntax : @sql_text (address) 8 | -- Last Modified: 15/07/2000 9 | -- ----------------------------------------------------------------------------------- 10 | SET LINESIZE 500 11 | SET PAGESIZE 1000 12 | SET FEEDBACK OFF 13 | SET VERIFY OFF 14 | 15 | SELECT a.sql_text 16 | FROM v$sqltext_with_newlines a 17 | WHERE a.address = UPPER('&&1') 18 | ORDER BY a.piece; 19 | 20 | PROMPT 21 | SET PAGESIZE 14 22 | SET FEEDBACK ON 23 | -------------------------------------------------------------------------------- /monitoring/sql_text_by_sid.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/sql_text_by_sid.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the SQL statement held for a specific SID. 5 | -- Comments : The SID can be found by running session.sql or top_session.sql. 6 | -- Requirements : Access to the V$ views. 7 | -- Call Syntax : @sql_text_by_sid (sid) 8 | -- Last Modified: 15/07/2000 9 | -- ----------------------------------------------------------------------------------- 10 | SET LINESIZE 500 11 | SET PAGESIZE 1000 12 | SET VERIFY OFF 13 | 14 | SELECT a.sql_text 15 | FROM v$sqltext a, 16 | v$session b 17 | WHERE a.address = b.sql_address 18 | AND a.hash_value = b.sql_hash_value 19 | AND b.sid = &1 20 | ORDER BY a.piece; 21 | 22 | PROMPT 23 | SET PAGESIZE 14 24 | -------------------------------------------------------------------------------- /monitoring/system_events.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/system_events.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information on all system events. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @system_events 7 | -- Last Modified: 21-FEB-2005 8 | -- ----------------------------------------------------------------------------------- 9 | SELECT event, 10 | total_waits, 11 | total_timeouts, 12 | time_waited, 13 | average_wait, 14 | time_waited_micro 15 | FROM v$system_event 16 | ORDER BY event; 17 | -------------------------------------------------------------------------------- /monitoring/system_parameters.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/system_parameters.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays a list of all the system parameters. 5 | -- Comment out isinstance_modifiable for use prior to 10g. 6 | -- Requirements : Access to the v$ views. 7 | -- Call Syntax : @system_parameters 8 | -- Last Modified: 15-JUL-2000 9 | -- ----------------------------------------------------------------------------------- 10 | SET LINESIZE 500 11 | 12 | COLUMN name FORMAT A30 13 | COLUMN value FORMAT A60 14 | 15 | SELECT sp.name, 16 | sp.type, 17 | sp.value, 18 | sp.isses_modifiable, 19 | sp.issys_modifiable, 20 | sp.isinstance_modifiable 21 | FROM v$system_parameter sp 22 | ORDER BY sp.name; 23 | 24 | -------------------------------------------------------------------------------- /monitoring/system_privs.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/system_privs.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays users granted the specified system privilege. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @system_privs ("sys-priv") 7 | -- Last Modified: 27/07/2005 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 VERIFY OFF 10 | 11 | SELECT privilege, 12 | grantee, 13 | admin_option 14 | FROM dba_sys_privs 15 | WHERE privilege LIKE UPPER('%&1%') 16 | ORDER BY privilege, grantee; 17 | 18 | SET VERIFY ON -------------------------------------------------------------------------------- /monitoring/system_stats.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/system_stats.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays system statistics. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @system_stats (statistic-name or all) 7 | -- Last Modified: 03-NOV-2004 8 | -- ----------------------------------------------------------------------------------- 9 | SET VERIFY OFF 10 | 11 | COLUMN name FORMAT A50 12 | COLUMN value FORMAT 99999999999999999999 13 | 14 | SELECT sn.name, ss.value 15 | FROM v$sysstat ss, 16 | v$statname sn 17 | WHERE ss.statistic# = sn.statistic# 18 | AND sn.name LIKE '%' || DECODE(LOWER('&1'), 'all', '', LOWER('&1')) || '%'; 19 | -------------------------------------------------------------------------------- /monitoring/table_dep.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/table_dep.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays a list dependencies for the specified table. 5 | -- Requirements : Access to the ALL views. 6 | -- Call Syntax : @table_dep (table-name) (schema-name) 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | PROMPT 10 | SET VERIFY OFF 11 | SET FEEDBACK OFF 12 | SET LINESIZE 255 13 | SET PAGESIZE 1000 14 | 15 | 16 | SELECT ad.referenced_name "Object", 17 | ad.name "Ref Object", 18 | ad.type "Type", 19 | Substr(ad.referenced_owner,1,10) "Ref Owner", 20 | Substr(ad.referenced_link_name,1,20) "Ref Link Name" 21 | FROM all_dependencies ad 22 | WHERE ad.referenced_name = Upper('&&1') 23 | AND ad.owner = Upper('&&2') 24 | ORDER BY 1,2,3; 25 | 26 | SET VERIFY ON 27 | SET FEEDBACK ON 28 | SET PAGESIZE 14 29 | PROMPT 30 | -------------------------------------------------------------------------------- /monitoring/table_growth.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/table_growth.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information on all active database sessions. 5 | -- Requirements : Access to the DBA_HIST views. Diagnostics and Tuning license. 6 | -- Call Syntax : @table_growth (schema-name) (table_name) 7 | -- Last Modified: 03-DEC-2019 8 | -- ----------------------------------------------------------------------------------- 9 | COLUMN object_name FORMAT A30 10 | 11 | SELECT TO_CHAR(sn.begin_interval_time,'DD-MON-YYYY HH24:MM') AS begin_interval_time, 12 | sso.object_name, 13 | ss.space_used_total 14 | FROM dba_hist_seg_stat ss, 15 | dba_hist_seg_stat_obj sso, 16 | dba_hist_snapshot sn 17 | WHERE sso.owner = UPPER('&1') 18 | AND sso.obj# = ss.obj# 19 | AND sn.snap_id = ss.snap_id 20 | AND sso.object_name LIKE UPPER('&2') || '%' 21 | ORDER BY sn.begin_interval_time; 22 | -------------------------------------------------------------------------------- /monitoring/table_indexes.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/table_indexes.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays index-column information for the specified table. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @table_indexes (schema-name) (table-name) 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 500 PAGESIZE 1000 VERIFY OFF 10 | 11 | COLUMN index_name FORMAT A30 12 | COLUMN column_name FORMAT A30 13 | COLUMN column_position FORMAT 99999 14 | 15 | SELECT a.index_name, 16 | a.column_name, 17 | a.column_position 18 | FROM all_ind_columns a, 19 | all_indexes b 20 | WHERE b.owner = UPPER('&1') 21 | AND b.table_name = UPPER('&2') 22 | AND b.index_name = a.index_name 23 | AND b.owner = a.index_owner 24 | ORDER BY 1,3; 25 | 26 | SET PAGESIZE 18 VERIFY ON -------------------------------------------------------------------------------- /monitoring/table_triggers.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/table_triggers.sql 3 | -- Author : Tim Hall 4 | -- Description : Lists the triggers for the specified table. 5 | -- Call Syntax : @table_triggers (schema) (table_name) 6 | -- Last Modified: 07/11/2016 7 | -- ----------------------------------------------------------------------------------- 8 | SELECT owner, 9 | trigger_name, 10 | status 11 | FROM dba_triggers 12 | WHERE table_owner = UPPER('&1') 13 | AND table_name = UPPER('&2'); -------------------------------------------------------------------------------- /monitoring/tables_with_locked_stats.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/tables_with_locked_stats.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays tables with locked stats. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @tables_with_locked_stats.sql 7 | -- Last Modified: 06-DEC-2013 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SELECT owner, 11 | table_name, 12 | stattype_locked 13 | FROM dba_tab_statistics 14 | WHERE stattype_locked IS NOT NULL 15 | ORDER BY owner, table_name; 16 | -------------------------------------------------------------------------------- /monitoring/tablespaces.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/tablespaces.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about tablespaces. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @tablespaces 7 | -- Last Modified: 17-AUG-2005 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET LINESIZE 200 11 | 12 | SELECT tablespace_name, 13 | block_size, 14 | extent_management, 15 | allocation_type, 16 | segment_space_management, 17 | status 18 | FROM dba_tablespaces 19 | ORDER BY tablespace_name; 20 | -------------------------------------------------------------------------------- /monitoring/temp_io.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/temp_io.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the amount of IO for each tempfile. 5 | -- Requirements : Access to the v$ views. 6 | -- Call Syntax : @temp_io 7 | -- Last Modified: 15-JUL-2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET PAGESIZE 1000 10 | 11 | SELECT SUBSTR(t.name,1,50) AS file_name, 12 | f.phyblkrd AS blocks_read, 13 | f.phyblkwrt AS blocks_written, 14 | f.phyblkrd + f.phyblkwrt AS total_io 15 | FROM v$tempstat f, 16 | v$tempfile t 17 | WHERE t.file# = f.file# 18 | ORDER BY f.phyblkrd + f.phyblkwrt DESC; 19 | 20 | SET PAGESIZE 18 -------------------------------------------------------------------------------- /monitoring/temp_segments.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/temp_segments.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays a list of all temporary segments. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @temp_segments 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 500 10 | 11 | SELECT owner, 12 | Trunc(Sum(bytes)/1024) Kb 13 | FROM dba_segments 14 | WHERE segment_type = 'TEMPORARY' 15 | GROUP BY owner; 16 | -------------------------------------------------------------------------------- /monitoring/temp_usage.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/temp_usage.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays temp usage for all session currently using temp space. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @temp_usage 7 | -- Last Modified: 12/02/2004 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | 11 | COLUMN temp_used FORMAT 9999999999 12 | 13 | SELECT NVL(s.username, '(background)') AS username, 14 | s.sid, 15 | s.serial#, 16 | ROUND(ss.value/1024/1024, 2) AS temp_used_mb 17 | FROM v$session s 18 | JOIN v$sesstat ss ON s.sid = ss.sid 19 | JOIN v$statname sn ON ss.statistic# = sn.statistic# 20 | WHERE sn.name = 'temp space allocated (bytes)' 21 | AND ss.value > 0 22 | ORDER BY 1; 23 | -------------------------------------------------------------------------------- /monitoring/tempfiles.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/tempfiles.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about tempfiles. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @tempfiles 7 | -- Last Modified: 17-AUG-2005 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET LINESIZE 200 11 | COLUMN file_name FORMAT A70 12 | 13 | SELECT file_id, 14 | file_name, 15 | ROUND(bytes/1024/1024/1024) AS size_gb, 16 | ROUND(maxbytes/1024/1024/1024) AS max_size_gb, 17 | autoextensible, 18 | increment_by, 19 | status 20 | FROM dba_temp_files 21 | ORDER BY file_name; 22 | -------------------------------------------------------------------------------- /monitoring/tempseg_usage.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/tempseg_usage.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays temp segment usage for all session currently using temp space. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @tempseg_usage 7 | -- Last Modified: 01/04/2006 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET LINESIZE 200 11 | COLUMN username FORMAT A20 12 | 13 | SELECT username, 14 | session_addr, 15 | session_num, 16 | sqladdr, 17 | sqlhash, 18 | sql_id, 19 | contents, 20 | segtype, 21 | extents, 22 | blocks 23 | FROM v$tempseg_usage 24 | ORDER BY username; -------------------------------------------------------------------------------- /monitoring/top_latches.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/top_latches.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about the top latches. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @top_latches 7 | -- Last Modified: 15-JUL-2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | 11 | SELECT l.latch#, 12 | l.name, 13 | l.gets, 14 | l.misses, 15 | l.sleeps, 16 | l.immediate_gets, 17 | l.immediate_misses, 18 | l.spin_gets 19 | FROM v$latch l 20 | WHERE l.misses > 0 21 | ORDER BY l.misses DESC; 22 | -------------------------------------------------------------------------------- /monitoring/trace_runs.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/trace_runs.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information on all trace runs. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @trace_runs.sql 7 | -- Last Modified: 06/05/2005 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | SET TRIMOUT ON 11 | 12 | COLUMN runid FORMAT 99999 13 | 14 | SELECT runid, 15 | run_date, 16 | run_owner 17 | FROM plsql_trace_runs 18 | ORDER BY runid; -------------------------------------------------------------------------------- /monitoring/ts_datafiles.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/ts_datafiles.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about datafiles for the specified tablespace. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @ts_datafiles (tablespace-name) 7 | -- Last Modified: 17-AUG-2005 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET LINESIZE 200 11 | COLUMN file_name FORMAT A70 12 | 13 | SELECT file_id, 14 | file_name, 15 | ROUND(bytes/1024/1024/1024) AS size_gb, 16 | ROUND(maxbytes/1024/1024/1024) AS max_size_gb, 17 | autoextensible, 18 | increment_by, 19 | status 20 | FROM dba_data_files 21 | WHERE tablespace_name = UPPER('&1') 22 | ORDER BY file_id; 23 | -------------------------------------------------------------------------------- /monitoring/ts_thresholds.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/ts_thresholds.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays threshold information for tablespaces. 5 | -- Call Syntax : @ts_thresholds 6 | -- Last Modified: 13/02/2014 - Created 7 | -- ----------------------------------------------------------------------------------- 8 | SET LINESIZE 200 9 | 10 | COLUMN metrics_name FORMAT A30 11 | COLUMN warning_value FORMAT A30 12 | COLUMN critical_value FORMAT A15 13 | 14 | SELECT tablespace_name, 15 | contents, 16 | extent_management, 17 | threshold_type, 18 | metrics_name, 19 | warning_operator, 20 | warning_value, 21 | critical_operator, 22 | critical_value 23 | FROM dba_tablespace_thresholds 24 | ORDER BY tablespace_name, metrics_name; 25 | 26 | SET LINESIZE 80 27 | -------------------------------------------------------------------------------- /monitoring/undo_segments.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/undo_segments.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information about undo segments. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @undo_segments {name | all} 7 | -- Last Modified: 20-APR-2021 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | set verify off linesize 100 11 | column owner format a30 12 | column segment_name format a30 13 | column segment_type format a20 14 | 15 | select owner, 16 | segment_name, 17 | segment_type 18 | from dba_segments 19 | where segment_type in ('TYPE2 UNDO','ROLLBACK') 20 | and lower(segment_name) like '%' || decode(lower('&1'), 'all', '', lower('&1')) || '%' 21 | order by 1, 2; -------------------------------------------------------------------------------- /monitoring/unusable_indexes.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/unusable_indexes.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays unusable indexes for the specified schema or all schemas. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @unusable_indexes (schema-name or all) 7 | -- Last Modified: 28/01/2018 8 | -- ----------------------------------------------------------------------------------- 9 | SET VERIFY OFF LINESIZE 200 10 | 11 | COLUMN owner FORMAT A30 12 | COLUMN index_name FORMAT A30 13 | COLUMN table_owner FORMAT A30 14 | COLUMN table_name FORMAT A30 15 | 16 | SELECT owner, 17 | index_name, 18 | index_type, 19 | table_owner, 20 | table_name 21 | table_type 22 | FROM dba_indexes 23 | WHERE owner = DECODE(UPPER('&1'), 'ALL', owner, UPPER('&1')) 24 | AND status NOT IN ('VALID', 'N/A') 25 | ORDER BY owner, index_name; 26 | 27 | -------------------------------------------------------------------------------- /monitoring/user_hit_ratio.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/user_hit_ratio.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the Cache Hit Ratio per user. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @user_hit_ratio 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 500 10 | COLUMN "Hit Ratio %" FORMAT 999.99 11 | 12 | SELECT a.username "Username", 13 | b.consistent_gets "Consistent Gets", 14 | b.block_gets "DB Block Gets", 15 | b.physical_reads "Physical Reads", 16 | Round(100* (b.consistent_gets + b.block_gets - b.physical_reads) / 17 | (b.consistent_gets + b.block_gets),2) "Hit Ratio %" 18 | FROM v$session a, 19 | v$sess_io b 20 | WHERE a.sid = b.sid 21 | AND (b.consistent_gets + b.block_gets) > 0 22 | AND a.username IS NOT NULL; 23 | -------------------------------------------------------------------------------- /monitoring/user_objects.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/monitoring/user_objects.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the objects owned by the current user. 5 | -- Requirements : 6 | -- Call Syntax : @user_objects 7 | -- Last Modified: 23-OCT-2019 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | COLUMN object_name FORMAT A30 11 | 12 | SELECT object_name, object_type 13 | FROM user_objects 14 | ORDER BY 1, 2; 15 | -------------------------------------------------------------------------------- /monitoring/user_roles.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/user_roles.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays a list of all roles and privileges granted to the specified user. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @user_roles (username) 7 | -- Last Modified: 26/06/2023 8 | -- ----------------------------------------------------------------------------------- 9 | set serveroutput on 10 | set verify off 11 | 12 | select a.granted_role, 13 | a.admin_option 14 | from dba_role_privs a 15 | where a.grantee = upper('&1') 16 | order by a.granted_role; 17 | 18 | select a.privilege, 19 | a.admin_option 20 | from dba_sys_privs a 21 | where a.grantee = upper('&1') 22 | order by a.privilege; 23 | 24 | set verify on 25 | -------------------------------------------------------------------------------- /monitoring/user_system_privs.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/user_system_privs.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays system privileges granted to a specified user. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @user_system_privs (user-name) 7 | -- Last Modified: 27/07/2005 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 VERIFY OFF 10 | 11 | SELECT grantee, 12 | privilege, 13 | admin_option 14 | FROM dba_sys_privs 15 | WHERE grantee = UPPER('&1') 16 | ORDER BY grantee, privilege; 17 | 18 | SET VERIFY ON -------------------------------------------------------------------------------- /monitoring/user_ts_quotas.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/user_ts_quotas.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays tablespaces the user has quotas on. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @user_ts_quotas {username} 7 | -- Last Modified: 16-JAN-2024 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | set verify off 11 | column tablespace_name format a30 12 | 13 | select tablespace_name, blocks, max_blocks 14 | from dba_ts_quotas 15 | where username = decode(upper('&1'), 'all', username, upper('&1')) 16 | order by 1; 17 | -------------------------------------------------------------------------------- /monitoring/users_with_role.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/users_with_role.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays a list of users granted the specified role. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @user_with_role DBA 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET VERIFY OFF 11 | COLUMN username FORMAT A30 12 | 13 | SELECT username, 14 | lock_date, 15 | expiry_date 16 | FROM dba_users 17 | WHERE username IN (SELECT grantee 18 | FROM dba_role_privs 19 | WHERE granted_role = UPPER('&1')) 20 | ORDER BY username; 21 | 22 | SET VERIFY ON -------------------------------------------------------------------------------- /monitoring/users_with_sys_priv.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/users_with_sys_priv.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays a list of users granted the specified role. 5 | -- Requirements : Access to the DBA views. 6 | -- Call Syntax : @users_with_sys_priv "UNLIMITED TABLESPACE" 7 | -- Last Modified: 15/07/2000 8 | -- ----------------------------------------------------------------------------------- 9 | 10 | SET VERIFY OFF 11 | COLUMN username FORMAT A30 12 | 13 | SELECT username, 14 | lock_date, 15 | expiry_date 16 | FROM dba_users 17 | WHERE username IN (SELECT grantee 18 | FROM dba_sys_privs 19 | WHERE privilege = UPPER('&1')) 20 | ORDER BY username; 21 | -------------------------------------------------------------------------------- /rac/monitor_memory_rac.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/monitor_memory_rac.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays memory allocations for the current database sessions for the whole RAC. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @monitor_memory_rac 7 | -- Last Modified: 15-JUL-2000 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | 11 | COLUMN username FORMAT A20 12 | COLUMN module FORMAT A20 13 | 14 | SELECT a.inst_id, 15 | NVL(a.username,'(oracle)') AS username, 16 | a.module, 17 | a.program, 18 | Trunc(b.value/1024) AS memory_kb 19 | FROM gv$session a, 20 | gv$sesstat b, 21 | gv$statname c 22 | WHERE a.sid = b.sid 23 | AND a.inst_id = b.inst_id 24 | AND b.statistic# = c.statistic# 25 | AND b.inst_id = c.inst_id 26 | AND c.name = 'session pga memory' 27 | AND a.program IS NOT NULL 28 | ORDER BY b.value DESC; -------------------------------------------------------------------------------- /rac/session_undo_rac.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/monitoring/session_undo_rac.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays undo information on relevant database sessions. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @session_undo_rac 7 | -- Last Modified: 20/12/2005 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | 11 | COLUMN username FORMAT A15 12 | 13 | SELECT s.inst_id, 14 | s.username, 15 | s.sid, 16 | s.serial#, 17 | t.used_ublk, 18 | t.used_urec, 19 | rs.segment_name, 20 | r.rssize, 21 | r.status 22 | FROM gv$transaction t, 23 | gv$session s, 24 | gv$rollstat r, 25 | dba_rollback_segs rs 26 | WHERE s.saddr = t.ses_addr 27 | AND s.inst_id = t.inst_id 28 | AND t.xidusn = r.usn 29 | AND t.inst_id = r.inst_id 30 | AND rs.segment_id = t.xidusn 31 | ORDER BY t.used_ublk DESC; 32 | -------------------------------------------------------------------------------- /rac/session_waits_rac.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/10g/session_waits_rac.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays information on all database session waits for the whole RAC. 5 | -- Requirements : Access to the V$ views. 6 | -- Call Syntax : @session_waits_rac 7 | -- Last Modified: 02/07/2005 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | SET PAGESIZE 1000 11 | 12 | COLUMN username FORMAT A20 13 | COLUMN event FORMAT A30 14 | COLUMN wait_class FORMAT A15 15 | 16 | SELECT s.inst_id, 17 | NVL(s.username, '(oracle)') AS username, 18 | s.sid, 19 | s.serial#, 20 | sw.event, 21 | sw.wait_class, 22 | sw.wait_time, 23 | sw.seconds_in_wait, 24 | sw.state 25 | FROM gv$session_wait sw, 26 | gv$session s 27 | WHERE s.sid = sw.sid 28 | AND s.inst_id = sw.inst_id 29 | ORDER BY sw.seconds_in_wait DESC; 30 | -------------------------------------------------------------------------------- /resource_manager/active_plan.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/resource_manager/active_plan.sql 3 | -- Author : Tim Hall 4 | -- Description : Lists the currently active resource plan if one is set. 5 | -- Call Syntax : @active_plan 6 | -- Requirements : Access to the v$ views. 7 | -- Last Modified: 12/11/2004 8 | -- ----------------------------------------------------------------------------------- 9 | SELECT name, 10 | is_top_plan 11 | FROM v$rsrc_plan 12 | ORDER BY name; 13 | -------------------------------------------------------------------------------- /resource_manager/consumer_group_usage.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/resource_manager/consumer_group_usage.sql 3 | -- Author : Tim Hall 4 | -- Description : Lists usage information of consumer groups. 5 | -- Call Syntax : @consumer_group_usage 6 | -- Requirements : Access to the v$ views. 7 | -- Last Modified: 12/11/2004 8 | -- ----------------------------------------------------------------------------------- 9 | SELECT name, 10 | consumed_cpu_time 11 | FROM v$rsrc_consumer_group 12 | ORDER BY name; 13 | -------------------------------------------------------------------------------- /resource_manager/consumer_groups.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/resource_manager/consumer_groups.sql 3 | -- Author : Tim Hall 4 | -- Description : Lists all consumer groups. 5 | -- Call Syntax : @consumer_groups 6 | -- Requirements : Access to the DBA views. 7 | -- Last Modified: 12/11/2004 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | SET VERIFY OFF 11 | 12 | COLUMN status FORMAT A10 13 | COLUMN comments FORMAT A50 14 | 15 | SELECT consumer_group, 16 | status, 17 | comments 18 | FROM dba_rsrc_consumer_groups 19 | ORDER BY consumer_group; -------------------------------------------------------------------------------- /resource_manager/plan_directives.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/resource_manager/plan_directives.sql 3 | -- Author : Tim Hall 4 | -- Description : Lists all plan directives. 5 | -- Call Syntax : @plan_directives (plan-name or all) 6 | -- Requirements : Access to the DBA views. 7 | -- Last Modified: 12/11/2004 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | SET VERIFY OFF 11 | 12 | SELECT plan, 13 | group_or_subplan, 14 | cpu_p1, 15 | cpu_p2, 16 | cpu_p3, 17 | cpu_p4 18 | FROM dba_rsrc_plan_directives 19 | WHERE plan = DECODE(UPPER('&1'), 'ALL', plan, UPPER('&1')) 20 | ORDER BY plan, cpu_p1 DESC, cpu_p2 DESC, cpu_p3 DESC; 21 | -------------------------------------------------------------------------------- /resource_manager/resource_plans.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/resource_manager/resource_plans.sql 3 | -- Author : Tim Hall 4 | -- Description : Lists all resource plans. 5 | -- Call Syntax : @resource_plans 6 | -- Requirements : Access to the DBA views. 7 | -- Last Modified: 12/11/2004 8 | -- ----------------------------------------------------------------------------------- 9 | SET LINESIZE 200 10 | SET VERIFY OFF 11 | 12 | COLUMN status FORMAT A10 13 | COLUMN comments FORMAT A50 14 | 15 | SELECT plan, 16 | status, 17 | comments 18 | FROM dba_rsrc_plans 19 | ORDER BY plan; -------------------------------------------------------------------------------- /script_creation/db_link_ddl.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/script_creation/db_link_ddl.sql 3 | -- Author : Tim Hall 4 | -- Description : Creates the DDL for DB links for the specific schema, or all schemas. 5 | -- Call Syntax : @db_link_ddl (schema or all) 6 | -- Last Modified: 16/03/2013 7 | -- ----------------------------------------------------------------------------------- 8 | SET LONG 20000 LONGCHUNKSIZE 20000 PAGESIZE 0 LINESIZE 1000 FEEDBACK OFF VERIFY OFF TRIMSPOOL ON 9 | 10 | BEGIN 11 | DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'SQLTERMINATOR', true); 12 | DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'PRETTY', true); 13 | END; 14 | / 15 | 16 | SELECT DBMS_METADATA.get_ddl ('DB_LINK', db_link, owner) 17 | FROM dba_db_links 18 | WHERE owner = DECODE(UPPER('&1'), 'ALL', owner, UPPER('&1')); 19 | 20 | SET PAGESIZE 14 LINESIZE 1000 FEEDBACK ON VERIFY ON -------------------------------------------------------------------------------- /script_creation/directory_ddl.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/script_creation/directory_ddl.sql 3 | -- Author : Tim Hall 4 | -- Description : Creates the DDL for specified directory, or all directories. 5 | -- Call Syntax : @directory_ddl (directory or all) 6 | -- Last Modified: 16/03/2013 7 | -- ----------------------------------------------------------------------------------- 8 | SET LONG 20000 LONGCHUNKSIZE 20000 PAGESIZE 0 LINESIZE 1000 FEEDBACK OFF VERIFY OFF TRIMSPOOL ON 9 | 10 | BEGIN 11 | DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'SQLTERMINATOR', true); 12 | DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'PRETTY', true); 13 | END; 14 | / 15 | 16 | SELECT DBMS_METADATA.get_ddl ('DIRECTORY', directory_name) 17 | FROM dba_directories 18 | WHERE directory_name = DECODE(UPPER('&1'), 'ALL', directory_name, UPPER('&1')); 19 | 20 | SET PAGESIZE 14 LINESIZE 1000 FEEDBACK ON VERIFY ON -------------------------------------------------------------------------------- /script_creation/index_monitoring_off.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/script_creation/index_monitoring_on.sql 3 | -- Author : Tim Hall 4 | -- Description : Sets monitoring off for the specified table indexes. 5 | -- Call Syntax : @index_monitoring_on (schema) (table-name or all) 6 | -- Last Modified: 04/02/2005 7 | -- ----------------------------------------------------------------------------------- 8 | SET PAGESIZE 0 9 | SET FEEDBACK OFF 10 | SET VERIFY OFF 11 | SPOOL temp.sql 12 | 13 | SELECT 'ALTER INDEX "' || i.owner || '"."' || i.index_name || '" NOMONITORING USAGE;' 14 | FROM dba_indexes i 15 | WHERE owner = UPPER('&1') 16 | AND table_name = DECODE(UPPER('&2'), 'ALL', table_name, UPPER('&2')); 17 | 18 | SPOOL OFF 19 | 20 | SET PAGESIZE 18 21 | SET FEEDBACK ON 22 | 23 | @temp.sql 24 | 25 | -------------------------------------------------------------------------------- /script_creation/index_monitoring_on.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/script_creation/index_monitoring_on.sql 3 | -- Author : Tim Hall 4 | -- Description : Sets monitoring on for the specified table indexes. 5 | -- Call Syntax : @index_monitoring_on (schema) (table-name or all) 6 | -- Last Modified: 04/02/2005 7 | -- ----------------------------------------------------------------------------------- 8 | SET PAGESIZE 0 9 | SET FEEDBACK OFF 10 | SET VERIFY OFF 11 | SPOOL temp.sql 12 | 13 | SELECT 'ALTER INDEX "' || i.owner || '"."' || i.index_name || '" MONITORING USAGE;' 14 | FROM dba_indexes i 15 | WHERE owner = UPPER('&1') 16 | AND table_name = DECODE(UPPER('&2'), 'ALL', table_name, UPPER('&2')); 17 | 18 | SPOOL OFF 19 | 20 | SET PAGESIZE 18 21 | SET FEEDBACK ON 22 | 23 | @temp.sql 24 | 25 | -------------------------------------------------------------------------------- /script_creation/job_ddl.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/script_creation/job_ddl.sql 3 | -- Author : Tim Hall 4 | -- Description : Creates the DDL for the specified job. 5 | -- Call Syntax : @job_ddl (schema-name) (job-name) 6 | -- Last Modified: 31/12/2018 7 | -- ----------------------------------------------------------------------------------- 8 | SET LONG 20000 LONGCHUNKSIZE 20000 PAGESIZE 0 LINESIZE 1000 FEEDBACK OFF VERIFY OFF TRIMSPOOL ON 9 | 10 | BEGIN 11 | DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'SQLTERMINATOR', true); 12 | DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'PRETTY', true); 13 | END; 14 | / 15 | 16 | SELECT DBMS_METADATA.get_ddl ('PROCOBJ', job_name, owner) 17 | FROM all_scheduler_jobs 18 | WHERE owner = UPPER('&1') 19 | AND job_name = DECODE(UPPER('&2'), 'ALL', job_name, UPPER('&2')); 20 | 21 | SET PAGESIZE 14 LINESIZE 100 FEEDBACK ON VERIFY ON -------------------------------------------------------------------------------- /script_creation/monitoring_off.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/script_creation/monitoring_on.sql 3 | -- Author : Tim Hall 4 | -- Description : Sets monitoring off for the specified tables. 5 | -- Call Syntax : @monitoring_on (schema) (table-name or all) 6 | -- Last Modified: 21/03/2003 7 | -- ----------------------------------------------------------------------------------- 8 | SET PAGESIZE 0 9 | SET FEEDBACK OFF 10 | SET VERIFY OFF 11 | SPOOL temp.sql 12 | 13 | SELECT 'ALTER TABLE "' || owner || '"."' || table_name || '" NOMONITORING;' 14 | FROM dba_tables 15 | WHERE owner = UPPER('&1') 16 | AND table_name = DECODE(UPPER('&2'), 'ALL', table_name, UPPER('&2')) 17 | AND monitoring = 'YES'; 18 | 19 | SPOOL OFF 20 | 21 | SET PAGESIZE 18 22 | SET FEEDBACK ON 23 | 24 | @temp.sql 25 | 26 | -------------------------------------------------------------------------------- /script_creation/monitoring_on.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/script_creation/monitoring_on.sql 3 | -- Author : Tim Hall 4 | -- Description : Sets monitoring on for the specified tables. 5 | -- Call Syntax : @monitoring_on (schema) (table-name or all) 6 | -- Last Modified: 21/03/2003 7 | -- ----------------------------------------------------------------------------------- 8 | SET PAGESIZE 0 9 | SET FEEDBACK OFF 10 | SET VERIFY OFF 11 | SPOOL temp.sql 12 | 13 | SELECT 'ALTER TABLE "' || owner || '"."' || table_name || '" MONITORING;' 14 | FROM dba_tables 15 | WHERE owner = UPPER('&1') 16 | AND table_name = DECODE(UPPER('&2'), 'ALL', table_name, UPPER('&2')) 17 | AND monitoring != 'YES'; 18 | 19 | SPOOL OFF 20 | 21 | SET PAGESIZE 18 22 | SET FEEDBACK ON 23 | 24 | @temp.sql 25 | 26 | -------------------------------------------------------------------------------- /script_creation/object_grants.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/script_creation/object_grants.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the DDL for all grants on a specific object. 5 | -- Call Syntax : @object_grants (owner) (object_name) 6 | -- Last Modified: 28/01/2006 7 | -- ----------------------------------------------------------------------------------- 8 | 9 | set long 1000000 linesize 1000 pagesize 0 feedback off trimspool on verify off 10 | column ddl format a1000 11 | 12 | begin 13 | dbms_metadata.set_transform_param (dbms_metadata.session_transform, 'SQLTERMINATOR', true); 14 | dbms_metadata.set_transform_param (dbms_metadata.session_transform, 'PRETTY', true); 15 | end; 16 | / 17 | 18 | select dbms_metadata.get_dependent_ddl('OBJECT_GRANT', UPPER('&2'), UPPER('&1')) AS ddl 19 | from dual; 20 | 21 | set linesize 80 pagesize 14 feedback on trimspool on verify on 22 | -------------------------------------------------------------------------------- /script_creation/profile_ddl.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/script_creation/profile_ddl.sql 3 | -- Author : Tim Hall 4 | -- Description : Displays the DDL for the specified profile(s). 5 | -- Call Syntax : @profile_ddl (profile | part of profile) 6 | -- Last Modified: 28/01/2006 7 | -- ----------------------------------------------------------------------------------- 8 | 9 | set long 20000 longchunksize 20000 pagesize 0 linesize 1000 feedback off verify off trimspool on 10 | column ddl format a1000 11 | 12 | begin 13 | dbms_metadata.set_transform_param (dbms_metadata.session_transform, 'SQLTERMINATOR', true); 14 | dbms_metadata.set_transform_param (dbms_metadata.session_transform, 'PRETTY', true); 15 | end; 16 | / 17 | 18 | select dbms_metadata.get_ddl('PROFILE', profile) as profile_ddl 19 | from (select distinct profile 20 | from dba_profiles) 21 | where profile like upper('%&1%'); 22 | 23 | set linesize 80 pagesize 14 feedback on verify on 24 | -------------------------------------------------------------------------------- /script_creation/synonym_public_remote_ddl.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/script_creation/synonym_public_remote_ddl.sql 3 | -- Author : Tim Hall 4 | -- Description : Creates the DDL for public synonyms to remote objects. 5 | -- Call Syntax : @synonym_remote_ddl 6 | -- Last Modified: 08/07/2013 - Rewritten to use DBMS_METADATA 7 | -- ----------------------------------------------------------------------------------- 8 | SET LONG 20000 LONGCHUNKSIZE 20000 PAGESIZE 0 LINESIZE 1000 FEEDBACK OFF VERIFY OFF TRIMSPOOL ON 9 | 10 | BEGIN 11 | DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'SQLTERMINATOR', true); 12 | DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'PRETTY', true); 13 | END; 14 | / 15 | 16 | SELECT DBMS_METADATA.get_ddl ('SYNONYM', synonym_name, owner) 17 | FROM dba_synonyms 18 | WHERE owner = 'PUBLIC' 19 | AND db_link IS NOT NULL; 20 | 21 | SET PAGESIZE 14 FEEDBACK ON VERIFY ON -------------------------------------------------------------------------------- /script_creation/table_grants_ddl.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/script_creation/table_grants_ddl.sql 3 | -- Author : Tim Hall 4 | -- Description : Creates the DDL for all grants on the specified table. 5 | -- Call Syntax : @table_grants_ddl (schema) (table_name) 6 | -- Last Modified: 16/03/2013 - Rewritten to use DBMS_METADATA 7 | -- ----------------------------------------------------------------------------------- 8 | SET LONG 20000 LONGCHUNKSIZE 20000 PAGESIZE 0 LINESIZE 1000 FEEDBACK OFF VERIFY OFF TRIMSPOOL ON 9 | 10 | BEGIN 11 | DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'SQLTERMINATOR', true); 12 | DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'PRETTY', true); 13 | END; 14 | / 15 | 16 | SELECT dbms_metadata.get_dependent_ddl('OBJECT_GRANT', UPPER('&2'), UPPER('&1')) from dual; 17 | 18 | SET PAGESIZE 14 LINESIZE 100 FEEDBACK ON VERIFY ON -------------------------------------------------------------------------------- /script_creation/tablespace_structure.sql: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /script_creation/view_ddl.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/script_creation/view_ddl.sql 3 | -- Author : Tim Hall 4 | -- Description : Creates the DDL for the specified view. 5 | -- Call Syntax : @view_ddl (schema-name) (view-name) 6 | -- Last Modified: 16/03/2013 - Rewritten to use DBMS_METADATA 7 | -- ----------------------------------------------------------------------------------- 8 | SET LONG 20000 LONGCHUNKSIZE 20000 PAGESIZE 0 LINESIZE 1000 FEEDBACK OFF VERIFY OFF TRIMSPOOL ON 9 | 10 | BEGIN 11 | DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'SQLTERMINATOR', true); 12 | DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'PRETTY', true); 13 | END; 14 | / 15 | 16 | SELECT DBMS_METADATA.get_ddl ('VIEW', view_name, owner) 17 | FROM all_views 18 | WHERE owner = UPPER('&1') 19 | AND view_name = DECODE(UPPER('&2'), 'ALL', view_name, UPPER('&2')); 20 | 21 | SET PAGESIZE 14 LINESIZE 100 FEEDBACK ON VERIFY ON -------------------------------------------------------------------------------- /security/grant_delete.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/security/grant_delete.sql 3 | -- Author : Tim Hall 4 | -- Description : Grants delete on current schemas tables to the specified user/role. 5 | -- Call Syntax : @grant_delete (schema-name) 6 | -- Last Modified: 28/01/2001 7 | -- ----------------------------------------------------------------------------------- 8 | SET PAGESIZE 0 9 | SET FEEDBACK OFF 10 | SET VERIFY OFF 11 | 12 | SPOOL temp.sql 13 | 14 | SELECT 'GRANT DELETE ON "' || u.table_name || '" TO &1;' 15 | FROM user_tables u 16 | WHERE NOT EXISTS (SELECT '1' 17 | FROM all_tab_privs a 18 | WHERE a.grantee = UPPER('&1') 19 | AND a.privilege = 'DELETE' 20 | AND a.table_name = u.table_name); 21 | 22 | SPOOL OFF 23 | 24 | @temp.sql 25 | 26 | -- Comment out following line to prevent immediate run 27 | @temp.sql 28 | 29 | SET PAGESIZE 14 30 | SET FEEDBACK ON 31 | SET VERIFY ON 32 | -------------------------------------------------------------------------------- /security/grant_insert.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/security/grant_insert.sql 3 | -- Author : Tim Hall 4 | -- Description : Grants insert on current schemas tables to the specified user/role. 5 | -- Call Syntax : @grant_insert (schema-name) 6 | -- Last Modified: 28/01/2001 7 | -- ----------------------------------------------------------------------------------- 8 | SET PAGESIZE 0 9 | SET FEEDBACK OFF 10 | SET VERIFY OFF 11 | 12 | SPOOL temp.sql 13 | 14 | SELECT 'GRANT INSERT ON "' || u.table_name || '" TO &1;' 15 | FROM user_tables u 16 | WHERE NOT EXISTS (SELECT '1' 17 | FROM all_tab_privs a 18 | WHERE a.grantee = UPPER('&1') 19 | AND a.privilege = 'INSERT' 20 | AND a.table_name = u.table_name); 21 | 22 | SPOOL OFF 23 | 24 | -- Comment out following line to prevent immediate run 25 | @temp.sql 26 | 27 | SET PAGESIZE 14 28 | SET FEEDBACK ON 29 | SET VERIFY ON 30 | -------------------------------------------------------------------------------- /security/grant_update.sql: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------------- 2 | -- File Name : https://oracle-base.com/dba/security/grant_update.sql 3 | -- Author : Tim Hall 4 | -- Description : Grants update on current schemas tables to the specified user/role. 5 | -- Call Syntax : @grant_update (schema-name) 6 | -- Last Modified: 28/01/2001 7 | -- ----------------------------------------------------------------------------------- 8 | SET PAGESIZE 0 9 | SET FEEDBACK OFF 10 | SET VERIFY OFF 11 | 12 | SPOOL temp.sql 13 | 14 | SELECT 'GRANT UPDATE ON "' || u.table_name || '" TO &1;' 15 | FROM user_tables u 16 | WHERE NOT EXISTS (SELECT '1' 17 | FROM all_tab_privs a 18 | WHERE a.grantee = UPPER('&1') 19 | AND a.privilege = 'UPDATE' 20 | AND a.table_name = u.table_name); 21 | 22 | SPOOL OFF 23 | 24 | -- Comment out following line to prevent immediate run 25 | @temp.sql 26 | 27 | SET PAGESIZE 14 28 | SET FEEDBACK ON 29 | SET VERIFY ON 30 | -------------------------------------------------------------------------------- /weblogic/deploy_app.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | path=$1 3 | app=$2 4 | targetlist=$3 5 | 6 | export MW_HOME=/u01/app/oracle/middleware 7 | export DOMAIN_HOME=$MW_HOME/user_projects/domains/myDomain 8 | . $DOMAIN_HOME/bin/setDomainEnv.sh 9 | 10 | if [ "$app" != "" -a "$targetlist" = "" ]; then 11 | java weblogic.WLST ~/scripts/deploy_app.py -p $path -a $app 12 | elif [ "$app" != "" -a "$targetlist" != "" ] ; then 13 | java weblogic.WLST ~/scripts/deploy_app.py -p $path -a $app -t $targetlist 14 | else 15 | java weblogic.WLST ~/scripts/deploy_app.py -p $path 16 | fi 17 | -------------------------------------------------------------------------------- /weblogic/start-domain.sh: -------------------------------------------------------------------------------- 1 | # ----------------------------------------------------------------------------------- 2 | # File Name : https://oracle-base.com/dba/weblogic/start-domain.sh 3 | # Author : Tim Hall 4 | # Description : Starts a WebLogic domain and managed server. 5 | # Call Syntax : ./start-domain.sh 6 | # Last Modified: 15-JUN-2013 7 | # Notes : Amend DOMAIN_HOME and managed server name appropriately. 8 | # ----------------------------------------------------------------------------------- 9 | 10 | export MW_HOME=/u01/app/oracle/middleware 11 | export DOMAIN_HOME=$MW_HOME/user_projects/domains/clusterDomain 12 | 13 | echo "Starting AdminServer" 14 | nohup $DOMAIN_HOME/startWebLogic.sh > /dev/null 2>&1 & 15 | sleep 120 16 | 17 | echo "Starting clusterServer_1" 18 | nohup $DOMAIN_HOME/bin/startManagedWebLogic.sh clusterServer_1 > /dev/null 2>&1 & 19 | sleep 60 20 | 21 | echo "Done!" -------------------------------------------------------------------------------- /weblogic/start-node-manager.sh: -------------------------------------------------------------------------------- 1 | # ----------------------------------------------------------------------------------- 2 | # File Name : https://oracle-base.com/dba/weblogic/start-node-manager.sh 3 | # Author : Tim Hall 4 | # Description : Starts the WebLogic Node Manager 5 | # Call Syntax : ./start-node-manager.sh 6 | # Last Modified: 15-JUN-2013 7 | # ----------------------------------------------------------------------------------- 8 | 9 | export MW_HOME=/u01/app/oracle/middleware 10 | export WLS_HOME=$MW_HOME/wlserver_10.3 11 | 12 | echo "Starting Node Manger" 13 | nohup $WLS_HOME/server/bin/startNodeManager.sh > /dev/null 2>&1 & 14 | 15 | echo "Done!" 16 | -------------------------------------------------------------------------------- /weblogic/stop-domain.sh: -------------------------------------------------------------------------------- 1 | # ----------------------------------------------------------------------------------- 2 | # File Name : https://oracle-base.com/dba/weblogic/stop-domain.sh 3 | # Author : Tim Hall 4 | # Description : Stops a WebLogic domain and managed server. 5 | # Call Syntax : ./stop-domain.sh 6 | # Last Modified: 15-JUN-2013 7 | # Notes : Amend DOMAIN_HOME and managed server name appropriately. 8 | # ----------------------------------------------------------------------------------- 9 | 10 | export MW_HOME=/u01/app/oracle/middleware 11 | export DOMAIN_HOME=$MW_HOME/user_projects/domains/clusterDomain 12 | 13 | echo "Stopping clusterServer_1" 14 | $DOMAIN_HOME/bin/stopManagedWebLogic.sh clusterServer_1 15 | 16 | echo "Stopping AdminServer" 17 | $DOMAIN_HOME/bin/stopWebLogic.sh 18 | 19 | echo "Tidy up temp files" 20 | find $DOMAIN_HOME/servers -name "*.lok" -exec rm -f {} \; 21 | find $DOMAIN_HOME/servers -name "*.DAT" -exec rm -f {} \; 22 | 23 | echo "Done!" -------------------------------------------------------------------------------- /weblogic/stop-node-manager.sh: -------------------------------------------------------------------------------- 1 | # ----------------------------------------------------------------------------------- 2 | # File Name : https://oracle-base.com/dba/weblogic/stop-node-manager.sh 3 | # Author : Tim Hall 4 | # Description : Stops the WebLogic Node Manager by killing the processes. 5 | # Call Syntax : ./stop-node-manager.sh 6 | # Last Modified: 15-JUN-2013 7 | # ----------------------------------------------------------------------------------- 8 | 9 | echo "Stopping Node Manger" 10 | kill -9 `ps -ef | grep [N]odeManager | awk '{print $2}'` --------------------------------------------------------------------------------