分类目录归档:Oracle Database

How to determine bind variable value and type from trace file

from

http://oradbatips.blogspot.jp/2007/11/tip-64-how-to-determine-bind-variable.html

For finding more information about bind variable, user should be able to locate BINDS keyword in trace file.
This part is something like this :

BINDS #2:
bind 0: dty=1 mxl=32(30) mal=00 scl=00 pre=00 oacflg=13 oacfl2=1 size=32 offset=0
bfp=030a79ec bln=32 avl=01 flg=05
value="A"

dty determines bind variable type and value shows bind variable value at the time of execution.
Different values can be assigned to dty which presents different data type.

Typical dty value is :

1 VARCHAR2 or NVARCHAR2
2 NUMBER
8 LONG
11 ROWID
12 DATE
23 RAW
24 LONG RAW
96 CHAR
112 CLOB or NCLOB
113 BLOB
114 BFILE

To demosnstrate, I ran some queries.

SQL> alter session set statistics_level=ALL;

Session altered.

SQL> alter session set max_dump_file_size=UNLIMITED;

Session altered.

SQL> alter session set events '10046 trace name context forever, level 12';

Session altered.

SQL> variable b number;
SQL> declare
2 cnt number;
3 begin
4 :b:=1;
5 select count(*) into cnt from dba_objects where object_id=:b;
6 end;
7 /

PL/SQL procedure successfully completed.

SQL> alter session set events '10046 trace name context off';

Session altered.

Checking trace file ……

PARSING IN CURSOR #2 len=52 dep=1 uid=0 oct=3 lid=0 tim=2797155817 hv=1220784193 ad='130a9d4c'
SELECT count(*) from dba_objects where object_id=:b1
END OF STMT
PARSE #2:c=15625,e=24270,p=0,cr=5,cu=0,mis=1,r=0,dep=1,og=0,tim=2797155809
BINDS #2:
bind 0: dty=2 mxl=22(22) mal=00 scl=00 pre=00 oacflg=13 oacfl2=1 size=24 offset=0
bfp=030a7b2c bln=22 avl=02 flg=05
value=1
EXEC #2:c=0,e=2062,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,tim=2797159524
FETCH #2:c=0,e=37,p=0,cr=3,cu=0,mis=0,r=1,dep=1,og=4,tim=2797159885

 

—— Query #2 : Varhchar2 Bind variable

SQL> alter session set events '10046 trace name context forever, level 12';

Session altered.

SQL> variable b varchar2(30);
SQL> declare
2 cnt number;
3 begin
4 :b:='A';
5 select count(*) into cnt from dba_objects where object_name=:b;
6 end;
7 /

PL/SQL procedure successfully completed.

SQL> alter session set events '10046 trace name context off';

Checking trace file .....

PARSING IN CURSOR #2 len=54 dep=1 uid=0 oct=3 lid=0 tim=3007778755 hv=2029951970 ad='12ff2c80'
SELECT count(*) from dba_objects where object_name=:b1
END OF STMT
PARSE #2:c=15625,e=12991,p=0,cr=2,cu=0,mis=1,r=0,dep=1,og=0,tim=3007778748
BINDS #2:
bind 0: dty=1 mxl=32(30) mal=00 scl=00 pre=00 oacflg=13 oacfl2=1 size=32 offset=0
bfp=030a79ec bln=32 avl=01 flg=05
value="A"
EXEC #2:c=0,e=2167,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,tim=3007782524
WAIT #2: nam='db file sequential read' ela= 9458 p1=1 p2=89 p3=1
WAIT #2: nam='db file sequential read' ela= 6606 p1=1 p2=26791 p3=1

 

 

EBS, visit homepage, 500 Internal Server Error

restore a 11203 database backup, not change appl files.

visit the EBS login page

http://server:port/

500 Internal Server Error
Servlet error: An exception occurred. The current application deployment descriptors do not allow for including it in this response. Please consult the application log for details.

check $INST_TOP/logs/ora/10.1.3/j2ee/oacore/oacore_default_group_1/application.log
find following errors

