RAISE_APPLICATION_ERROR未能阻止用户登录DB

背景:

DB Version:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

想使用trigger阻止用户(非AP server IP)登录。但在测试环境2中测试时发现没能成功阻止。而是向alter.log中写一条告警信息。

Thu Jun 07 09:18:41 2012
Errors in file /u01/app/oracle/diag/rdbms/xxxx/xxxx/trace/xxxx_ora_16214.trc:
ORA-00604: 递归 SQL 级别 1 出现错误
ORA-01422: 实际返回的行数超出请求的行数
ORA-06512: 在 line 5

Oracle文档[ID 427563.1]描述如下:

Symptoms
RAISE_APPLICATION_ERROR in an AFTER LOGON trigger does not prevent a user from logging in, and writes the error message to the alert log instead.

Cause
This behavior occurs when the user logging in has DBA priviledges (more specifically the Administer Database Trigger privilege), or if the trigger is in the shema of the user logging in.
This is a safety mechanism built into the database such that you cannot prevent a DBA user from logging in, and is discussed in the following ASK TOM thread:

http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:3236035522926

Solution
Revoking DBA or moving the trigger should make the trigger behave as desired.

 

你可能感兴趣的:(RAISE_APPLICATION_ERROR未能阻止用户登录DB)