trace的目的
trace主要是用于程序调优,优化,程序bug调试,程序运行系统情况跟踪
trace步骤
1.并发定义中,勾上“启用跟踪”
2.提交一个请求,得到请求编号
注意:用完之后,将启用追踪去掉,以免生成大量无用的 log 文件,占用服务器资源
3.获取并发程序日志目录:SELECT * FROM v$parameter t WHERE t.NAME = 'user_dump_dest'
4.用数据库用户登陆linux切换到上面查找出的目录:tkprof *XX.trc $HOME/XX.fchela.txt sort=fchela将trc转化为txt。sort=fchela。按执行时间倒序排列
5.用数据库用户登陆服务器:对应目录,找到文件
当然也可以用下面的 sql 语句查找 trace 文件
select fcr.request_id "Request ID",
p1.value "Trace Directory",
'*' || fcr.oracle_process_id || '*.trc' "Trace File format",
fcp.user_concurrent_program_name "Program"
from fnd_concurrent_requests fcr,
v$parameter p1,
fnd_concurrent_programs_tl fcp
where p1.name = 'user_dump_dest'
and fcp.language = 'US'
and fcr.concurrent_program_id = fcp.concurrent_program_id
and fcr.program_application_id = fcp.application_id
and fcr.request_id = &request_id
这个更详细:
select 'Request id: ' || request_id,
'Trace id: ' || oracle_process_id,
'Trace Flag: ' || req.enable_trace,
'Trace Name: ' || dest.value || '/' || lower(dbnm.value) || '_ora_' ||
oracle_process_id || '.trc',
'Prog. Name: ' || prog.user_concurrent_program_name,
'File Name: ' || execname.execution_file_name ||
execname.subroutine_name,
'Status : ' || decode(phase_code, 'R', 'Running') || '-' ||
decode(status_code, 'R', 'Normal'),
'SID Serial: ' || ses.sid || ',' || ses.serial#,
'Module : ' || ses.module
from fnd_concurrent_requests req,
v$session ses,
v$process proc,
v$parameter dest,
v$parameter dbnm,
fnd_concurrent_programs_vl prog,
fnd_executables execname
where req.request_id = &request
and req.oracle_process_id = proc.spid(+)
and proc.addr = ses.paddr(+)
and dest.name = 'user_dump_dest'
and dbnm.name = 'db_name'
and req.concurrent_program_id = prog.concurrent_program_id
and req.program_application_id = prog.application_id
and prog.application_id = execname.application_id
and prog.executable_id = execname.executable_id;
FORM的trace
在任意想要 trace 的界面上,点菜单栏上的帮助->诊断->跟踪>选择一个跟踪的选择即可。
点完之后,界面提示 trace 文件存放位置及文件名
Report trace
需要在 report 开发时修改下面内容
1.Add "SRW.USER_EXIT('FND SRWINIT');" in before report trigger
2. Add "SRW.USER_EXIT('FND SRWEXIT');" in after report trigger
3. Add a parameter P_CONC_REQUEST_ID in User Parameters
这样就可以拥有启用跟踪的功能