Sunday, April 17, 2016

Concurrent Processing Analyzer


The Concurrent Processing Analyzer is a Self-Service Health-Check script which reviews the overall Concurrent Processing Footprint, analyzes the current configurations and settings for the environment providing feedback and recommendations on Best Practices.

NOTE: This is a non-invasive script - (Query only) it just reports on it. The Analyzer identifies known issues and provides solutions and recommended actions to be performed for the specific instance it was run on and can be run at any time. For production instances, always apply any changes to a recent clone to ensure an expected outcome.

Benefits
Immediate analysis and output of Concurrent Processing data from a particular environment
Identifies Concurrent Processing system setup and configurations
Provides recommended actions and best practices
Runs as a standalone or Concurrent Request

E-Business Applications Concurrent Request Analysis
  • Long Running Reports During Business Hours 
  • Elapsed Time History of Concurrent Requests 
  • Requests Currently Running on a System 
  • FND_CONCURRENT_REQUESTS Totals 
  • Running Requests 
  • Total Pending Requests by Status Code 
  • Count of Pending Regularly Scheduled Requests 
  • Count of Pending Non Regularly Scheduled Requests 
  • Count of Pending Requests on Hold 
  • Count of Pending Requests Not on Hold 
  • Listing of Scheduled Requests 
  • Listing of Pending Requests on Hold 
  • Listing of Scheduled Requests 
  • Volume of Daily Concurrent Requests for Last Month 
  • Identify/Resolve the "Pending/Standby" Issue, if Caused by Run Alone Flag 
  • Tablespace Statistics for the FND_CONCURRENT Tables 
  • Additional Tablespace Statistics for the FND_CONCURRENT Tables 
E-Business Applications Concurrent Manager Analysis
  • Concurrent Managers Active/Enabled and Workshifts 
  • Active Managers for Applications not Installed/Used 
  • Total Target Processes for Request Managers Excluding Off-Hours 
  • Request Managers with Incorrect Cache Size 
  • Concurrent Manager Request Summary by Manager 
  • Check Manager Queues for Pending Requests 
  • Check the Configuration of OPP 
This script can be used from 11.x.

Run the Analyzer via Sql*Plus

NOTE : The Concurrent Processing Analyzer Report (CP_Analyzer_<host>.<domain>_<SID>_<date>.html) location is specified at the completion of the analyzer execution, when running via Sql*Plus

Log into SQL*Plus as the APPS user, and run the script. Example:
$ sqlplus apps/ @cp_analyzer.sql


SQL*Plus: Release 11.2.0.3.0 - Production on Mon Apr 17 23:03:13 2016
Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

Output Files are located on Host : .
Output file : 
    /usr/tmp/CP_Analyzer_.__.html
Log file: 
    /usr/tmp/CP_Analyzer_.__.log


PL/SQL procedure successfully completed.


Complete Information can be obtained from Doc ID 1411723.1 EBS Concurrent Processing (CP) Analyzer



Friday, April 8, 2016

Orale Home Space Issues Because OPatch Backups


Often we all face issues with the Oracle Homes getting filled, and most likely we will go and remove the .patch storage, But we end up facing challeneges when ever next time we try applying new patches.
Oracle Recommends safe way how we can clean up the .patch storage in safe and Easy way.

oracle:ORCL>opatch util cleanup -help

Oracle Interim Patch Installer version 12.1.0.1.6

Copyright (c) 2016, Oracle Corporation.  All rights reserved.


DESCRIPTION

     This utility cleans up 'restore.sh,make.txt' files and 'scratch,backup'

     directories of the.patch_storage directory of Oracle Home.If -ps option is used,

     then, it cleans the above specified areas only for that patch, else for all

     patches under ORACLE_HOME/.patch_storage. You will be still able to

     rollback patches after this cleanup.

SYNTAX

opatch util cleanup  [-invPtrLoc <Path to oraInst.loc> ]

                     [-jre <LOC> ] [-oh <ORACLE_HOME> ]

                     [-silent] [-report]

                     [-ps <patch ID with time stamp>, this will

                       be located under ORACLE_HOME/.patch_storage/]



OPTIONS

       -invPtrLoc

              Used to locate the oraInst.loc file. Needed when the

              installation used the -invPtrLoc flag. This should be

              the path to the oraInst.loc file.



       -jre

              This option tells OPatch to use JRE (java) from the

              specified location instead of the default location

              under Oracle Home. Both -jdk and -jre options cannot

              be specified together. OPatch will display error in

              that case.



       -oh

              The oracle home to work on. This takes precedence over

              the environment variable ORACLE_HOME.



       -ps

              This option is used to specify the Patch ID with timestamp.

              This Patch ID with timestamp should be the same as in

              .patch_storage directory.



              A directory by this name will be present under

              ORACLE_HOME/.patch_storage. If this directory is specified

              and is valid, then the contents specified in the description

              will be cleaned up only for this patch. Otherwise, all patch

              related directories will be acted upon by this utility.



      -silent

              In silent mode, the cleanup always takes place.



      -report

              Prints the operations without actually executing them.

OPatch succeeded.

64bit test-db ~

oracle:ORCL>

Ref: How To Avoid Disk Full Issues Because OPatch Backups Take Big Amount Of Disk Space. (Doc ID 550522.1)

Locate and Download Recommanded Patches from MOS

To locate WebLogic patches for the versions you are interested in:

  1. Log onto My Oracle Support.
  2. Click on the "Patches & Updates" tab.
  3. Click on "Product or Family (Advanced Search)."
  4. For the "Product is" choose Oracle WebLogic Server
  5. For the "Release is" choose the WebLogic Server releases you want to search on.
  6. Choose "Platform" or (Select the default which is "Select up to 5" for any platforms).
  7. Hit Search.




Complete Information can be located in MOS NOTE:

How to Locate and Download Patches for WebLogic Server Using My Oracle Support (Doc ID 1302053.1)

To locate WebLogic Advised patches for the versions you are interested in:

  1. Log onto My Oracle Support.
  2. Click on the "Patches & Updates" tab.
  3. Click on "Recommended Patch Advisor."
  4. For the "Product is" choose Oracle WebLogic Server
  5. For the "Release is" choose the WebLogic Server releases you want to search on.
  6. Choose "Platform" or (Select the default which is "Select up to 5" for any platforms).
  7. Hit Search.


Saturday, April 2, 2016

Some useful scripts.


1) Running programs, user names

/* Script to show the running programs,username and time */
SELECT   q.concurrent_queue_name || ' - ' || target_node qname,
         a.request_id "Req Id", fu.user_name, a.phase_code, a.status_code,
           (NVL (actual_completion_date, SYSDATE) - actual_start_date
           )
         * 1440 "Time",
            c.concurrent_program_name
         || ' ('
         || TO_CHAR (c.concurrent_program_id)
         || ')' intprog,
         ctl.user_concurrent_program_name "program"
    FROM applsys.fnd_concurrent_requests a,
         applsys.fnd_concurrent_processes b,
         applsys.fnd_concurrent_queues q,
         applsys.fnd_concurrent_programs c,
         applsys.fnd_concurrent_programs_tl ctl,
         applsys.fnd_user fu
   WHERE a.controlling_manager = b.concurrent_process_id
     AND a.concurrent_program_id = c.concurrent_program_id
     AND a.program_application_id = c.application_id
     AND a.status_code IN ('I', 'H', 'W', 'Q', 'R', 'F')
     AND a.phase_code IN ('P', 'R')
     AND b.queue_application_id = q.application_id
     AND b.concurrent_queue_id = q.concurrent_queue_id
     AND ctl.concurrent_program_id = c.concurrent_program_id
     AND ctl.LANGUAGE = 'US'
     AND fu.user_id = a.requested_by
ORDER BY 6 DESC;


2) Request id to Trace file name


/* Request id to Trace file name*/

SELECT 'Request id: ' || request_id, 'Trace id: ' || oracle_process_id,
       'Trace Flag: ' || req.enable_trace,
          'Trace Name: 
'
       || dest.VALUE
       || '/'
       || LOWER (dbnm.VALUE)
       || '_ora_'
       || oracle_process_id
       || '.trc',
       'Prog. Name: ' || prog.user_concurrent_program_name,
       'File Name: ' || execname.execution_file_name
       || execname.subroutine_name,
          'Status : '
       || DECODE (phase_code, 'R', 'Running')
       || '-'
       || DECODE (status_code, 'R', 'Normal'),
       'SID Serial: ' || ses.SID || ',' || ses.serial#,
       'Module : ' || ses.module
  FROM fnd_concurrent_requests req,
       v$session ses,
       v$process proc,
       v$parameter dest,
       v$parameter dbnm,
       fnd_concurrent_programs_vl prog,
       fnd_executables execname
 WHERE req.request_id = &request
   AND req.oracle_process_id = proc.spid(+)
   AND proc.addr = ses.paddr(+)
   AND dest.NAME = 'user_dump_dest'
   AND dbnm.NAME = 'db_name'
   AND req.concurrent_program_id = prog.concurrent_program_id
   AND req.program_application_id = prog.application_id
   AND prog.application_id = execname.application_id
   AND prog.executable_id = execname.executable_id;

~~ Cheer
s

Concurrent Managers


Concurrent Managers
Concurrent Managers, typically, allow you to execute long running and data intensive application programs asynchronously.
Concurrent Processing
Concurrent Processing is the running of batch type jobs interspersed (concurrently) with typical transactional transactions without having either impact the performance of the other.
In Concurrent Processing, Concurrent Managers run Concurrent Programs from Concurrent Program Libraries either on demand or on a set schedule that is defined in terms of work shifts.
There are many predefined libraries. Below Table 1.1 gives a few of the libraries with their executable name and the Concurrent Manager description that can run the immediate programs.
Table 1.1 Concurrent Manager Executable Descriptions
Executable
Concurrent Manager Description
ARLIBR
Receivables Tax Engine.
CYQLIB
Capacity Manager.
FNDCRM
Conflict Resolution Manager.
FNDIMON
Internal Monitor.
FNDLIBR
Applications Object Library (AOL) — The ICM and the Standard Manager are both members of this library.
FNDSCH
Scheduler Manager.
INVLIBR
Inventory Manager Library.
MRCLIB
Oracle MRP Library.
PALIBR
Oracle Project Accounting.
POXCON
Purchase Order Document Approval.
RCVOLTM
Receiving Transaction Manager.

