User Tools

Site Tools


usefulscripts

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
usefulscripts [2019/03/29 12:54] z0hpvkusefulscripts [2025/03/08 22:24] (current) – external edit 127.0.0.1
Line 95: Line 95:
 ) b ) b
 ORDER BY PROGRAM, OSUSER; ORDER BY PROGRAM, OSUSER;
 +</code>
 +
 +<code SQL>
 +select RESOURCE_NAME,CURRENT_UTILIZATION,MAX_UTILIZATION
 +  from V$RESOURCE_LIMIT
 + where RESOURCE_NAME in ('processes','sessions');
 +</code>
 +
 +<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 = 'DD-MON-YYYY HH24:MI';
 +
 +select inst_id, sid, serial#, opname, target, start_time, last_update_time, time_remaining, elapsed_seconds
 +from gv$session_longops
 +where to_char(start_time, 'DD-MON-YYYY') = to_char(sysdate, 'DD-MON-YYYY')
 +and target is not null
 +and time_remaining > 0
 +order by elapsed_seconds DESC, start_time;
 </code> </code>
  
Line 113: Line 136:
 from v$sgastat  from v$sgastat 
 where name = 'free memory'; where name = 'free memory';
 +</code>
 +
 +====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, to_char(next_run_date, 'DD-MON-YYYY HH24:MI:SS') next_run_date
 +FROM   dba_scheduler_jobs
 +where enabled = 'TRUE' and owner not in ('SYS','ORACLE_OCM','EXFSYS')
 +ORDER BY owner, job_name;
 +</code>
 +
 +<code>
 +exec dbms_scheduler.set_scheduler_attribute('SCHEDULER_DISABLED', 'TRUE');
 +exec dbms_scheduler.set_scheduler_attribute('SCHEDULER_DISABLED', 'FALSE');
 +select * from DBA_SCHEDULER_GLOBAL_ATTRIBUTE;
 +</code> 
 +====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,
 +       window_name,
 +       to_char(job_start_time, 'DD-MON-YYYY HH24:MI:SS') job_start_time,
 +       job_duration,
 +       job_status
 +FROM   dba_autotask_job_history where client_name like '%optimizer%'
 +and job_start_time > sysdate -3
 +ORDER BY job_start_time;
 </code> </code>
  
Line 269: Line 330:
 </code> </code>
  
 +====Patching and Registry====
 +<code SQL>
 +SET LINESIZE 120
 +COL ACTION_TIME FORMAT A30
 +COL DESCRIPTION FORMAT A70
 +
 +select PATCH_ID, ACTION_TIME, DESCRIPTION from DBA_REGISTRY_SQLPATCH;
 +</code>
 +
 +<code SQL>
 +SET LINESIZE 120
 +COL COMP_NAME FORMAT A40
 +COL VERSION FORMAT A20
 +
 +select COMP_NAME, VERSION, STATUS from DBA_REGISTRY;
 +</code>
 +
 +====Endian Format====
 +<code SQL>
 +select * from v$TRANSPORTABLE_PLATFORM order by platform_id;
 +
 +select tp.platform_name, tp.endian_format
 +  from v$database d, v$transportable_platform tp
 + where d.platform_name = tp.platform_name;
 +</code>
 ====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 281: Line 366:
 END END
 from dba_sys_privs  from dba_sys_privs 
-where grantee in (select name from sys.user$ +where grantee in (select username from dba_users where oracle_maintained = 'N');
-                  where user# > 47);+
 </code> </code>
 <code SQL> <code SQL>
Line 292: Line 376:
 END END
 from dba_tab_privs  from dba_tab_privs 
-where grantee in (select name from sys.user$ +where grantee in (select username from dba_users where oracle_maintained = 'N');
-                  where user# > 47);+
 </code> </code>
 <code SQL>                  <code SQL>                 
Line 303: Line 386:
 END     END    
 from dba_role_privs  from dba_role_privs 
-where grantee in (select name from sys.user$ +where grantee in (select username from dba_users where oracle_maintained = 'N');</code>
-                  where user# > 47);</code>+
                                      
 ====Dummy Data==== ====Dummy Data====
usefulscripts.1553864052.txt.gz · Last modified: 2025/03/08 22:23 (external edit)