易截截图软件、单文件、免安装、纯绿色、仅160KB

oracle死锁的检测及处理

一. 死锁的检测
   --查死锁的会话。
select  A.sid, b.serial#,
 decode(A.type,
    'MR', 'Media Recovery',
    'RT','Redo Thread',
    'UN','User Name',
    'TX', 'Transaction',
    'TM', 'DML',
    'UL', 'PL/SQL User Lock',
    'DX', 'Distributed Xaction',
    'CF', 'Control File',
    'IS', 'Instance State',
    'FS', 'File Set',
    'IR', 'Instance Recovery',
    'ST', 'Disk Space Transaction',
    'TS', 'Temp Segment',
    'IV', 'Library Cache Invalida-tion',
    'LS', 'Log Start or Switch',
    'RW', 'Row Wait',
    'SQ', 'Sequence Number',
    'TE', 'Extend Table',
    'TT', 'Temp Table',
    'Unknown') LockType,
 c.object_name,
 b.username,
 b.osuser,
 decode(a.lmode,   0, 'None',
            1, 'Null',
            2, 'Row-S',
            3, 'Row-X',
            4, 'Share',
            5, 'S/Row-X',
            6, 'Exclusive', 'Unknown') LockMode,
 B.MACHINE,D.SPID ,b.PROGRAM
 from v$lock a,v$session b,all_objects c,V$PROCESS D
 where a.sid=b.sid and a.type in ('TM','TX')
 and c.object_id=a.id1
 AND B.PADDR=D.ADDR
二. 发生死锁后的处理方法
1. 9i以后的版本,oracle会自动检测死锁,检测到有死锁后会回滚或提交其中一个事务,使死锁消除.
2. ALTER SYSTEM KILL 'SID,SIEREL#' 注意:有可能产生两个会话SID为一样


相关文档:

oracle中调用带参数的存储过程

create or replace procedure proc_test
( a in number, b out number )
as
begin
b:=a+1;
end    proc_test;
现在要调用的话就是这样
SQL> c number;
SQL>exec proc_test(1,:c);
千万要注意别忘了写冒号 ......

如何在Oracle中复制表结构和表数据


1. 复制表结构及其数据:
create table table_name_new as select * from table_name_old
2. 只复制表结构:
create table table_name_new as select * from table_name_old where 1=2;
或者:
create table table_name_new like table_name_old
3. 只复制表数据:
如果两个表结构一样:
insert into table_name_ ......

Oracle Schema Objects

Introduction to Schema Objects
A schema is a collection of logical structures of data, or schema objects. A schema is owned by a database user and has the same name as that user. Each user owns a single schema. Schema objects can be created and manipulated with SQL and include the following types o ......

[转]Oracle 随机获取N条数据


当我们获取数据时,可能会有这样的需求,即每次从表中获取数据时,是随机获取一定的记录,而不是每次都获取一样的数据,这时我们可以采取Oracle内部一些函数,来达到这样的目的.   
  
   1) select * from (select * from tablename order  ......

ORACLE to_char函数详解


The following are number examples for the to_char
function.
to_char
(1210.73,
'9999.9')
would return '1210.7'
to_char
(1210.73,
'9,999.99')
would return '1,210.73'
to_char
(1210.73,
'$9,999.00')
would return
'$1,210.73'
to_char
(21,
'000099')
would return '000021'
The foll ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号