usefulscripts
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
usefulscripts [2019/02/20 17:02] – [Memory] z0hpvk | usefulscripts [2025/03/08 22:24] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
=====Scripts===== | =====Scripts===== | ||
- | ====Tablespaces | + | ====Tablespaces |
<code SQL> | <code SQL> | ||
SET PAGESIZE 140 LINESIZE 200 | SET PAGESIZE 140 LINESIZE 200 | ||
COLUMN used_pct FORMAT A11 | COLUMN used_pct FORMAT A11 | ||
- | COLUMN size_mb FORMAT 999,999 | + | COLUMN size_mb FORMAT |
- | COLUMN free_mb FORMAT 999,999 | + | COLUMN free_mb FORMAT |
- | COLUMN max_size_mb FORMAT 999,999 | + | COLUMN max_size_mb FORMAT |
- | COLUMN max_free_mb FORMAT 999,999 | + | COLUMN max_free_mb FORMAT |
SELECT tablespace_name, | SELECT tablespace_name, | ||
Line 61: | Line 61: | ||
ORDER BY df.tablespace_name, | ORDER BY df.tablespace_name, | ||
| | ||
+ | </ | ||
+ | <code SQL> | ||
+ | SELECT OWNER, SEGMENT_NAME, | ||
+ | WHERE FILE_ID = < | ||
+ | AND BLOCK_ID BETWEEN < | ||
</ | </ | ||
Line 90: | Line 95: | ||
) 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 102: | Line 130: | ||
WHERE | WHERE | ||
ORDER BY component; | ORDER BY component; | ||
+ | </ | ||
+ | |||
+ | <code SQL> | ||
+ | select pool, round(bytes/ | ||
+ | from v$sgastat | ||
+ | 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 145: | Line 217: | ||
====ASM==== | ====ASM==== | ||
<code SQL> | <code SQL> | ||
+ | set echo off | ||
set wrap off | set wrap off | ||
set lines 155 pages 9999 | set lines 155 pages 9999 | ||
Line 257: | Line 330: | ||
</ | </ | ||
+ | ====Patching and Registry==== | ||
+ | <code SQL> | ||
+ | SET LINESIZE 120 | ||
+ | COL ACTION_TIME FORMAT A30 | ||
+ | COL DESCRIPTION FORMAT A70 | ||
+ | |||
+ | select PATCH_ID, ACTION_TIME, | ||
+ | </ | ||
+ | |||
+ | <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 269: | Line 366: | ||
END | END | ||
from dba_sys_privs | from dba_sys_privs | ||
- | where grantee in (select | + | where grantee in (select |
- | | + | |
</ | </ | ||
<code SQL> | <code SQL> | ||
Line 280: | Line 376: | ||
END | END | ||
from dba_tab_privs | from dba_tab_privs | ||
- | where grantee in (select | + | where grantee in (select |
- | | + | |
</ | </ | ||
<code SQL> | <code SQL> | ||
Line 291: | Line 386: | ||
END | END | ||
from dba_role_privs | from dba_role_privs | ||
- | where grantee in (select | + | where grantee in (select |
- | | + | |
| | ||
====Dummy Data==== | ====Dummy Data==== |
usefulscripts.1550682173.txt.gz · Last modified: 2025/03/08 22:23 (external edit)