来自:http://www.itpub.net/thread-1411293-1-4.html

Oracle Applications DBA
基础》- 9 - Concurrent Processing

==================================



参考资料:



1. Oracle Applications System Administrator's Guide - Configuration

http://download.oracle.com/docs/ ... acrobat/120sacg.pdf



2. Oracle Applications System Administrator's Guide - Maintenance

http://download.oracle.com/docs/ ... acrobat/120samg.pdf



3. Oracle 11i System Administrator Fundamentals



4. Oracle Applications Developer's Guide

http://download.oracle.com/docs/ ... acrobat/120devg.pdf



并发处理 ( Concurrent process) 和 并发管理器(Concurrent Manager) 是R12中负责

处理批作业 或 后台作业的。 用的地方很多,所以需要多花点时间理解。



Concurrent Manager 管理的基础知识,比如 start/stop,output and logfile location 等,

前面已提及。



下面只是列出一些常用的内容,可以帮助理解concurrent manager。



=====================================================

# 如何从 concurrent request id  找到 Oracle session id (sid) :



很多时候我们需要从 concurrent request 的request id 找到对应的

Oracle session id (sid),可以用下面的方法, 由此我们也可了解

concurrent manager 对应的 table 结构。





# 当前正在运行的 concurrent request:



select request_id, controlling_manager,  phase_code 

from fnd_concurrent_requests  

where phase_code='R';



# 根据 request id 找到 对应的<controlling_manager>

select request_id, controlling_manager,  phase_code 

from fnd_concurrent_requests  

where request_id = <request_id>;



# 根据 <controlling_manager> 找到对应的<ORACLE_PROCESS_ID>:

select OS_PROCESS_ID, ORACLE_PROCESS_ID 

from fnd_concurrent_processes 

where CONCURRENT_PROCESS_ID = <controlling_manager>;



# 根据 <ORACLE_PROCESS_ID> 就知道 SID

select a.sid ,b.spid from v$session a , v$process b 

where b.addr=a.paddr and b.pid = <ORACLE_PROCESS_ID>;



# 另外一种 SQL query 方法:

select session_id from fnd_concurrent_processes 

where CONCURRENT_PROCESS_ID = <controlling_manager>;



select sid from v$session where audsid=<session_id>;



===========================================

# 统计 每个 program 对应完成的 request 数量:



select a.concurrent_program_id , b.CONCURRENT_PROGRAM_NAME, count(1) 

from fnd_concurrent_requests a, fnd_concurrent_programs b

where a.concurrent_program_id = b.concurrent_program_id

group by a.concurrent_program_id,b.CONCURRENT_PROGRAM_NAME;



===============================================

# 列出 concurrent program的种类



col LOOKUP_CODE for a10

col meaning for a60



select lv.lookup_code, lv.meaning from fnd_lookup_values lv

where lv.lookup_type='CP_EXECUTION_METHOD_CODE' and language='US' order by 1;



# 列出 concurrent program的种类对应的数量

select lv.meaning , count(*) from fnd_lookup_values lv,

fnd_concurrent_programs cp where lv.lookup_type='CP_EXECUTION_METHOD_CODE' and

language='US' and lv.lookup_code=cp.execution_method_code

group by lv.meaning order by 2;



select cp.enabled_flag,lv.meaning , count(*) cp_count

from fnd_lookup_values lv,fnd_concurrent_programs cp 

where lv.lookup_type='CP_EXECUTION_METHOD_CODE' and

language='US' and lv.lookup_code=cp.execution_method_code

group by cp.enabled_flag,lv.meaning

order by cp.enabled_flag, cp_count;



==========================================================

# 列出正在运行的 concurrent manager processes: 



select CONCURRENT_QUEUE_NAME, control_code, running_processes, max_processes 

from fnd_concurrent_queues 

where running_processes != 0



========================

# status code 对应的解释 <297909.1>



select lookup_type,lookup_code, meaning from fnd_lookups 

where lookup_type like 'CP_%';



# fnd_concurrent_processes 的 status_code



select lookup_code, meaning from fnd_lookups 

where lookup_type='CP_PROCESS_STATUS_CODE'





# 如何手动停掉正在运行的 Concurrent Request <154688.1> 



update fnd_concurrent_requests set status_code='C',phase_code='c' 

where request_id=4374195;



# <152763.1> , in that case, set status_code='X'

# check the meaning of status_code of requests from the note above



update fnd_concurrent_requests set status_code='C' ,phase_code='C' 

where request_id = 2722233;



