DOYENSYS Knowledge Portal




We Welcome you to visit our DOYENSYS KNOWLEDGE PORTAL : Doyensys Knowledge Portal




Monday, July 16, 2018

Queries to monitor the FND_LOBS attachment

1. To determins total number of attachments per program,

SQL> select distinct program_name, count(*) from fnd_lobs group by program_name order by 2 desc;

2. To determine total number of program with Expiration Date,

SQL> select program_name,count(*) from FND_LOBS where expiration_date is not NULL group by program_name order by 2 desc;

3. To determine total number of program with no Expiration Date,

SQL> select program_name,count(*) from FND_LOBS where expiration_date is NULL group by program_name order by 2 desc;

4. To find the size of the attachments Programwise,

SQL> select program_name, count(0), round(sum((dbms_lob.getlength(FILE_DATA)-1)/1024/1024/1024),1) size_gb
from fnd_lobs group by program_name order by size_gb desc;

5. To find the size of the attachments Applicationwise,

SQL>  select fa.application_name, count(0), round(sum(dbms_lob.getlength (FILE_DATA)/1024/1024/1024),1) size_gb
from fnd_lobs fl,
 fnd_document_entities fde,
 fnd_attached_documents fad,
 fnd_documents_vl fd,
 fnd_application_vl fa
where fd.media_id = fl.file_id
 and fd.document_id = fad.document_id
 and fl.program_name = 'FNDATTCH'    ------Change this for other programs
 and fad.entity_name = fde.data_object_code
 and fa.application_id = fde.application_id
group by fa.application_name
order by size_gb desc;

6. To find the size of the attachmentsSize as per the Expiration Date,

SQL> select program_name,round(sum(dbms_lob.getlength (FILE_DATA))/1024/1024/1024,0) "Size(G)"
from APPS.fnd_LOBS where expiration_date is NULL group by program_name order by 2 desc;

SQL> select program_name,round(sum(dbms_lob.getlength (FILE_DATA))/1024/1024/1024,0) "Size(G)"
from APPS.fnd_LOBS where expiration_date is not NULL group by program_name order by 2 desc;


7. To find PCTVERSION of the segment,

SQL> select SEGMENT_NAME, PCTVERSION from dba_lobs where TABLE_NAME ='FND_LOBS';

8. Find which user has uploaded more attachements,

SQL> select fu.user_name, round(sum(dbms_lob.getlength(file_data)/1024/1024),0) size_mb
from fnd_documents fd, fnd_lobs fl, fnd_user fu
where fd.media_id = fl.file_id
and fl.program_name ='FNDATTCH'  ------Change this for other programs
and fd.datatype_id = 6
and fu.user_id=fd.created_by
group by fu.user_name
order by 2 desc;

No comments: