Sunday, August 15, 2010

Application commands

Generating fmb files manually in Rel 12

frmcmp_batch module=$AU_TOP/forms/US/MSDDEMRH.fmb userid=apps/(appspass) output_file=$MSD_TOP/forms/US/MSDDEMRH.fmx module_type=form batch=no compile_all=yes

Maintain Snapshot Information:
This will sync up your application tier with database.
http://oracleappstechnology.blogspot.com/2008/05/appltop-snapshot-feature.html

Run the following command to locate the properties file that you want to customize to preserve your settings:
R11i10

sh $AD_TOP/bin/adtmplreport.sh contextfile=$CONTEXT_FILE target=$IAS_ORACLE_HOME/Apache/Jserv/etc/xmlsvcs.properties

R12

sh $AD_TOP/bin/adtmplreport.sh contextfile=$CONTEXT_FILE target=$INST_TOP/ora/10.1.3/j2ee/oafm/config/oc4j.properties


Navigate to the location of the template directory and create a custom subdirectory to store to store your customization:

cd $FND_TOP/admin/template

mkdir custom

Copy the template file to the custom directory. and edit to add custom entries and run autoconfig"

What is staging area ?
Staging Area is special directory structure where you can dump 11i installation software so that you don’t have to insert CD’s during install and these disks will automatically be picked by Installer.
Q. How you set up staging area ?
Use adautostg.pl to create staging area orcreate required directory manually for staging like (following directories under Stage11i - startCD, oraApps, oraDB, oraiAS, oraAppsDB, oraNLS and inside these directories Disk1, Disk2…).


AOLJTEST
http://hostname:portno/OA_HTML/jsp/fnd/aoljtest.jsp

Check Jserv with the following url http://:port/servlets/Hello

Increase number of JVM to 2:
1. Comment out this line in the jserv.conf file:
ApJServGroup OACoreGroup 1 1 /d01/oracle/prodora/iAS/Apache/Jserv/etc/jserv.properties

2. Uncomment this line in the jserv.conf file:
#ApJServGroup OACoreGroup 2 1 /d01/oracle/prodora/iAS/Apache/Jserv/etc/jserv.properties

Bounce apache


To change paswords for all modules:
select 'FNDCPASS apps/xxx 0 Y system/xxx ORACLE '||oracle_username||' xxxxx' from fnd_oracle_userid where oracle_username in (select username from dba_users) and oracle_username not in ('APPS','APPLSYS','APPLSYSPUB');

PASSWORD CREATION USING FNDCPASS
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
edit pwd is wdbsvr.app and cat $806ORACLE_HOME/reports60/server/CGIcmd.dat


alter user system identified by xxx;
alter user sys identified by xxx;

FNDCPASS apps/xxx 0 Y system/xxxxxx ALLORACLE xxxxx

WFLOAD syntax
WFLOAD 0 Y {UPLOAD | DOWNLOAD | UPGRADE | FORCE} [@:] []

EXECUTION OF LDT FILE
FNDLOAD &ui_apps 0 Y UPLOAD @FND:patch/115/import/affaudit.lct @GMA:patch/115/import/US/gmaausch.ldt

download from one instance and upload to another instance
FNDLOAD apps/password 0 Y DOWNLOAD $FND_TOP/patch/115/import/afcpprog.lct
TPCOCUSTMAP.ldt PROGRAM
CONCURRENT_PROGRAM_NAME="TPCOCUSTMAP"
APPLICATION_SHORT_NAME="XBOL" 

FNDLOAD APPS/password 0 Y UPLOAD @FND:patch/115/import/afcpprog.lct
TPCOCUSTMAP.ldt 

backup menus, Responsibility, user using below FNDLOAD commands( ****IMPORTANT STEP****)
FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afsload.lct PATCH_SUB_MENU.ldt MENU MENU_NAME=""WH_ENQ""
FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afsload.lct PATCH_MENU.ldt MENU MENU_NAME=""WH_ENQ_MAIN""
FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afscursp.lct PATCH_RESP.ldt FND_RESPONSIBILITY RESP_KEY=""MFG US ATP WH MGMT""
FNDLOAD apps/apps 0 Y DOWNLOAD $FND_TOP/patch/115/import/afscursp.lct PATCH_USER.ldt FND_USER USER_NAME=""MOBILE_USER""

Upload Menus, Responsibility and User using below FNDLOAD commands
cd $backup_dir ** directory in which files were backed up thru step#4

FNDLOAD apps/appspwd 0 Y UPLOAD $FND_TOP/patch/115/import/afsload.lct PATCH_SUB_MENU.ldt
FNDLOAD apps/appspwd 0 Y UPLOAD $FND_TOP/patch/115/import/afsload.lct PATCH_MENU.ldt
FNDLOAD apps/appspwd 0 Y UPLOAD $FND_TOP/patch/115/import/afscursp.lct PATCH_RESP.ldt
FNDLOAD apps/appspwd 0 Y UPLOAD $FND_TOP/patch/115/import/afscursp.lct /tmp/PATCH_USER.ldt


PACKAGE CREATION USING PKH and PKB FILES
sqlplus apps/apps @******.pkh --- this will create the package header or specification
sqlplus apps/apps @******.pkb --- this will create the package body

ODF FILE EXECUTION
adodfcmp userid=cn/cn mode=TABLES odffile=cntrx02.odf touser=apps/apps priv_schema=apps/apps logfile=cn.log changedb=YES
adodfcmp userid=/ odffile=afsec.odf touser=apps_appfnd/xxx logfile=/tmp/a2.lst changedb=Yes priv_schema=apps_appfnd/xxx mode=tables

Execute the following command to determine the version of OA.jsp:
ident $FND_TOP/html/OA.jsp and
ident $OA_HTML/OA.jsp
(ie: Header: OA.jsp 115.26 2002/01/18 14:49:41 pkm ship)

Attention: The version of OA.jsp in $FND_TOP/html should be the same as the one in $OA_HTML if the version of OA.jsp does not match do the following :
Run adadmin.
Choose the option called Maintain Application Files.
Choose the option called Copy files to destination.

Note: If the ident command returns a no such file error or does not return any version information for OA.jsp then you have not installed the Oracle Applications Self Service Framework. Please use this metalink document to install the Self Service Framework.

Note: ident is not available on SUN & AIX. In this instance please use:
adident Header $FND_TOP/html/OA.jsp and
adident Header $OA_HTML/OA.jsp


How to compile JSP in Oracle Apps ?
You can use ojspCompile.pl perl script shipped with Oracle apps to compile JSP files. This script is under $JTF_TOP/admin/scripts. Sample compilation method is
perl ojspCompile.pl --compile --quiet

compiling few jsp's
Clear the following files from $OA_HTML/../_pages/_oa__html
rm _qot*.*
rm _xx*.*
ojspCompile.pl --compile -s '%qot%.jsp' -log $HOME/err.log --flush
ojspCompile.pl --compile -s '%xxdhr%.jsp' -log $HOME/err.log –flush
Confirm _qot*.* and _xx*.* files exist (after running the above Perl script)
in $OA_HTML/../_pages/_oa__html directory

Compile JSPs (~ 45 mts)
cd $FND_TOP/patch/115/bin
perl ojspCompile.pl --compile --flush -p 2

JSP compilation
$ cd $JTF_TOP/admin/scripts
$ ./ojspCompile.pl --compile
perl -x $JTF_TOP/admin/scripts/ojspCompile.pl --compile --quiet
perl -x $JTF_TOP/admin/scripts/ojspCompile.pl --compile --quiet -log /tmp/ojspc_error.log 341205.1


cd $FND_TOP/patch/115/bin
$ ls -rlt ojsp*
-rwxr-xr-x 1 appldev2 dba 85192 Apr 24 06:23 ojspCompile.pl
$ perl -x ojspCompile.pl --compile --quiet
logfile set: $INST_TOP/logs/appl/rgf/ojsp/ojspc_error.log
For r12


How to convert pll to pld file or pld file to pll ?
Pll->Pld f60gen module=MSCOSCW3.pll module_type=library userid=apps/ module_access=file output_file=MSCOSCW1.pld script=yes
Pld -> pll f60gen module=MSCOSCW3.pld userid=apps/ module_type=library module_access=file output_file=MSCOSCW1.pll parse=y batch=yes compile_all=special

How to convert pll to pld file or pld file to pll ?
Ans: Pll->Pld f60gen module=MSCOSCW3.pll module_type=library userid=apps/ module_access=file output_file=MSCOSCW1.pld script=yes

Pld -> pll f60gen module=MSCOSCW3.pld userid=apps/ module_type=library module_access=file output_file=MSCOSCW1.pll parse=y batch=yes compile_all=special

FORM file compilation
The following environment setting should be part of the Forms compilation to include the standard oracle library files.

export PATH=$PATH:$AU_TOP/forms/US:$AU_TOP/resource:$AU_TOP/resource/US

export FORMS60_PATH=$FORMS60_PATH:$AU_TOP/forms/US:$AU_TOP/resource:$AU_TOP/resource/US

f60gen module=$AU_TOP/forms/US/INVTOMAI.fmb userid=apps/xxx output_file=$INV_TOP/forms/US/INVTOMAI.fmx module_type=form batch=yes compile_all=special

Temporarily resetting FORMS_PATH to compile language forms

$AU_TOP/resource:$AU_TOP0/forms/F:$AU_TOP/resource/F

FORM file compilation
f60gen module=$AU_TOP/forms/F/ASXTRLKP.fmb userid=apps/apps output_file=$AS_TOP/forms/F/ASXTRLKP.fmx module_type=form batch=yes compile_all=special

To complie .fmb , .pll in R12
$ frmcmp_batch.sh module=$AU_TOP/resource/CUSTOM.pll userid=apps/xxxx output_file=$AU_TOP/resource/CUSTOM.plx module_type=library compile_all=special

frmcmp_batch.sh module=$AU_TOP/forms/US/CLX_CTG_FORM.fmb userid=apps/xxxx output_file=$AU_TOP/forms/US/CLX_CTG_FORM.fmx module_type=form compile_all=special


To compile pll file
f60gen module=$AU_TOP/resource/CUSTOM.pll userid=apps/apps output_file=$AU_TOP/resource/CUSTOM.plx module_type=library batch=yes compile_all=special

Playing with CUSTOM.pll
To convert from CUSTOM.pll to CUSTOM.pld
f60gen module_type=LIBRARY module=CUSTOM script=YES userid=apps/apps

To convert back from CUSTOM.pld to CUSTOM.pll ( after having edited the text pld file )
f60gen module_type=LIBRARY module=CUSTOM parse=YES userid=apps/apps

To convert from CUSTOM.pll to CUSTOM.plx
f60gen module_type=LIBRARY module=CUSTOM userid=apps/apps

REPORT file comilation

rwcon60 userid=APPS/xxx source=$BIL_TOP/reports/US/BILPHP01.rdf dest=$APPL_TOP/admin/CNV1/out/tmp001.rdf stype=rdffile dtype=rdffile logfile=$APPL_TOP/admin/CNV1/out/adrep001.txt overwrite=yes batch=yes compile_all=yes

rwcon60 userid=APPS/xxx source=BILPHP01.rdf dest=BILPHP01.rex stype=rdffile dtype=rexfile logfile=BILPHP01.txt overwrite=yes batch=yes

rwcon60 userid=apps/apps source=JEFRDVER.rdf stype=rdffile dtype=rexfile dest=JEFRDVER.rex overwrite=yes batch=yes


Compiling all application flexfields.
$FND_TOP/bin/fdfcmp APPS/***** 0 Y

TO start dataInstaller
jre oracle.apps.per.DataInstall apps pwd thin dbt11.unix.flarock.com:1551:OABT

jre oracle.apps.per.DataInstall apps thin ::

hrglobal.drv
PER_TOP/patch/115/driver

To check to make sure the correct data was installed run the following script this script can also be used to check if datainstaller was run successfully:
select application_short_name, Legislation_code, status, action, last_update_date
from hr_legislation_installations
where application_short_name in ('PER','PAY');

To check the version of the iAS 1.0.2.2.2
cd /Apache/Apache
httpd -version


To check the version of the forms
f60gen


To relink manually
adrelink.sh force=Y ranlib=Y "AD"
./adrelink.sh force=y ranlib=y "WPS WPCFSQ"

To complile forms and reports library
cd $ORACLE_HOME/forms/lib32
Note: if this directory does not exist: cd $ORACLE_HOME/forms/lib
$ make -f ins_forms.mk install

cd $ORACLE_HOME/reports/lib32
Note: if this directory does not exist: cd $ORACLE_HOME/reports/lib
$ make -f ins_reports.mk install

Relink Procedure Builder, Forms, Graphics and Reports:
cd $ORACLE_HOME/procbuilder60/lib; make -f ins_procbuilder.mk install
cd $ORACLE_HOME/forms60/lib; make -f ins_forms60w.mk install
cd $ORACLE_HOME/graphics60/lib; make -f ins_graphics60w.mk install
Reports has both link-time and run-time dependency with libjava.so so you need to append $ORACLE_HOME/network/jre11/lib/linux/native_threads in

$LD_LIBRARY_PATH before linking Reports. The same $LD_LIBRARY_PATH should be used at run-time.
cd $ORACLE_HOME/reports60/lib; make -f ins_reports60w.mk install


Relink iAS and Oracle Home using
$IAS_ORACLE_HOME/bin/adlnkiAS.sh and $ORACLE_HOME/bin/adlnk806.sh


To fin perl version
$ perl -version

To find java version
$ java -version

To find JDK version:
From appl_top, xml file
/amtoac/applmgr/common/util/java/1.4/j2sdk1.4.2_04


Discoverer launcher and viewer urls
http://hostname.oracle.com:10000/discwb4/html/discolaunch.htm)
http://hostname.oracle.com:10000/discoverer4i/viewer
Plus--http://hostname.domain:port/discwb4/html/english/welcome.htm
To find Version
$ string –a dis4pr | grep –i ‘discoverer version’
The location for looking for dis4pr is $ORACLE_HOME/diswb4/bin

To start discoverer
Script to start discoverer server is addisctl.sh under $OAD_TOP/admin/scripts/$CONTEXT_NAME
-- This script in turn start discoverer processes which can be start by startall.sh under $ORACLE_HOME/discwb4/util (This script is different from adstrtal.sh)
-- startall.sh calls scripts like startgatekeeper.sh, startlocator.sh , startoad.sh, startosagent.sh to start gatekeeper, locator, oad & osagent resp.
In Apps two major way to access EUL is via Discoverer view & Discoverer Plus edition (You can use Discoverer Administration Edition as well)


to generate xml file on apps and db tier
ad_top/bin
adbldxml.sh tier=apps appsuser= appspasswd=
Source the environment before runnibg

Go to /appsutil/bin    
perl adbldxml.pl tier=db appsuser= appspasswd=



Make command
make -f $APPL_TOP/admin/train/out/link_inv_1040580.mk $INV_TOP/bin/INCOIN

restart apache without killing current web sessions
usellx41.corp.invacare.us:support_conf> $SCRIPTS/adapcctl.sh graceful
adapcctl.sh version 115.48
Apache Web Server Listener :httpd ( pid 16249 ) is running.
Gracefully restarting the Apache Web Server Dedicated HTTP Listener..
Apache Web Server Listener (PLSQL) :httpd ( pid 16379 ) is running.
Gracefully restarting the Apache Web Server Dedicated PLSQL Listener..
adapcctl.sh: exiting with status 0


enabling Autoconfig on DB tier
As applmgr Copy AutoConfig templates to the RDBMS ORACLE_HOME
---------------------------------------------------------------------------
Create appsutil.zip file by: perl $AD_TOP/bin/admkappsutil.pl
sandbox806> perl $AD_TOP/bin/admkappsutil.pl
Starting the generation of appsutil.zip
Log file located at /ORACLE/apps/sandbox/admin/log/MakeAppsUtil_09061407.log
output located at /ORACLE/apps/sandbox/admin/out/appsutil.zip
MakeAppsUtil completed successfully.
sandbox806>
Copy appsutil.zip file to the $RDBMS_ORACLE_HOME
sandbox> id
uid=300(oracle) gid=200(dba) groups=1(staff),202(oaa),203(move),13(oinstall)
sandbox> cp /ORACLE/apps/sandbox/admin/out/appsutil.zip $ORACLE_HOME
sandbox> ls -l $ORACLE_HOME/appsutil.zip
-rw-r--r-- 1 oracle dba 2814669 Sep 06 14:13 /ORACLE/sandbox/9.2.0/appsutil.zip
unzip -o appsutil.zip # say A if being prompted for file over-writing

# Generate the database context file:
------------------------------------
sandbox> pwd
/ORACLE/sandbox/9.2.0/appsutil/bin
sandbox> id
uid=300(oracle) gid=200(dba) groups=1(staff),202(oaa),203(move),13(oinstall)
sandbox> perl adbldxml.pl tier=db appsuser=apps
Starting context file generation for db tier..
Using JVM from /ORACLE/sandbox/9.2.0/jdk/bin/java to execute java programs..
APPS Password: apps
The log file for this adbldxml session is located at:
/ORACLE/sandbox/9.2.0/appsutil/log/adbldxml_09061436.log
Enter the value for Display Variable: hostname:1
Context File /ORACLE/sandbox/9.2.0/appsutil/sandbox_hostname.xml
already exists.
Overwriting Context File may cause loss of existing settings, hence
backing it up as: /ORACLE/sandbox/9.2.0/appsutil/sandbox_hostname.xml.bak
The context file has been created at:
/ORACLE/sandbox/9.2.0/appsutil/sandbox_hostname.xml

# Take a backup of all the crucial configuration files and Generate and apply AutoConfig configuration file:
------------------------------------------------------------------------------------------------------------

a) Backup $TNS_ADMIN/*.ora and $ORACLE_HOME/dbs/*.ora
b) run Autoconfig on source tier to generate the context specific files:

cd /appsutil/bin
adconfig.sh contextfile= appspass=
c) Restore the $TNS_ADMIN/*.ora and $ORACLE_HOME/dbs/*.ora Immediately
d) Do a reload of the listener.ora to make sure other instances using /var/opt/oracle/listener.ora do not get affected:

$ lsnrctl reload qa
$ lsnrctl reload sandbox


The command used to check for the Forms patchset level
( you should be 17 or above)
`f60gen | grep '(Form Compiler)' | grep -v Release | awk -F. '{print $5}' `


How to find JDBC thin driver that your iAS 1.0.2.2.2 is using ?
A simple java program & procedure to compile it that will give your jdbc thin driver version.
Create a file with name JDBCVersion.java in your middle tier (Application Tier)
---------
import java.sql.*;
import oracle.jdbc.driver.*;
class JDBCVersion
{
public static void main (String args[])
throws SQLException
{
// Load the Oracle JDBC driver
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
// Get a connection to a database
Connection conn = DriverManager.getConnection
("jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=YES)(FAILOVER=YES) (ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST= ) (PORT= )))(CONNECT_DATA=(SID=)))" ,"apps","");
// Create Oracle DatabaseMetaData object
DatabaseMetaData meta = conn.getMetaData();
// gets driver info:
System.out.println("JDBC driver version is " + meta.getDriverVersion());
}
}
-----------
Replace following parameters
1. with your database hostname or IP address
2. with your database port no.
3. with SID for your database
4. with your apps password
After changing save it with name JDBCVersion.java in your middle tier & execute command
javac JDBCVersion.java
This will create class file in your workign directory. Include your current directory into your classpath like
export CLASSPATH=$CLASSPATH:/
then execute
java JDBCVersion
you should see output like
JDBC driver version is 9.2.0.6.0
Which means you are using jdbc thin driver version 9.2.0.6.0.


How to check if Apps 11i System is Autoconfig enabled ?
Under $AD_TOP/bin check for file adcfginfo.sh & if this exists use
adcfginfo.sh contextfile= show=enabled
If this file is not there , look for any configuration file under APPL_TOP if system is Autoconfig enabled then you will see entry like
# AutoConfig automatically generates this file. It will be read and .......


Context Editor
Application /util/editcontext/
Database /appsutil/editcontext/
"To run the Context Editor:
On UNIX
editcontext
If the [COMMON_TOP]/util/editcontext (for Unix) or [COMMON_TOP]\util\editcontext (for Windows) directory does not
exist, please refer to MetaLink Note 165195.1 titled ""Using AutoConfig to Manage System Configurations with Oracle
Applications 11i"".
Copy the Context Editor meta data file adctxinf.tmp to the common top directory under util/editcontext/etc and rename
it as adctxinf.xml:
on UNIX:
cp $AD_TOP/admin/template/adctxinf.tmp [COMMON_TOP]/util/editcontext/etc/adctxinf.xml

EDITING CONTEXT FILE
Editing Context file(xml file) in Oracle apps R12 using Context editor.
It is a mandatory thing that you should not edit the context file or xml file manually .
Context editor should be used for this(This can be used for updating ports or to change any configuration)
of application Tier or database tier.
follow these steps to install context editor in your existing oracle apps R12 system.
Apply patch 2873456 from metalink
after applying you will not be able to invoke the editcontext executable and you will get a error. this is because jre 1.1.8 which is
supplied along with this patch is no longer supported.
So download jre1.5.0_10 from sun.java.com and unpack it inside the path editcontext/jre/Linux/
and rename the old 1.1.8 jre inside that
then go to the bin directory inside the editcontext directory
open the file runWizard.sh
and accordingly replace the jre directory and also replace the jre executable with java in the same file ..
and invoke it from
$RDBMS_ORACLE_HOME/appsutil for editing database context(xml) file.
$COMMON_TOP/util for editing Application context(xml) file.
Syntax is
./editcontext
Before editing shutdown the application tier and after editing run autoconfig.sh to update the configuration files to reflect the new value.

The URL for ext web node is
JTF Login Page for customers using CRM (Check for each MT using real host names).
http://:port/OA_HTML/jtflogin.jsp

start Apache in SSL mode as root (on web025) using following cmd:

. //APPSORA.env

$IAS_ORACLE_HOME/Apache/Apache/bin/httpdsctl startssl.

URL to access OAM
access http://.:/servlets/weboam/oam/oamlogin


How will you identify if you are using Forms in Socket or Servlet mode in Oracle Applications 11i or R12 ?

You can find out the form are in Socket or Servlet mode in form configuration file it is in $COMMON_TOP/html/bin and the file name is “appsweb_SID_hostname.cfg”.

s_forms_servlet_serverurl If value is blank that means this is not servlet else if value is “/forms/formservlet” this indicates forms servlet.

In the context file, unde OA variable, ‘frmConnectMode’

repackage the jinit using the following command :
adjbuild.sh $COMMON_TOP/util/jinitiator $COMMON_TOP/util/jinitiator/j2se15012.exe 1.5.0.12


CPU patch log location on iAS HOME/d01/oratst/preprodora/iAS/cpu/CPUJul2005/install-Jun-09-2008-07-11-34.log


Apache config test
$ pwd
/d01/oratst/preprodora/iAS/Apache/Apache/bin

$ ./apachectl configtest
Syntax error on line 239 of /d01/oratst/preprodora/iAS/Apache/Apache/conf/httpd.conf:
Cannot load /d01/oratst/preprodora/iAS/Apache/Apache/libexec/mod_log_config.so into server: ld.so.1: httpd: fatal: relocation error: file /d01/oratst/preprodora/iAS/Apache/Apache/libexec/mod_log_config.so: symbol ap_escape_logitem: referenced symbol not found


To check X-display is working
Access page at http://hostname.domainnmae:8000/OA_HTML/testXServer.jsp. If the display setting is inappropriate you will see an exception page


Edit the AutoConfig context file.
If you are currently using E-Business Suite level 11.5.9 or above, or have applied FND.G patchset (or above), you will use Oracle Applications Manager to edit your context file. For all previous versions, you will use the AutoConfig Context Editor tool.
To edit the context file using Oracle Applications Manager, login to Oracle Applications Manager and navigate to Site Map > AutoConfig > Edit Parameters.
To edit the context file using the AutoConfig Context Editor tool, enter the following commands:

% cd [COMMON_TOP]/util/editcontext/
% ./editcontext"


To convert host specific url to user friendly url

Make host entries for ebus and make the following xml file changes and run autoconfig.

$ grep evis VIS_hostname.xml
ebus
http://evis.corpdom.local:8000/oracle_smp_chronos/oracle_smp_chronos_sdk.gif
evis.corpdom.local
http://evis.corpdom.local:8000
evis
http://evis.corpdom.local:8000/pls/VIS_portal30/portal30.home
http://evis.corpdom.local:8000/OA_HTML/US/ICXINDEX_VIS_hostname.htm
http://evis.corpdom.local:8000/OA_TEMP
$



MWA boucne procedure on 11 i

cd $MWA_TOP/bin
mwactl.sh start 10200
mwactl.sh start 10210
mwactl.sh start 10220
mwactl.sh start 10230
mwactl.sh start 10240
nohup mwactl.sh start_dispatcher & Port for Dispatcher is 10300

Procedure to Shutdown Dispatcher
mwactl.sh -login sysadmin/xxx stop_force 10200
mwactl.sh -login sysadmin/xxx stop_force 10210
mwactl.sh -login sysadmin/xxx stop_force 10220
mwactl.sh -login sysadmin/xxx stop_force 10230
mwactl.sh -login sysadmin/xxx stop_force 10240

nohup mwactl.sh stop_dispatcher &

1. Autoconfig. In autoconfig-enbled environment configuration file mwa.cfg is written by autoconfig. So it would be good to modify any configuration setting that you want to be permanent via AutoConfig editor in OAM. For all MWA server configuration variables OA_VAR begins from s_mwa. There is also a description for each parameter.
2. R12. While in 11i mwa.cfg is located in $MWA_TOP/secure, in R12 it’s in $INST_TOP/admin/install. Startup script mwactl.sh in R12 is located in $INST_TOP/admin/scripts
3. Dispatcher. If we are going to run multiple servers (specified by mwa.TelnetPortNumber / s_mwaTelnetPortNo) then we most likely will also use dispatcher to load balance client requests between MCSA telnet servers. We use mwa.Dispatcher=host:port to set MCSA dispatcher (in AutoConfig there is s_mwaDispatcherPort for the port setting). To start|stop dispatcher we can use:
mwactl.sh start_dispatcher | stop dispatcher.
Dispatcher is MWADIS binary within $MWA_TOP/bin directory. We can check whether it’s running using:
ps -ef | grep MWADIS
4. OAM. There are Generic Services (MWA MSCA Telnet Server & MWA MSCA Telnet Dispatchers) in OAM that corresponds to MSCA telnet server & dispatcher respectively and can be used to start/stop them automatically.
5. Server shutdown. When we use
mwactl.sh -login / stop [port]
- it’s so called graceful shutdown. MCSA Telnet Server won’t stop unless there are no clients currently using it. If you need to force shutdown, use stop_force instead of stop
6. Tracing. Setting mwa.LogLevel could be very useful for trobleshooting issues with MWA In 11.5.10/R12 this will usually produce serveral files within MWA log directory:
.system.log
.INV.log
.WMS.log (optionally)
But for performance tuning we can also use SQL tracing. It can be enabled by setting mwa.LogLevel (s_mwaLogLevel) to performance. SQL trace file will be put into usual user_dump_dest directory on database server.

The steps that needs to be done to disable MWA are as follows:
1. Modify the $IAS_ORACLE_HOME/Apache/Jserv/etc/mobile.properties file by commenting out the following line:
servlets.startup=oracle.apps.mwa.wap.engine.WapServlet

2. Comment out the following lines in the $IAS_ORACLE_HOME/Apache/Jserv/etc/jserv.properties file:
zones=mobile

3. Comment out the following lines in the $IAS_ORACLE_HOME/Apache/Jserv/etc/jserv.conf file:
ApJServGroupMount /mobile balance://OACoreGroup/mobile



Check if tcfsocket server is running
ps -ef|grep jre|grep comn

appltst 6466 6226 0 14:04:07 ? 0:03 /d01/oratst/testcomn/util/jre/1.1.8/bin/../bin/sparc/native_threads/jre -Ddbcfi
appltst 7969 6226 0 14:12:59 ? 0:03 /d01/oratst/testcomn/util/jre/1.1.8/bin/../bin/sparc/native_threads/jre -Ddbcfi
appltst 6496 6226 0 14:04:13 ? 0:03 /d01/oratst/testcomn/util/jre/1.1.8


Generating jar files
Generating product JAR files in JAVA_TOP -
/d01/oratst/testcomn/java with command:

adjava -mx512m -nojit oracle.apps.ad.jri.adjmx @/d01/oratst/testappl/admin/TEST02/out/genjars.cmd


The AutoConfig check utility

   The AutoConfig check utility is located at Target Database Tier /appsutil/bin
i) Check the AutoConfig configuration files by executing the following command
adchkcfg.sh contextfile=.xml  appspass= – This report provides information about All the profile options that get changed during the next normal execution of AutoConfig.
– For every profile option there is information about the current value in the database, the changed value and the AutoConfig script that changes the profile option.
– The script will also create a zip file report “ADXcfgcheck.zip” that contains all the files and reports mentioned above, so that you can copy the ADXcfgcheck.zip to a local desktop PC and view the html report from there without breaking the hyper-links in the report.

Check Java Cache in your Env :
login to URL http://: /OA_HTML/jtflogin.jsp
Login as sysadmin and navigate to Performance -> Components.


How to change all Applications user passwords
In apps, there are times when we want to force all the application users to change their passwords. In apps 11i, we have a concurrent request under System Administrator->

CP SQL*Plus Expire FND_USER Passwords

This concurrent request basically sets the fnd_user.password_date to null for all apps users. The users are thus prompted to change their passwords on next login


Responsibility attached to a users
SELECT UNIQUE u.user_id, SUBSTR (u.user_name, 1, 30) user_name,
SUBSTR (r.responsibility_name, 1, 60) responsiblity,
SUBSTR (a.application_name, 1, 50) application
FROM fnd_user u,
fnd_user_resp_groups g,
fnd_application_tl a,
fnd_responsibility_tl r
WHERE g.user_id(+) = u.user_id
AND g.responsibility_application_id = a.application_id
AND a.application_id = r.application_id
AND g.responsibility_id = r.responsibility_id
ORDER BY SUBSTR (user_name, 1, 30),
SUBSTR (a.application_name, 1, 50),
SUBSTR (r.responsibility_name, 1, 60);

Query useful when user wants to get application wise responsibility list
SELECT (SELECT application_short_name
FROM fnd_application fa
WHERE fa.application_id = frt.application_id) application,
frt.responsibility_id, frt.responsibility_name
FROM apps.fnd_responsibility_tl frt;


####### Script to create LENOVO User ###################
####### Please copy this script in a file and execute as apps user #####
REM XX_CREATE_USER.SQL
REM Script to create a user and add
REM responsibility. This script will run as part of
REM post-clone processes in a non-PROD instance.

SET serveroutput ON

DECLARE
l_appl_short_name fnd_application.application_short_name%TYPE;
l_resp_key fnd_responsibility.responsibility_key%TYPE;
BEGIN
SAVEPOINT create_user;

DBMS_OUTPUT.put_line('Creating user ...'||CHR(10));

FND_USER_PKG.CreateUser ( x_user_name => 'LENOVO'
,x_owner => 'SEED'
,x_unencrypted_password => 'welcome1'
,x_description => 'Consultant'
);

DBMS_OUTPUT.put_line('User created successfully.'||CHR(10));

SELECT application_short_name
,responsibility_key
INTO l_appl_short_name
,l_resp_key
FROM fnd_responsibility_vl resp
,fnd_application app
WHERE app.application_id = resp.application_id
AND responsibility_name = 'System Administrator';

DBMS_OUTPUT.put_line('Adding Responsibility...'||CHR(10));

FND_USER_PKG.addresp( username => 'DELOITTE'
,resp_app => l_appl_short_name
,resp_key => l_resp_key
,security_group => 'STANDARD'
,description => ''
,start_date => SYSDATE - 1
,end_date => SYSDATE + 364
);

DBMS_OUTPUT.put_line('Repsonsibility added sucessfully.');

COMMIT;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.put_line(SUBSTR(SQLERRM,1,200));
ROLLBACK TO create_user;
END;
/
####### Script to create LENOVO User ###################


Using following tables we can get the end-user access details:
APPLSYS.FND_LOGINS
APPLSYS.FND_LOGIN_RESPONSIBILITY
APPLSYS.FND_LOGIN_RESP_FORMS
APPLSYS.FND_UNSUCCESSFUL_LOGINS
FND_CONCURRENT_REQUESTS
ICX.ICX_FAILURES

Clients requires to restrict duplicate user sessions usually, so in previous project we setted ICX_SESSIONS of DISABLED_FALG=Y to restrict the duplicate session of E-buss suite user. { This can obtain by patch 21228669 }

Requirement:

Client want to secure login policy to more robust for users of 11i.
> The password contains at least one letter and at least one number
> The password does not contain the username
> If user tried more than 3 attempts , password should lock
> If user unable to login more than 2 attempted, need weekly report of those users.

After doing a bit R & D, recommanded for the client the following:

1. Change the profile option " Signon Password Failure limit" to 3, defalt is None.
2. Change the profile option " Signon Password Hard to guess" to YES, defalt is NO.
3. We are sheduling a con.program weekly using the tables FND_UNSUCCESSFUL_LOGINS and ICX.ICX_FAILURES to reports on login attempts.


JDK version userd by AD Utilities
AD Utilities use jdk 1.3 or jdk 1.4. You can detect the version used by the AD Utilities with the command $ADJVAPRG -version.

Apps dba related issues

Login as “apps” user via sql*plus and run delete SQL below to remove the values for profile %SignOn%Passwo%, otherwise the FNDCPASS command will fail: (should delete 4 rows only)
SQL> delete from FND_PROFILE_OPTION_VALUES
where profile_option_id in (5792,3844,2027,4524 )
and level_id = 10001

LOCK, performance realated scripts

To find details(including appln user name) of a lock on given object or all objects locked in database

SELECT c.owner
,c.object_name
,c.object_type
,fu.user_name locking_fnd_user_name
,fl.start_time locking_fnd_user_login_time
,vs.module
,vs.machine
,vs.osuser
,vlocked.oracle_username
,vs.sid
,vp.pid
,vp.spid AS os_process
,vs.serial#
,vs.status
,vs.saddr
,vs.audsid
,vs.process
FROM fnd_logins fl
,fnd_user fu
,v$locked_object vlocked
,v$process vp
,v$session vs
,dba_objects c
WHERE vs.sid = vlocked.session_id
AND vlocked.object_id = c.object_id
AND vs.paddr = vp.addr
AND vp.spid = fl.process_spid(+)
AND vp.pid = fl.pid(+)
AND fl.user_id = fu.user_id(+)
AND c.object_name LIKE '%' || upper('&tab_name_leaveblank4all') || '%'
AND nvl(vs.status
,'XX') != 'KILLED';

To fine locks on table query
v$locked_object, some other tables dba_objecs, tab , dba-tables, v$session, v$process, v$loc, dba_locks ,dba-waiters
select OBJECT_NAME,OBJECT_ID,OBJECT_TYPE from dba_objects where OBJECT_NAME='FA_MASS_ADDITIONS';
select * from v$locked_object where OBJECT_ID=79706; if this return any rows then lock is present on that object
rdbms/admin/utllockt.sql to get lock tree
Also check in v$access to see if any session is holding the opbject
select SESSION_ID,OBJECT_ID,LOCKED_MODE,PROCESS from v$locked_object where OBJECT_ID=79706;
select SESSION_ID,OBJECT_ID,LOCKED_MODE,PROCESS,ORACLE_USERNAME,OS_USER_NAME from v$locked_object where OBJECT_ID=79706;
select LOCKWAIT,STATUS,SCHEMANAME,OSUSER from v$session where SID=105;

query to find a lock
select sid,username,serial#,status from v$session where sid in
(select session_id from dba_locks where blocking_others='Blocking');


To find locks on a module
SELECT a.object_id, a.session_id, SUBSTR(b.object_name, 1, 40)
FROM v$locked_object a, dba_objects b
WHERE a.object_id = b.object_id
AND b.owner IN ('&M')
ORDER BY a.session_id;

SELECT a.object_id, a.session_id, substr(b.object_name, 1, 40),owner,status
FROM v$locked_object a, dba_objects b WHERE a.object_id = b.object_id AND b.owner in ('&module');


To find and terminate all the sessions held by an object
SQL> select sid, serial#, status, module from v$session where sid in (select distinct sid from v$access where object = 'XXART_RCV_TRANSACTION_PK');

SID SERIAL# STATUS MODULE
---------- ---------- -------- ------------------------------------------------
3434 53145 ACTIVE XXPOURCVW
3854 9742 ACTIVE XXPOURCVW
3949 6531 INACTIVE XXPOURCVW
3955 14566 INACTIVE XXPOURCVW
3991 50125 INACTIVE XXPOURCVW
4143 58949 ACTIVE XXPOURCVW
4294 39052 ACTIVE XXPOURCVW
4347 19960 INACTIVE XXPOURCVW
4770 65507 INACTIVE XXPOURCVW
4841 59140 INACTIVE XXPOURCVW
4895 3632 INACTIVE XXPOURCVW"


Some times JVM processes keeps hogging on the db server, to check who all the users connected from that jvm prcoess we can do the below to track those users along with the action they are doing and report to client.

set linesize 1000
set pagesize 1000
column module format a40
column program format a20
column address format 9
column appsuser format a8
column username format a4
column SID format 99999
column sql_text format a80
column user_name format a15
col action for a10
SELECT s.sid,s.serial#,p.pid,p.spid,s.status,s.action,s.last_call_et/60 wait_mins,f.user_name,s.module
FROM gv$process p, gv$session s,fnd_signon_audit_view f
WHERE p.inst_id = s.inst_id
and p.addr = s.paddr
and f.pid=p.pid
and s.process = '12649'
-- and s.sid = 9606;
/



To find forms session details which are existing from several hours"select b.sid ""sid"", b.serial# ""ser#"", c.spid ""OS Prc."", b.status, b.username, b.module, b.action, to_char(b.logon_time, 'DD-MON-YY HH:MI AM') ""Logon Time""
from v$session b, v$process c
where b.paddr = c.addr
and b.action like 'FRM%'
and b.logon_time < sysdate - (1/2) --logged in over 16 hours ago
order by logon_time asc
/"

select b.sid "sid", b.serial# "ser#", c.spid "OS Prc.", a.event, b.status, b.username, b.module, b.action,
to_char(b.logon_time, 'DD-MON-YY HH:MI AM') "Logon Time"
from v$session_wait a, v$session b, v$process c
where a.sid = b.sid
and b.paddr = c.addr
and b.action like 'FRM%'
and b.logon_time < (sysdate - (1/4)) -- logged in over 6 hours ago
order by logon_time asc

To find number of sessions held by application users
select count(*), fu.user_name
from v$process p,v$session s, apps.fnd_logins f, apps.fnd_user fu where p.addr = s.paddr
and f.spid (+) = s.process
and fu.user_id (+) = f.user_id
and f.end_time(+) is null
and fu.user_name IN ('VLEE', 'TNGUYEN', 'DBREIG' ) group by fu.user_name
/"

To Kill all sessions of an user ( eg: DBREIG)

select 'alter system kill session ' || '''' ||sid || ',' || s.serial# || '''' || ';'
from v$process p,v$session s, apps.fnd_logins f, apps.fnd_user fu
where p.addr = s.paddr
and f.spid (+) = s.process
and fu.user_id (+) = f.user_id
and f.end_time(+) is null
and fu.user_name='DBREIG'
order by f.start_time
/

TO get session informations of an application user

set linesize 1000 pagesize 1000 feedback off

column module format a15

column program format a20

column address format 9

column appsuser format a8

column username format a4

column SID format a10

column sql_text format a80

column user_name format a30

column "Time (m)" for a9

SELECT s.sid||','||s.serial# sid,p.pid,p.spid,s.status,s.action,f.time "Time (m)",u.email_address user_name

FROM v$process p, v$session s,fnd_signon_audit_view f, fnd_user u

WHERE p.addr = s.paddr

and f.pid=p.pid

and f.user_id = u.user_id

and u.user_name like '&Application_User%';

To find sql test from sid
"select sql_text from v$sqlarea where address in (select sql_address from v$session where sid =928);

SQL_TEXT
----------------------------------------------------------------------------------------------------------------------------------
begin DP.DATA_LOAD.EP_LOAD_SALES; end;

SQL> select SID,EVENT,p1,p2 from v$session_wait where sid=928;

SID EVENT P1 P2
---------- ---------------------------------------------------------------- ---------- ----------
928 db file sequential read 53 223359


To get Top 5 time-consuming requets
*****************************

select f1.conc_prog,f1.req_id,f1.oracle_id from
(select f.concurrent_program conc_prog,f.request_id req_id,f.oracle_process_id oracle_id from
(select t.user_concurrent_program_name concurrent_program,
r.request_id request_id,r.oracle_process_id oracle_process_id
from fnd_concurrent_requests r,
fnd_concurrent_processes p,
fnd_concurrent_programs_tl t
where r.controlling_manager = p.concurrent_process_id
and r.program_application_id = t.application_id
and r.concurrent_program_id = t.concurrent_program_id
and to_char(sysdate-r.actual_start_date)*1440 > 60
and r.Phase_Code = 'R' and r.Status_Code = 'R'
order by to_char(sysdate-r.actual_start_date)*1440 ) f
where rownum < 6) f1

To get sqls of Top 5 time-consuming concurrent requests
***********************************************

set pages 5000
set lines 132
break on cy
spoo /tmp/cy
select f1.conc_prog||' '||f1.req_id||' '||f1.oracle_id cy,st.sql_text
FROM
(select f.concurrent_program conc_prog,f.request_id req_id,f.oracle_process_id oracle_id from
(select t.user_concurrent_program_name concurrent_program,
r.request_id request_id,r.oracle_process_id oracle_process_id
from fnd_concurrent_requests r,
fnd_concurrent_processes p,
fnd_concurrent_programs_tl t
where r.controlling_manager = p.concurrent_process_id
and r.program_application_id = t.application_id
and r.concurrent_program_id = t.concurrent_program_id
and to_char(sysdate-r.actual_start_date)*1440 > 60
and r.Phase_Code = 'R' and r.Status_Code = 'R'
order by to_char(sysdate-r.actual_start_date)*1440 ) f where rownum < 6) f1,
v$session s,
v$process p,
v$sqltext st
WHERE
p.spid = f1.oracle_id
and p.addr = s.paddr
and s.sql_address = st.address
and s.sql_hash_value = st.hash_value
order by cy,st.piece
/

Monitors for excessive JDBC connections and alerts if the connection count breaches the defined threshold.

Use the following query:
select count(*) from v$session where program like 'JDBC Thin%'

How to check JDBC Connection ?
connect using apps, sys or system & issue
select count(*), module from v$session where program like '%JDBC%' group by module;

Command to kill a session I.e also to release a lock heldby a table
alter system kill session 'sid,serial#';

REQUEST ID TAKING LONG TIME
SQL> select REQUEST_ID,ORACLE_ID,ORACLE_PROCESS_ID,ORACLE_SESSION_ID,OS_PROCESS_ID from FND_CONCURRENT_REQUESTS where REQUEST_ID=10779300;

REQUEST_ID ORACLE_ID ORACLE_PROCESS_ID ORACLE_SESSION_ID
---------- ---------- ------------------------------ -----------------
OS_PROCESS_ID
--------------------------------------------------------------------------------
10779300 900 15875 32829458
29985

SQL> select addr from v$process where spid=15875;

ADDR
----------------
C0000000513FEAF0



SQL> select sid,status,serial# from v$session where paddr='C0000000513FEAF0';

SID STATUS SERIAL#
---------- -------- ----------
178 ACTIVE 48878

SQL> select SOFAR,TOTALWORK from v$session_longops where sid=178;

SOFAR TOTALWORK
---------- ----------
16576 16576
1116 12668

SQL> /

SOFAR TOTALWORK
---------- ----------
16576 16576
1131 12668

SQL> select sql_hash_value from v$session_longops where sid=178;

SQL_HASH_VALUE
--------------
2468084395
2468084395


SQL> select sql_text from v$sql where hash_value='2468084395';

SQL_TEXT
--------------------------------------------------------------------------------
SELECT CRRID.* FROM CNC_RS_RES_INT_DELTA CRRID WHERE CRRID.PROCESS_FLAG IN ('PRO
CESSED','UNPROCESSED','ERRORED') AND (CRRID.PROCESS_TYPE = 'DELETE' OR ( CRRID.P
ROCESS_TYPE = 'NEW' AND CRRID.END_DATE_ACTIVE IS NOT NULL) ) AND NOT EXISTS ( SE
LECT 1 FROM CNC_RS_RG_INT_DELTA CRRID1 WHERE CRRID1.SOURCE_ID = CRRID.SOURCE_ID
AND CRRID1.PROCESS_FLAG IN ('G','ERRORED','UNPROCESSED') ) ORDER BY CRRID.START_
DATE_ACTIVE


SQL> select last_analyzed from dba_tables where table_name='CNC_RS_RES_INT_DELTA';

LAST_ANAL
---------
22-Dec-05


This is a quick note to share a SQL that will tell you the FND_USER.USER_NAME of the person that has locked a given table in Oracle APPS.
The column named ""module"" will tell you the name of the Form Function or the Concurrent Program Short name which has aquired a lock onto that table.

SELECT c.owner
,c.object_name
,c.object_type
,fu.user_name locking_fnd_user_name
,fl.start_time locking_fnd_user_login_time
,vs.module
,vs.machine
,vs.osuser
,vlocked.oracle_username
,vs.sid
,vp.pid
,vp.spid AS os_process
,vs.serial#
,vs.status
,vs.saddr
,vs.audsid
,vs.process
FROM fnd_logins fl
,fnd_user fu
,v$locked_object vlocked
,v$process vp
,v$session vs
,dba_objects c
WHERE vs.sid = vlocked.session_id
AND vlocked.object_id = c.object_id
AND vs.paddr = vp.addr
AND vp.spid = fl.process_spid(+)
AND vp.pid = fl.pid(+)
AND fl.user_id = fu.user_id(+)
AND c.object_name LIKE '%' || upper('&tab_name_leaveblank4all') || '%'
AND nvl(vs.status
,'XX') != 'KILLED';

Friday, August 13, 2010

Create read only user like apps

Create read only user like apps

connect system/&systempwd
create user &&user identified by &&pass default tablespace iwatch temporary tablespace TEMP;
grant connect, resource, select any table to &&user;

connect apps/&appspwd
spool /tmp/syn.sql
set pages 500
set lines 200
select 'create synonym '||synonym_name||' for '||table_owner||'.'||table_name||';'
from user_synonyms;
spool off
spool /tmp/syn2.sql
set pages 500
set lines 200
select 'create synonym '||view_name||' for APPS.'||view_name||';'
from user_views;
spool off

connect &&user/&&pass
@/tmp/syn2.sql
@/tmp/syn.sql
select 'NEW USER '||USER||' CREATED'
from dual;
exit

One more method:
How to create a user similar to APPS but with READ-ONLY privileges.
-------------------------------------------------------------------

1. Create user:

create user apps_ro identified by usi_ro
default tablespace XXXX
temporary tablespace temp
quota 0M on XXXX;

2. Create Role:

Create role r_role;
Grant create session to r_role;
Grant connect to r_role;
Grant select any table to r_role;
Grant execute any procedure to r_role;
Grant create trigger to r_role;

3. Grant role to user:
Grant r_role to apps_ro;

4. Create trigger:

Login as apps_ro and create the following trigger

Create trigger rlogin_trigger
After logon on apps_ro.schema
Begin
Execute immediate 'Alter session set current_schema = apps';
End;
/

5. Revoke privilege
Revoke create trigger from r_role;

PATCH related scripts

/* Query to find out if any patch except localisation patch is applied or not, if applied, that what all drivers it contain and time of it’s application*/

select A.APPLIED_PATCH_ID, A.PATCH_NAME, A.PATCH_TYPE, B.PATCH_DRVIER_ID, B.DRIVER_FILE_NAME, B.ORIG_PATCH_NAME, B.CREATION_DATE, B.PLATFORM, B.SOURCE_CODE, B.CREATIONG_DATE, B.FILE_SIZE, B.MERGED_DRIVER_FLAG, B.MERGE_DATE from AD_APPLIED_PATCHES A, AD_PATCH_DRIVERS B where A.APPLIED_PATCH_ID = B.APPLIED_PATCH_ID and A.PATCH_NAME = ‘’

/* To know that if the patch is applied successfully, applied on both node or not, start time of patch application and end time of patch application, patch top location , session id … patch run id */

select D.PATCH_NAME, B.APPLICATIONS_SYSTEM_NAME, B.NAME, C.DRIVER_FILE_NAME, A.PATCH_DRIVER_ID, A.PATCH_RUN_ID, A.SESSION_ID, A.PATCH_TOP, A.START_DATE, A.END_DATE, A.SUCCESS_FLAG, A.FAILURE_COMMENTS from AD_PATCH_RUNS A, AD_APPL_TOPS B, AD_PATCH_DRIVERS C, AD_APPLIED_PATCHES D where A.APPL_TOP_ID = B.APPL_TOP_ID AND A.PATCH_DRIVER_ID = C.PATCH_DRIVER_ID and C.APPLIED_PATCH_ID = D.APPLIED_PATCH_ID and A.PATCH_DRIVER_ID in (select PATCH_DRIVER_ID from AD_PATCH_DRIVERS where APPLIED_PATCH_ID in (select APPLIED_PATCH_ID from AD_APPLIED_PATCHES where PATCH_NAME = ‘’)) ORDER BY 3;


* To get file version of any application file which is changed through patch application */

select A.FILE_ID, A.APP_SHORT_NAME, A.SUBDIR, A.FILENAME, max(B.VERSION) from AD_FILES A, AD_FILE_VERSIONS B where A.FILE_ID = B.FILE_ID and B.FILE_ID = 86291 group by A.FILE_ID, A.APP_SHORT_NAME, A.SUBDIR, A.FILENAM

/* To get information related to how many time driver file is applied for bugs */

select * from AD_PATCH_RUN_BUGS where BUG_ID in (select BUG_ID from AD_BUGS where BUG_NUMBER = ‘’

/* To find latest patchset level for module installed */

select APP_SHORT_NAME, max(PATCH_LEVEL) from AD_PATCH_DRIVER_MINIPKS GROUP BY APP_SHORT_NAME

/* To find what is being done by the patch */

select A.BUG_NUMBER “Patch Number”, B. PATCh_RUN_BUG_ID “Run Id”,D.APP_SHORT_NAME appl_top, D.SUBDIR, D.FILENAME, max(F.VERSION) latest, E.ACTION_CODE action from AD_BUGS A, AD_PATCH_RUN_BUGS B, AD_PATCH_RUN_BUG_ACTIONS C, AD_FILES D, AD_PATCH_COMMON_ACTIONS E, AD_FILE_VERSIONS F where A.BUG_ID = B.BUG_ID and B.PATCH_RUN_BUG_ID = C.PATCH_RUN_BUG_ID and C.FILE_ID = D.FILE_ID and E.COMMON_ACTION_ID = C.COMMON_ACTION_ID and D.FILE_ID = F.FILE_ID and A.BUG_NUMBER = ‘’ and B.PATCH_RUN_BUG_ID = ‘ < > ‘ and C.EXECUTED_FLAG = ‘Y’ GROUP BY A.BUG_NUMBER, B.PATCH_RUN_BUG_ID, D. APP_SHORT_NAME, D>SUBDIR, D.FILENAME, E.ACTION_CODE

/* Second Query to know, what all has been done during application of PATCH */
Select J.PATCh_NAME, H.APPLICATIONS_SYSTEM_NAME Instance_Name, H.NAME, I.DRIVER_FILE_NAME, D.APP_SHORT_NAME appl_top, D.SUBDIR, D.FILENAME, max(F.VERSION) latest, E.ACTION_CODE action from AD_BUGS A, AD_PATCH_RUN_BUGS B, AD_PATCH_RUN_BUG_ACTIONS C, AD_FILES D, AD_PATCH_COMMON_ACTIONS E, AD_FILE_VERSIONS F, AD_PATCH_RUNS G, AD_APPL_TOPS H, AD_PATCH_DRIVERS I, AD_APPLIED_PATCHES J where A.BUG_ID = B.BUG_ID and B.PATCH_RUN_BUG_ID = C.PATCH_RUN_BUG_ID and C.FILE_ID = D.FILE_ID and E.COMMON_ACION_ID = C.COMMON_ACTION_ID and D.FILE_ID = F.FILE_ID and G.APPL_TOP_ID = H.APPL_TOP_ID and G.PATCH_DRIVER_ID = I.PATCH_DRIVER_ID and I.APPLIED_PATCH_ID = J.APPLIED_PATCH_ID and B.PATCH_RUN_ID = G.PATCH_RUN_ID and C.EXECUTED_FLAG = ‘Y’ and G.PATCH_DRIVER_ID in (select PATCH_DRIVER_ID from AD_PATCH_DRIVERS where APPLIED_PATCH_ID in (select APPLIED_PATCH_ID from AD_APPLIED_PATCHES where PATCH_NAME = ‘’)) GROUP BY J.PATCH_NAME, H.APPLICATINS_SYSTEM_NAME, H.NAME, I.DRIVER_FILE_BNAME, D.APP_SHORT_NAME, D.SUBDIR, D.FILENAME, E.ACTION_CODE


/* To find Merged patch Information from database in Oracle Applications */
select bug_number from ad_bugs where bug_id in ( select bug_id from ad_comprising_patches where patch_driver_id =(select patch_driver_id from ad_patch_drivers where applied_patch_id =&n) );

/* Script to find out Patch level of mini Pack */
Select product_version,patch_level from FND_PROUDCT_INSTALLATIONS where patch_level like ‘%&shortname%’;
Replace short name by name of Oracle Apps Minipack for which you want to find out Patch level . ex.
AD – for Applications DBA
GL – for General Ledger
PO – Purchase Order

Query to check .Autoconfig patch Level

11i

SET head off Lines 120 pages 100
col p_num format A65
col bug_number format A10
col patch_name format A10
select bug_number, decode(bug_number,
'2488995' ,'11i.ADX.A'
,'2682177' ,'11i.ADX.B'
,'2682863' ,'11i.TXK-C'
,'2757379' ,'11i.TXK-D'
,'2902755' ,'11i.TXK-E'
,'3002409' ,'11i.ADX.C'
,'3104607' ,'11i.TXK-F'
,'3219567' ,'11i.TXK-B'
,'3239694' ,'11i.TXK-G'
,'3271975' ,'11i.ADX.E'
,'3416234' ,'11i.TXK-H'
,'3453499' ,'11i.ADX.F'
,'3594604' ,'11i.TXK-I'
,'3817226' ,'11i.ADX.E.1'
,'3950067' ,'11i.TXK-J'
,'4104924' ,'11i.TXK-K'
,'4367673' ,'11i.TXK-J.1'
,'4717668' ,'11i.TXK-M'
,'5035661' ,'11i.One_off'
,'5107107' ,'11i.TXK-N ROLLUP PATCH (AUG 2'
,'5414396 ' ,'11i RAPIDCLONE CONSOLIDATED FIXES JAN/2008 '
,'5456078' ,'11i.One_off_a'
,'5473858' ,'11i.ATG_PF.H RUP5'
,'5478710' ,'11i.TXK-O'
,'5759055' ,'11i.TXK-P'
,'5903765' ,'11i.ATG_PF.H RUP6'
,'5985992' ,'11i.TXK-Q'
) p_num, last_update_date
FROM ad_bugs
WHERE bug_number IN ( '2488995' ,'2682177' ,'2682863' ,'2757379' ,'2902755' ,'3002409' ,'3104607' ,'3219567' ,'3239694' ,'3271975' ,'3416234' ,'3453499' ,'3594604' ,'3817226' ,'3950067' ,'4104924' ,'4367673' ,'4717668' ,'5035661' ,'5107107' ,'5414396 ' ,'5456078' ,'5473858' ,'5478710' ,'5759055' ,'5903765' ,'5985992' );


R12

===


SET head off Lines 120 pages 100
col p_num format A65
col bug_number format A10
col patch_name format A10
spool LACF_ptch_level.txt
select ' LACF ' FROM dual;
/
select bug_number, decode(bug_number,
'4494373' ,'R12.TXK.A'
,'5872965' ,'R12.OAM.A'
,'5909746' ,'R12.TXK.A.1'
,'5917601' ,'R12.TXK.A.2'
,'6077487' ,'R12.TXK.A.DELTA.3'

,'6329757' ,'R12.TXK.A.DELTA.4'
,'6145693 ' ,'R12 RAPIDCLONE CONSOLIDATED FIXES JAN/2008'
) p_num, last_update_date
FROM ad_bugs
WHERE bug_number IN ( '4494373' ,'5872965' ,'5909746' ,'5917601' ,'6077487' ,'6145693 ','6329757' );


Query to check AD Patch level

11i

==

SET head off Lines 120 pages 100
col p_num format A65
col bug_number format A10
col patch_name format A10


select bug_number, decode(bug_number,
'1351004' '11i.AD.A'
,'1460640' ,'11i.AD.B'
,'1475426' ,'11i.AD.C'
,'1627493' ,'11i.AD.D'
,'1945611' ,'11i.AD.E'
,'2141471' ,'11i.AD.F'
,'2344175' ,'11i.AD.G'
,'2673262' ,'11i.AD.H'
,'4038964' ,'11i.AD.I.1'
,'4229931' ,'11i.AD.I.2'
,'4337683' ,'11i.AD.I.2'
,'4502904' ,'11i.AD.I.3'
,'4605654' ,'11i.AD.I.4 Delta.4'
,'4712847' ,'11i.AD.I.3'
,'4712852' ,'11i.AD.I.4'
,'5161676' ,'11i.AD.I.5'
,'5161680' ,'11i.AD.I.5'

,'6502079' ,'11i.AD.I.Delta.6'

,'6502082' ,'11i.AD.I.6'

) p_num, last_update_date
FROM ad_bugs
WHERE bug_number IN ( '1351004' '1460640' '1475426' '1627493' '1945611' '2141471' '2344175' '2673262' '4038964' '4229931' '4337683' '4502904' '4605654' '4712847' '4712852' '5161676' '5161680','6502079','6502082' );



R12

==



SET head off Lines 120 pages 100
col p_num format A65
col bug_number format A10
col patch_name format A10

select bug_number, decode(bug_number,
'4502962' 'R12.AD.A'
,'5905728' ,'R12.AD.A.1'
,'6014659' ,'R12.AD.A.2'

,'6272715' ,'R12.AD.A.3'

,'6510214' ,'R12.AD.A.4'
) p_num, last_update_date
FROM ad_bugs
WHERE bug_number IN ( '4502962' '5905728' '6014659','6272715','6510214' );


Query to Check ATG (Techstack) Patch level

11i

===

SET head off Lines 120 pages 100
col p_num format A65
col bug_number format A10
col patch_name format A10
select bug_number, decode(bug_number,
'3438354', '11i.ATG_PF.H'
,'4017300' ,'11i.ATG_PF.H.RUP1'
,'4125550' ,'11i.ATG_PF.H.RUP2'
,'4334965' ,'11i.ATG_PF.H RUP3'
,'4676589' ,'11i.ATG_PF.H RUP4'
,'5382500' ,'11i.ATG_PF.H RUP5 HELP'
,'5473858' ,'11i.ATG_PF.H.5'
,'5674941' ,'11i.ATG_PF.H RUP5 SSO Integrat'
,'5903765' ,'11i.ATG_PF.H RUP6'
,'6117031' ,'11i.ATG_PF.H RUP6 SSO 10g Integration'
,'6330890' ,'11i.ATG_PF.H RUP6 HELP'
) p_num, last_update_date
FROM ad_bugs
WHERE bug_number
IN ( '3438354', '4017300', '4125550', '4334965', '4676589', '5382500', '5473858', '5674941', '5903765', '6117031', '6330890' );


R12
===
SET head off Lines 120 pages 100
col p_num format A65
col bug_number format A10
col patch_name format A10

select bug_number, decode(bug_number,
'5917344', 'R12.ATG_PF.A.DELTA.2',
'6077669', 'R12.ATG_PF.A.DELTA.3',
'6272680', 'R12.ATG_PF.A.DELTA.4 '
) p_num, last_update_date
FROM ad_bugs
WHERE bug_number
IN ('5917344', '6077669', '6272680');


Query to check Product patch levels

set linesize 1000
column APPS format a10
select decode(nvl(a.APPLICATION_short_name,'Not Found'),
'SQLAP','AP','SQLGL','GL','OFA','FA',
'Not Found','id '||to_char(fpi.application_id),
a.APPLICATION_short_name) apps,
decode(fpi.status,'I','Installed','S','Shared',
'N','Inactive',fpi.status) status,
fpi.product_version,
nvl(fpi.patch_level,'-- Not Available --') Patchset,
to_char(fpi.last_update_date,'dd-Mon-RRRR') "Update Date"
from fnd_oracle_userid o, fnd_application a, fnd_product_installations fpi
where fpi.application_id = a.application_id(+)
and fpi.oracle_id = o.oracle_id(+)
order by 1,2
/

Running the following query will tell you which family pack of HRMS you are on in 11i.

SELECT ‘HR_PF.’ ||
DECODE (BUG_NUMBER,’2115771' ,’A(2115771)’,
‘2268451' ,’B(2268451)’,
‘2502761' ,’C(2502761)’,
‘2632500' ,’D(2632500)’,
‘2803988' ,’E(2803988)’,
‘2968701' ,’F(2968701)’,
‘3116666' ,’G(3116666)’,
‘3233333' ,’H(3233333)’,
‘3127777' ,’I(3127777)’,
‘3333633' ,’J(3333633)’,
‘3500000' ,’K(3500000)’,
‘5055050' ,’K RUP1(5055050)’,
‘5337777' ,’K RUP2(5337777)’,
‘6699770' ,’K RUP3(6699770)’,
‘7666111' ,’K RUP4(7666111)’) ||
‘ patchset is installed ‘ “HR Family Pack”,
to_char(last_update_date,’DD-MON-YYYY HH24:MI:SS’) “DATE APPLIED”
FROM AD_BUGS
WHERE BUG_NUMBER in (‘2115771',’2268451',’2502761',’2632500',’2803988',
‘2968701',’3116666',’3233333',’3127777',’3333633',’3500000', ‘5055050',
‘5337777',’6699770',’7666111')
ORDER BY BUG_NUMBER DESC
/


To find localization patches are applied.select * from jai_applied_patches where patch_number = 7361928;

How to check whether the product is install,shared and Not installed in Apps.
select t.application_name
, t.application_id
, i.patch_level
, decode(i.status,’I',’Fully Installed’,
‘N’,'Not Installed’,'S’,'Shared’,'Undetermined’) status
from fnd_product_installations i
, fnd_application_vl t
where i.application_id = t.application_id
order by t.application_id;


/* To find the latest application version */

select ARU_RELEASE_NAME||'.'||MINOR_VERSION||'.'||TAPE_VERSION version, START_DATE_ACTIVE updated,ROW_SOURCE_COMMENTS "how it is done", BASE_RELEASE_FLAG "Base version" FROM AD_RELEASES where END_DATE_ACTIVE IS NULL


/* to find the base application version */

select ARU_RELEASE_NAME||'.'||MINOR_VERSION||'.'||TAPE_VERSION version, START_DATE_ACTIVE when updated, ROW_SOURCE_COMMENTS "how it is done" from AD_RELEASES where BASE_RELEASE_FLAG = 'Y'


/* To find all available application version */

select ARU_RELEASE_NAME||'.'||MINOR_VERSION||'.'||TAPE_VERSION version, START_DATE_ACTIVE when updated, END_DATE_ACTIVE "when lasted", CASE WHEN BASE_RELEASE_FLAG = 'Y' Then 'BASE VERSION' ELSE 'Upgrade' END "BASE/UPGRADE", ROW_SOURCE_COMMENTS "how it is done" from AD_RELEASES

It shows patches applied to multiple application tiers - this sql shows if the 11.5.10.2 maintenance pack has been applied (patch number 3480000)

DECLARE
TYPE p_patch_array_type is varray(30) of varchar2(10);
p_patchlist p_patch_array_type;
p_appltop_name varchar2(50);
p_patch_status varchar2(15);
p_appl_top_id number;
p_result varchar2(15);
p_instance varchar2(15);
gvAbstract varchar2(240) := NULL;
CURSOR alist IS
select appl_top_id, name from ad_appl_tops;
procedure println(msg in varchar2)
is
begin
dbms_output.enable(1000000);
dbms_output.put_line(msg);
end;
BEGIN
select instance_name into p_instance from v$instance;
open alist;
p_patchlist:= p_patch_array_type('3480000');
LOOP
FETCH alist INTO p_appl_top_id,p_appltop_name;
EXIT WHEN alist%NOTFOUND;
IF p_appltop_name NOT IN ('GLOBAL','*PRESEEDED*')
THEN
println(p_appltop_name || ' - - - ' || p_instance );
println('=============================');
for i in 1..p_patchlist.count
loop
begin
select ABSTRACT into gvAbstract
from FND_UMS_BUGFIXES
where BUG_NUMBER = p_patchlist(i);
exception
when NO_DATA_FOUND then
gvAbstract := NULL;
end;
p_patch_status := ad_patch.is_patch_applied('11i',p_appl_top_id,p_patchlist(i));
case p_patch_status
when 'EXPLICIT' then
p_result := 'APPLIED';
else
p_result := p_patch_status;
end case;
println('Patch ' || p_patchlist(i)|| ' - ' || substr(gvAbstract,1,25) || ' - was ' || p_result);
end loop;
END if;
println('.');
END LOOP;
close alist;
END;
/

To check if specific bug fix is applied, you need to query the AD_BUGS table only. This table contains all patches and all superseded patches ever applied:

select ab.bug_number, ab.creation_date
from ad_bugs ab
where ab.bug_number = '&BugNumber';

Retrieve basic information regarding patch applied, useful when you need to know when and where (node) you applied specific patch:
select aap.patch_name, aat.name, apr.end_date
from ad_applied_patches aap,
ad_patch_drivers apd,
ad_patch_runs apr,
ad_appl_tops aat
where aap.applied_patch_id = apd.applied_patch_id
and apd.patch_driver_id = apr.patch_driver_id
and aat.appl_top_id = apr.appl_top_id
and aap.patch_name = '&PatchName';

Run the following query, it will show you all modules affected by specific patch in one click…
select distinct aprb.application_short_name as "Affected Modules"
from ad_applied_patches aap,
ad_patch_drivers apd,
ad_patch_runs apr,
ad_patch_run_bugs aprb
where aap.applied_patch_id = apd.applied_patch_id
and apd.patch_driver_id = apr.patch_driver_id
and apr.patch_run_id = aprb.patch_run_id
and aprb.applied_flag = 'Y'
and aap.patch_name = '&PatchName';

One of the ways to find out the exact patchset that was applied to your database successfully, is you can query from props$ table. This table is owner by sys. Logon as system or sys and select from props$ table. This table has fields like name, values and comments. The name columne NLS_RDBMS_VERSION has the value equilent to the patchset applied to that database.

SQL> select name, value$ from props$;
NAME VALUE$
NLS_RDBMS_VERSION 7.3.4.3.1

Query to find languages installed or not:

Select distinct NLS_LANGUAGE, LANGUAGE_CODE,NLS_TERRITORY,INSTALLED_FLAG
from fnd_languages
where INSTALLED_FLAG = 'I' or INSTALLED_FLAG = 'B'
ORDER BY NLS_LANGUAGE

Select distinct NLS_LANGUAGE, LANGUAGE_CODE,NLS_TERRITORY,INSTALLED_FLAG
from fnd_languages
ORDER BY NLS_LANGUAGE

Tech stack validation:
Ensure that your current working directory is
patch unzipped location]/fnd/patch/115/bin

on Unix or Linux:
Ensure "APPLRGF" variable is set in environment. If not, set it to the same value as "APPLTMP".
./txkprepatchcheck.pl -script=ValidateRollup
-outfile=$APPLTMP/txkValidateRollup.html
-appspass=
or
./txkprepatchcheck.pl -script=ValidateRollup -outfile=$APPLTMP/txkValidateRollup.txt -reporttype=text -appspass=crepti12

Query to check customizations are affected by a patch
This script will read cr_customization.txt file
xx_custom=/local/dba/scripts_vis/cr_customization.txt
patch_loc=/patch11i/vis_patches/6329356
echo "checking for customizations under ${patch_loc}"
cd ${patch_loc}
cat ${xx_custom} | while read line
do
if [ "$line" != "" ];
then
grep -i "$line" /vis/applmgr/11510/admin/VIS/log/u5014514.drv.log

fi
done

To knowd all the patdhes applied from 01-Sep-2005 to 28-Jan-2006. i.e b/w 2 dates use
$AD_TOP/patch/115/sql/adpchlst.sql

To check to make sure the correct data was installed run the following script this script can also be used to check if datainstaller was run successfully:
select application_short_name, Legislation_code, status, action, last_update_date
from hr_legislation_installations
where application_short_name in ('PER','PAY');

To check if DB version is 32 or 64 bit:
a.) conn to sqlplus if it is 64 ,then will show
b.)select address from v$sql where rownum<2;
c.)go to ORACLE_HOME/bin
do a file oracle.

Commands usefull during Patch analysis
select bug_number from ad_bugs where bug_number='&t';
select to_char(CREATION_DATE,'dd-mon-yyyy hh24:mi:ss') from ad_bugs where bug_number=’&t’;
select to_char(LAST_UPDATE_DATE,'dd-mon-yyyy hh24:mi:ss')from ad_bugs where bug_number='&t’;
select patch_level from fnd_product_installations where patch_level like '&p';
select release_name from fnd_product_groups;
select DRIVER_FILE_NAME from ad_patch_drivers where DRIVER_FILE_NAME like '%3117672%';


For querrying the MERGED PATCHES you can use the following script which will show which merged patches are applied for which language
select a.PATCH_DRIVER_ID,DRIVER_FILE_NAME,c.bug_id,d.language
from ad_patch_drivers a,AD_COMPRISING_PATCHES b, ad_bugs
c,AD_PATCH_DRIVER_LANGS d
where c.bug_number = '&no'
and c.bug_id = b.bug_id
and a.PATCH_DRIVER_ID = b.patch_driver_id
and a.patch_driver_id = d.patch_driver_id;

we can querry the ad_bugs for the US language version patches


To know which services are running on what nodes
select SUPPORT_CP,SUPPORT_FORMS,SUPPORT_WEB,SUPPORT_ADMIN from fnd_nodes;


To Know All the Drivers (NLS) language applied to Instance?

col PATCH_NAME format a10
col PATCH_TYPE format a10
col DRIVER_FILE_NAME format a15
col PLATFORM format a10
select AP.PATCH_NAME, AP.PATCH_TYPE, AD.DRIVER_FILE_NAME, AD.CREATION_DATE, AD.PLATFORM,AL.LANGUAGE
from AD_APPLIED_PATCHES AP, AD_PATCH_DRIVERS AD, AD_PATCH_DRIVER_LANGS AL
where AP.APPLIED_PATCH_ID = AD.APPLIED_PATCH_ID
and AD.PATCH_DRIVER_ID = AL.PATCH_DRIVER_ID
and AP.PATCH_NAME = '&No';"

select aap.patch_name,count(*) from AD_patch_driver_langs apdl, ad_applied_patches aap, AD_PATCH_DRIVERS apd
where apdl.patch_driver_id=apd.patch_driver_id and
aap.applied_patch_id=apd.applied_patch_id and
apdl.language <>'US'
group by aap.patch_name
having count(*) > 0 and count(*)<10 -- Changed from 9 to 10
order by patch_name"

To see NLS patches applied:
select language,driver_file_name from AD_PATCH_DRIVERS adp,AD_PATCH_DRIVER_LANGS adpl where adp.patch_driver_id = adpl.patch_driver_id
and driver_file_name like '%&a%' order by 1;

Script for Patch Log Analysis :
@$AD_TOP/patch/115/sql/adphrept.sql 1 ALL ALL 03/01/2004 07/05/2004 ALL ALL ALL ALL ALL N N N N N sample.txt


To know patches applied
select distinct(patch_name) from ad_applied_patches

AD Patches Tables
AD_APPLIED_PATCHES
AD_PATCH_DRIVERS
AD_PATCH_RUNS
AD_APPL_TOPS
AD_RELEASES
AD_FILES
AD_FILE_VERSIONS
AD_PATCH_RUN_BUGS
AD_BUGS
AD_PATCH_COMMON_ACTIONS
AD_PATCH_RUN_BUG_ACTIONS
ad_comprising_patches

FND Tables
FND_APPL_TOPS
FND_LOGINS
FND_USER
FND_DM_NODES
FND_TNS_ALIASES
FND_NODES
FND_RESPONSIBILITY
FND_DATABASES
FND_UNSUCCESSFUL_LOGINS
FND_LANGUAGES
FND_APPLICATION
FND_PROFILE_OPTION_VALUES


To know which driver patch has been applied:
select DRIVER_FILE_NAME from AD_PATCH_DRIVERS;
select DRIVER_FILE_NAME from AD_PATCH_DRIVERS where DRIVER_FILE_NAME like '%2408149%';


To check if multicurrency is present
select MULTI_CURRENCY_FLAG from fnd_product_groups;
M
-
Y

Purging timing information for prior sessions.
sqlplus -s APPS/***** @$AD_TOP/admin/sql/adtpurge.sql 10 1000

Snapshot sql
sqlplus -s &un_apps/***** @$AD_TOP/patch/115/sql/adbkflsn.sql 111

Maintenance mode
$AD_TOP/patch/115/sql/adsetmmd.sql ENABLE
$AD_TOP/patch/115/sql/adsetmmd.sql DISABLE
select fnd_profile.value('APPS_MAINTENANCE_MODE') from dual;
FND_PROFILE.VALUE('APPS_MAINTENANCE_MODE')
--------------------------------------------------------------------------------
MAINT


to check the product is registered
select * from applsys.fnd_application where application_short_name='BNE';


adutconf.sql --- script used to generate Oracle Applications Database Configuration Report
Location : $AD_TOP/sql/adutconf.sql
Output : $AD_TOP/sql/adutconf.lst

PRODUCT VERSIONS (AD,PO,....)
select patch_level from fnd_product_installations where patch_level like '%&PRODUCT_NAME%';
select PATCH_LEVEL from fnd_product_installations where PATCH_LEVEL like '%AD%';
select PATCH_LEVEL,status from fnd_product_installations where PATCH_LEVEL like '%ICX%';

applying opatch without inventory
opatch apply -no_inventory
$ORACLE_HOME/cfgtoollogs/opatch/opatch-2009_Oct_29_22-33-37-CST_Thu.log --> opatch log location


To find opatch version:
/OPatch/
./opatch version


opatch options:
$ opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir ./9352164
opatch apply -local: apply patch only on local node in clusterdatabase environment
opatch apply -jdktop : if opatch could not find the path of jdk
opatch apply -no_inventory : Apply patch without updating inventory

to find the opatch that are installed
cd /OPatch/.patch_storage

OR cd /unioac/oracle/product/920/OPatch/
./opatch lsinventory
If it fails please check the path is correct in /etc/oraInst.loc or /var/opt/oracle/oraInst.loc

From CPUJan2006 onwards, for the OPatch installed CPU’s it is possible to do the following
select * from registry$history;

ACTION_TIME ACTION NAMESPACE VERSION ID COMMENTS
—————————- —— ——— ———- ——— ———-
09-MAY-07 07.17.43.371379 AM CPU SERVER 10.2.0.2.0 5689957 CPUJan2007"

CPU will create directories and files like %ORACLE_HOME%\cpu\CPUOct2005\patch.log or $ORACLE_HOME/cpu/CPUOct2005/install.log

Syntax to merge set of patches
admrgpch -s temp -d 3171663_NLS
admrgpch -s merge_nov11 -d merge_cnv1_nov11 -logfile merge_cnv1_nov11.log


To know products and patches present in system
/SQL/adutconf.lst



adpatch options
Adpatch no longer checks for prerequisite patches as part of the patch
to force this check:
adpatch options=prereqs

To see what the patch does without applying it (a good idea when
patching in a production environment)
adpatch apply=no"

To bypass the irritating maintenance mode requirement run:
adpatch options=hotpatch"

How do you hide apps password during adpatching?
Ans:
adpatch flags=hidepw"
adpatch options=noprereq
adpatch options=nocopyportion,nogenerateportion i.e to apply only database portion of u driver on db/admin node
options=nocompilejsp
on admin1 opations=nocompiledb, on admin 2 options=nocompiledb,nodatabaseportion, on web1 options=nocompiledb,nodatabaseportion, on web2 options=nocompiledb,nodatabaseportion
opatch options=nofilecheck (for not checking version of patch in database from ad_patch_version table
adpatch options=nodatabaseportion ( this is required while applying patches on external nodes )
adpatch options=nodatabaseportion,nocompiledb,nocompilejsp,norevcache

adpatch options :

adpatch options=nocompilejsp
adpatch options=forcecopy
adpatch options=noprereq,hotpatch,nocompilejsp

adpatch options = ""hotpatch,noautoconfig,nocompilejsp"".
adpatch options = ""hotpatch,nodatabaseportion,nocompilejsp,noautoconfig"".

adpatch options=nocheckfile,hotpatch,nocopyportion,nogenerateportion
adpatch options = ""novalidate""

On external Webnode:
adpatch options=nogenerateportion,nodatabaseportion"

Verify that you do not want to restart the previous failed session.
Start AutoPatch with the abandon=yes option:
UNIX:
$ adpatch defaultsfile=$APPL_TOP/admin/testdb1/def.txt logfile=7654321.log \
patchtop=$APPL_TOP/patches/7654321 driver=c7654321.drv workers=3 \
interactive=no abandon=yes



Create the defaults file
adpatch defaultsfile=$APPL_TOP/admin/testdb1/adpatchdef.txt

Create Defaultsfile.txt

adpatch defaultsfile=$APPL_TOP/admin/$TWO_TASK/defaults.txt

( You can keep this txt file in any location of your choice)
Now abort autopatch section at point where it asks for patch directory by ctrl +c or ctrl+d
Now check if this file exists
You have to do above steps only once in an environment to create defaults file.
====================================
Apply as per below-

time adpatch \
defaultsfile=$APPL_TOP/admin/$TWO_TASK/defaults.txt \
logfile=u5394384.log \
patchtop=/d31/app/upgrade_115102/BASE_PATCHES/5394384 \
driver=u5394384.drv \
workers=8 \
interactive=yes \
abandon=yes


R12
PAA helps users to track and perform manual steps during patching Executed by invoking

$AD_TOP/bin/admsi.pl…
When patches are merged using admrgpch, PAA merges readme files and this avoids redundant tasks. Also it simplifies patch application by combining all manual steps


To find some products patch level

ATG rollup patch level by pointing your browser to this URL -> http://hostname:port/OA_HTML/OAInfo.jsp

How to Find iReceviables Patchset Level on 11i Instance [ID 263942.1]
[ID 307564.1]

How to Find iReceviables Patchset Level on 11i Instance [ID 263942.1]

How To Determine Which HZ-Trading Community Architecture (TCA), Oracle Customers Online (IMC), Oracle Credit Management (OCM), TAX (AR), CUs And Framework

(FWK) Patchset Has Been Applied? [ID 262680.1]



Change the Patch Wizard directory patch
Login to OAM

Navigate to Patch Wizard and then click Go Button
Under Patch Wizard Tasks you will find the below along with 3 more task names
Task Name
Patch Wizard Preferences

Click the Icon under Tasks

then change the value of Staging directory from /d01/applmgr/prodappl/pwizard to the /d01/apreprod/preprodappl/pwizard

you trace 10.1.0.6 OUI by running the following command
/usr/bin/truss -aefo /tmp/oui.trc ./runInstaller

// This will bypass the OS check //

runInstaller eg
$ JAVA_HOME=/u01/app/oracle/product/jdk1.6.0_16; export JAVA_HOME

$ ./runInstaller -jreLoc $JAVA_HOME

runInstaller -ignoreSysPrereqs

Query used to view the patch level status of all modules
SELECT a.application_name,
DECODE (b.status, 'I', 'Installed', 'S', 'Shared', 'N/A') status,
patch_level
FROM apps.fnd_application_vl a, apps.fnd_product_installations b
WHERE a.application_id = b.application_id;

Check Current Applied Patch
SELECT patch_name, patch_type, maint_pack_level, creation_date
FROM applsys.ad_applied_patches
ORDER BY creation_date DESC

To know if OTA is running or not:
@$ECX_TOP/patch/115/sql/ecxver.sql

patchsets.sh
ftp://oracle-ftp.oracle.com/apps/patchsets/PATCHSET_COMPARE_TOOL/patchsets.sh
ftp ftp.oracle.com
login as an anonymous user, and then:
cd support/outgoing/PATCHSET_COMPARE_TOOL
mget patchsets.sh

DATABASE scripts

How to check access level when label security feature is installed.

col  USER_NAME format a15
col POLICY_NAME format a15
col USER_PRIVILEGES format a15
col USER_LABELS format a20
select USER_NAME,POLICY_NAME,USER_PRIVILEGES,USER_LABELS from dba_sa_users
 where USER_NAME=’APPS’;


procedure or package backup

set verify off
set feedback off
set lines 132
set pages 0
set heading off
set space 0
set recsep off
column text format a79
column line noprint

Spool ABC_CRS_TASKS_DL_bak.pkg

select DECODE(line,1,'create or replace ','')||text
from dba_source
where owner = upper('apps')
and type = upper('package')
and name = upper('ABC_CRS_TASKS_DL')
and line >= 1;

select DECODE(line,1,'create or replace ','')||text
from dba_source
where owner = upper('apps')
and type = upper('package body')
and name = upper('ABC_CRS_TASKS_DL')
and line >= 1;

spool off

Script to compile package,procedure,view manually
SQL> select 'alter view '|| OBJECT_NAME ||' compile ;' from user_objects
where OBJECT_TYPE='VIEW' and status='INVALID';
SQL> select 'alter procedure '|| OBJECT_NAME ||' compile ;' from user_objects
where OBJECT_TYPE='PROCEDURE' and status='INVALID';
SQL> select 'alter package '|| OBJECT_NAME ||' compile body ;' from user_objects
where OBJECT_TYPE='PACKAGE BODY' and status='INVALID';
SQL> select 'alter package '|| OBJECT_NAME ||' compile ;' from user_objects
where OBJECT_TYPE='PACKAGE' and status='INVALID';

select OWNER,OBJECT_TYPE,count(*) from dba_objects where status='INVALID' group by
OBJECT_TYPE,owner;


To compile the package:
alter package packg_name compile (will compile only the header).
alter package packg_name compile body (will compile the body explicitly).

Check To know whether package body also exists etc.
select owner , OBJECT_NAME ,OBJECT_TYPE , status from dba_objects where OBJECT_NAME like '%CSI_ITEM_INSTANCE_PUB%';


Syntax to create synonym
create synonym system.FND_ORACLE_USERID_bkp for system.FND_ORACLE_USERID;

How to set a table in read-only mode

ALTER TABLE empADD CONSTRAINT read_only CHECK (1=1) DISABLE VALIDATE;It is now, impossible to insert, update or delete anything with this table.



How to backup the defination of a View before droping a view.

select dbms_metadata.get_ddl(’VIEW’,'RG_View’,'APPS’) from dual;

How to check if the partitions of a table are set to LOGGING

select partition_name, logging
from dba_tab_partitions
where table_name=’WF_LOCAL_ROLES’;


How to check which object is corrupted when corrupted file_id is know

SELECT tablespace_name, segment_type, owner, segment_name
FROM dba_extents
WHERE file_id = 64 and 1 between block_id AND block_id + blocks-1;

col file_id format 99
col block_id format 9999999
col blocks format 9999999
col segment_name format a25
col owner format a15
col tablespace_name format a20
set lines 150

SELECT file_id,block_id,blcoks,tablespace_name, segment_type, owner, segment_name
FROM dba_extents
WHERE file_id = &1
and &2 between block_id AND block_id + blocks - 1

Count the number of JAVA Objects in the APPS schema via the SQL:select count(*)
from dba_objects
where owner = 'APPS'
and object_type like '%JAVA%';

To find number of invalid JAVA objects via:
select count(*)
from dba_objects
where owner = 'APPS'
and object_type like '%JAVA%'
and status = 'INVALID';

set linesize 120
set pagesize 60
col java_class format a80 wrap
select dbms_java.longname(object_name) as "JAVA_CLASS", status
from user_objects
where object_type = 'JAVA CLASS'
and status = 'INVALID'
/

To reduce invalid java objects do,
Run adadmin - Reload JAR files
Run adadmin - Compile Apps schema

To compile java class objects
SQL> alter java CLASS "oracle/apps/jtf/cache/CacheMessageManager" compile;
SQL> alter java class "oracle/apps/fnd/security/AolSecurity" resolve ;

Warning: Java altered with compilation errors.

SQL> show err
Errors for JAVA CLASS /50e4719a_AolSecurity:

set echo off
set feedback off
set pagesize 0
spool alter_java.sql
select 'ALTER JAVA SOURCE "' || object_name || '" COMPILE;'
from user_objects
where object_type = 'JAVA SOURCE'
and status = 'INVALID'
/
select 'ALTER JAVA CLASS "' || object_name || '" RESOLVE;'
from user_objects
where object_type = 'JAVA CLASS'
and status = 'INVALID'
/
spool off
set feedback on
set pagesize 120
set echo on
@alter_java.sql


To laod JAVA objects to database manually
Eg:
loadjava asf java/jar asfleadshare.jar
loadjava asg java/jar asgmtran.jar
loadjava csf java/jar csflf.jar
loadjava csf java/jar csflf.jar
loadjava cz java/jar czdb.jar
loadjava eam java/jar eampmsch.jar
loadjava eam java/jar eamwkbch.jar
loadjava ecx java/jar ecxutils.jar
loadjava ecx java/jar ecxprocess.jar
loadjava fnd java/3rdparty/stdalone xmlparserv2.zip
loadjava fnd java/jar fndcct.jar
loadjava fnd java/jar fndsec.jar
loadjava ibe java/jar ibeeos.jar
loadjava inv java/jar invdbtrx.jar
loadjava inv java/jar invlabel.jar
loadjava jtf java/jar jtfaoljdepen.zip
loadjava pay java/jar payproc.jar
loadjava pay java/jar payutil.jar
loadjava per java/jar perimage.jar
loadjava per java/jar perkpiclient.jar
loadjava per java/jar perkigfclient.jar
loadjava wms java/jar wmscrtzn.jar
loadjava xtr java/jar xtrintrp.jar
Related metalink note:To ensure the removal of any unnecessary java class files run the rmjvm.sql and full_jvminst.sql (as per Note 276554.1)

few more egs:
loadjava -user apps/ -r .jar
loadjava -force -u apps/ -r AppsCacheContext.class
loadjava -force -resolve -user user/password@database -verbose jars
loadjava -u apps/apps -r $JTF_TOP/java/jar/jtfaoljdepen.zip
loadjava -user apps/ -v -force -resolve $JTF_TOP/java/jar/jtfaoljdepen.zip


To find java class object details given thier longname

col object_name format a45
col owner format a10
select object_name, status, owner
from dba_objects
where object_type = 'JAVA CLASS'
and dbms_java.longname(object_name) IN
(
'oracle/xml/parser/v2/DOMParser',
'oracle/xml/parser/v2/XMLError',
'oracle/xml/parser/v2/NSName',
'oracle/xml/parser/v2/SAXParser',
'oracle/xml/parser/v2/XMLParser',
'oracle/xml/parser/v2/DTD'
)
;

Table reorg
"SQL> show user;
USER is ""SYS""
SQL> ALTER TABLE ONT.OE_ORDER_LINES_ALL ENABLE ROW MOVEMENT ;

Table altered.

SQL> ALTER TABLE ONT.OE_ORDER_LINES_ALL SHRINK SPACE COMPACT CASCADE;

Table altered.

SQL> ALTER TABLE ONT.OE_ORDER_LINES_ALL SHRINK SPACE CASCADE;"


To grant privileges on one user objects to another user
You could write a simple loop :
begin
for i in
(select distinct table_name from all_tables where owner='USER_A')
loop
execute immediate 'grant all on '||i.table_name||' to USER_B';
end loop;
end;
/

To find users who have DBA role means List of Persons Having DML Access
Select username, created from dba_users where username in (Select grantee from dba_role_privs where granted_role = 'DBA');


To find temporary tablespace usage query
"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;


How would you check if the tablespace is in backup mode ?- Check in v$backup
SQL> SELECT d.tablespace_name, b.status FROM dba_data_files d, v$backup b
WHERE d.file_id = b.FILE# and b.STATUS = ‘ACTIVE’ ;


how to monitor dba_jobs of materialized view
For more detailed info, pls follow ""How to monitor the progress of a materialized view refresh (MVIEW) [ID 258021.1]
Check for number of failures in query. In case of failures check for any locks/blocking sessions.

SQL> column broken format a6
SQL>
SQL> alter session set nls_date_format='DD-MON-YY hh24:MI:SS';

Session altered.

SQL> select job, last_date last_refresh,next_date next_refresh, total_time,broken, failures, what from dba_jobs where what like '%dbms_refresh%ABSL_MGN_BK_US_OPS_MV1%';

JOB LAST_REFRESH NEXT_REFRESH TOTAL_TIME BROKEN
---------- ------------------------ ------------------------ ---------- ------
FAILURES
----------
WHAT
--------------------------------------------------------------------------------
7643 02-JAN-10 00:00:04 03-JAN-10 00:00:00 331694 N
0
dbms_refresh.refresh('""ABSL"".""ABSL_MGN_BK_US_OPS_MV1""');


To force a logfile switch use

ALTER SYSTEM SWITCH LOGFILE;

Put db in archive mod in 10g
If your DB is in no Archive log mode then change the mode to Archive log.

Set FRA (Flash Recovery Area) in your init/spfile.ora

DB_RECOVERY_FILE_DEST=/u03/FRA
DB_RECOVERY_FILE_DEST_SIZE=4G

Startup up the database in mount state

$ sqlplus / as sysdba

SQL> STARTUP MOUNT;
SQL> ALTER DATABASE ARCHIVE LOG;
SQL> ALTER DATABASE OPEN;
SQL> ARCHIVE LOG LIST;

To force a checkpoint use

ALTER SYSTEM CHECKPOINT;


In Oracle 10.1 and above, the following supported command can be used to flush the buffer cache:

ALTER SYSTEM FLUSH BUFFER_CACHE;
In Oracle 9.0.1 and above the following unsupported command can also be used to flush the buffer cache:

ALTER SESSION SET EVENTS 'immediate trace name flush_cache';
After this command has been executed, the STATE column for all rows in X$BH will be zero unless the block is currently pinned

To flush the shared pool use:

ALTER SYSTEM FLUSH SHARED_POOL;

move all objects from tools to apps_ts_tools and then drop tools tablepsaceEg:
alter TABLE USIDBA.USI_ALERT_LOG move tablespace APPS_TS_TOOLS
alter index USIDBA.USII0_INFO rebuild online tablespace APPS_TS_TOOLS parallel 2;

To check on which directories you have privilege to read & write:
#################################################################

SQL> SELECT privilege, directory_name
2 FROM user_tab_privs t, all_directories d
3 WHERE t.table_name(+)=d.directory_name
4 ORDER BY 2,1;

Re-creating Dba_directories
drop directory COST_DIR;
create directory COST_DIR as '/d01/oravis/visappl/xxhem/11.5.0/datain/Cost';

grant all on directory COST_DIR to apps;

Using ANALYZE command is little bit older now. If you are using oracle >8i then you have new package called dbms_stats.
To analyze schema use
dbsm_stats.gather_schema_stats 'USERNAME',casacde=>true,estimate_percent=>10);
For table use the following
dbms_stats.gather_table_stats

syntax for analysing a table is :
ANALYZE TABLE emp ESTIMATE STATISTICS;
The full syntax (not using DBMS package) is

ANALYZE TABLE xxxxx ESTIMATE STATISTICS SAMPLE 20 PERCENT;
analyze table Dec6Table4 compute statistics;
Oracle will actually read through all the blocks/rows to compute the true value of the stats"

To drop and re-create the statistics on sys schema
SQL> EXECUTE DBMS_STATS.DELETE_SCHEMA_STATS('SYS');
SQL> EXECUTE DBMS_STATS.GATHER_SCHEMA_STATS('SYS');


exec fnd_stats.gather_schema_statistics('SYS');
exec fnd_stats.gather_schema_statistics('SYSTEM');
exec fnd_stats.gather_schema_statistics('ONT');

sqlplus apps/
SQL> exec fnd_stats.gather_schema_statistics('MRP'); <- One schema
SQL> exec fnd_stats.gather_schema_statistics('ALL'); <- All schemas
SQL> exec fnd_stats.gather_table_stats('MRP','MRP_FORECAST_DATES'); <- One table
exec fnd_stats.gather_schema_statistics(SCHEMANAME =>'XXBR',ESTIMATE_PERCENT=>10,HMODE=>'LASTRUN',OPTIONS=>'GATHER AUTO',MODPERCENT=>5,INVALIDATE=>'Y');


To find out a hidden parameter value in the database
SELECT a.ksppinm ""Parameter"",
b.ksppstvl ""Session Value"",
c.ksppstvl ""Instance Value""
FROM x$ksppi a, x$ksppcv b, x$ksppsv c
WHERE a.indx = b.indx AND
a.indx = c.indx AND
a.ksppinm LIKE '%kgl_large_heap%';

To get a list of all deprecated initialization parameters, issue the following SQL statement:
SELECT name FROM v$parameter WHERE isdeprecated = 'TRUE';


How to Inovke SQLPLUS in scripts in Oracle 10g !!!
In Oracle 9i we use ""sqlplus -s @start_mydb.sql"" to start the database. But, where as in Oracle 10g this command simply hangs and will not do anything.

To invoke SQLPLUS in shell/bat scripts in Oracle 10g, We need to give below command.
sqlplus /NOLOG @start_mydb.sql


How to find the ORACLE_HOME path in Oracle Database?
In 9i:

SELECT substr(file_spec,1,instr(file_spec,'lib')-2) ORACLE_HOME FROM dba_libraries
WHERE library_name='DBMS_SUMADV_LIB';

In 10g:

SQL > var OHM varchar2(100);
SQL > EXEC dbms_system.get_env('ORACLE_HOME', :OHM) ;
SQL > PRINT OHM

Linux/Unix:

echo $ORACLE_HOME

Windows:

start - run - regedit (enter) - HKEY_LOCAL_MACHINE - SOFTWARE - ORACLE

Type the below command at prompt if the environment variable is defined for ORACLE_HOME

c:\> set oracle_home (ENTER)


Using ORA_ROWSCN and SCN_TO_TIMESTAMP to find the last updated date or timestamp of a record.
SQL> SELECT scn_to_timestamp(ORA_ROWSCN) FROM emp WHERE empno=7839;

SCN_TO_TIMESTAMP(ORA_ROWSCN)
------------------------------------
02-SEP-08 03.20.20.000000000 PM"


To find database characterset
SQL> SELECT * FROM nls_database_parameters;
SQL> select * from nls_database_parameters
2 where parameter in ('NLS_LANGUAGE','NLS_TERRITORY','NLS_CHARACTERSET');

PARAMETER VALUE
------------------------------ ----------------------------
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CHARACTERSET WE8ISO8859P1
"
"Set the NLS_LANG environment variable according the database character set and language details.
$ export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1

Following script can be used to construct the dblink.
SELECT‘create ‘||DECODE(U.NAME,’PUBLIC’,'public ‘)||’database link ‘||CHR(10)||DECODE(U.NAME,’PUBLIC’,Null, U.NAME||’.')|| L.NAME||chr(10)    ||’connect to ‘ || L.USERID || ‘ identified by ”’||L.PASSWORD||”’ using ”’ || L.host || ””   ||chr(10)||’;’ TEXTFROM  sys.link$       L,      sys.user$       UWHERE L.OWNER# = U.USER# ; 

To drop db links
SQL> select 'drop database link '||b.username||'.'||c.name||' ;'
from dba_users b ,link$ c
where c.owner#=b.user_id
union
select 'drop public database link '||c.name||' ;'
from link$ c
where owner#=1;
To test DB links
select * from dual@link name; need to put tns entries for using colomun

To find/create DB links
select 'DB link for '||b.username||chr(10)||' create database link '||c.name||' connect to '||c.userid|| ' identified by '||c.password||' using '''||c.host||''';'
from dba_users b ,link$ c
where c.owner#=b.user_id
union
select 'DB link for Public' ||chr(10)|| ' create public database link '||c.name||' connect to
'||c.userid|| ' identified by '||c.password||' using '''||c.host||''';'
from link$ c
where owner#=1
;

select owner||','||DB_LINK||','||USERNAME||','||HOST||','||created from dba_db_links;

To create db link b/w two instances:
VIS is the non-prod ASCP instance. All ASCP related db links should point to VIS.

Login to the DB as system user:
Drop public database link PLAN;
Drop public database link VIS;
Create public database link PLAN connect to APPS identified by APPS using ‘VIS’;
Create public database link VIS connect to APPS identified by APPS using ‘VIS’;

Login to the DB as apps user:
Drop database link PLAN;
Drop database link VIS;
Create database link PLAN connect to APPS identified by APPS using ‘VIS’;
Create database link VIS connect to APPS identified by APPS using ‘VIS’;

How to find the particular Data Dictionary Table or Dynamic Performance View (V$)?
SELECT * FROM dictionary
WHERE table_name='DICTIONARY';

TABLE_NAME
------------------------------
COMMENTS
-----------------------------------------------
DICTIONARY
Description of data dictionary tables and views

To Stop Password set DB listener
LSNRCTL> set current_listener ABC
Current Listener is ABC
LSNRCTL> set password xxxxx
The command completed successfully
LSNRCTL> start ABC


Creating dictionary mangaed temporary tablespsce
create tablespace temp datafile '/d14/oracle/proddata/temp01.dbf' size 2048M temporary default storage (initial 5m next 5m pctincrease 0);


Enable unsuccessfull db sessions audit
audit_trial=true in parameter file
"Connect to sysdba
create spfile from pfile
=> start the database
=> NOAUDIT ALL ;
= AUDIT SESSION WHENEVER NOT SUCCESSFUL;
=> Run this script to verify that audit is enabled for failed logins only :
SQL> SELECT * FROM dba_stmt_audit_opts;

USER_NAME PROXY_NAME AUDIT_OPTION SUCCESS FAILURE
------------------------------ ------------------------------ ---------------------------------------- ---------- ----------
CREATE SESSION NOT SET BY ACCESS


Here is the list of few important tables.

Concurrent Manager

FND_CONCURRENT_QUEUES
FND_CONCURRENT_PROGRAMS
FND_CONCURRENT_REQUESTS
FND_CONCURRENT_PROCESSES
FND_CONCURRENT_QUEUE_SIZE

FND

FND_APPL_TOPS
FND_LOGINS
FND_USER
FND_DM_NODES
FND_TNS_ALIASES
FND_NODES
FND_RESPONSIBILITY
FND_DATABASES
FND_UNSUCCESSFUL_LOGINS
FND_LANGUAGES
FND_APPLICATION
FND_PROFILE_OPTION_VALUES

AD / Patches

AD_APPLIED_PATCHES
AD_PATCH_DRIVERS
AD_BUGS
AD_INSTALL_PROCESSES
AD_SESSIONS
AD_APPL_TOPS

To revert the password back
SQL> alter user abc identified by values '901D29B9D7CACF3D';

To know the value of any parameter listed in init.ora.
select name , value from v$parameter; or
show parameter dump;

To know database status
select status from v$instance;

To know database name
select name from v$database


Enabling hot backup
1.do the following changes in init file:

log_archive_start = true
log_archive_format = SID_%t_%s.arc (SID - instance name)
log_archive_dest = '/ux1/oraarch/SID’ REOPEN' (x - could be 1,2,3 etc; there's a space after SID)

2.shutdown immediate;
3.startup mount;
4.alter database archivelog;
5.alter database open ;
6.archive log list; (to check the changes are there)
7.alter system switch logfile;
8.check the log dir.Verify that log files are getting written there or not.

To take the DB out of archive mode
SQL>sqlplus "" / as sysdba""
SQL>archive log stop;
SQL>alter database noarchivelog;
4. Shutdown the database.
5. Start the database instance
sqlplus "" / as sysdba""
SQL>startup pfile=/d01/vis/sw/920/dbs/initvis.ora -- This init.ora file has been updated to start the database in noarchivelog mode
SQL>archive log list; -- This should show that automatic archival is disabled and that the database is running in noarchivelog mode"


If Compiling Invalids manually:
i) As sysdba run utlrcmp.sql from rdbms/admin
Then as sysdba run the follwoing
exec utl_recomp.recomp_parallel (8);(8 – no. Of workers)
ii) in case of Materialized Views:
TO COMPILE INVALID OBJECTS WE CAN USE THE FOLLOWING SYNTAX exec
dbms_mview.refresh ('VIEW NAME');

Syntax to refresh meterilaized view:

SQL> connect apps/xxx
Connected.
SQL> begin
2 dbms_snapshot.refresh('CCOR_NETRV_MV','c');
3 end;
4 /

dbms_refresh.refresh('"APPS"."FREIGHT_NOT_INVOICED_MV"');

INVALIDS IN SPECIFIC FORMAT
Invalid objects listing by name, type, owner; total count.
spool original_invalids.lst
col owner format a15
col object_name format a35
col object_type format a18
select count(*) from dba_objects where status = 'INVALID';
select object_name, object_type, owner from dba_objects where status = 'INVALID';
spool off;

Invalid objects listing by name, type, owner; total count.
spool original_invalids.lst
col owner format a15
col object_name format a35
col object_type format a18
select count(*) from dba_objects where status = 'INVALID';
select owner, object_name, object_type from dba_objects where status = 'INVALID' order by owner, object_name;
spool off;

Number of database objects by owner, type (order by owner, type). spool original_objects.lst
col owner format a15
col object_name format a35
col object_type format a18
select owner, object_type, count(object_type) from dba_objects group by owner, object_type order by owner, object_type;
spool off;"

select count(*) from dba_objects where status='INVALID';

SELECT owner, object_type, object_name
FROM dba_objects
WHERE status = 'INVALID'
AND object_name IN (SELECT referenced_name
FROM dba_dependencies
WHERE name ='WK_SNAPSHOT');

DBVERIFY for chechking database block corruption
dbv file=/u01/oradata/PROJDEV/invd02.dbf blocksize=8192 logfile=invd02_feb25.log feedback=10000

create a password file as follows:
$orapwd file=$ORACLE_HOME/dbs/orapwDB01
password=orapass(must be sys pwd) entries=5

set REMOTE_LOGIN_PASSWORDFILE to EXCLUSIVE.


to grant all privileges for all tables of a schema to another schema:
SQL> begin
for i in (select distinct table_name from all_tables where owner='MIM')
loop
execute immediate 'grant all on '||i.table_name||' to apps';
end loop;
end;
/


When starting listener for DB, you will find it asks for password.
Do the following :

lsnrctl
LSNRCTL>set current_listener PROD
LSNRCTL>set password

supply the pwd

LSNRCTL>stop or start as the case may be
LSNRCTL>exit

Version related scripts from database

How to find out version of a package.

select text from dba_source
where line=2
and name=’AP_IMPORT_INVOICES_PKG’;


How to find out Package Header.
select name,text from dba_source where text like ‘%Header: %’
and owner = ‘APPS’ and name = ‘INVALID_OBJECT_NAME’;

How to check whether the product is install,shared and Not installed in Apps.

select t.application_name
, t.application_id
, i.patch_level
, decode(i.status,’I',’Fully Installed’,
‘N’,'Not Installed’,'S’,'Shared’,'Undetermined’) status
from fnd_product_installations i
, fnd_application_vl t
where i.application_id = t.application_id
order by t.application_id;

/* To find the latest application version */

