usefulscripts
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| usefulscripts [2019/06/05 08:25] – z0hpvk | usefulscripts [2025/08/07 09:11] (current) – z0hpvk | ||
|---|---|---|---|
| Line 62: | Line 62: | ||
| | | ||
| </ | </ | ||
| + | |||
| + | <code SQL> | ||
| + | SET linesize 140 | ||
| + | COL owner FORMAT a15 | ||
| + | COL segment_name FORMAT a35 | ||
| + | |||
| + | SELECT owner, segment_name, | ||
| + | round(sum(bytes)/ | ||
| + | FROM dba_segments | ||
| + | GROUP BY owner, segment_name | ||
| + | HAVING sum(bytes) > 102400000 | ||
| + | ORDER BY bytes DESC; | ||
| + | </ | ||
| + | |||
| <code SQL> | <code SQL> | ||
| SELECT OWNER, SEGMENT_NAME, | SELECT OWNER, SEGMENT_NAME, | ||
| Line 95: | Line 109: | ||
| ) b | ) b | ||
| ORDER BY PROGRAM, OSUSER; | ORDER BY PROGRAM, OSUSER; | ||
| + | </ | ||
| + | |||
| + | <code SQL> | ||
| + | select RESOURCE_NAME, | ||
| + | from V$RESOURCE_LIMIT | ||
| + | where RESOURCE_NAME in (' | ||
| + | </ | ||
| + | |||
| + | <code SQL> | ||
| + | set lines 180 | ||
| + | col opname format a30 | ||
| + | col target format a40 | ||
| + | col start_time format a20 | ||
| + | col last_update_time format a20 | ||
| + | |||
| + | alter session set nls_date_format = ' | ||
| + | |||
| + | select inst_id, sid, serial#, opname, target, start_time, last_update_time, | ||
| + | from gv$session_longops | ||
| + | where to_char(start_time, | ||
| + | and target is not null | ||
| + | and time_remaining > 0 | ||
| + | order by elapsed_seconds DESC, start_time; | ||
| </ | </ | ||
| Line 113: | Line 150: | ||
| from v$sgastat | from v$sgastat | ||
| where name = 'free memory'; | where name = 'free memory'; | ||
| + | </ | ||
| + | |||
| + | ====Scheduler Jobs==== | ||
| + | <code SQL> | ||
| + | SET LINESIZE 200 | ||
| + | |||
| + | COLUMN owner FORMAT A20 | ||
| + | COLUMN job_name FORMAT A30 | ||
| + | COLUMN job_class FORMAT A30 | ||
| + | COLUMN next_run_date FORMAT A25 | ||
| + | |||
| + | SELECT owner, job_name, run_count, failure_count, | ||
| + | FROM | ||
| + | where enabled = ' | ||
| + | ORDER BY owner, job_name; | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | exec dbms_scheduler.set_scheduler_attribute(' | ||
| + | exec dbms_scheduler.set_scheduler_attribute(' | ||
| + | select * from DBA_SCHEDULER_GLOBAL_ATTRIBUTE; | ||
| + | </ | ||
| + | ====Optimiser Statistics==== | ||
| + | <code SQL> | ||
| + | COLUMN client_name FORMAT A32 | ||
| + | COLUMN window_name FORMAT A20 | ||
| + | COLUMN job_start_time FORMAT A30 | ||
| + | COLUMN job_duration FORMAT A20 | ||
| + | COLUMN job_status FORMAT A10 | ||
| + | |||
| + | SELECT client_name, | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | FROM | ||
| + | and job_start_time > sysdate -3 | ||
| + | ORDER BY job_start_time; | ||
| </ | </ | ||
| Line 269: | Line 344: | ||
| </ | </ | ||
| - | ====Patching==== | + | ====Patching |
| <code SQL> | <code SQL> | ||
| SET LINESIZE 120 | SET LINESIZE 120 | ||
| Line 278: | Line 353: | ||
| </ | </ | ||
| + | <code SQL> | ||
| + | SET LINESIZE 120 | ||
| + | COL COMP_NAME FORMAT A40 | ||
| + | COL VERSION FORMAT A20 | ||
| + | |||
| + | select COMP_NAME, VERSION, STATUS from DBA_REGISTRY; | ||
| + | </ | ||
| + | |||
| + | ====Endian Format==== | ||
| + | <code SQL> | ||
| + | select * from v$TRANSPORTABLE_PLATFORM order by platform_id; | ||
| + | |||
| + | select tp.platform_name, | ||
| + | from v$database d, v$transportable_platform tp | ||
| + | where d.platform_name = tp.platform_name; | ||
| + | </ | ||
| ====Grants==== | ====Grants==== | ||
| The below 3 scripts will detail what privileges have been granted to standard users.\\ | The below 3 scripts will detail what privileges have been granted to standard users.\\ | ||
| It needs to be run as a user with DBA privilege.\\ | It needs to be run as a user with DBA privilege.\\ | ||
| - | Also before running check the table sys.user$ to see what value is needed to user#\\ | ||
| <code SQL> | <code SQL> | ||
| select | select | ||
| Line 290: | Line 380: | ||
| END | END | ||
| from dba_sys_privs | from dba_sys_privs | ||
| - | where grantee in (select | + | where grantee in (select |
| - | | + | |
| </ | </ | ||
| <code SQL> | <code SQL> | ||
| Line 301: | Line 390: | ||
| END | END | ||
| from dba_tab_privs | from dba_tab_privs | ||
| - | where grantee in (select | + | where grantee in (select |
| - | | + | |
| </ | </ | ||
| <code SQL> | <code SQL> | ||
| Line 312: | Line 400: | ||
| END | END | ||
| from dba_role_privs | from dba_role_privs | ||
| - | where grantee in (select | + | where grantee in (select |
| - | | + | |
| | | ||
| ====Dummy Data==== | ====Dummy Data==== | ||
usefulscripts.1559723140.txt.gz · Last modified: (external edit)