12/05/02 00:04:26.497 html: Servlet error
java.lang.ExceptionInInitializerError
at oracle.apps.fnd.sso.Utils.(Utils.java:664)
at oracle.apps.fnd.sso.AppsLoginRedirect.AppsSetting(AppsLoginRedirect.java:116)
at oracle.apps.fnd.sso.AppsLoginRedirect.init(AppsLoginRedirect.java:170)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpApplication.loadServlet(HttpApplication.java:2379)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpApplication.findServlet(HttpApplication.java:4830)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpApplication.findServlet(HttpApplication.java:4754)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpApplication.getRequestDispatcher(HttpApplication.java
:2978)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.ja
va:738)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java
:453)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:234)
at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:29)
at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:879)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResource
PooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:619)
Caused by: oracle.apps.fnd.common.AppsException: oracle.apps.fnd.common.PoolException: Not able to create new database connection: FNDSECUR
ITY_APPL_SERVER_ID
at oracle.apps.fnd.profiles.Profiles.getProfileOption(Profiles.java:1509)
at oracle.apps.fnd.profiles.Profiles.getProfile(Profiles.java:362)
at oracle.apps.fnd.profiles.ExtendedProfileStore.getSpecificProfileFromDB(ExtendedProfileStore.java:211)
at oracle.apps.fnd.profiles.ExtendedProfileStore.getSpecificProfile(ExtendedProfileStore.java:171)
at oracle.apps.fnd.profiles.ExtendedProfileStore.getProfile(ExtendedProfileStore.java:148)
at oracle.apps.fnd.common.logging.DebugEventManager.configureUsingDatabaseValues(DebugEventManager.java:1294)
at oracle.apps.fnd.common.logging.DebugEventManager.configureLogging(DebugEventManager.java:1149)
at oracle.apps.fnd.common.logging.DebugEventManager.internalReinit(DebugEventManager.java:1118)
at oracle.apps.fnd.common.logging.DebugEventManager.reInitialize(DebugEventManager.java:1085)
at oracle.apps.fnd.common.logging.DebugEventManager.reInitialize(DebugEventManager.java:1072)
at oracle.apps.fnd.common.AppsLog.reInitialize(AppsLog.java:595)
at oracle.apps.fnd.common.AppsContext.initLog(AppsContext.java:593)
at oracle.apps.fnd.common.AppsContext.initializeContext(AppsContext.java:570)
at oracle.apps.fnd.common.AppsContext.initializeContext(AppsContext.java:524)
at oracle.apps.fnd.common.AppsContext.(AppsContext.java:292)
at oracle.apps.fnd.common.WebAppsContext.(WebAppsContext.java:1095)
at oracle.apps.fnd.sso.Utils.getAppsContext(Utils.java:539)
at oracle.apps.fnd.sso.SessionMgr.loadInstalledLanguages(SessionMgr.java:3875)
at oracle.apps.fnd.sso.SessionMgr.getInstalledLanguages(SessionMgr.java:3693)
at oracle.apps.fnd.sso.Utils.getBaseInstalledLangCode(Utils.java:1476)
at oracle.apps.fnd.sso.Authenticator.(Authenticator.java:45)
… 17 more
Caused by: oracle.apps.fnd.common.PoolException: Not able to create new database connection: FNDSECURITY_APPL_SERVER_ID
at oracle.apps.fnd.security.DBConnObj.(DBConnObj.java:246)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at oracle.apps.fnd.common.Pool.createObject(Pool.java:1273)
at oracle.apps.fnd.common.Pool.borrowObject(Pool.java:1027)
at oracle.apps.fnd.security.DBConnObjPool.borrowObject(DBConnObjPool.java:584)
at oracle.apps.fnd.security.AppsConnectionManager.borrowConnection(AppsConnectionManager.java:301)
at oracle.apps.fnd.common.Context.borrowConnection(Context.java:1719)
at oracle.apps.fnd.common.AppsContext.getPrivateConnectionFinal(AppsContext.java:2266)
at oracle.apps.fnd.common.AppsContext.getPrivateConnection(AppsContext.java:2203)
at oracle.apps.fnd.common.AppsContext.getJDBCConnection(AppsContext.java:2061)
at oracle.apps.fnd.common.AppsContext.getJDBCConnection(AppsContext.java:1871)
at oracle.apps.fnd.common.AppsContext.getJDBCConnection(AppsContext.java:1715)
at oracle.apps.fnd.common.AppsContext.getJDBCConnection(AppsContext.java:1728)
at oracle.apps.fnd.common.Context.getJDBCConnection(Context.java:1453)
at oracle.apps.fnd.cache.GenericCacheLoader.load(GenericCacheLoader.java:170)
at oracle.apps.fnd.profiles.Profiles.getProfileOption(Profiles.java:1500)
… 37 more

check db connection using sqlplus

$ sqlplus apps/apps@vis1

SQL*Plus: Release 10.1.0.5.0 – Production on Wed May 2 00:19:00 2012

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, Data Mining
and Real Application Testing options

SQL>
……..OK

check db connection using