select ARU_RELEASE_NAME||’.'||MINOR_VERSION||’.'||TAPE_VERSION version, START_DATE_ACTIVE updated,ROW_SOURCE_COMMENTS “how it is done”, BASE_RELEASE_FLAG “Base version” FROM AD_RELEASES where END_DATE_ACTIVE IS NULL

/* to find the base application version */

select ARU_RELEASE_NAME||’.'||MINOR_VERSION||’.'||TAPE_VERSION version, START_DATE_ACTIVE when updated, ROW_SOURCE_COMMENTS “how it is done” from AD_RELEASES where BASE_RELEASE_FLAG = ‘Y’

/* To find all available application version */

select ARU_RELEASE_NAME||’.'||MINOR_VERSION||’.'||TAPE_VERSION version, START_DATE_ACTIVE when updated, END_DATE_ACTIVE “when lasted”, CASE WHEN BASE_RELEASE_FLAG = ‘Y’ Then ‘BASE VERSION’ ELSE ‘Upgrade’ END “BASE/UPGRADE”, ROW_SOURCE_COMMENTS “how it is done” from AD_RELEASES


Workflow version embedded in 11i
************************
Run following SQL from apps user ;
SQL>select TEXT from WF_RESOURCES where NAME='WF_VERSION';

You should see output like
TEXT
-----------------------
2.6.0
Which means you are on Workflow Version 2.6.0

You can also use script wfver.sql in FND_TOP/sql to find version of workflow in Apps.

To check if if your database contains an Identity Management Metadata Repository
enter the following query (a non-null result means you should perform the step):
SQL> select USERNAME from dba_users where upper(USERNAME) like '%ODS%';


An eg of import command:
SQL> drop user DBO cascade;
User dropped
imp system/xxxxxx FILE=exp_tw01_042109.dmp log=imp_DBO_TW02.log full=y


How to backup the defination of a View before droping a view or index.

select dbms_metadata.get_ddl(’VIEW’,'RG_View’,'APPS’) from dual;

To get defination of index
SQL> select dbms_metadata.GET_DDL('INDEX','FND_LOBS_CTX','APPLSYS') from dual;

DBMS_METADATA.GET_DDL('INDEX','FND_LOBS_CTX','APPLSYS')
--------------------------------------------------------------------------------

CREATE INDEX ""APPLSYS"".""FND_LOBS_CTX"" ON ""APPLSYS"".""FND_LOBS"" (""FILE_DATA"")


To display options that are installed (the value column is ‘FALSE’ if the
option is not installed)

SELECT parameter, value FROM v$option;


To know database version query
seelct version from v$instance;
select banner from v$version;
select comp_name,version,status from dba_registry;