Tuesday, 30 March 2021

Routine AFPESA cannot construct the name of an executable file for your concurrent request

 

Concurrent Processing - Requests Stuck with Inactive No Manager - Routine AFPESA Cannot Construct the Name of an Executable File



SYMPTOMS


All the Concurrent Requests are showing up with Phase Inactive and Status No Manager. The Standard Manager is not able to process any request because each manager process dies immediately after starting up. The log file of the manager process shows the following error:

List of errors encountered:
.............................................................................

_ 1 _
Routine AFPESA cannot construct the name of an executable file for
your concurrent request 2181143.

Check that the file name components are correct and valid on your
system. Check that the environment for the person who started the conc
.............................................................................



SOLUTION



To implement the solution, perform the below steps :-

1- Use the following select statement to identify the concurrent program name using the request ID that appears in the error

select p.* from fnd_concurrent_requests r, fnd_concurrent_programs_tl p where p.concurrent_program_id = r.concurrent_program_id and request_id=673032;

2- Cancel the request id=<Request Id>

3- Exclude the custom program (identified from step 1) from the standard manager specialization rules.

4- Include this custom program to a new custom manager specialization rules.

5- Restart the internal manager and check again if standard manager up or down.

Thursday, 4 March 2021

Query to find Tablespace size and free space - dba tech blog

Tablespace management in an Oracle database is important and something a DBA will need to do quite frequently.  Therefore I wrote a query, which I believe I originally got from the internet and then it evolved by me adding in temp tablespace and few other things 🙂



 Querying Tablespace Usage                                              


Query 1 : 

SELECT b.tsname tablespace_name
, MAX(b.used_size_mb) cur_used_size_mb
, round(AVG(inc_used_size_mb),2)avg_increas_mb 
FROM ( 
SELECT a.days, a.tsname, used_size_mb 
, used_size_mb - LAG (used_size_mb,1)  OVER ( PARTITION BY a.tsname ORDER BY a.tsname,a.days) inc_used_size_mb 
FROM (
SELECT TO_CHAR(sp.begin_interval_time,'MM-DD-YYYY') days 
,ts.tsname
,MAX(round((tsu.tablespace_usedsize* dt.block_size )/(1024*1024),2)) used_size_mb  
 FROM DBA_HIST_TBSPC_SPACE_USAGE tsu, DBA_HIST_TABLESPACE_STAT ts 
 ,DBA_HIST_SNAPSHOT sp, DBA_TABLESPACES dt
 WHERE tsu.tablespace_id= ts.ts# AND tsu.snap_id = sp.snap_id
 AND ts.tsname = dt.tablespace_name  AND sp.begin_interval_time > sysdate-7
 GROUP BY TO_CHAR(sp.begin_interval_time,'MM-DD-YYYY'), ts.tsname 
 ORDER BY ts.tsname, days
 ) A 
) b GROUP BY b.tsname ORDER BY b.tsname


Query 2 : 

SELECT TO_CHAR (sp.begin_interval_time,'DD-MM-YYYY') days
, ts.tsname
, max(round((tsu.tablespace_size* dt.block_size )/(1024*1024),2) ) cur_size_MB
, max(round((tsu.tablespace_usedsize* dt.block_size )/(1024*1024),2)) usedsize_MB
FROM DBA_HIST_TBSPC_SPACE_USAGE tsu
, DBA_HIST_TABLESPACE_STAT ts
, DBA_HIST_SNAPSHOT sp
, DBA_TABLESPACES dt
WHERE tsu.tablespace_id= ts.ts#
AND tsu.snap_id = sp.snap_id
AND ts.tsname = dt.tablespace_name
AND ts.tsname NOT IN ('SYSAUX','SYSTEM')
GROUP BY TO_CHAR (sp.begin_interval_time,'DD-MM-YYYY'), ts.tsname
ORDER BY ts.tsname, days;


Query 3 :

SELECT   a.tablespace_name, (a.BYTES / 1024/1024) || 'MB' AS total,
           (b.BYTES / 1024/1024) || 'MB' AS free,
           ROUND(((a.BYTES-b.BYTES)/1024/1024) ,2) || 'MB' AS used,
           (b.largest / 1024/1024) || 'MB' AS largest_block,
           ROUND (((a.BYTES - b.BYTES) / a.BYTES) * 100, 2) AS percent_used,
           ROUND (100 - ((a.BYTES - b.BYTES) / a.BYTES) * 100, 2) AS percent_free
      FROM (SELECT   tablespace_name, SUM (BYTES) BYTES
                  FROM dba_data_files
              GROUP BY tablespace_name) a,
             (SELECT   tablespace_name, SUM (BYTES) BYTES, MAX (BYTES) largest
                 FROM dba_free_space
             GROUP BY tablespace_name) b
      WHERE a.tablespace_name = b.tablespace_name(+)
union
select sh.tablespace_name,
sum(sh.bytes_used + sh.bytes_free)/1048576 || 'MB' total,
sum(sh.bytes_free)/1048576 || 'MB' free,
sum(sh.bytes_used)/1048576 || 'MB' used,
max(BYTES_FREE)/1048576 || 'MB',
ROUND(sum(sh.bytes_used) /sum(sh.bytes_used + sh.bytes_free) *100, 2) percent_used,
ROUND(sum(sh.bytes_free) /sum(sh.bytes_used + sh.bytes_free) *100, 2) percent_free
from v$temp_space_header sh
group by tablespace_name
order by 7;


Query 4:

SELECT 
   A.tablespace_name tablespace, 
   D.mb_total,
   SUM (A.used_blocks * D.block_size) / 1024 / 1024 mb_used,
   D.mb_total - SUM (A.used_blocks * D.block_size) / 1024 / 1024 mb_free
FROM 
   v$sort_segment A,
(SELECT 
   B.name, 
   C.block_size, 
   SUM (C.bytes) / 1024 / 1024 mb_total
FROM 
   v$tablespace B, 
   v$tempfile C
WHERE 
   B.ts#= C.ts#
GROUP BY 
   B.name, 
   C.block_size) D
WHERE 
   A.tablespace_name = D.name
GROUP by 
   A.tablespace_name, 
   D.mb_total;


Temp Tablespace :


          SELECT   s.sid "SID",
         s.username "User",
         s.program "Program",
         u.tablespace "Tablespace",
         u.contents "Contents",
         u.extents "Extents",
         u.blocks * 8 / 1024 "Used Space in MB",
         q.sql_text "SQL TEXT",
         a.object "Object",
         k.bytes / 1024 / 1024 "Temp File Size"
        FROM   v$session s,
         v$sort_usage u,
         v$access a,
         dba_temp_files k,
         v$sql q
        WHERE       s.saddr = u.session_addr
         AND s.sql_address = q.address
         AND s.sid = a.sid
         AND u.tablespace = k.tablespace_name;


I use this query


           SELECT   sl.sid,
           sl.serial#,
           SYSDATE,
           TO_CHAR (sl.start_time, 'DD-MON-YYYY:HH24:MI:SS') start_time,
           ROUND ( (sl.elapsed_seconds / 60), 2) min_elapsed,
           ROUND ( (sl.time_remaining / 60), 2) min_remaining,
           sl.opname,
           sl.MESSAGE
          FROM   v$session_longops sl, v$session s
         WHERE   s.sid = sl.sid AND s.serial# = sl.serial# AND sl.opname like 'Sort%' 
         ORDER BY   sl.start_time DESC, sl.time_remaining ASC;