# The Oracle server process might become runaway. 

# find out the sid first to kill it manully if needed.



==================================

# 如何在命令行上提交 concurrent request



CONCSUB apps/apps SYSADMIN "System Administrator" SYSADMIN WAIT=N CONCURRENT FND cusupt3 PROGRAM_NAME="custom update 3"



"cusupt3": concurrent executable in $FND_TOP/bin





# 如何 trace concurrent program

===================================

metalink note: 453527.1



1. concurrent program => define => "Enable Trace" 



2. Profiles => System => Concurrent:Allow Debugging



3. submit request => Debug Options





# 各种 不同的 concurrent programs

Concurrent Program 可以用不同的方式构成, 既可以用 shell,PL/SQL, C, JAVA 等

语言,也可以用 Oracle Reports,SQL*loader 等工具。下面逐一介绍。

====================================== 

example 1 : shell concurrent program

=======================================



cd $FND_TOP/bin

vi WH1TEST.prog



cat ./WH1TEST.prog

===========================

#!/bin/ksh

. /applvis/apps/apps_st/appl/APPSVIS_mis.env



sqlplus apps/apps@VIS <<EOF

EOF

echo "END"

=========================



chmod +x WH1TEST.prog



### pass parameter as separate variable



ln -s $FND_TOP/bin/fndcpesr WH1TEST



然后,在R12中逐一定义如下内容:

concurrent executable 

concurrent program 

Responsibility : Request 

request group (system Administrator Reports)



## start concurrent program "WH1TEST" manually

CONCSUB apps/apps SYSADMIN "System Administrator" SYSADMIN WAIT=N CONCURRENT FND WH1TEST PROGRAM_NAME="WH1TEST"



select CONCURRENT_PROGRAM_NAME, PROGRAM_TYPE from 

fnd_concurrent_programs where concurrent_program_name likE '%WH1%';



====================================================================





example 2: c & pro*c concurrent program

========================================

基本上参考 metalink <113428.1>。因为内容比较长,不在这里列出。



example 3: report concurrent program

===================================

这里只是copy 现成的一个test Oracle Report 做示范。

cd $FND_TOP/reports/US



Note: the report file should be in US directory.



cp /applvis/apps/tech_st/10.1.2/reports/samples/demo/test.rdf ./WH1RPTCP.rdf



[applvis@mis US]$ pwd

/applvis/apps/apps_st/appl/fnd/12.0.0/reports/US

[applvis@mis US]$ ls -l WH1*

-rw-r--r--  1 applvis dba 98304 Aug  9 17:40 WH1RPTCP.rdf

[applvis@mis US]$



then register this rdf as in other cases of the concurrent testing program

use "WH1RPTCP" as the Execution file name. (note: without the .rdf suffix)



but in the "define" part, choose "pdf" as output format .

=================================================



example 4: PL/SQL concurrent program

===================================

参考 metalink <73492.1>。



[oravis@mis ~]$ cat plconc.sql

create or replace procedure WH1plcp(errbuf out varchar2, retcode out varchar2) as

begin

fnd_file.put_line(FND_FILE.LOG, 'WH1plcp begins');

fnd_file.put_line(FND_FILE.OUTPUT, 'WH1plcp output');

insert into t1 values('WH1PLCP');

commit;

fnd_file.put_line(FND_FILE.LOG, 'WH1plcp ends');

end;

/

[oravis@mis ~]$



### submit conc request in PL/SQL

### ref <221542.1> 

### note that CONC_REQUEST_ID returns -1. <878636.1> 

declare

v_id number;

v_id2 number;

begin

--(user_id, responsibility_id, app_resp_id) 

--(sysadmin, system administrator, application system admin)



fnd_global.apps_initialize(0,20420,1);



--(app short name, conc program short name )

v_id := APPS.FND_REQUEST.SUBMIT_REQUEST('FND','FNDSCURS');

v_id2 := FND_GLOBAL.CONC_REQUEST_ID;

commit;

dbms_output.put_line(v_id);

dbms_output.put_line(v_id2);

end;





### find out relevant info

select * from fnd_application_tl where application_id = 1 ;

select * from fnd_user where user_name ='SYSADMIN' ;

select * from fnd_responsibility_tl where responsibility_name = 'System Administrator';

select * from fnd_user_resp_groups where user_id = 0 ;

select * from fnd_conc_req_summary_v where program_short_name='FNDSCURS';

select * from fnd_conc_req_summary_v where request_id=  314020 ;

### check the stauts of an conc request



declare

l_req_id number;

