Sunday 31 January 2016

Query to Find Concurrent Requests Run on a specific Date

The Script below gives the details of all Concurrent Programs submitted on a given date

==
select
f.request_id ,
pt.user_concurrent_program_name user_conc_program_name,
to_char(f.actual_start_date,'DD-MON-YY HH24:MI:SS') start_on,
to_char(f.actual_completion_date,'DD-MON-YY HH24:MI:SS') end_on,
floor(((f.actual_completion_date-f.actual_start_date)
*24*60*60)/3600)
|| ' HOURS ' ||
floor((((f.actual_completion_date-f.actual_start_date)
*24*60*60) -
floor(((f.actual_completion_date-f.actual_start_date)
*24*60*60)/3600)*3600)/60)
|| ' MINUTES ' ||
round((((f.actual_completion_date-f.actual_start_date)
*24*60*60) -
floor(((f.actual_completion_date-f.actual_start_date)
*24*60*60)/3600)*3600 -
(floor((((f.actual_completion_date-f.actual_start_date)
*24*60*60) -
floor(((f.actual_completion_date-f.actual_start_date)
*24*60*60)/3600)*3600)/60)*60) ))
|| ' SECS ' time_difference,
p.concurrent_program_name concurrent_program_name,
decode(f.phase_code,'R','Running','C','Complete',f.phase_code) Phase,
f.status_code
from  apps.fnd_concurrent_programs p,
apps.fnd_concurrent_programs_tl pt,
apps.fnd_concurrent_requests f
where f.concurrent_program_id = p.concurrent_program_id
and f.program_application_id = p.application_id
and f.concurrent_program_id = pt.concurrent_program_id
and f.program_application_id = pt.application_id
AND pt.language = USERENV('Lang')
and f.actual_start_date like '24-JUN-15%'
order by
f.actual_start_date desc;

Friday 29 January 2016

Useful Linux Commands for Apps DBA's

Check Used Space on  a Disk/ Mount Point
---------------------
The du command summarizes your disk usage. The sort command sorts the files by size. The command shown below sorts from smallest to largest all files in the current directory and all directories contained below the starting directory. Because the sort starts with the smallest file, the end of the list shows the largest files.

Deleting a large file is usually more efficient than deleting many small files. Often the largest files are core files or cache files, both of which you can delete.

du -h --max-depth=1
du -a | sort -k 1n,1|tail -30
du -sk * | sort -n | tail


Files more than 5mb
-------------------

find . -mount -size +50000000c -print | ls -lh
find . -size +100000000c -print
find . -size +50000000c -print | xargs ls -l
find . -size +10000000c -print
find . -size +10000 -print


Files more than 30 day old.
---------------------------

find . -name "*.aud" -mtime +7

find . -name *.req -mtime +30|xargs gzip

find . -name "TEST01_*.out" -mtime +2 |xargs ls -l

find . -name "*.log" -mtime -1|xargs ls -l

Files modified in the last 6hrs ago
------------------------------------
find . -name "*.log" -mmin 360|xargs ls -l
find . -mmin 360|xargs ls -l

find . -mtime +1|xargs ls -l

?+++++++++++++++++++++++++++++++++++++++++++++++++
find . -size +30000000c -xdev -exec ls -l {} \;

?+++++++++++++++++++++++++++++++++++++++++++++++++

Database Links in Oracle

A database link is a schema object in one database that enables you to access objects on another database.


SQL> desc dba_db_links
 Nombre                                                                                     ¨Nulo?   Tipo
 ------------------------------------------------------------------------------------------ -------- -------------------------------------------------------------
 OWNER                                                                                      NOT NULL VARCHAR2(30)
 DB_LINK                                                                                    NOT NULL VARCHAR2(128)
 USERNAME                                                                                            VARCHAR2(30)
 HOST                                                                                                VARCHAR2(2000)
 CREATED                                                                                    NOT NULL DATE


Use the below query to find the db links available for a database:

set lines 152
col owner for a15
col db_link for a30
col username for a15
col host for a30




select owner,db_link,username,host,CREATED
from dba_db_links;

spool db_link_test.sql

select 'select count(*) from tab@'||db_link||';'
from dba_db_links;

spool off

spool db_link_output.log

@db_link_test.sql

spool off

=================

How to Test if a DB link is working fine?

select ' connect '||owner||'/'||owner||'1'||chr(10)||
'select count(*) from tab@'||db_link||';'
from dba_db_links;


select distinct owner
from dba_db_links;