文章目录
- 值集查询
- 快码查询
- 查询可执行请求
- 批量取消请求
- 职责查询
- 死锁处理
- 脚本获取包体
- 查询最后编译信息
值集查询
SELECT ffs.flex_value_set_id,
ffs.flex_value_set_name,
ffv.flex_value,
ffv.flex_value_meaning,
ffv.description,
ffv.flex_value
FROM applsys.fnd_flex_value_sets ffs, fnd_flex_values_vl ffv
WHERE ffs.flex_value_set_id = ffv.flex_value_set_id
AND ffs.flex_value_set_name = ?
AND ffv.enabled_flag = 'Y'
AND ffv.flex_value = ?
AND SYSDATE BETWEEN nvl(ffv.start_date_active, SYSDATE) AND
nvl(ffv.end_date_active, SYSDATE + 1);
快码查询
SELECT flv.meaning
FROM fnd_lookup_values flv
WHERE flv.language = userenv('LANG')
AND flv.lookup_type = ?
AND flv.enabled_flag = 'Y'
AND flv.lookup_code = ?;
查询可执行请求
SELECT fcpv.user_concurrent_program_name 程序名称,
fcpv.concurrent_program_name 并发程序简称,
fcpv.output_file_type 输出格式,
fefv.executable_name 执行程序简称,
fefv.execution_file_name 执行文件名称,
decode(fefv.execution_method_code,
'I',
'PL/SQL存储过程',
'P',
'Oracle Reports') 执行方法
FROM fnd_concurrent_programs_vl fcpv, fnd_executables_form_v fefv
WHERE 1 = 1
AND fcpv.executable_id = fefv.executable_id
AND fcpv.enabled_flag = 'Y'
AND fcpv.concurrent_program_name = 'AUTOREMAPI'
批量取消请求
DECLARE
CURSOR c_r IS
SELECT cp.user_concurrent_program_name,
r.request_id,
r.requested_by user_id,
r.responsibility_id,
r.responsibility_application_id
FROM fnd_concurrent_requests r, fnd_concurrent_programs_vl cp
WHERE r.concurrent_program_id = cp.concurrent_program_id
AND r.phase_code IN ('P', 'R', 'C')
AND r.concurrent_program_id = 265358
AND r.request_date > trunc(SYSDATE);
l_bool BOOLEAN;
l_msg VARCHAR2(2000);
BEGIN
FOR rec IN c_r LOOP
fnd_global.apps_initialize(user_id => rec.user_id,
resp_id => rec.responsibility_id,
resp_appl_id => rec.responsibility_application_id);
l_bool := fnd_concurrent.cancel_request(request_id => rec.request_id,
message => l_msg);
COMMIT;
dbms_output.put_line(rec.user_concurrent_program_name || '=>请求ID:' ||
rec.request_id || ',message:' || l_msg);
END LOOP;
END;
职责查询
SELECT distinct fst.responsibility_name 职责名
FROM fnd_responsibility_tl fst
WHERE 1 = 1
AND fst.language = 'ZHS'
AND fst.RESPONSIBILITY_NAME like '%%';
SELECT distinct wur.user_name 用户名,fst.responsibility_name 职责名
FROM fnd_responsibility_tl fst,wf_all_user_roles wur
WHERE 1 = 1
AND fst.language = 'ZHS'
AND fst.RESPONSIBILITY_ID = wur.role_orig_system_id
order by wur.user_name;
select fu.user_name,
ppf.FULL_NAME,
fr.RESPONSIBILITY_NAME,
fur.START_DATE,
fur.END_DATE,
fcp.CONCURRENT_PROGRAM_NAME,
fcp.USER_CONCURRENT_PROGRAM_NAME
from fnd_user fu,
per_people_f ppf,
fnd_user_resp_groups_all fur,
fnd_responsibility_vl fr,
fnd_request_groups frg,
fnd_request_group_units frgu,
fnd_concurrent_programs_vl fcp
where fu.user_id = fur.user_id
and fu.employee_id = ppf.PERSON_ID
and ppf.EFFECTIVE_END_DATE > sysdate
and fur.RESPONSIBILITY_ID = fr.RESPONSIBILITY_ID
and fr.REQUEST_GROUP_ID = frg.request_group_id
and frgu.request_group_id = frg.request_group_id
and frgu.request_unit_id = fcp.CONCURRENT_PROGRAM_ID
order by 1, 2, 3, 6;
死锁处理
SELECT l.session_id sid,
s.serial
l.locked_mode,
l.oracle_username,
s.user
l.os_user_name,
s.machine,
s.terminal,
a.sql_text,
a.action
FROM v$sqlarea a, v$session s, v$locked_object l
WHERE l.session_id = s.sid
AND s.prev_sql_addr = a.address
ORDER BY sid, s.serial
alter system kill session'135,397'
SELECT b.owner,
b.object_name,
c.logon_time 登录时间,
c.client_identifier,
c.username 数据库用户名称,
c.command 正在处理的命令,
c.status 会话当前状态,
c.osuser 操作系统名称,
c.machine 操作系统主机,
c.terminal 操作系统终端,
c.program 操作系统程序名称,
c.type 会话类型,
c.action 正在执行的操作名称,
a.locked_mode,
'alter system kill session ' || '''' || c.sid || ',' || c.serial
''';' kill_command
FROM v$locked_object a, v$session c, dba_objects b
WHERE c.sid = a.session_id
AND b.object_id = a.object_id
AND c.action <> '/'
AND c.logon_time < SYSDATE - 60 / 60 / 24
AND c.action <> 'Concurrent Request'
ORDER BY c.logon_time;
脚本获取包体
SELECT decode(ds.line, 1, 'CREATE OR REPLACE ' || ds.text, ds.text) text
FROM sys.dba_source ds
WHERE ds.name = ?
AND ds.type IN ('FUNCTION', 'PROCEDURE', 'PACKAGE BODY', 'TRIGGER')
And ds.owner='APPS'
ORDER BY ds.line;
查询最后编译信息
SELECT t.last_ddl_time 最后编译时间, t.*
FROM dba_objects t
WHERE t.object_name = ?;