l_phase varchar2(30);

l_status varchar2(30);

l_dev_status varchar2(30);

l_dev_phase varchar2(30);

l_msg varchar2(2000);

status boolean;

begin

l_req_id := 314021  ;

  status :=fnd_concurrent.get_request_status(REQUEST_ID=>l_req_id, 

  PHASE=> l_phase, STATUS=>l_status, DEV_PHASE => l_dev_phase, 

  DEV_STATUS => l_dev_status, MESSAGE => l_msg ) ; 

dbms_output.put_line(l_req_id ||':'||l_phase||':'||l_status||':'||l_dev_phase||':'||l_dev_status);

end;

/





#####################################

example 5: SQL*loader Concurrent program

========================================

vi .ctl file in $PRODUCT_TOP/bin





example 6: Java concurrent program

=================================================

参看 metalink <250964.1>。



cd $JAVA_TOP/oracle/apps/fnd/cp

mkdir sample



vi Hello.java

################################

package oracle.apps.fnd.cp.sample;

import oracle.apps.fnd.cp.request.*;



public class Hello implements JavaConcurrentProgram {

public static final String RCS_ID = "$Header$";

public void runProgram (CpContext ctx) {

ctx.getLogFile().writeln("-- Hello World!--",0);

ctx.getOutFile().writeln("-- Hello World!--");

ctx.getReqCompletion().setCompletion(ReqCompletion.NORMAL, "");

}

}



###########################



javac $JAVA_TOP/oracle/apps/fnd/cp/sample/Hello.java



ls -l $INST_TOP/appl/fnd/12.0.0/secure/VIS.dbc



[applvis@mis sample]$ which java

/applvis/apps/tech_st/10.1.3/appsutil/jdk/jre/bin/java



java -Ddbcfile=$INST_TOP/appl/fnd/12.0.0/secure/VIS.dbc \

-Drequest.outfile=./outfile \

oracle.apps.fnd.cp.request.Run \

oracle.apps.fnd.cp.sample.Hello



# 在R12中作如下设置:

executable: WH1JAVACP

program:WH1JAVACP

security > responsiblity > request





### 另一个版本

cat Hello.java



package oracle.apps.fnd.cp.sample;

import oracle.apps.fnd.cp.request.*;

import oracle.apps.fnd.util.*;

import java.io.*;

import java.sql.*;



public class Hello implements JavaConcurrentProgram {

public static final String RCS_ID = "$Header$";

String c1Var ;

public void runProgram (CpContext ctx) {

c1Var ="HI";

ctx.getLogFile().writeln("-- Hello World!--",0);

ctx.getOutFile().writeln("-- Hello World!--");

Connection mJConn = ctx.getJDBCConnection();

ParameterList lPara = ctx.getParameterList();

ReqCompletion lRC = ctx.getReqCompletion();

String lQuery = "select c1 from t1 where c1 = ?";

while (lPara.hasMoreElements() )

{

   NameValueType aNVT = lPara.nextParameter();

   c1Var = aNVT.getValue();

}

  try {

    PreparedStatement lStmt = mJConn.prepareStatement(lQuery);

    lStmt.setString(1, c1Var);

    ResultSet lRs = lStmt.executeQuery();

  OutFile lOF = ctx.getOutFile();

  LogFile lLF = ctx.getLogFile();

  while  ( lRs.next() )

  {

    lOF.writeln(lRs.getString(1));

  }

  lStmt.close();

ctx.getReqCompletion().setCompletion(ReqCompletion.NORMAL, "");

  }

  catch (SQLException e) {

  lRC.setCompletion(ReqCompletion.ERROR,e.toString());

  }

  finally {

   ctx.releaseJDBCConnection();

}

}

}





java -Ddbcfile=$INST_TOP/appl/fnd/12.0.0/secure/VIS.dbc \

-Drequest.outfile=./outfile \

oracle.apps.fnd.cp.request.Run \

oracle.apps.fnd.cp.sample.Hello \

"TOKEN1=HI"

=======================================================================