http://host:port/OA_HTML/jsp/fnd/aolj_native_conn_test.jsp

….OK

search FNDSECURITY_APPL_SERVER_ID in metalink
find following notes
Cannot Complete Applications Logon Error When Trying to Access the Personal Home Page in 11.5.10 (Doc ID 297165.1)

check dbc file, in $INST_TOP/appl/fnd/12.0.0/secure

[apps@slcc01db01 secure]$ java oracle.apps.fnd.security.AdminAppServer apps/ STATUS DBC=$FND_TOP/secure/_.dbc

-bash: apps: No such file or directory
$ java oracle.apps.fnd.security.AdminAppServer apps/apps STATUS DBC=$INST_TOP/appl/fnd/12.0.0/secure/VIS.dbc

Database Server
—————
DATABASE_ID: VIS
AUTHENTICATION: SECURE

Application Server
——————
APPL_SERVER_STATUS: INVALID
APPL_SERVER_ID: BE55F0DAD9FD799AE0434840F20A504835206050571755234233375501553514

……INVALID

check VIS.dbc update date, is Apr-24, seems changed by newer version …

redo adconfig
$cd /apps/visappl/ad/12.0.0/bin
$./adconfig.sh contextfile=/apps/visinst/@@/appl/admin/@@.xml appspass=apps
$./adconfig.sh contextfile=/apps/visinst/@@/appl/admin/@@.xml appspass=apps

$ java oracle.apps.fnd.security.AdminAppServer apps/apps STATUS DBC=$INST_TOP/appl/fnd/12.0.0/secure/VIS.dbc

Database Server
—————
DATABASE_ID: VIS
AUTHENTICATION: SECURE

Application Server
——————
APPL_SERVER_STATUS: VALID
APPL_SERVER_ID: BF08D1A8342D3BA2E0434940F20AEDE731393517292025862455146256984412

http connect to login page , ok

从11.1.0.7 32bit ASM OMF rman backup恢复数据到11.1.0.7 64bit filesystem OMF

 

准备工作
安装64bit软件
Install 11.1.0.6 db software
Upgrate to 11.1.0.7

复制rman备份到新机器
复制init.ora到新机器,修改相关路径如下

*.control_files=’/apps/oradata/DESTDB/controlfile/control01.ctl’
*.db_create_file_dest=’/apps/oradata’
*.db_create_online_log_dest_1=’/apps/oradata’

开始恢复
继续阅读

v$sql_plan format

set lines 121
set pages 999
col sql_text format a80
select sql_text from
v$sqltext_with_newlines
where hash_value=4041323804
order by piece;
set heading off
select ‘——————————————————————————–’ from dual
union all
select ‘| Operation                                                    | PHV/Object Name     | Rows  | Bytes| Cost   |’ as "Optimizer Plan:" from dual
union all
select ‘——————————————————————————–’ from dual
union all
select *
from (select
rpad(‘|’||substr(lpad(‘ ‘,1*(depth-1))||operation||
decode(options, null,”,’ ‘||options), 1, 62), 63, ‘ ‘)||’|'||
rpad(decode(id, 0, ‘—– ‘||to_char(hash_value)||’ —–’
, substr(decode(substr(object_name, 1, 7), ‘SYS_LE_’, null, object_name)
||’ ‘,1, 20)), 21, ‘ ‘)||’|'||
lpad(decode(cardinality,null,’ ‘,
decode(sign(cardinality-10000), -1, cardinality||’ ‘,
decode(sign(cardinality-1000000), -1, trunc(cardinality/1000)||’K',
decode(sign(cardinality-1000000000), -1, trunc(cardinality/1000000)||’M',
trunc(cardinality/1000000000)||’G')))), 7, ‘ ‘) || ‘|’ ||
lpad(decode(bytes,null,’ ‘,
decode(sign(bytes-1024), -1, bytes||’ ‘,
decode(sign(bytes-1048576), -1, trunc(bytes/1024)||’K',
decode(sign(bytes-1073741824), -1, trunc(bytes/1048576)||’M',
trunc(bytes/1073741824)||’G')))), 6, ‘ ‘) || ‘|’ ||
lpad(decode(cost,null,’ ‘,
decode(sign(cost-10000000), -1, cost||’ ‘,
decode(sign(cost-1000000000), -1, trunc(cost/1000000)||’M',
trunc(cost/1000000000)||’G'))), 8, ‘ ‘) || ‘|’ as "Explain plan"
from v$sql_plan
where hash_value = 3918835632)
union all
select ‘——————————————————————————–’ from dual;