如何在Delphi里,存取Oracle数据库的Blob字段?本人以前在网上也找到一些方法,但都不可行。希望哪位高手能给一个验证了的方法,谢谢!

解决方案 »

  1.   

    如果杀掉oracle死锁的进程?!
    请查看:
    http://www.csdn.net/expert/topicview1.asp?id=83603谢谢了!
      

  2.   

    to gogoli:我不是一个高手,只是尽自己的一份力!to superall:
    因为我不懂delphi,我只能跟你说一下oracle中的处理方法:
    在oracle中有一个操作包DBMS_LOB,下面列出了DBMS_LOB包中的过程函数:
    APPEND procedure Appends the contents of the source LOB to the destination LOB. 
    CLOSE procedure Closes a previously opened internal or external LOB. 
    COMPARE function Compares two entire LOBs or parts of two LOBs. 
    COPY procedure Copies all, or part, of the source LOB to the destination LOB. 
    CREATETEMPORARY procedure Creates a temporary BLOB or CLOB and its corresponding index in the user's default temporary tablespace. 
    ERASE procedure Erases all or part of a LOB. 
    FILECLOSE procedure Closes the file. 
    FILECLOSEALL procedure Closes all previously opened files. 
    FILEEXISTS function Checks if the file exists on the server. 
    FILEGETNAME procedure Gets the directory alias and file name. 
    FILEISOPEN function Checks if the file was opened using the input BFILE locators. 
    FILEOPEN procedure Opens a file. 
    FREETEMPORARY procedure Frees the temporary BLOB or CLOB in the user's default temporary tablespace. 
    GETCHUNKSIZE function Returns the amount of space used in the LOB chunk to store the LOB value.
    GETLENGTH function Gets the length of the LOB value. 
    INSTR function Returns the matching position of the nth occurrence of the pattern in the LOB. 
    ISOPEN function Checks to see if the LOB was already opened using the input locator. 
    ISTEMPORARY function Checks if the locator is pointing to a temporary LOB. 
    LOADFROMFILE procedure Loads BFILE data into an internal LOB. 
    OPEN procedure Opens a LOB (internal, external, or temporary) in the indicated mode. 
    READ procedure Reads data from the LOB starting at the specified offset。
    BSTR function Returns part of the LOB value starting at the specified offset. 
    TRIM procedure Trims the LOB value to the specified shorter length. 
    WRITE procedure Writes data to the LOB from a specified offset. 
    WRITEAPPEND procedure Writes a buffer to the end of a LOB. 
      

  3.   

    to flyinthesky:
    下面是一个显示lock的script:
    select s.sid, s.serial#,
           decode(s.process, null,
              decode(substr(p.username,1,1), '?',   upper(s.osuser), p.username),
              decode(       p.username, 'ORACUSR ', upper(s.osuser), s.process)
           ) process,
           nvl(s.username, 'SYS ('||substr(p.username,1,4)||')') username,
           decode(s.terminal, null, rtrim(p.terminal, chr(0)),
                  upper(s.terminal)) terminal,
           decode(l.type,
              -- Long locks
                          'TM', 'DML/DATA ENQ',   'TX', 'TRANSAC ENQ',
                          'UL', 'PLS USR LOCK',
              -- Short locks
                          'BL', 'BUF HASH TBL',  'CF', 'CONTROL FILE',
                          'CI', 'CROSS INST F',  'DF', 'DATA FILE   ',
                          'CU', 'CURSOR BIND ',
                          'DL', 'DIRECT LOAD ',  'DM', 'MOUNT/STRTUP',
                          'DR', 'RECO LOCK   ',  'DX', 'DISTRIB TRAN',
                          'FS', 'FILE SET    ',  'IN', 'INSTANCE NUM',
                          'FI', 'SGA OPN FILE',
                          'IR', 'INSTCE RECVR',  'IS', 'GET STATE   ',
                          'IV', 'LIBCACHE INV',  'KK', 'LOG SW KICK ',
                          'LS', 'LOG SWITCH  ',
                          'MM', 'MOUNT DEF   ',  'MR', 'MEDIA RECVRY',
                          'PF', 'PWFILE ENQ  ',  'PR', 'PROCESS STRT',
                          'RT', 'REDO THREAD ',  'SC', 'SCN ENQ     ',
                          'RW', 'ROW WAIT    ',
                          'SM', 'SMON LOCK   ',  'SN', 'SEQNO INSTCE',
                          'SQ', 'SEQNO ENQ   ',  'ST', 'SPACE TRANSC',
                          'SV', 'SEQNO VALUE ',  'TA', 'GENERIC ENQ ',
                          'TD', 'DLL ENQ     ',  'TE', 'EXTEND SEG  ',
                          'TS', 'TEMP SEGMENT',  'TT', 'TEMP TABLE  ',
                          'UN', 'USER NAME   ',  'WL', 'WRITE REDO  ',
                          'TYPE='||l.type) type,
           decode(l.lmode, 0, 'NONE', 1, 'NULL', 2, 'RS', 3, 'RX',
                           4, 'S',    5, 'RSX',  6, 'X',
                           to_char(l.lmode) ) lmode,
           decode(l.request, 0, 'NONE', 1, 'NULL', 2, 'RS', 3, 'RX',
                             4, 'S', 5, 'RSX', 6, 'X',
                             to_char(l.request) ) lrequest,
           decode(l.type, 'MR', decode(u.name, null,
                                'DICTIONARY OBJECT', u.name||'.'||o.name),
                          'TD', u.name||'.'||o.name,
                          'TM', u.name||'.'||o.name,
                          'RW', 'FILE#='||substr(l.id1,1,3)||
                          ' BLOCK#='||substr(l.id1,4,5)||' ROW='||l.id2,
                          'TX', 'RS+SLOT#'||l.id1||' WRP#'||l.id2,
                          'WL', 'REDO LOG FILE#='||l.id1,
                          'RT', 'THREAD='||l.id1,
                          'TS', decode(l.id2, 0, 'ENQUEUE',
                                                 'NEW BLOCK ALLOCATION'),
                          'ID1='||l.id1||' ID2='||l.id2) object
    from   sys.v_$lock l, sys.v_$session s, sys.obj$ o, sys.user$ u,
           sys.v_$process p
    where  s.paddr  = p.addr(+)
      and  l.sid    = s.sid
      and  l.id1    = o.obj#(+)
      and  o.owner# = u.user#(+)
      and  l.type   <> 'MR'解除锁可以用dbms_lock,也可以直接使用dba命令:
    alter system kill session 'sid,serial#';