Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Logon Trigger - Question

719861Aug 28 2009 — edited Aug 28 2009
Hi,

I'm a beginner on the Oracle technology and I'm trying add a step on my logon trigger that avoids that the same user connects twice to the database using PL/SQL Developer.

Here what I'm doing:

.
.
.
VUSER := UPPER(SYS_CONTEXT('USERENV', 'SESSION_USER'))

VPROGRAM := UPPER(SYS_CONTEXT('USERENV', 'MODULE'))
.
.
.
SELECT COUNT(*) INTO N_SESSION
FROM V$SESSION
WHERE USERNAME = UPPER(SYS_CONTEXT('USERENV', 'SESSION_USER'));

IF VUSER NOT IN ('SYS','SYSTEM') AND N_SESSION >= 2 AND VPROGRAM LIKE 'PLSQLDEV%' THEN
RAISE_APPLICATION_ERROR(-20003,
'Access to database ' ||
UPPER(SYS_CONTEXT('USERENV', 'DB_NAME')) ||
' denied for this application');
END IF;
.
.
.

For some reason, it's not working.

Do you guys know what I should do?

Thanks

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 25 2009
Added on Aug 28 2009
2 comments
814 views