2007-5-28 19:37
surffish
怎样自杀???
我写了个触发器,触发器调用存储过程
用户在登陆的时候判断session是否在属于规定好的时间段。
如果是那么登陆。
如果不是那么kill sid
在实验过程中,符合条件的正常,不符合条件的没有办法kill sid。原因是触发器是这个session 触发的,没办法自己kill 自己的sid。
有什么好办法能把这个session丢弃掉???
2007-5-28 22:46
hexiong
为什么要这样做呢? 可以在 oracle 数据库logon trigger中判断 不合格就抛出异常
这个session就断开了 可以借鉴如下例子:
CREATE OR REPLACE TRIGGER authorize_users_trig
AFTER LOGON ON DATABASE
-- Description: This trigger helps database administrators to
-- control users logging into the database using various client
-- tools and machines. List of USERNAME, OSUSER, PROGRAM and
-- MACHINE entered in table AUTHORIZE_USERS_TAB will only be
-- permitted to login into the database.
-- Ref Oracle Bug No.2628258 and Doc No.2628258.8 in Metalink for
-- using RTRIM(machine,CHR(0)) in the below code.
-- Caveat: When a user tries to connect via SQL*Plus and if the
-- trigger refuses connection, info about that session is shown
-- as INACTIVE in V$SESSION, unless that user closes the SQL*Plus
-- window/session.
DECLARE
p_count NUMBER(1);
BEGIN
SELECT COUNT(*) INTO p_count
FROM sys.authorize_users_tab
WHERE UPPER(username||osuser||program||RTRIM(machine,CHR(0)))
IN (
SELECT UPPER(username||osuser||program||RTRIM(machine,CHR(0)))
FROM v$session
! WHERE au dsid = USERENV('sessionid')
AND logon_time = (
SELECT MAX(logon_time)
FROM v$session
WHERE audsid = USERENV('sessionid')));
IF p_count = 0 THEN
RAISE_APPLICATION_ERROR(-20001, '---> Sorry, Access Denied <---');
END IF;
END ;
2007-5-31 02:29
老农
这个标题很吓人哈;P
2007-6-7 20:56
盈盈笑
跳楼吧!!:victory:
2008-2-28 12:17
joebora
煤气
2008-3-4 14:28
1224
往服务器里面倒杯茶,就离死不远了
2008-3-5 21:54
五“宅”一生
直接用水龙头不是更快,呵呵!:lol :lol
2008-3-6 19:10
老农
撒泡尿不更简单?;P
2008-3-6 19:43
twisters
[quote]原帖由 [i]joebora[/i] 于 2008-2-28 12:17 发表 [url=http://www.loveunix.net/discuz/redirect.php?goto=findpost&pid=761990&ptid=72747][img]http://www.loveunix.net/discuz/images/common/back.gif[/img][/url]
煤气 [/quote]
现在管道气都换天然气了。
放这个不能自杀了。但是会累街坊的。千万不要再用管道气自身了:lol
2008-3-8 00:46
五“宅”一生
[quote]原帖由 [i]老农[/i] 于 2008-3-6 19:10 发表 [url=http://bbs.loveunix.net/redirect.php?goto=findpost&pid=763679&ptid=72747][img]http://bbs.loveunix.net/images/common/back.gif[/img][/url]
撒泡尿不更简单?;P [/quote]
农哥!万一漏电怎么办?:lol :lol
2008-3-10 17:12
老农
那不就更直接了?;P
2008-3-14 18:39
smallflower
哈哈
:lol
2008-3-30 07:13
vongates
哈哈,还是2楼的实用呀
2008-4-19 09:51
benq011
还以为楼主想不开了呢
2008-5-9 09:55
xp0118
安乐死比较好呵呵!!!
页:
[1]
Powered by Discuz! Archiver 5.5.0
© 2001-2006 Comsenz Inc.