Friday 29 January 2016

Script for concurrent request details using Request Id

Below script for running concurrent request details using Request Id.

Script:

set head off
set verify off
set echo off
set pages 1500
set linesize 100
set lines 120
prompt
prompt Request_ID
prompt ==================================
select /*+ CHOOSE*/
'Session  Id.............................................: '||s.sid,
'Serial Num..............................................: '||s.serial#,
'User Name ..............................................: '||s.username,
'Session Status .........................................: '||s.status,
'Client Process Id on Client Machine ....................: '||'*'||s.process||'*'  Client,
'Server Process ID ......................................: '||p.spid Server,
'Sql_Address ............................................: '||s.sql_address,
'Sql_hash_value .........................................: '||s.sql_hash_value,
'Schema Name ..... ......................................: '||s.SCHEMANAME,
'Program  ...............................................: '||s.program,
'Module .................................................: '|| s.module,
'Action .................................................: '||s.action,
'Terminal ...............................................: '||s.terminal,
'Client Machine .........................................: '||s.machine,
'LAST_CALL_ET ...........................................: '||s.last_call_et,
'S.LAST_CALL_ET/3600 ....................................: '||s.last_call_et/3600,
'E.SQL_TEXT .............................................: '||E.SQL_TEXT
from v$session s, v$process p, V$SQL E
where p.addr=s.paddr AND s.SQL_ADDRESS = E.ADDRESS and
s.sid in (SELECT d.sid FROM apps.fnd_concurrent_requests a,
apps.fnd_concurrent_processes b, v$process c,v$session d
WHERE a.controlling_manager = b.concurrent_process_id
AND c.pid = b.oracle_process_id
AND b.session_id=d.audsid
AND a.request_id = &Request_ID);

Script for scheduled concurrent programs on particular date and time

Below script for scheduled concurrent details on exact date and time.

Script:

SELECT   fcr.request_id,
         DECODE (fcpt.user_concurrent_program_name,
                 'Report Set', 'Report Set:' || fcr.description,
                 fcpt.user_concurrent_program_name)
            CONC_PROG_NAME,
         argument_text PARAMETERS,
         NVL2 (fcr.resubmit_interval,
               'PERIODICALLY',
               NVL2 (fcr.release_class_id, 'ON SPECIFIC DAYS', 'ONCE'))
            PROG_SCHEDULE_TYPE,
         DECODE (
            NVL2 (fcr.resubmit_interval,
                  'PERIODICALLY',
                  NVL2 (fcr.release_class_id, 'ON SPECIFIC DAYS', 'ONCE')),
            'PERIODICALLY',
               'EVERY '
            || fcr.resubmit_interval
            || ' '
            || fcr.resubmit_interval_unit_code
            || ' FROM '
            || fcr.resubmit_interval_type_code
            || ' OF PREV RUN',
            'ONCE',
            'AT :' || TO_CHAR (fcr.requested_start_date, 'DD-MON-RR HH24:MI'),
            'EVERY: ' || fcrc.class_info
         )
            PROG_SCHEDULE,
         fu.user_name USER_NAME,
         requested_start_date START_DATE,
         requested_start_date + 5 / 24 + (30 / (24 * 60)) ISO_Start_date --- +5.30
  FROM   apps.fnd_concurrent_programs_tl fcpt,
         apps.fnd_concurrent_requests fcr,
         apps.fnd_user fu,
         apps.fnd_conc_release_classes fcrc
WHERE       fcpt.application_id = fcr.program_application_id
         AND fcpt.concurrent_program_id = fcr.concurrent_program_id
         AND fcr.requested_by = fu.user_id
         AND fcr.phase_code = 'P'
         AND fcr.hold_flag = 'N'
        --AND fcr.requested_start_date > SYSDATE
         and fcr.requested_start_date >= to_date('01/29/2016 22:00:00','mm/dd/yyyy HH24:MI:SS')
         and fcr.requested_start_date <= to_date('01/30/2016 10:30:00','mm/dd/yyyy HH24:MI:SS')
                                AND fcpt.LANGUAGE = 'US'
         AND fcrc.release_class_id(+) = fcr.release_class_id
         AND fcrc.application_id(+) = fcr.release_class_app_id;

Hope this script helps you :)

Thursday 28 January 2016

Adadmin Fails after schema password has been changed through AFPASSWD

We are facing with adadmin fails after changing the password using AFPASSWD. Below is the issue and fix for solving the issue.

Issue:

AD Administrator error:
DCPW null for "PJI" [1292]

AD Administrator error:
Failed getting PDI list for product 'pji'

AD Administrator error:
aipspv(): Error setting up PDI list for upgrade.

Cause:

Code issue in AFPASSWD resulting in errors using AD tools.

Fix:

1. The issue is fixed by Patch 13855823:R12.FND.B -10FF:12373900:12.1.3:12.1.3:QREP1220.2:FND.RLNK:RELINK FAILED FOR MODULE FNDCPASS. Download, review the readme and pre-requisites.

2. Ensure that you have taken a backup of your system before applying the recommended patch.

3. Apply any required pre-requisite patches and Patch 13855823:R12.FND.B in a Test environment. Verify files installed with this patch.

4. Retest the issue.

5. If the issue is resolved, please migrate the solution as appropriate to other environments

(Note :If you are not able to apply patch because adpatch itself fails, the workaround is to first reset the passwords using FNDCPASS. Then adpatch will work and the above patch can be applied.)
Ref. (Doc ID 1492939.1)

Wednesday 27 January 2016

adopmnctl.sh exit with status 206 in oracle apps R12

We are facing issue while restarting opmnctl services.

Issue:

-bash-3.2$ cd $ADMIN_SCRIPTS_HOME
-bash-3.2$ sh adopmnctl.sh startall

adopmnctl.sh exiting with status 206

Fix:

Step 1:
-bash-3.2$ cd $ORA_CONFIG_HOME/10.1.3/j2ee/oacore/persistence

Step 2:
-bash-3.2$ rm -rf *

Step 3:
-bash-3.2$ cd $ORA_CONFIG_HOME/10.1.3/j2ee/oafm/persistence

Step 4:
-bash-3.2$ rm -rf *

Step 5:
-bash-3.2$ cd $ADMIN_SCRIPTS_HOME
-bash-3.2$ sh adopmnctl.sh stopall

Step 5:
-bash-3.2$ cd $ADMIN_SCRIPTS_HOME
-bash-3.2$ sh adopmnctl.sh startll

Step 6:
-bash-3.2$ sh adopmnctl.sh status

You are running adopmnctl.sh version 120.6.12010000.5

Checking status of OPMN managed processes...

Processes in Instance: Instance URL
---------------------------------+--------------------+---------+---------
ias-component                    | process-type       |     pid | status
---------------------------------+--------------------+---------+---------
OC4JGroup:default_group          | OC4J:oafm          |   15978 | Alive
OC4JGroup:default_group          | OC4J:oacore        |   15884 | Alive
OC4JGroup:default_group          | OC4J:oacore        |   15883 | Alive
HTTP_Server                              | HTTP_Server        |   15781 | Alive

adopmnctl.sh: exiting with status 0

adopmnctl.sh: check the logfile $APPL_TOP/admin/log/adopmnctl.txt for more information ...

Hope this post will helps you.

How to create a schema with existing schema permissions in oracle database

In my case existing schema is APPS and need to create a schema like CMSRC.

Step 1:

SQL> Set long 100000000
SQL> select dbms_metadata.get_ddl('USER','APPS') from dual;

DBMS_METADATA.GET_DDL('USER','APPS')
--------------------------------------------------------------------------------

   CREATE USER "APPS" IDENTIFIED BY VALUES '*******************'
      DEFAULT TABLESPACE "ODSDATA_TBS"
      TEMPORARY TABLESPACE "TEMP"

Step 2:

SQL> select DBMS_METADATA.GET_GRANTED_DDL('ROLE_GRANT','APPS') from dual;

DBMS_METADATA.GET_GRANTED_DDL('ROLE_GRANT','APPS')
--------------------------------------------------------------------------------

   GRANT "RESOURCE" TO "APPS"
   GRANT "SELECT_CATALOG_ROLE" TO "APPS"
   GRANT "AQ_ADMINISTRATOR_ROLE" TO "APPS" WITH ADMIN OPTION
   GRANT "JAVASYSPRIV" TO "APPS"
   GRANT "CTXAPP" TO "APPS"
   GRANT "EBS_APPS_ROLE" TO "APPS"


Step 3: Create CMSRC schema

CREATE USER CMSRC IDENTIFIED BY cmsrc DEFAULT TABLESPACE ODSDATA_TBS  TEMPORARY TABLESPACE TEMP;

Step 4:   Granting permissions to CMSRC schema as like APPS schema

   GRANT "RESOURCE" TO "CMSRC"
   GRANT "SELECT_CATALOG_ROLE" TO "CMSRC"
   GRANT "AQ_ADMINISTRATOR_ROLE" TO "CMSRC" WITH ADMIN OPTION
   GRANT "JAVASYSPRIV" TO "CMSRC"
   GRANT "CTXAPP" TO "CMSRC"
   GRANT "EBS_APPS_ROLE" TO "CMSRC"

Hope this post helps :)

Tuesday 26 January 2016

How to run Autoconfig in TEST mode

When we run Autoconfig, It will update the existing configuration file. To prevent any unwanted changes, we can run the Autoconfig in TEST mode to determine the impact of the running the Auto-config without updating the configuration files.

Step 1:

Source the env file.

Step 2:

-bash-3.2$ echo $CONTEXT_FILE
context_file.xml

Step 3:

-bash-3.2$ cd $AD_TOP/bin
-bash-3.2$ ls -ltr adchkcfg.sh
-rwxr-xr-x   1 applmgr  dba         4767 Aug 15  2014 adchkcfg.sh
-bash-3.2$ sh adchkcfg.sh
Enter the full path to the Applications Context file:
context_file.xml location(with path)
Enter the APPS password:

The log file for this session is located at:
$INST_TOP/apps/**********/admin/log/01262302/adconfig.log

AutoConfig is running in test mode and building diffs...

AutoConfig will consider the custom templates if present.
        Using CONFIG_HOME location     : /d01/oracle/ebs12/inst/apps/PATCH_patchapp
        Classpath                   : /d01/oracle/ebs12/apps/apps_st/comn/java/lib/appsborg2.zip:/d01/oracle/ebs12/apps/apps_st/comn/java/classes

        Using Context file          : existing context_file

Context Value Management will now update the test Context file

        Updating test Context file...COMPLETED

        [ Test mode ]
        No uploading of Context File and its templates to database.

Testing templates from all of the product tops...
        Testing AD_TOP........COMPLETED
        Testing FND_TOP.......COMPLETED
        Testing ICX_TOP.......COMPLETED
        Testing MSC_TOP.......COMPLETED
        Testing IEO_TOP.......COMPLETED
        Testing BIS_TOP.......COMPLETED
        Testing AMS_TOP.......COMPLETED
        Testing CCT_TOP.......COMPLETED
        Testing WSH_TOP.......COMPLETED
        Testing CLN_TOP.......COMPLETED
        Testing OKE_TOP.......COMPLETED
        Testing OKL_TOP.......COMPLETED
        Testing OKS_TOP.......COMPLETED
        Testing CSF_TOP.......COMPLETED
        Testing IGS_TOP.......COMPLETED
        Testing IBY_TOP.......COMPLETED
        Testing JTF_TOP.......COMPLETED
        Testing MWA_TOP.......COMPLETED
        Testing CN_TOP........COMPLETED
        Testing CSI_TOP.......COMPLETED
        Testing WIP_TOP.......COMPLETED
        Testing CSE_TOP.......COMPLETED
        Testing EAM_TOP.......COMPLETED
        Testing FTE_TOP.......COMPLETED
        Testing ONT_TOP.......COMPLETED
        Testing AR_TOP........COMPLETED
        Testing AHL_TOP.......COMPLETED
        Testing OZF_TOP.......COMPLETED
        Testing IES_TOP.......COMPLETED
        Testing CSD_TOP.......COMPLETED
        Testing IGC_TOP.......COMPLETED

Differences text report is located at:
/PATH_/admin/out/01262302/cfgcheck.txt

        Generating Profile Option differences report...COMPLETED
Differences text report for the Database is located at:  /PATH_/admin/admin/out/01262302/ProfileReport.txt
        Generating File System differences report......COMPLETED
Differences html report is located at:
/PATH_/admin//out/01262302/cfgcheck.html

Differences Zip report is located at:
/PATH/admin/out/01262302/ADXcfgcheck.zip

AutoConfig completed successfully.

Output:








Hope this post will helps you.

Invalid objects details in oracle database

Below script to know the invalid objects count and details including (creation date, modification date and user details).

Script:

set linesize 200
column owner format a12
col columnname format a20
column object_name format a30
column object_type format a15
column "Created" format a21
column "Last DDL Time" format a21

select owner, object_name, object_type, status, to_char(created, 'DD-MON-YYYY HH:MI AM') "Created", to_char(last_ddl_time, 'DD-MON-YYYY HH:MI AM') "Last DDL Time" , timestamp from dba_objects
where status = 'INVALID' order by owner, object_name;


Output:



Monday 25 January 2016

Current running concurrent request details in oracle apps R12

Below script to know the current running concurrent request details in oracle apps R12.

Script:

set echo off pages 100 lines 202
column REQUEST heading 'Request' format a9
column PHASE heading 'Phase' format A8
column STATUS heading 'Status' format A8
column PROGRAM heading 'Program Name' format A40
column SHORT heading 'Short Name' format A15
column REQUESTOR heading 'Requestor' format A15
column START_TIME heading 'Start Time' format A15
column RUN_TIME justify left heading 'Time(m)' format 999999.9
column OSPID heading 'OSPID' format a5
column OS_PIDa heading 'OSPIDA' format a6
column SID heading 'SID' format 99999
column serial# heading 'Serial#' format 99999
column sidser heading 'SidSer#' format a10
select  substr(fcrv.request_id,1,9)REQUEST,
        decode(fcrv.phase_code,'P','Pending','R','Running','I','Inactive','Completed')PHASE,
        decode(fcrv.status_code,
        'A','Waiting',
        'B','Resuming',
        'C','Normal',
        'F','Scheduled',
        'G','Warning',
        'H','On Hold',
        'I','Normal',
        'M','No Manager',
        'Q','Standby',
        'R','Normal',
        'S','Suspended',
        'T','Terminating',
        'U','Disabled',
        'W','Paused',
        'X','Terminated',
        'Z','Waiting',fcrv.status_code)STATUS,
        substr(fcrv.program,1,40)PROGRAM,
        substr(fcrv.PROGRAM_SHORT_NAME,1,15)SHORT,
        substr(fcrv.requestor,1,15)REQUESTOR,
