Showing posts with label check. Show all posts
Showing posts with label check. Show all posts

Tuesday, 24 March 2015

Displays a list of tablespaces and their used/full status.

SET PAGESIZE 140
COLUMN used_pct FORMAT A11
SELECT tablespace_name,
       size_mb,
       free_mb,
       max_size_mb,
       max_free_mb,
       TRUNC((max_free_mb/max_size_mb) * 100) AS free_pct,
       RPAD(' '|| RPAD('X',ROUND((max_size_mb-max_free_mb)/max_size_mb*10,0), 'X'),11,'-') AS used_pct
FROM   (
        SELECT a.tablespace_name,
               b.size_mb,
               a.free_mb,
               b.max_size_mb,
               a.free_mb + (b.max_size_mb - b.size_mb) AS max_free_mb
        FROM   (SELECT tablespace_name,
                       TRUNC(SUM(bytes)/1024/1024) AS free_mb
                FROM   dba_free_space
                GROUP BY tablespace_name) a,
               (SELECT tablespace_name,
                       TRUNC(SUM(bytes)/1024/1024) AS size_mb,
                       TRUNC(SUM(GREATEST(bytes,maxbytes))/1024/1024) AS max_size_mb
                FROM   dba_data_files
                GROUP BY tablespace_name) b
        WHERE  a.tablespace_name = b.tablespace_name
       )
ORDER BY tablespace_name;

SET PAGESIZE 14

Monday, 23 March 2015

find all the users with Sysadmin Responsibility

SELECT fu.*
FROM fnd_user_resp_groups_direct furgd, fnd_responsibility_vl frvl, fnd_user fu
WHERE furgd.responsibility_id = frvl.responsibility_id
AND fu.user_id = furgd.user_id
AND(to_char(furgd.end_date) is null
OR furgd.end_date > sysdate)
AND frvl.end_date is null
AND frvl.responsibility_name = 'System Administrator'; 

Saturday, 14 March 2015

How to list and compile Invalid objects

1) To list the Invalid objects:-

SELECT count(OBJECT_NAME),OBJECT_TYPE from dba_objects WHERE  status = 'INVALID' group by object_type;


2) To Compile the Invalid objects:-

EXEC UTL_RECOMP.recomp_serial('schema name');

Orinvalid.sql

Set heading off;set feedback off;set echo off;Set lines 999;Spool run_invalid.sql


select'ALTER ' || OBJECT_TYPE || ' ' ||OWNER || '.' || OBJECT_NAME || ' COMPILE;'fromdba_objectswherestatus = 'INVALID'and object_type in ('PACKAGE','FUNCTION','PROCEDURE');


spool off;
set heading on;set feedback on;set echo on;
@run_invalid.sql


Or 

select 'alter package '|| object_name || ' compile '|| decode(object_type, 'PACKAGE', '', 'PACKAGE BODY', 'body')|| ';' from dba_objects where status = 'INVALID';


In Application side.

a) Login as application tier user (avisr12 in my case)
b) Set environment variable (under $INSTALL_DIR/apps/apps_st/appl/APPS[sid]_[hostname].env)
c) admin
d) option 3 “compile/reload Applications Database Entities menu
e) option 1 “Compile Apps Schema”

References:

NOTE: Please be aware, that using adadmin to compile invalid objects, only the invalid objects for APPS will be compiled.
References
NOTE:1019928.6 - Script: To verify Stored Procedures
NOTE:331169.1 - Using Fully Qualified Database Link Name With a Hyphen in the Domain Name From PL/SQL Fails With ORA-02083, But Not From Regular SQL
NOTE:429252.1 - Forms With Dblink Fails With ORA-01041 ORA-03113
NOTE:73995.1 - Script: To Recompile Invalid Objects
NOTE:1325394.1 Troubleshooting Guide - invalid objects in the E-Business Suite Environment 11i and 12 

Monday, 9 March 2015

Script to check Oracle Tablespaces Size

Check Oracle Tablespaces Size


SELECT a.tablespace_name TS_NAME,
ROUND (((c.BYTES - NVL (b.BYTES, 0)) / c.BYTES) * 100,2) percent_used,
c.BYTES / 1024 / 1024 space_allocated,
ROUND (c.BYTES / 1024 / 1024 - NVL (b.BYTES, 0) / 1024 / 1024,2) space_used,
ROUND (NVL (b.BYTES, 0) / 1024 / 1024, 2) space_free,
c.DATAFILES
FROM dba_tablespaces a,
( SELECT tablespace_name,
SUM (BYTES) BYTES
FROM dba_free_space
GROUP BY tablespace_name
) b,
( SELECT COUNT (1) DATAFILES,
SUM (BYTES) BYTES,
tablespace_name
FROM dba_data_files
GROUP BY tablespace_name
) c
WHERE b.tablespace_name(+) = a.tablespace_name
AND c.tablespace_name(+) = a.tablespace_name
ORDER BY NVL (((c.BYTES - NVL (b.BYTES, 0)) / c.BYTES), 0) DESC;

for more scripts:-

http://www.oracle-base.com/dba/scripts.php