Types of Concurrent Managers
Internal Concurrent Manager
The Internal Concurrent Manager (ICM) is the controlling manager for all of the others. When you start the Concurrent Managers, this is the only one that you actually have direct control over. This manager in turn starts all of the others depending on their schedules and work shifts. It controls starting and stopping all other managers based on the definition of their work shifts and it monitors for failures. If there are failures, it cleans up after them. Its definition cannot be changed after its startup. On starting, you can, by parameter passing, set its values for sleep time, PM ON on cycle, and queue size.
Conflict Resolution Manager
The Conflict Resolution Manager enforces all compatibility rules and based on priorities and run rules, determines which jobs can run when if there is a conflict in timing.
Scheduler Manager
The Scheduler Manager, a manager added in 11i, assists the ICM and the CRM in scheduling and conflict resolution.
Product Specific Concurrent Manager
There are many product specific Concurrent Managers. The list includes Inventory, MRP, and Projects, as well as any user-defined managers. Utilizing these managers can help you off-load some of the processing from the Standard Manager.
Standard Manager
The Standard Manager is the manager that ships with the Oracle E-Business Suite and accepts any and all requests and does not, as configured, have any specialization rules.
Transaction Managers
Conventional Concurrent Managers run batch type jobs that are typically long running, involve large amounts of data, and run asynchronously. Transaction Managers run synchronous processing of certain reports requested from a client program but run as a server side program. A Transaction Manager is owned by an application and associated with a data group. Due to this association, and the fact that it runs immediate programs, the Transaction Manager can only run programs contained within its program library.
Checking the Status of a Manager
Applications Interface Method
Through the Applications interface, Log into the sysadmin responsibility and navigate to the Concurrent Manager Administration Page.  shows the navigation screen.
On this screen, check to make sure that the nonzero numbers in the Target and Actual columns match. Target is the number of processes that should be running for each individual manager during the current work shift. The Actual column shows the number of processes that are actually currently running. If the number in the Target column is 0, that manager is not scheduled for this work shift. If the number in the Target column is not 0, but the number in the Actual column is 0, then you should have processes running for the given manager, but do not.
SQL Script Method
A less descriptive method to determine if the Concurrent Manager is running on the system is to find the afimchk.sql script located in your $FND_TOP/sql directory and run that script at a SQL prompt:
SQL>@$FND_TOP/sql/afimchk
Operating System Process Method
An operating Concurrent Manager creates a library process at the OS level on the Concurrent Manager host server. The ICM creates a process called FNDLIBR. If you run the following command, you can get an idea of what library processes you have running on your server.
ps -ef |grep LIBR
Oracle Application Manager Method
Oracle Applications Manager in the 11i Suite, check on the status of your Concurrent Managers, define new managers, start and stop managers, and edit properties of current Concurrent Managers.
The same Target and Actual columns are available and they provide the same information as is available through the Concurrent Manager Administration Page. You can drill out quickly and easily to requests for each manager, the status for each manager, and the running and pending request detail. Further, you can start and stop and activate and deactivate any of the defined managers.
Starting Individual Managers
You can activate or restart individual managers by changing their status in the Administer Managers form. Restarting a manager forces the Internal Manager to go out and reread that manager's definition. Activating a manager undoes a previous command to deactivate it and allows the Internal Manager to start it when its next scheduled work shift starts.
Deactivating Individual Managers
Deactivation can take two different paths. You can either choose to deactivate a manager and abort all requests that that manager is acting on or you can choose to allow it to finish its active requests before it shuts down. Terminated requests are marked for resubmission the next time that the manager is activated. If a manager is explicitly deactivated, it has to be explicitly activated and the Internal Manager has to be active at the time of reactivation.
Concurrent Programs are designed in such a way that regardless of the reason for termination, there will be no data loss.
Verify a Manager's Status
Controlling Internal Manager
You can control the Internal Manager from the command line of the OS by using the STARTMGR command  to start it or through the CONCSUB command to deactivate, verify, or abort it. The utility can only be run on the server on which the Concurrent Managers are running, but can be called on that server from any other server on the same network.
STARTMGR
STARTMGR starts the ICM, which in turn starts all Concurrent Managers defined that should be running for that work shift. To successfully run this command, you have to be logged into the server with a user ID that has write privileges to the log directory and the out directory of every application, otherwise, the Concurrent Manager will be unable to write some or all of its files. STARTMGR has to be run anytime you have shutdown the Concurrent Managers, after the server has been rebooted, or after the database has been restarted.
$ startmgr sysmgr=" apps/apps" mgrname='std"
printer="lpr_finance" mailto="jdoe" restart=" N"
logfile="mymanagerlog" queuesize="15" pmon="10"
sleep="60"
Table 1.2: STARTMGR Command with 10 Optional Parameters
Parameter
Description
Default
Sysmgr
Apps schema user ID and password.
Apps/apps
Mgrname
Name of the ICM (used for locking purposes).
STD
Printer
Default printer to which you want output sent.
No default
mailto
List of usernames who need to be informed whenever the ICM terminates.
Applmgr
Restart
Should the manager restart after a crash? Valid values are N (for no) or the number of seconds that it should wait to restart after abnormal stop.
N
Logfile
User specified file to use for the manager's own log file (not to be confused by the logs for the requests).
Std.mgr
Sleep
Number of seconds for the ICM to wait between checking for new requests in the FND_CONCURRENT_REQUESTS table.
60
PMon
Number of sleep cycles that the ICM or the CRM will wait before checking for failed managers. This can be set lower than the default as the PMon resources that are dedicated to this process does not require such a long sleep interval.
20
Quesiz
Number of PMon iterations that the Internal Concurent Manager will wait while scanning for sudden changes in the number of actively running Concurrent Manager workers.
1
Diag
Diagnostic output to be produced to aid in debugging. The default (N) provides better performance. Can also be set to Y.
N
These commands start the ICM, which in turn starts up the CRM and the Scheduler Manager, followed by any specialized managers depending on their work shifts. FND_CONCURRENT_QUEUES and FND_CONCURRENT_QUEUE_SIZE provide information to the ICM about each manager, its work shift, and the target number of processes to be started (based on the value in the MAX_PROCESSES column of the FND_CONCURRENT_QUEUE table). If you want to verify that there is at least one Concurrent Manager process running on your server, you can check the Task Manager on Windows for a FNDLIBR process or ps -ef |grep FNDLIBR on a UNIX platform (ps -ef |grep FNDLIBR will work on Windows as well, thanks to the running of MKS Toolkit). FNDLIBR is the program library process that gets spawned when the ICM or any generic Standard Manager is running on your system. CRM program library process appears as FNDCRM.
Oracle Support will often have you check for the existence of FNDLIBR processes if it appears that your ICM did not start.
Once the managers are started on the system, ICM will insert one row into the FND_CONCURRENT_PROCESSES table for each running manager and one row for itself and will update the RUNNING_PROCESSES column in the FND_CONCURRENT_QUEUES table to reflect the actual number of running processes. When the actual number in the RUNNING_PROCESSES column matches the target number in the MAX_PROCESSES column, all managers that are scheduled for the current work shift are running. Each entry in the FND_CONCURRENT_PROCESSES table identifies the process ID (PID) of the OS process as well as the process's status code.
CONCSUB
CONCSUB is a utility for allowing the sysadmin username and password to have the ability to submit concurrent requests at the OS level. This utility, unlike many of the Applications utilities, is not menu driven. It runs from the command line, submits a concurrent request, and returns you to the command prompt once the concurrent request completes. You can check the status of your concurrent request via the Concurrent Request form.
The CONCSUB command takes the following form:

CONCSUB applsys/pwd  'responsibility  application
shortname' 'responsibility name' 'username' [wait=]
CONCURRENT 'Program  application shortname'  PROGRAM

Table below defines the parameters and their meaning.
1.3 CONCSUB Parameters and Their Meanings
Parameter
Meaning
Applsys/pwd
Oracle application username and password that connects to Applications Object Library.
Responsibility Application Short Name
Application shortname of the responsibility you want to run the request for.
Responsibility Name
Name of the responsibility for which you want to run the request.
Username
Username of the person who is submitting the request.
Wait
Do you want CONCSUB to wait before returning the OS command prompt?
N (default value) waits until the job completes.
Y returns you to the command prompt.
"n" is the number of seconds to wait before it exits.
If this parameter is used, it has to come before concurrent.
Program Application Short Name
Short name of the program (for deactivate, abort, and verify, the program application shortname is FND).
PROGRAM
The program to submit (e.g., DEACTIVATE, VERIFY, ABORT).

Example of a CONCSUB command:
Concsub applsys/apps SYSADMIN 'system Administraor'
SYSADMIN  concurrent fnd deactivate

You can use CONCSUB to shutdown Concurrent Managers before the sysadmin reboots the server, before the database administrator shuts down the database, or when you need changes to Concurrent Managers to take effect.

Coming next how to ensure that terminated concurrent request freed up its process at DB and Os level...

~~~ Cheers

FNDCPASS Usage..Tricks and Methods

In Oracle Application 11i and R12, we have an FND functionality for changing the passwords for either application user, or product schema password or most important the “APPS” password. The FND binary which will help us is doing these things is FNDCPASS.

This is present in $FND_TOP/bin directory.

This post explains the usage of FNDCPASS, best practices that needs to be followed while using FNDCPASS and some tricks when FNDCPASS screws up the instance :))

Using FNDCPASS

Below is the usage for FNDCPASS
$FNDCPASS
Usage: FNDCPASS logon 0 Y system/password mode username new_password

where logon is username/password[@connect]

system/password is password of the system account of that database

mode is SYSTEM/USER/ORACLE

username is the username where you want to change its password

new_password is the new password in unencrypted format

Example:
FNDCPASS apps/apps 0 Y system/manager SYSTEM APPLSYS WELCOME
FNDCPASS apps/apps 0 Y system/manager ORACLE GL GL1
FNDCPASS apps/apps 0 Y system/manager USER VISION WELCOME

You can just type FNDCPASS and press enter, it will give you these details.

The first usage
FNDCPASS apps/apps 0 Y system/manager SYSTEM APPLSYS WELCOME

is for changing the password for apps and applsys. These are the database schema users
(most important for application to work). Password for both these users should be in synch. You can change the password of these users using this command. Note that this is the only way to change the password for apps and applsys. Please do not try any other method for changing apps and applsys password. Oracle recomends using FNDCPASS only to change apps and applsys password. Also note that using this command will change the password for both apps and applsys.

Following activities will take place

(1) applsys validation. (make sure APPLSYS name is correct)
(2) reencrypt all password in FND_USER
(3) reencrypt all password in FND_ORACLE_USERID
(4) update applsys’s password in FND_ORACLE_USERID table.
(5) Update apps password in FND_ORACLE_USERID table. Also changes are made in DBA_USERS table.

The second usage
FNDCPASS apps/apps 0 Y system/manager ORACLE GL GL1

is for changing password for any other product schema like MSC, GL etc.

Following activities will take place
(1) update GL’s password in FND_ORACLE_USERID table. The new password is reencrypted
with the current applsys password. If GL does not exists, step (2) below does not happen. Message for invalid oracle user is written in the log file.