--        to_char(fcrv.actual_start_date,'MM/DD/RR HH24:MI')START_TIME,
        round(((sysdate - fcrv.actual_start_date)*1440),1)RUN_TIME,
        substr(fcr.oracle_process_id,1,7)OSPID,
        s.sid||','||s.serial# sidser
--        substr(fcr.os_process_id,1,7)OS_PIDa
from    apps.fnd_conc_req_summary_v fcrv,
        apps.fnd_concurrent_requests fcr,
        v$session s,
        v$process p
where   fcrv.phase_code = 'R'
and     fcrv.request_id = fcr.request_id
and     s.paddr(+) = p.addr
and     fcr.oracle_process_id = p.spid(+)
and     fcrv.concurrent_program_id not in ('40112','40113','36887')
--and   trunc(fcrv.actual_start_date) like trunc(sysdate)
order by PHASE, STATUS,REQUEST desc
/

Output:


Forgotten SYSADMIN password in oracle apps R12

Step 1:  Connect to apps user in application node 

SQL> conn apps/APPS123;

Connected.

Step 2:  Create below package 

SQL> CREATE OR REPLACE PACKAGE XXX_GET_PWD AS
FUNCTION decrypt (KEY IN VARCHAR2, VALUE IN VARCHAR2)
RETURN VARCHAR2;
END XXX_GET_PWD;
/


Step 3:  Create below package body 

SQL> CREATE OR REPLACE PACKAGE BODY XXX_GET_PWD AS
FUNCTION decrypt (KEY IN VARCHAR2, VALUE IN VARCHAR2)
RETURN VARCHAR2 AS
LANGUAGE JAVA NAME 'oracle.apps.fnd.security.WebSessionManagerProc.decrypt
(java.lang.String,java.lang.String) return java.lang.String';
END XXX_GET_PWD;
/

Step 4:  Run the below script 

SELECT Usr.User_Name,
Usr.Description,
XXX_GET_PWD.Decrypt (
(SELECT (SELECT XXX_GET_PWD.Decrypt (
Fnd_Web_Sec.Get_Guest_Username_Pwd,
Usertable.Encrypted_Foundation_Password)
FROM DUAL)
AS Apps_Password
FROM applsys.Fnd_User Usertable
WHERE Usertable.User_Name =
(SELECT SUBSTR (
Fnd_Web_Sec.Get_Guest_Username_Pwd,
1,
INSTR (Fnd_Web_Sec.Get_Guest_Username_Pwd,
'/')
- 1)
FROM DUAL)),
Usr.Encrypted_User_Password)
Password
FROM applsys.Fnd_User Usr

WHERE Usr.User_Name = '&User_Name';

(Note:Enter the SYSADMIN user name in CAPS)

Step 5:  Validate the SYSADMIN password is working fine or not.

SQL> select fnd_web_sec.validate_login('SYSADMIN','sysadmin') from dual;

FND_WEB_SEC.VALIDATE_LOGIN('SYSADMIN','SYSADMIN')
--------------------------------------------------------------------------------
Y

(Note: In my case Username is "SYSADMIN" and password is "sysadmin") 

Hope this post will helps you :)

Sunday 24 January 2016

Forgotten apps user password in oracle apps R12

Below steps to get the forgotten apps user password in oracle apps R12.

Step 1:  Connect to sys user 

SQL> show user
USER is "SYS"

Step 2:  Create function to know the encrypted password

SQL> create FUNCTION apps.decrypt_pin_func(in_chr_key IN VARCHAR2,in_chr_encrypted_pin IN VARCHAR2) RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'oracle.apps.fnd.security.WebSessionManagerProc.decrypt(java.lang.String,java.lang.String) return java.lang.String';
/

Function created.

Step 3:  Query for password

SQL> set linesize 200 long 300
SQL> select ENCRYPTED_FOUNDATION_PASSWORD from apps.fnd_user where USER_NAME='GUEST';

ENCRYPTED_FOUNDATION_PASSWORD
----------------------------------------------------------------------------------------------------
ZGC679A64D8394F23E12CA4EB288F264FC09EBC9144C06181E921F88A972E231E9B530E7810DE42AC6103FC3CCD317CA3391

Step 4:  Apps password using encrypted guest password

