EBS系统管理常用SQL语句整理汇总(参考网上资料&其他人博客)

标签: ebsORACLE系统管理SQL
1129人阅读 评论(0) 收藏 举报
--1查找系统用户基本信息 

SELECT user_id,
       
       user_name,
       
       description,
       
       employeE_id,
       
       person_party_id

  FROM fnd_user;

--3查找所有的interface表 

SELECT *

  FROM dba_objects db

 WHERE db.object_type = 'TABLE'
   AND db.object_name LIKE '%INTERFACE%';

--4查找对应模块的interface表  

SELECT *

  FROM dba_objects db

 WHERE db.object_type = 'TABLE'
      
   AND db.object_name LIKE '%INTERFACE%'
      
   AND owner LIKE 'PO';

--5查找用户当前的状态  

SELECT substr(v$session.username, 1, 8) username,
       
       v$session.osuser osuser,
       
       --        DECODE(V$SESSION.SERVER,'DEDICATED','D','SHARED','S','O') SERVER, 
       
       v$sqlarea.disk_reads disk_reads,
       
       v$sqlarea.buffer_gets buffer_gets,
       
       substr(v$session.lockwait, 1, 10) lockwait,
       
       v$session.process    pid,
       v$session_wait.event event,
       
       v$sqlarea.sql_text SQL

  FROM v$session_wait, v$sqlarea, v$session

 WHERE v$session.sql_address = v$sqlarea.address
      
   AND v$session.sql_hash_value = v$sqlarea.hash_value
      
   AND v$session.sid = v$session_wait.sid(+)
      
   AND v$session.status = 'ACTIVE'
      
   AND v$session_wait.event != 'client message'

 ORDER BY v$session.lockwait ASC, v$session.username;

--6查找用户的职责 

SELECT c.user_name AS login_name,
       
       d.full_name AS employee_name,
       
       f.name AS department_name,
       
       a.user_id AS user_id,
       
       a.responsibility_id AS responsibility_id,
       
       b.responsibility_name AS responsibility_name

  FROM fnd_user_resp_groups a,
       
       fnd_responsibility_vl b,
       
       fnd_user c,
       
       hr_employees d,
       
       per_assignments_f e,
       
       hr_all_organization_units_tl f

 WHERE a.user_id = c.user_id
      
   AND c.employee_id = d.employee_id
      
   AND c.employee_id = e.person_id
      
   AND e.organization_id = f.organization_id
      
   AND a.responsibility_id = b.responsibility_id
      
   AND SYSDATE > e.effective_start_date
      
   AND SYSDATE < e.effective_end_date

 ORDER BY c.description,
          c.user_name,
          a.responsibility_id
          
          --7查找组织信息 
          
            SELECT organization_id   id,
                   organization_code 代码,
                   organization_name 名称,
                   
                   operating_unit 营运ouid
            
              FROM org_organization_definitions ood;




--11查询所有应用模块的ID,对应的职责ID,模块的简称代码 

SELECT resp.application_id,
       
       resp.responsibility_id,
       
       resp.responsibility_key,
       
       appl.application_short_name

  FROM fnd_responsibility resp, fnd_application appl

 WHERE resp.application_id = appl.application_id;

--12查询当前系统登录的用户数  

SELECT COUNT(DISTINCT d.user_name)

  FROM apps.fnd_logins a,
       
       v$session b,
       
       v$process c,
       
       apps.fnd_user d

 WHERE b.paddr = c.addr
      
   AND a.pid = c.pid
      
   AND a.spid = b.process
      
   AND d.user_id = a.user_id
      
   AND (d.user_name = 'USER_NAME' OR 1 = 1);

--13查询系统当前物料单位列表 

SELECT muom.unit_of_measure,
       
       muom.uom_code,
       
       muom.description,
       
       muom.uom_class,
       
       muom.source_lang

  FROM mtl_units_of_measure muom;

--14OU 库存组织与子库存  

SELECT hou.organization_id ou_org_id,
       
       hou.name ou_name,
       
       ood.organization_id org_org_id,
       
       ood.organization_code org_org_code,
       
       msi.secondary_inventory_name,
       
       msi.description

  FROM hr_organization_information hoi,
       
       hr_organization_units hou,
       
       org_organization_definitions ood,
       mtl_secondary_inventories    msi

 WHERE hoi.org_information1 = 'OPERATING_UNIT'
      
   AND hoi.organization_id = hou.organization_id
      
   AND ood.operating_unit = hoi.organization_id
      
   AND ood.organization_id = msi.organization_id;

--15查询库存物料现有量  

SELECT ms.*

  FROM mtl_supply ms, po_headers_all ph

 WHERE ms.po_header_id = ph.po_header_id
   AND ph.segment1 = '2009001' --PO号 

 ORDER BY ms.po_header_id,
          
          ms.po_release_id,
          
          ms.po_line_id,
          
          ms.po_line_location_id,
          
          ms.po_distribution_id;

--16 查找死锁进程 

SELECT vs.username,
       
       lo.object_id,
       
       sob.name,
       
       lo.session_id,
       
       vs.serial#,
       
       lo.oracle_username,
       
       lo.os_user_name,
       
       lo.process

  FROM v$locked_object lo, v$session vs, sys.obj$ sob

 WHERE lo.session_id = vs.sid
   AND sob.obj# = lo.object_id;

--17 中断死锁进程 

ALTER system kill session 'sid,serial#';

--18 查找死锁进程2 

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';

--查询EBS用户密码sql语句 参考萌虫小换换
SELECT usr.user_name,
       
       get_pwd.decrypt
       
       ((SELECT (SELECT get_pwd.decrypt
                       
                       (fnd_web_sec.get_guest_username_pwd,
                        
                        usertable.encrypted_foundation_password
                        
                        )
                
                  FROM dual) AS apps_password
        
          FROM fnd_user usertable
        
         WHERE usertable.user_name =
              
               (SELECT substr
                       
                       (fnd_web_sec.get_guest_username_pwd,
                        
                        1,
                        
                        instr
                        
                        (fnd_web_sec.get_guest_username_pwd,
                         
                         '/'
                         
                         )
                        
                        - 1
                        
                        )
                
                  FROM dual))
        
        
        
        ) password,
   usr.encrypted_user_password
  FROM fnd_user usr
 WHERE usr.user_name = 'SYSADMIN';

1
0

猜你在找
【直播】机器学习&数据挖掘7周实训--韦玮
【套餐】系统集成项目管理工程师顺利通关--徐朋
【直播】3小时掌握Docker最佳实战-徐西宁
【套餐】机器学习系列套餐(算法+实战)--唐宇迪
【直播】计算机视觉原理及实战--屈教授
【套餐】微信订阅号+服务号Java版 v2.0--翟东平
【直播】机器学习之矩阵--黄博士
【套餐】微信订阅号+服务号Java版 v2.0--翟东平
【直播】机器学习之凸优化--马博士
【套餐】Javascript 设计模式实战--曾亮
查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:1030931次
    • 积分:14086
    • 等级:
    • 排名:第864名
    • 原创:348篇
    • 转载:260篇
    • 译文:0篇
    • 评论:21条
    ★★★★★★★交流方式★★★★★★
    Mail:xingyun.cai@qq.com
    个人书籍
    《深入浅出Oracle Form开发》.电子工业出版社
    最新评论