(2) alter user to change GL’s password.


The third usage
FNDCPASS apps/apps 0 Y system/manager USER VISION WELCOME

is for changing the application level passwords like sysadmin etc used for logging into
application.

Following activities will take place
(1) update VISION’s password in FND_USER table. The new password is reencrypted
with the current applsys password.

If VISION does not exist, message for invalid application user is written in the log file.
No products affected by the patch When you run FNDCPASS command it will check the integrity of all schema password in the application. If any of the password is corrupt then this will through and error and will not change the password.

The tables that it uses is FND_USER and FND_ORACLE_USERID. All the application
passwords and schema passwords are stored in these two tables. Ofcourse DBA_USERS
will have the schema users and password stored as well.

When we run FNDCPASS it will update all the above 3 tables.

Best practices for using FNDCPASS
Before using FNDCPASS and changing the passwords from default to some thing else,
always follow the following best practices.
1) Always, Always, Always keep the back of tables FND_USER and FND_ORACLE_USERID. You can take back of these tables using CREATE TABLE —
AS SELECT * FROM —.

You must have backup of these tables before running FNDCPASS. In case if FNDCPASS fails then it might corrupt the passwords of your application and worst can happen that the application wont come up. So always be cautions about this command.

2) If possible also keep an export dump of these two tables.

3) Verify each arguement you are providing to FNDCPASS. Like verify that apps and system passwords you are providing is correct.

4) Never update apps, applsys or any schema password directly from database using the alter command. Always use FNDCPASS. System password can be set directly using ALTER command in database.

Issue with APPLSYS and APPS password

Scenario 1:
As you know that apps and applsys password should be in synch and should be changed
using FNDCPASS.
There can be situation where a novice user changes applsys password from the backend
database. In that case when you try to start the services it will show following error
APPFND01496:

Cannot access application ORACLE password

Cause: Application Object Library was unable access your ORACLE password.
You can even reproduce this issue (ofcourse after taking the backup of FND_USER and
FND_ORACLE_USERID table) using the following steps:

1. Use the ALTER USER command to change the APPLSYS password
2. Try to run the adstrall.sh script to start Apps services.
3. You will get an error “Cannot complete applications logon. You may have entered an invalid applications password, or there may have been a database connect error.”
4. Then try FNDCPASS to fix password and you will get the error the APPFND01496
error.

If this situation happens then you cannot access the application. In fact the services even wont start.
Resolution to such problem is to rollback the 2 tables FND_USER and FND_ORACLE_USERID. Once you rollback the tables, apps and applsys passwords will be in synch and password will be older one. You can then run FNDCPASS and change the password.

Scenario 2:
Some times when you run FNDCPASS, you get following error
APPFND01502: Cannot encrypt application ORACLE password

Cause: Application Object Library was unable encrypt your ORACLE password.

Action: Contact your support representative. (ORACLEUSER=APPS_SERV)
The error comes because the table fnd_oracle_userid contain rows for schemas that does
not exist. Those rows must be deleted from the table.

Use the following query to get the details of the schema that doest not exists
select * from fnd_oracle_userid
where oracle_username not in
(select username from all_users);

The rows returned by this query can be deleted from FND_ORACLE_USERID table.
This will resolve this issue.

Scenario 3:
There can be situation where users has update APPLSYS password using ALTER command in database directly and also you dont have backup of those tables. Under such situation, it is very difficult to recover the application and make it working. Still following methodology is proposed which might help you to restore the password back and make your application work fine.

For this to work you should have some other application (may be debug or UAT) which is having the same passwords or default passwords for schemas. If you have such application the following the below steps in the application which is affected by password mismatch.

This method is for resetting apps and applsys passwords. Below are the SQL statements that will help you reset the APPS and APPLSYS passwords to APPS, the APPLSYSPUB password to PUB, and the SYSADMIN password to SYSADMIN.

WARNING: This procedure will cause all user passwords to become invalid. ALL users
passwords will need to be reset through the sysadmin responsibility.

Step 1) Reset the Oracle User IDs
Open a SQL*Plus as SYSTEM and reset the passwords for the APPS, APPLSYS, and the
APPLSYSPUB Oracle user ID:

ALTER USER apps IDENTIFIED BY apps;
ALTER USER applsys IDENTIFIED BY apps;
ALTER USER applsyspub IDENTIFIED BY pub;

Step 2) Backup the FND_ORACLE_USERID and FND_USER tables (even though these tables are right now corrupted, do take a backup. You can restore the same when ever you want).

Open a SQL*Plus session as APPLSYS and backup the tables:
create table FND_ORACLE_USERID_BAK as (select * from FND_ORACLE_USERID);
create table FND_USER_BAK as (select * from FND_USER);
Step 3) Reset the APPS and APPLSYS application encrypted passwords
Open a SQL*Plus session as APPLSYS and update the FND_ORACLE_USERID table.
update FND_ORACLE_USERID
set ENCRYPTED_ORACLE_PASSWORD =
‘ZGA34EA20B5C4C9726CC95AA9D49EA4DBA8EDB705CB7673E645EED570D54
47161491D78D444554655B87486EF537ED9843C8'
where ORACLE_USERNAME in (’APPS’, ‘APPLSYS’);
commit;

This encrypted string we are updating is the default encrypted string for apps. So if your
application is having apps password the encrypted string will look like this. We are
updating this encrypted string here directly.

