Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question.

Asked: March 05, 2017 - 12:39 pm UTC

Last updated: March 06, 2017 - 4:54 am UTC

Version: 11g R2

Viewed 1000+ times

You Asked

I used "alter user scott account lock;" for lock the account.
Now i try to access database so oracle prompts a message user is locked.
but when i connect via website build in asp.net , I first time also get message via exception handling in front-side.
but when i also perform such operation like select quyery fire and update query then work well while user is lock!

I'm sock when user is lock and DML operation allow.
How it's possible?

and Connor said...

If you lock an account, then any *future* connection will be blocked.

If you already have a connection open, then it will work fine.

SQL> conn scott/tiger
Connected.

--
-- from another session
--
SQL> alter user scott account lock;

User altered.

--
-- then back in the first session, its still fine
--
scott@np12
SQL> select count(*) from emp;

  COUNT(*)
----------
        14


--
-- but if I disconnect, then I can't get a new session
--
SQL> disc
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Advanced Analytics
and Real Application Testing options
scott@np12
SQL>  conn scott/tiger
ERROR:
ORA-28000: the account is locked


From a web tier, it might be an issue of connection pooling, so there is a mix of existing sessions and new sessions being utilised which would give pseudo-random behaviour.

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

VLDB

If you are new to partitioning, check out Connor McDonald's introduction series here.

VLDB

Documentation set on VLDB and Partitioning.