SQL> SELECT apps.decrypt_pin_func('GUEST/ORACLE','ZGC679A64D8394F23E12CA4EB288F264FC09EBC9144C06181E921F88A972E231E9B530E7810DE42AC6103FC3CCD317CA3391') from dual;

APPS.DECRYPT_PIN_FUNC('GUEST/ORACLE','ZGC679A64D8394F23E12CA4EB288F264FC09EBC9144C06181E921F88A972E231E9B530E7810DE42AC6103FC3CCD317CA3391')
---------------------------------------------------------------------------------------------------------------------------------------------
APPS

Step 5:  Test the password is working fine or not

SQL> conn apps/APPS123;
Connected.

Hope this post will helps you :)

Sunday 10 January 2016

Script for RMAN restore current status

Below script to know RMAN restore current status and remaining time to complete the refresh.

Script:

set lines 199
select OPNAME,SOFAR/TOTALWORK*100 PCT, trunc(TIME_REMAINING/60) MIN_RESTANTES, 
trunc(ELAPSED_SECONDS/60) MIN_ATEAGORA 
from v$session_longops where TOTALWORK>0 and OPNAME like '%RMAN%';

Output:


How to disable all scheduled concurrent programs after refresh

Below script to disable scheduled concurrent programs after refresh.

Script:

update fnd_concurrent_requests
set phase_code='C',
status_code='D'
where phase_code = 'P'
and (status_code = 'I' OR status_code = 'Q');
and requested_start_date >= SYSDATE
and hold_flag = 'N';

Apache, Jserv, Forms, Jinitiator and Perl version in Oracle Ebiz R12

Below script to know the versions of Apache, Jserv, Forms, Jinitiator and Perl version in Oracle Ebiz R12.

Apache Version:

-bash-3.2$ $IAS_ORACLE_HOME/Apache/Apache/bin/httpd -v
Server version: Oracle-Application-Server-10g/10.1.3.5.0 Oracle-HTTP-Server
Server built:   Aug  1 2009 07:55:39

(Note : Red color is script and below is the output)

Java Version:

-bash-3.2$ sh -c "`awk -F= '$1 ~ /^JSERVJAVA.*$/ {print $2}' $ADMIN_SCRIPTS_HOME/java.sh` -version;"
java version "1.6.0_71"
Java(TM) SE Runtime Environment (build 1.6.0_71-b31)
Java HotSpot(TM) Server VM (build 20.71-b01, mixed mode)

JRE Version:

-bash-3.2$ cat $FORMS_WEB_CONFIG_FILE|grep sun_plugin_version| cut -c 1-35
sun_plugin_version=1.6.0_38

Forms Version:

-bash-3.2$ $ORACLE_HOME/bin/frmcmp_batch|grep Forms| grep Version
Forms 10.1 (Form Compiler) Version 10.1.2.3.0 (Production)

PL/SQL Version:

-bash-3.2$ $ORACLE_HOME/bin/frmcmp_batch|grep PL/SQL|grep Version
PL/SQL Version 10.1.0.5.0 (Production)

Perl Version:

-bash-3.2$ $IAS_ORACLE_HOME/perl/bin/perl -v|grep built
This is perl, v5.8.3 built for sun4-solaris-thread-multi

AD Jobs running more than 1 hour

Below script to know AD jobs running more than 1 hour.

Script:

select distinct t.job_name,
       TRUNC(t.ELAPSED_TIME * 24 * 60) MINUTES,
       t.PROGRAM_RUN_ID,
       t.product,
       t.start_time,
       t.end_time
  from applsys.AD_PROGRAM_RUN_TASK_JOBS t
 WHERE PROGRAM_RUN_ID in
       (select program_run_id
          from AD_PATCH_RUNS
         where patch_top like '/application_r12/apps/apps_st/appl/au/12.0.0/patch/115/driver')
 AND TRUNC(t.ELAPSED_TIME * 24 * 60) > 60
 ORDER BY 2 desc;

How to check Gather schema stats run in last 30 days

How many times GSS run in last 30 days in oracle.

Script:

set linesize 200
select  r.request_id,r.actual_start_date,r.phase_code,r.status_code,r.actual_completion_date,argument_text from
apps.fnd_concurrent_programs_vl p, apps.fnd_concurrent_requests r
where p.concurrent_program_id = r.concurrent_program_id
and p.application_id = r.program_application_id
and p.user_concurrent_program_name like '%Gather Schema Statistics%'
and  r.actual_start_date >= sysdate-30 order by r.requested_start_date;

Note: Run this query in Toad (or) sql developer for clear data.

Output:

Saturday 9 January 2016

Health check of oracle Ebiz database and applications

The below script is very useful to get the health check of oracle ebiz database and application.

Script:

SQL>conn apps/***
SQL>spool health_check_apps_db.out

set pages 1000
set linesize 135
col PROPERTY_NAME for a25
col PROPERTY_VALUE for a15
col DESCRIPTION for a35
col DIRECTORY_PATH for a70
col directory_name for a25
col OWNER for a10
col DB_LINK for a40
col HOST for a20
col "User_Concurrent_Queue_Name" format a50 heading 'Manager'
col "Running_Processes" for 9999 heading 'Running'
set head off
set feedback off
set echo off

break on utl_file_dir

select '--------------------------------------------------------------------------------' from dual;
select '-----------------------     Database Checks    ---------------------------------' from dual;
select '--------------------------------------------------------------------------------' from dual;
Prompt
select '************************ Getting Database Information  *************' from dual ;

select 'Database Name..................... : '||name from v$database;
select 'Database Status................... : '||open_mode from v$database;
select 'Archiving Status.................. : '||log_mode  from v$database;
select 'Global Name....................... : '||global_name from global_name;
select 'Creation Date..................... : '||to_char(created,'DD-MON-YYYY HH24:MI:SS') from v$database;
select 'Checking For Missing File......... : '||count(*) from v$recover_file;
select 'Checking Missing File Name ....... : '||count(*) from v$datafile where name like '%MISS%';
select 'Total SGA ........................ : '||round(sum(value)/(1024*1024))||' MB' from v$sga ;
select 'Database Version.................. : '||version from v$instance;
select 'Temporary Tablespace.............. : '||property_value from database_properties
                                                where property_name like 'default_temp_tablespace';
select 'Apps Temp Tablespace.............. : '||temporary_tablespace from dba_users where username like '%APPS%';
select 'Temp Tablespace size.............. : '||sum(maxbytes/1024/1024/1024)||' GB' from dba_temp_files group by tablespace_name;
select 'No of Invalid Object ............. : '||count(*) from dba_objects where status = 'INVALID' ;
select 'service Name...................... : '||value from v$parameter2 where name='service_names';
select 'plsql code type................... : '||value from v$parameter2 where name='plsql_code_type';
select 'plsql subdir count................ : '||value from v$parameter2 where name='plsql_native_library_subdir_count';
select 'plsql native library dir.......... : '||value from v$parameter2 where name='plsql_native_library_dir';
select 'Shared Pool Size.........,........ : '||(value/1024/1024) ||' MB' from v$parameter where name='shared_pool_size';
select 'Log Buffer........................ : '||(value/1024/1024) ||' MB' from v$parameter where name='log_buffer';
select 'Buffer Cache...................... : '||(value/1024/1024) ||' MB' from v$parameter where name='db_cache_size';
select 'Large Pool Size................... : '||(value/1024/1024) ||' MB' from v$parameter where name='large_pool_size';
select 'Java Pool Size.................... : '||(value/1024/1024) ||' MB' from v$parameter where name='java_pool_size';
select 'utl_file_dir...................... : '||value from v$parameter2 where name='utl_file_dir';
select directory_name||'.................... : '||directory_path from all_directories where rownum  < 15 ;

select '************************ Getting Apps Information *****************' from dual ;

select 'Home URL.......................... : '||home_url from apps.icx_parameters ;
select 'Session Cookie.................... : '||session_cookie from apps.icx_parameters ;
select 'Applicaiton Database ID........... : '||fnd_profile.value('apps_database_id') from dual;
select 'GSM Enabled....................... : '||fnd_profile.value('conc_gsm_enabled') from dual;
select 'Maintainance Mode................. : '||fnd_profile.value('apps_maintenance_mode') from dual;
select 'Site Name......................... : '||fnd_profile.value('Sitename')from dual;
select 'Bug Number........................ : '||bug_number from ad_bugs where bug_number='2728236';

select '************************ Doing Workflow Checks ********************' from dual ;

select 'No Open Notifications............. : '||count(*) from wf_notifications where mail_status in('MAIL','INVALID','OPEN');
select 'Name(wf_systems).................. : '||name from wf_systems;
select 'Display Name(wf_systems).......... : '||display_name from wf_systems;
select 'Address........................... : '||address from wf_agents;
select 'Workflow Mailer Status............ : '||component_status from applsys.fnd_svc_components
                                                where component_name like 'Workflow Notification Mailer';
select 'Test Address...................... : '||b.parameter_value
                                                from fnd_svc_comp_param_vals_v a, fnd_svc_comp_param_vals b
                                                where a.parameter_id=b.parameter_id
                                                and a.parameter_name in ('TEST_ADDRESS');
select 'From Address...................... : '||b.parameter_value
                                                from fnd_svc_comp_param_vals_v a, fnd_svc_comp_param_vals b
                                                where a.parameter_id=b.parameter_id
                                                and a.parameter_name in ('FROM');
select 'WF Admin Role..................... : '||text from wf_resources where name = 'WF_ADMIN_ROLE' and  rownum =1;


Prompt
Prompt Getting Apps Node Info
Prompt ************************
select Node_Name,'........................ : '||server_id from fnd_nodes;
select server_type||'......................: '||name from fnd_app_servers, fnd_nodes
                                                where fnd_app_servers.node_id =fnd_nodes.node_id;

select '************************ Doing Conc Mgr Checks  ********************' from dual ;

Prompt Getting Con Mgr Status
Prompt ************************
Prompt
Prompt Manager Name                                                 Hostname          No of Proc Running
Prompt ~~~~~~~~~~~~                                                 ~~~~~~~~          ~~~~~~~~~~~~~~~~~~
set lines 145
Column Target_Node   Format A12
select User_Concurrent_Queue_Name,'....... : '||Target_Node||' ...... : '||Running_Processes
                                                from fnd_concurrent_queues_vl
                                                where Running_Processes = Max_Processes
                                                and Running_Processes > 0;

Prompt
Prompt Getting Pending Request
Prompt ***********************
--select user_concurrent_program_name||'........ : '||request_id
--                                                  from fnd_concurrent_requests r, fnd_concurrent_programs_vl p, fnd_lookups s, fnd_lookups ph
--                                                  where r.concurrent_program_id = p.concurrent_program_id
--                                                 and r.phase_code = ph.lookup_code
--                                                and ph.lookup_type = 'CP_PHASE_CODE'
--                                               and r.status_code = s.lookup_code
--                                                  and s.lookup_type = 'CP_STATUS_CODE'
--                                                  and ph.meaning ='Pending'
--                                                  and rownum < 10
--                                                  order by to_date(actual_start_date, 'dd-MON-yy hh24:mi');
--

Prompt
Prompt Getting Workflow Components Status
Prompt **********************************

set pagesize 1000
set linesize 125
col COMPONENT_STATUS for a20
col COMPONENT_NAME for a45
col STARTUP_MODE for a12

select fsc.COMPONENT_NAME,
fsc.STARTUP_MODE,
fsc.COMPONENT_STATUS,
fcq.MAX_PROCESSES TARGET,
fcq.RUNNING_PROCESSES ACTUAL
from APPS.FND_CONCURRENT_QUEUES_VL fcq, APPS.FND_CP_SERVICES fcs,
APPS.FND_CONCURRENT_PROCESSES fcp, fnd_svc_components fsc
where fcq.MANAGER_TYPE = fcs.SERVICE_ID
and fcs.SERVICE_HANDLE = 'FNDCPGSC'
and fsc.concurrent_queue_id = fcq.concurrent_queue_id(+)
and fcq.concurrent_queue_id = fcp.concurrent_queue_id(+)
and fcq.application_id = fcp.queue_application_id(+)
and fcp.process_status_code(+) = 'A'
order by fcp.OS_PROCESS_ID, fsc.STARTUP_MODE;

select '--------------------------------------------------------------------------------' from dual;
select '-----------------------     End Of Database Checks  ----------------------------' from dual;
select '--------------------------------------------------------------------------------' from dual;


SQL>spool off

Hope this post helps you :)

Thursday 7 January 2016

Cocurrent managers details from backend in oracle application

Below script to get all the concurrent manager details in oracle apps.

Script:

set lines 199
----set pagesize 9999
select
decode (CONCURRENT_QUEUE_NAME,
'FNDICM','Internal Manager',
'FNDCRM','Conflict Resolution Manager',
'AMSDMIN','Marketing Data Mining Manager',
'C_AQCT_SVC','C AQCART Service',
'FFTM','FastFormula Transaction Manager',
'FNDCPOPP','Output Post Processor',
'FNDSCH','Scheduler/Prereleaser Manager',
'FNDSM_AQHERP','Service Manager: AQHERP',
'FTE_TXN_MANAGER','Transportation Manager',
'IEU_SH_CS','Session History Cleanup',
'IEU_WL_CS','UWQ Worklist Items Release for Crashed session',
'INVMGR','Inventory Manager',
'INVTMRPM','INV Remote Procedure Manager',
'OAMCOLMGR','OAM Metrics Collection Manager',
'PASMGR','PA Streamline Manager',
'PODAMGR','PO Document Approval Manager',
'RCVOLTM','Receiving Transaction Manager',
'STANDARD','Standard Manager',
'WFALSNRSVC','Workflow Agent Listener Service',
'WFMLRSVC','Workflow Mailer Service',
'WFWSSVC','Workflow Document Web Services Service',
'WMSTAMGR','WMS Task Archiving Manager',
'XDP_APPL_SVC','SFM Application Monitoring Service',
'XDP_CTRL_SVC','SFM Controller Service',
'XDP_Q_EVENT_SVC','SFM Event Manager Queue Service',
'XDP_Q_FA_SVC','SFM Fulfillment Actions Queue Service',
'XDP_Q_FE_READY_SVC','SFM Fulfillment Element Ready Queue Service',
'XDP_Q_IN_MSG_SVC','SFM Inbound Messages Queue Service',
'XDP_Q_ORDER_SVC','SFM Order Queue Service',
'XDP_Q_TIMER_SVC','SFM Timer Queue Service',
'XDP_Q_WI_SVC','SFM Work Item Queue Service',
'XDP_SMIT_SVC','SFM SM Interface Test Service') as "Concurrent Manager's Name",
max_processes as "TARGET Processes",
running_processes as "ACTUAL Processes"
from apps.fnd_concurrent_queues where CONCURRENT_QUEUE_NAME in
('FNDICM','FNDCRM','AMSDMIN','C_AQCT_SVC','FFTM','FNDCPOPP','FNDSCH','FNDSM_AQHERP',
'FTE_TXN_MANAGER','IEU_SH_CS','IEU_WL_CS','INVMGR','INVTMRPM','OAMCOLMGR','PASMGR',
'PODAMGR','RCVOLTM','STANDARD','WFALSNRSVC','WFMLRSVC','WFWSSVC','WMSTAMGR',
'XDP_APPL_SVC','XDP_CTRL_SVC','XDP_Q_EVENT_SVC','XDP_Q_FA_SVC','XDP_Q_FE_READY_SVC',
'XDP_Q_IN_MSG_SVC','XDP_Q_ORDER_SVC','XDP_Q_TIMER_SVC','XDP_Q_WI_SVC','XDP_SMIT_SVC');

Output:



Tablespace growth report using sqlplus

Below script to find the growth of tablespace in oracle database:

Script:

set linesize 120
column name format a15
column variance format a20
alter session set nls_date_format='yyyy-mm-dd';
with t as (
select ss.run_time,ts.name,round(su.tablespace_size*dt.block_size/1024/1024/1024,2) alloc_size_gb,
round(su.tablespace_usedsize*dt.block_size/1024/1024/1024,2) used_size_gb
from
dba_hist_tbspc_space_usage su,
(select trunc(BEGIN_INTERVAL_TIME) run_time,max(snap_id) snap_id from dba_hist_snapshot
group by trunc(BEGIN_INTERVAL_TIME) ) ss,
v$tablespace ts,
dba_tablespaces dt
where su.snap_id = ss.snap_id
and   su.tablespace_id = ts.ts#
---and   ts.name          =upper('&TABLESPACE_NAME')
and   ts.name          = dt.tablespace_name )
select e.run_time,e.name,e.alloc_size_gb,e.used_size_gb curr_used_size_gb,b.used_size_gb prev_used_size_gb,
case when e.used_size_gb > b.used_size_gb then to_char(e.used_size_gb - b.used_size_gb)
     when e.used_size_gb = b.used_size_gb then '***NO DATA GROWTH'
     when e.used_size_gb < b.used_size_gb then '******DATA PURGED' end variance
from t e, t b
where e.run_time = b.run_time + 1
order by 1;

Output:



Oracle database growth

Below script to get the growth of the oracle database

Script:

select to_char(CREATION_TIME,'RRRR') year,to_char(CREATION_TIME,'MM') month,round(sum(bytes)/1024/1024/1024) gb
from v$datafile group by to_char(CREATION_TIME,'RRRR'),to_char(CREATION_TIME,'MM') order by 1,2;

Output:

SQL> select to_char(CREATION_TIME,'RRRR') year,to_char(CREATION_TIME,'MM') month,round(sum(bytes)/1024/1024/1024) gb
from v$datafile group by to_char(CREATION_TIME,'RRRR'),to_char(CREATION_TIME,'MM') order by 1,2;  2

YEAR MO         GB
---- -- ----------
2000 04         10
2001 05          2
2001 10          1
2001 11          0
2001 12          4
2002 05          0
2003 05          1
2004 05         33
2004 09         10
2004 12          0
2005 02          0

YEAR MO         GB
---- -- ----------
2005 05          7
2005 07          8
2006 07          2
2007 06          8
2008 01          6
2008 07        234
2008 11          4
2009 01         32
2009 05          8
2009 12          8
2010 05         29

YEAR MO         GB
---- -- ----------
2010 06          8
2010 07          8
2010 08          8
2010 09          8
2010 10          8
2010 12         16
2011 04         16
2011 06          8
2011 07          8
2011 09          8
2011 12          8

YEAR MO         GB
---- -- ----------
2012 03          8
2012 04          8
2012 05          5
2012 06         22
2012 07          8
2012 08         24
2012 09         16
2012 10         43
2012 11         24
2012 12         24
2013 01        105

YEAR MO         GB
---- -- ----------
2013 04         56
2013 05         16
2013 07          8
2013 08         20
2013 09         32
2013 10         96
2013 12         16
2014 01         16
2014 02          4
2015 03         31
2015 08          2

YEAR MO         GB
---- -- ----------
2015 11         13
2015 12         10

57 rows selected.