Verify the table update:
select ENCRYPTED_ORACLE_PASSWORD from FND_ORACLE_USERID
where ORACLE_USERNAME IN (’APPS’, ‘APPLSYS’);

Step 4) Reset the APPLSYSPUB application encrypted password
Open a SQL*Plus session as APPLSYS and update the FND_ORACLE_USERID table.

update FND_ORACLE_USERID
set ENCRYPTED_ORACLE_PASSWORD =
‘ZG31EC3DD2BD7FB8AD2628CE87DDDF148C1D2F248BE88BE987FDF8283022
8A88EF44BC78BC7A9FAD4BFB8F09DAD49DF7280E’
where ORACLE_USERNAME = (’APPLSYSPUB’);
commit;

The above encrypted string is the encrypted string for password pub. If your applsyspub
password is pub then the encrypted string in FND_ORACLE_USERID will look like
this.
Verify the table update:
select ENCRYPTED_ORACLE_PASSWORD
from FND_ORACLE_USERID
where ORACLE_USERNAME = ‘APPLSYSPUB’;

Once these updates are done, try your luck by running FNDCPASS and it should work fine.

~~ Cheers

Currently Running sqls.....

I was working on identifying the currently running sql statements.
Here are interesting facts I found and thought sharing with you all.
Active Sessions:
SELECT      username
         || '('
         || SID
         || ','
         || serial#
         || ') ospid = '
         || process
         || ' command = '
         || command
         || ' program = '
         || program username,
         TO_CHAR (logon_time, ' Day HH24:MI') logon_time,
         TO_CHAR (SYSDATE, ' Day HH24:MI') current_time, sql_address,
         last_call_et, SID, paddr
    FROM v$session
   WHERE status = 'ACTIVE'
     AND RAWTOHEX (sql_address) != '00'
     AND username IS NOT NULL
ORDER BY last_call_et
last_call_et field from v$session;
If the session STATUS is currently ACTIVE, then the value represents the elapsed time in seconds since the session has become active.
If the session STATUS is currently INACTIVE, then the value represents the elapsed time in seconds since the session has become inactive.
Currently running sql's:
SELECT s.sid, s.status, s.process, s.osuser, a.sql_text, p.program
  FROM v$session s, v$sqlarea a, v$process p
WHERE s.PREV_HASH_VALUE = a.hash_value
   AND s.PREV_SQL_ADDR = a.address   AND s.paddr = p.addr
   AND s.status = 'ACTIVE';
More precise way…
select sesion.sid,       sesion.serial#,       sesion.username,
       sesion.sql_id,       sesion.sql_child_number,       optimizer_mode,
       hash_value,       address,       sql_text
  from v$sqlarea sqlarea, v$session sesion
 where sesion.sql_hash_value = sqlarea.hash_value
   and sesion.sql_address    = sqlarea.address
   and sesion.username is not null;

The above queries will provide the information about all the sql which is currently being executed. With respect to the Oracle Applications if we want to find out what sql being currently executed for a particular request. 
Here is the way.    1) Get the SID from the Request id
                                 2) Get sql from the sid.
The first query will help us getting the sid,serial# from the request id, and other two will fetch the currently running sqls for the given sid. 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
select
   'Concurrent request number :'||a.request_id ,
   'Oracle session id(SID)    :'||d.sid,
   'Serial Hash value         :'||d.serial#,
   'OS process id (SPID)      :'||c.spid
from
   applsys.fnd_concurrent_requests a,
   applsys.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 c.addr=d.paddr
   and a.request_id=&RequestId   and a.phase_code='R';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
select sesion.sid,       sesion.serial#,
       sesion.username,       sesion.sql_id,
       sesion.sql_child_number,       optimizer_mode,
       hash_value,       address,       sql_text
  from v$sqlarea sqlarea, v$session sesion
 where sesion.sql_hash_value = sqlarea.hash_value
   and sesion.sql_address    = sqlarea.address
   and sesion.username is not null
   and sesion.sid=&sid;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SELECT sesion.username, 
       sesion.sql_id,        sesion.sql_child_number,        sql_text
  FROM v$sqltext sqltext, v$session sesion
 WHERE sesion.sql_hash_value = sqltext.hash_value
   AND sesion.sql_address = sqltext.address
   AND sesion.username IS NOT NULL
   AND sesion.SID = &sid;
Here I would like to mention few things about the different view available for the v$sql*
1.V$SQL
2.V$SQLTEXT
3.V$SQLAREA
4.V$SQLTEXT_WITH_NEWLINES
V$SQL: V$SQL lists statistics on shared SQL area without the GROUP BY clause and contains one row for each child of the original SQL text entered. Statistics displayed in V$SQL are normally updated at the end of query execution. However, for long running queries, they are updated every 5 seconds. This makes it easy to see the impact of long running SQL statements while they are still in progress.
V$SQLAREA : V$SQLAREA lists statistics on shared SQL area and contains one row per SQL string. It provides statistics on SQL statements that are in memory, parsed, and ready for execution.
V$SQLTEXT : This view contains the text of SQL statements belonging to shared SQL cursors in the SGA.
V$SQLTEXT_WITH_NEWLINES : This view is identical to the V$SQLTEXT view except that, to improve legibility, V$SQLTEXT_WITH_NEWLINES does not replace newlines and tabs in the SQL statement with spaces.
V$SQL_PLAN : V$SQL_PLAN contains the execution plan information for each child cursor loaded in the library cache.

