Wednesday 26 July 2017

Growth of oracle database size in day, week and month wise

Below query to get the database size growth in day, week and month wise.

Query:

set linesize 210
set linesize 210
COL "Database Size" FORMAT a13
COL "Used Space" FORMAT a11
COL "Used in %" FORMAT a11
COL "Free in %" FORMAT a11
COL "Database Name" FORMAT a13
COL "Free Space" FORMAT a12
COL "Growth DAY" FORMAT a11
COL "Growth WEEK" FORMAT a12
COL "Growth DAY in %" FORMAT a16
COL "Growth WEEK in %" FORMAT a16
SELECT
(select min(creation_time) from v$datafile) "Create Time",
(select name from v$database) "Database Name",
ROUND((SUM(USED.BYTES) / 1024 / 1024 ),2) || ' MB' "Database Size",
ROUND((SUM(USED.BYTES) / 1024 / 1024 ) - ROUND(FREE.K / 1024 / 1024 ),2) || ' MB' "Used Space",
ROUND(((SUM(USED.BYTES) / 1024 / 1024 ) - (FREE.K / 1024 / 1024 )) / ROUND(SUM(USED.BYTES) / 1024 / 1024 ,2)*100,2) || '% MB' "Used in %",
ROUND((FREE.K / 1024 / 1024 ),2) || ' MB' "Free Space",
ROUND(((SUM(USED.BYTES) / 1024 / 1024 ) - ((SUM(USED.BYTES) / 1024 / 1024 ) - ROUND(FREE.K / 1024 / 1024 )))/ROUND(SUM(USED.BYTES) / 1024 / 1024,2 )*100,2) || '% MB' "Free in %",
ROUND(((SUM(USED.BYTES) / 1024 / 1024 ) - (FREE.K / 1024 / 1024 ))/(select sysdate-min(creation_time) from v$datafile),2) || ' MB' "Growth DAY",
ROUND(((SUM(USED.BYTES) / 1024 / 1024 ) - (FREE.K / 1024 / 1024 ))/(select sysdate-min(creation_time) from v$datafile)/ROUND((SUM(USED.BYTES) / 1024 / 1024 ),2)*100,3) || '% MB' "Growth DAY in %",
ROUND(((SUM(USED.BYTES) / 1024 / 1024 ) - (FREE.K / 1024 / 1024 ))/(select sysdate-min(creation_time) from v$datafile)*7,2) || ' MB' "Growth WEEK",
ROUND((((SUM(USED.BYTES) / 1024 / 1024 ) - (FREE.K / 1024 / 1024 ))/(select sysdate-min(creation_time) from v$datafile)/ROUND((SUM(USED.BYTES) / 1024 / 1024 ),2)*100)*7,3) || '% MB' "Growth WEEK in %",
ROUND(((SUM(USED.BYTES) / 1024 / 1024 ) - (FREE.K / 1024 / 1024 ))/(select sysdate-min(creation_time) from v$datafile)*30,2) || ' MB' "Growth MONTH",
ROUND((((SUM(USED.BYTES) / 1024 / 1024 ) - (FREE.K / 1024 / 1024 ))/(select sysdate-min(creation_time) from v$datafile)/ROUND((SUM(USED.BYTES) / 1024 / 1024 ),2)*100)*30,3) || '% MB' "Growth MONTH in %"
FROM (SELECT BYTES FROM V$DATAFILE
UNION ALL
SELECT BYTES FROM V$TEMPFILE
UNION ALL
SELECT BYTES FROM V$LOG) USED,
(SELECT SUM(BYTES) AS K FROM dba_free_space) FREE
GROUP BY FREE.K;

Query to get the Custom Tables List in oracle application

Below query to get the list of custom tables in oracle application.

Query:

select object_name,
   object_type
from all_objects
where 1=1
and object_type='TABLE'
and status='VALID'
and object_name like 'XXCUST%';

Query to get list of Custom Form List in oracle application

Below query to get the list of Custom Form List in oracle application.

Query:

SELECT  DISTINCT forms.form_name,
         formstl.user_form_name,
         func.function_name,
         func.user_function_name,
         fm.menu_name,
         menu.prompt menu_prompt,
         menu.description,
         restl.responsibility_name
        -- FORMSTL.language
  FROM   fnd_form FORMS,
         fnd_form_tl FORMSTL,
         fnd_form_functions_VL FUNC,
         fnd_menu_entries_VL MENU,
         FND_MENUS FM,
         fnd_responsibility RES,
         fnd_responsibility_tl RESTL
 WHERE     1=1
         and forms.form_id = formstl.form_id
         and func.form_id = forms.form_id
         and menu.function_id = func.function_id
         and menu.menu_id=fm.menu_id
         and res.menu_id = menu.menu_id
         and res.responsibility_id = restl.responsibility_id
         and UPPER(forms.form_name) like 'XXCUST%'      
         order by 1;

Query to get list of Custom Concurrent Programs in oracle applications

Below query to get the list of Custom Concurrent Programs in oracle applications.

Query:

SELECT   DISTINCT fcp.user_concurrent_program_name "Concurrent Program Name",
fa.application_name,
fcp.concurrent_program_name conc_short_name,
decode( fef.execution_method_code, 'H','Host',
'I', 'PLSQL Stored Procedure',
'P', 'Report',
'L', 'SQL Loader',
'Q','SQL*Plus',
'A','Spawned',
'K','Java Concurrent Program',
'B','Request Set Stage Function',
'S','Immediate',
'J','Java Stored Procedure',
'M','Multi-Language Function',
fef.execution_method_code) "execution method",
fef.executable_name,
fcp.description "Concurrent Program Description",
fef.executable_name"Executable Name",
fef.description "Executable Description",
fef.execution_file_name ,
fcp.enabled_flag
,FCP.CREATION_DATE
FROM fnd_executables_form_v fef,
                fnd_concurrent_programs_VL fcp,
                fnd_application_tl fa
WHERE fcp.application_id=fef.application_id
and fa.application_id=fcp.application_id
AND fef.executable_id=fcp.executable_id
AND UPPER(fcp.user_concurrent_program_name) like 'XXCUST%'
ORDER BY 4;