《Oracle Applications DBA 基础》- 9 - Concurrent Processing的更多相关文章

  1. 《Oracle Applications DBA 基础》- 9 - Concurrent Processing[Z]

    <Oracle Applications DBA 基础>- 9 - Concurrent Processing================================== 参考资料 ...

  2. Oracle Applications DBA 基础(一)

    1.引子 2014年9月13日 20:33 <oracle Applications DBA 基础>介绍Oracle Applications R12的系统架构, 数据库后台及应用系统的基 ...

  3. Oracle Applications DBA 基础(二)

    6.OAM及系统管理 2014年9月13日 20:40 参考资料: 1.Oracle Applications System Administrator's Guide - Configuration ...

  4. Oracle Applications Multiple Organizations Access Control for Custom Code

    档 ID 420787.1 White Paper Oracle Applications Multiple Organizations Access Control for Custom Code ...

  5. Oracle Apps DBA 常用命令

    数据库启动监听 addlnctl.sh start instance 启动数据库 addbctl.sh start 启动应用服务器 adstrtal.sh 停止应用服务器 adstpall.sh -- ...

  6. Globalization Guide for Oracle Applications Release 12

    Section 1: Overview Section 2: Installing Section 3: Configuring Section 4: Maintaining Section 5: U ...

  7. 【绝密外泄】风哥Oracle数据库DBA高级工程师培训视频教程与内部资料v0.1

    [绝密外泄]风哥Oracle数据库DBA高级工程师培训视频教程与内部资料v0.1 由于是[绝密外泄]资料,防止被查,需要的小伙伴赶紧下载附件中的课件文档.由于视频太大了,已放在百度网盘了,已经在附中说 ...

  8. 查找EBS中各种文件版本(Finding File Versions in the Oracle Applications EBusiness Suite - Checking the $HEADER)

    Finding File Versions in the Oracle Applications EBusiness Suite - Checking the $HEADER (文档 ID 85895 ...

  9. Oracle 的DBA考证

    转自 :https://www.cnblogs.com/chunge2050/archive/2013/04/16/3023730.html 详细的了解了几天之后,总结起来就是oracle为DBA认证 ...

随机推荐

  1. 27 自定义View小结

    自定义View 1 为了满足开发需要 就需要自定义View 2 分类: 直接继承View 继承View的子类(现有控件 button,TextView-.) 继承ViewGroup(线性布局 相对布局 ...

  2. Linux下的一些常用命令(一)

    在Linux环境下敲各种命令是再正常不过了,尤其是现在大多少服务器均为Linux系统,但是我又记不住这么多命令,只是偶尔在项目做完发布到服务器上的时候会涉及到,所以在网上找了一些命令,在此记录一下~ ...

  3. Android 读取清单文件<meta-data>元素的数据

    添加属性 <application -- > <meta-data android:value="Channel_0" android:name="UM ...

  4. Linux--FTP和MAIL服务器

     1) FTP协议 FTP(FileTransfer Protocol,文件传输协议)用于管理计算机之间的文件传送.FTP 是Internet 上使用非常广泛的一种通讯协议,它是由支持Intern ...

  5. 指令汇B新闻客户端开发(三) 下拉刷新

    现在我们继续这个新闻客户端的开发,今天分享的是下拉刷新的实现,我们都知道下拉刷新是一个应用很常见也很实用的功能.我这个应用是通过拉ListView来实现刷新的,先看一张刷新的原理图 从图中可知,手指移 ...

  6. 从操作系统内核看Java非阻塞IO事件检测

    非阻塞服务器模型最重要的一个特点是,在调用读取或写入接口后立即返回,而不会进入阻塞状态.在探讨单线程非阻塞IO模型前必须要先了解非阻塞情况下Socket事件的检测机制,因为对于非阻塞模式最重要的事情是 ...

  7. TCP的发送系列 — 发送缓存的管理(二)

    主要内容:从TCP层面判断发送缓存的申请是否合法,进程因缺少发送缓存而进行睡眠等待. 因为有发送缓存可写事件而被唤醒. 内核版本:3.15.2 我的博客:http://blog.csdn.net/zh ...

  8. UNIX网络编程——信号驱动式I/O

    信号驱动式I/O是指进程预先告知内核,使得当某个描述符上发生某事时,内核使用信号通知相关进程. 针对一个套接字使用信号驱动式I/O,要求进程执行以下3个步骤: 建立SIGIO信号的信号处理函数. 设置 ...

  9. UNIX网络编程——产生RST

    产生RST的3个条件:1. 建立连接的SYN到达某端口,但是该端口上没有正在监听的服务.   如:IP为192.168.1.33的主机上并没有开启WEB服务(端口号为0x50),这时我们通过IE去访问 ...

  10. Android初级教程进程间的通信AIDL

    在介绍跨程序进程间通信AIDL前,先看一下本程序activity与某个服务是怎么绑定在一起进行交互的. 需求:服务有两个方法.分别是播放音乐与停止播放音乐.该程序的活动要访问这两个方法,在activi ...