In other words….
V$SQL – Will have the multiple copies of the query. (Details)
V$SQLAREA – Is aggregate  of v$sql.  It selects out DISTINCT sql.
V$SQLTEXT  -- is simply a way to see the entire query.  the v$sql and v$sqlarea views only show the first 1000 bytes.  newlines and other control characters are replace with whitespace.
V$SQLTEXT_WITH_NEWLINES is v$sqltext without the whitespace replacement.

So whenever you need to identify the currently running sql you can do this way. And helped you understand  use for various v$sql* views.

~~ Cheers

How To Ensure Terminated conc program freed DB/OS Sessions

FND_CONCURRENT_REQUESTS table Codes meanings..

Often while trouble shooting with the concurrent requests table we may wonder what does status_code and phase_code internally, meaning of the codes in the status_code and phase_code columns of the FND_CONCURRENT_REQUESTS table are as follows.... 

STATUS_CODE Column:
==================
Code Meaning
A Waiting
B Resuming
C Normal
D Cancelled
E Error
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

PHASE_CODE column:
==================
Code Meaning
C Completed
I Inactive
P Pending
R Running

/*Get the Details of the Program */
SELECT 'Concurrent request number :' || a.request_id,
       'Oracle session id(SID)    :' || d.SID,
       'Serial Hash value         :' || d.serial#,
       'OS process id (SPID)      :' || c.spid,
       'Phase Code                :' || DECODE (a.phase_code,
                  'P', 'Pending',
                  'R', 'Running',
                  'C', 'Completed'
                 ) "PHASE_CODE",
       'Status Code               :' || DECODE (a.status_code,
                  'H', 'On Hold',
                  'I', 'Normal',
                  'W', 'Paused',
                  'S', 'Suspended',
                  'T', 'Terminating',
                  'D', 'Cancelled',
                  'X', 'Terminated'
                 ) "STATUS_CODE",
       'Actual Start Date        : ' || a.actual_start_date,
       'Actual Complete Date     : ' || a.actual_completion_date,
       'Run Time                 : ' || TRUNC (  (  (actual_completion_date - actual_start_date)
                    / ((1 / 24))* 60)* 60) secs
  FROM applsys.fnd_concurrent_requests a,
       applsys.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 c.addr = d.paddr
   AND a.request_id = &req_id;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/*Get the Details of the Session */
select 'Logon time          :'||to_char(s.logon_time,'mm/dd hh24:mi:ss'),
       'Session id(SID)     :'||s.sid,
       'Status of Session   :'||s.status||'                                             ',
       'Session type        :'||s.type,
       'Session User Name   :'||s.username,
       'OS User             :'||s.osuser,
       'Programme information:'||s.module || ' - ' ||s.program,
       'Process             :'||s.process||'                      ',
       'OS Process id (spid):'||p.spid,
       'SQL Hash Valuee     :'||s.sql_hash_value,
       'Elapsed Time        :'||s.last_call_et       
from v$session s, v$process p
where s.sid = NVL('&trgtsid',s.sid)
and p.spid = NVL(to_number('&trgtspid',999999999),p.spid)
and p.addr = s.paddr;

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Even then if the session is existing you can kill the session by issuing the ALTER SYSTEM KILL SESSION command is the only safe way to kill an Oracle session.
SQL> ALTER SYSTEM KILL SESSION 'sid,serial#';
or
SQL> ALTER SYSTEM KILL SESSION 'sid,serial#' IMMEDIATE;
Othere way ..

To kill the session via the UNIX operating system,

$ kill -9 spid

Note: Killing OS processes is dangerous and can lead to instance failures, so do this at your own peril.

Local Langugae in Oracle using NLS_LANG

There might be cases where you may need to extract the data stored in the database in the local language along with the English for some reporting purpose Here is the way how it can be achieved. Pre-requisite is that data must be stored in the Data Base in the local language character set.
1) Change the language setting from the control panel.
Regional and Language Options -->
Regional Options
 form the lov {customize} (in this case I have chosen “Chinese”)





















Advanced In the lov select
System will restart...
and the new language setting will be activated.














2) Change the variable NLS_LANG in registry... for the sql*plus where you want to run the query.
Get the vale from the database using the following query..
SELECT nls_language || '.' || nls_codeset AS nls_lang
  FROM fnd_languages
 WHERE nls_territory LIKE '%CHIN%';


Run ----> regedit--> 
HKEY_LOCAL_MACHINE --->
SOFTWARE -->
oracle -->



search for NLS_LANG Variable in the registry for the oracle home where you want to run the query.
To know more about the NLS_LANG click
NLS_LANG is a client side environmental variable. To specify the locale behavior- setting the NLS_LANG environment parameter is the simplest way.

With the setting of NLS_LANG parameter on client machine it is specified the language, territory and character set used by the client application. As through NLS_LANG parameter, client character set is also specified so oracle has an idea which is the character set for data entered or displayed by a client program as well as Oracle can do (if needed) conversion from the client's character set to the database character set.

After changing the settings re-launch the sql*plus session and start getting the output in whatever local language it may be..

Note: Dont forget to chnage back to the original values once you have completed your activity.

~~~ Cheers

Dependencies for Given Object

Friends some times while trouble shooting or for some analysis we may need the dependency hierarchy of the object, For that we have oracle provided view public_dependency. From where we can extract the details.
SQL> SELECT object_type, owner, object_name
2 FROM dba_objects
3 WHERE object_name = 'PUBLIC_DEPENDENCY';

