Oracle EBS工具脚本

文章目录

值集查询


sql 复制代码
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);

快码查询


sql 复制代码
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 = ?; --关联值

查询可执行请求


sql 复制代码
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 USER_CONCURRENT_PROGRAM_NAME LIKE 'CUX%'
   AND fcpv.executable_id = fefv.executable_id
   AND fcpv.enabled_flag = 'Y'
   AND fcpv.concurrent_program_name = 'AUTOREMAPI' --并发简称
   --AND fcpv.user_concurrent_program_name = 'CUXAP_费用报销明细表(AP)' --请求名称
   --AND upper(fefv.execution_file_name) like upper('%cux_product_lean_cost_pkg.jb_mx_yf%') --注册并发名

批量取消请求


sql 复制代码
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 --程序id
       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, --请求提交用户ID
                               resp_id      => rec.responsibility_id, --请求提交职责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;

职责查询

sql 复制代码
-- 职责
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_NAME like '%%'
   -- 职责名字范围
   AND fst.RESPONSIBILITY_ID = wur.role_orig_system_id
  -- AND wur.user_name in ('','') 
  -- 用户名范围
   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
    --AND fcp.concurrent_program_id = 504369
    --and fu.user_name = '104267'
  order by 1, 2, 3, 6;

死锁处理


sql 复制代码
-- 死锁查询
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#;


-- 死锁处理 杀掉serial#的请求
alter system kill session'135,397'


-- 死锁处理
SELECT b.owner,
       b.object_name,
       c.logon_time 登录时间,
       c.client_identifier,
       -- '''' || c.sid || ',' || c.serial# || '''' 进程id, -- 会话标识符-会话序列号,
       c.username    数据库用户名称,
       c.command     正在处理的命令,
       c.status      会话当前状态,
       c.osuser      操作系统名称,
       c.machine     操作系统主机,
       c.terminal    操作系统终端,
       c.program     操作系统程序名称,
       c.type        会话类型,
       c.action      正在执行的操作名称,
       a.locked_mode,
       /*0:none
       1:null 空
       2:Row-S 行共享(RS):共享表锁,sub share
       3:Row-X 行独占(RX):用于行的修改,sub exclusive
       4:Share 共享锁(S):阻止其他DML操作,share
       5:S/Row-X 共享行独占(SRX):阻止其他事务操作,share/sub exclusive
       6:exclusive 独占(X):独立访问使用,exclusive*/
       '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 b.owner = 'WIP'
   AND c.logon_time < SYSDATE - 60 / 60 / 24
   AND c.action <> 'Concurrent Request'
 ORDER BY c.logon_time;

脚本获取包体


sql 复制代码
-- 获取包体
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;

查询最后编译信息


sql 复制代码
SELECT t.last_ddl_time 最后编译时间, t.*
  FROM dba_objects t
 WHERE t.object_name = ?; --包名或视图名
相关推荐
蚂蚁在飞-4 小时前
一个高度可扩展的 Golang ORM 库【GORM】
数据库·oracle·golang
TPCloud6 小时前
AIX下crs-5005 ip address is aready in use in the network的解决办法
数据库·oracle·crs-5005
安迁岚6 小时前
【SQL Server】华中农业大学空间数据库实验报告 实验八 存储过程
数据库·sql·mysql·oracle
莳花微语10 小时前
Oracle RMAN克隆数据库(同主机)
数据库·oracle·克隆迁移
雅冰石12 小时前
oracle会话追踪
数据库·oracle
m0_7482329214 小时前
MySQL:基础操作(增删查改)
数据库·mysql·oracle
儿时可乖了1 天前
Linux 定时任务全解析
linux·oracle
halfbloodghost1 天前
【数据库】SQL语句简单运用
数据库·sql·oracle
ejinxian1 天前
SQLite 管理工具 SQLiteStudio 3.4.5 发布
数据库·oracle·sqlite
暴力的bug制造机1 天前
【MySQL】库的操作(增删查改 | 备份 | 恢复)
linux·数据库·mysql·oracle