现在的位置: 首页 > 综合 > 正文

FNDWRR.exe后面的temp_id是如何生成的–解析Oracle EBS request log/output的url

2013年09月04日 ⁄ 综合 ⁄ 共 3638字 ⁄ 字号 评论关闭

我们在EBS的view concurrent request 界面里, 通常会点击log或output, 然后在菜单里选copy file,从IE里来获取相应的log或output文件. 相应的url是
http://host:port/OA_CGI/FNDWRR.exe?temp_id=2391709&login=APPLSYSPUT/PUB@VIS 
这个url是如何生成的呢? 通过查看FNDRSRUN这个form, 查到相关的两个package是fnd_webfile.get_url和fnd_concurrent_file.get_file_id
以下是fnd_webfile.get_url的参数说明
/* Function: GET_URL
 *
 * Purpose: Constructs and returns the URL for a Concurrent Processing
 *          log or output file.
 *
 * Arguments:
 *  file_type - Specifies the type of file desired:
 *       fnd_webfile.process_log = The log of the concurrent process identified
 *                                 by the parameter ID.
 *       fnd_webfile.icm_log     = The log of the ICM process identified by ID.
 *                                 Or, the log of the ICM process that spawned
 *                                 the concurrent process identified by ID.
 *                                 Or, the log of the most recent ICM process
 *                                 if ID is null.
 *       fnd_webfile.request_log = The log of the request identified by ID.
 *       fnd_webfile.request_out = The output of the request identified by ID.
 *       fnd_webfile.request_mgr = The log of the concurrent process that ran
 *                                 the request identified by ID.
 *       fnd_webfile.frd_log     = The log of the forms process identified
 *                                 by ID.
 *       fnd_webfile.generic_log = The log file identified by ID.
 *       fnd_webfile.generic_trc = The trace file identified by ID.
 *       fnd_webfile.generic_ora = The ora file identified by ID.
 *       fnd_webfile.generic_cfg = The config file identified by ID.
 *       fnd_webfile.context_file= The context file identified by ID.
 *       fnd_webfile.generic_text= Generic file using text transfer mode.
 *       fnd_webfile.generic_binary = Generic file using binary transfer mode.
 *
 *  id        - A concurrent process ID, concurrent request ID, or file ID
 *                 depending on the file type specified.
 *              For fnd_webfile.context_file,fnd_webfile.generic_text,
 *              fnd_webfile.generic_binary this value is null.
 *
 *  gwyuid    - The value of the environment variable GWYUID used in
 *                 constructing the URL.
 *
 *  two_task  - The database two_task, used in constructing the URL.
 *
 *  expire_time - The number of minutes for which this URL will remain
 *                   valid.
 *  source_file - Source file name with full patch
 *
 *  source_node - Source node name.
 *
 *  dest_file   - Destination file name
 *
 *  dest_node   - Destination node name
 *
 *  Returns NULL on error.  Check the FND message stack.

在这个get_url中, 如果文件是request_log或request_out类型的, 它会调用fnd_concurrent_file.get_file_id, 以下是源代码
function get_file_id return varchar2
is
fuid number;
fcrc number;
frand number;
fid number;
rval varchar2(32);
rtemp  varchar2(32);
begin

 select fnd_s_file_temp_id.nextval
  into fuid
  from dual;

 -- Get a random number
 fnd_random_pkg.init(7);
 fnd_random_pkg.seed(to_number(to_char(sysdate, 'JSSSSS')), 10, false);
 frand := fnd_random_pkg.get_next;

 -- Compute CRC32 of the random number and the sequence number,
 -- this creates a self-checking value.
 rval := lpad(to_char(frand),10,'0')||lpad(to_char(fuid),10,'0');
 fcrc := fnd_hash_pkg.crc32(rval);

 -- XOR the sequence and random values with whatever we have
 -- lying around.  This make our algorithm more obscure,
 -- since sequence values and pseudorandom numbers are no longer
 -- obvious to an observer.
 fuid := fnd_hash_pkg.xor32(fuid, frand);
 frand := fnd_hash_pkg.xor32(fcrc, frand);

 -- this value will be unique
 fid := fcrc * power(2,64) + frand * power(2,32) + fuid;

 -- base 64
 rval := fnd_code_pkg.base64(fid, 16);
 rtemp := rval;

 -- and finally encrypt it all with RC4...actually we now use CRC Hash
-- rval := fnd_crypt_pkg.encrypt('4237533241', rval, 16);
        rval := to_char(icx_call.CRCHASH('4237533241',rval));
 return rval;

end get_file_id;

其中可见oracle几个有趣的package, 如:
fnd_crypt_pkg
fnd_code_pkg
fnd_random_pkg
fnd_hash_pkg
icx_call
有空再研究一下这几个package.

 

抱歉!评论已关闭.