OBJECT_TYPE OWNER OBJECT_NAME
--------------- --------------- ------------------------------
VIEW SYS PUBLIC_DEPENDENCY
SYNONYM PUBLIC PUBLIC_DEPENDENCY

SQL> desc PUBLIC_DEPENDENCY
Name Null? Type
------------------------------- -------- ----
OBJECT_ID NOT NULL NUMBER
REFERENCED_OBJECT_ID NOT NULL NUMBER
The following query can be used to identify the objects that a given object is dependent upon:
SELECT lvl, u.object_id, u.object_type, LPAD (' ', lvl) || object_name obj
FROM (SELECT LEVEL lvl, object_id
FROM SYS.public_dependency s
START WITH s.object_id =
(SELECT object_id
FROM user_objects
WHERE object_name = UPPER ('&OBJECT_NAME')
AND object_type = UPPER ('&OBJECT_TYPE'))
CONNECT BY s.object_id = PRIOR referenced_object_id
GROUP BY LEVEL, object_id) tree,
user_objects u
WHERE tree.object_id = u.object_id
ORDER BY lvl
/
When prompted, enter the OBJECT_NAME of the OBJECT_TYPE whose dependencies you want to identify.
SQL> SELECT lvl, u.object_id, u.object_type, LPAD (' ', lvl) || object_name obj
2 FROM (SELECT LEVEL lvl, object_id
3 FROM SYS.public_dependency s
4 START WITH s.object_id =
5 (SELECT object_id
6 FROM user_objects
7 WHERE object_name = UPPER ('&OBJECT_NAME')
8 AND object_type = UPPER ('&OBJECT_TYPE'))
9 CONNECT BY s.object_id = PRIOR referenced_object_id
10 GROUP BY LEVEL, object_id) tree,
11 user_objects u
12 WHERE tree.object_id = u.object_id
13 ORDER BY lvl
14 /
Enter value for object_name: XXXX_OJECTS_V
old 7: WHERE object_name = UPPER ('&OBJECT_NAME')
new 7: WHERE object_name = UPPER ('XXXX_OBJECTS_V')
Enter value for object_type: VIEW
old 8: AND object_type = UPPER ('&OBJECT_TYPE'))
new 8: AND object_type = UPPER ('VIEW'))

LVL OBJECT_ID OBJECT_TYPE OBJ
---------- ---------- --------------- ------------------------------
1 2655531 VIEW XXXX_OBJECTS_V
2 2655459 SYNONYM XXXX_OBJECTS
2 2655461 SYNONYM XXXX_OBJECTS_LOG
Another way In the $OH/rdbms/admin exists a UTLDTREE.SQL script which creates a procedure called deptree_fill. This procedure and some tables created with the script make it possible for a user, to see the dependency for objects. Run this script once for each schema that needs this utility. The UTLDTREE.SQL creates a view deptree which will ultimately contain the dependent information for the object. This view is also created as SYS.DEPTREE, the view shows which shared cursors depend on the given object. If the current user is not sys, then this view may get an error, either about lack of privileges or about the non-existence of table x$kglxs. Example -------
SQL> @$ORACLE_HOME/rdbms/admin/utldtree.sql

SQL> SELECT object_type, owner, object_name, status
2 FROM dba_objects
3 WHERE object_name = '&obj_name'
4 /
Enter value for obj_name: XXXX_OBJECTS_V
old 3: WHERE object_name = '&obj_name'
new 3: WHERE object_name = 'XXXX_OBJECTS_V'

OBJECT_TYPE OWNER OBJECT_NAME STATUS
--------------- --------------- ------------------------------ -------
VIEW APPS XXXX_OBJECTS_V VALID
SYNONYM GGL_READONLY XXXX_OBJECTS_V VALID
SYNONYM XXGGLOM XXXX_OBJECTS_V VALID

SQL> EXEC deptree_fill('VIEW','APPS','XXXX_OBJECTS_V');

PL/SQL procedure successfully completed.

SQL> select * from deptree order by seq#;

NESTED_LEVEL TYPE SCHEMA NAME SEQ#
------------ -------- -------- ------------------------------ ----------
0 VIEW APPS XXXX_OBJECTS_V 0
1 SYNONYM XXOM XXXX_OBJECTS_V 1
1 PACKAGE APPS XXGGL_OM_EMAIL_BATCH 2
BODY
1 SYNONYM XXREAD XXXX_OBJECTS_V 3
ONLY
This shows the dependency relationship via indenting.
SQL> select * from ideptree;

DEPENDENCIES
--------------------------------------------------------------------------------
SYNONYM XXOM.XXXX_OBJECTS_V
PACKAGE BODY APPS.XXGGL_OM_EMAIL_BATCH
VIEW APPS.XXXX_OBJECTS_V
SYNONYM XXREADONLY.XXXX_OBJECTS_V
define OWNER='SCOTT';
define PARENT_TABLE ='TEST_1' ;

select level,lpad('> ',5*(level-1)) || to_char(child) "TABLE" from 
(select b.table_name "PARENT",a.table_name "CHILD" 
from all_constraints a,all_constraints b 
where a.owner=b.owner 
and a.owner='&OWNER' 
and a.constraint_type='R' 
and a.r_constraint_name=b.constraint_name 
order by b.table_name,a.table_name) 
start with parent='&PARENT_TABLE' 
connect by prior child = parent ;
~~cheers...