Solved

oracle lock table

Posted on 2006-07-11
15
1,206 Views
Last Modified: 2007-12-19
actually .. i wish lock whole table in my database to prevent the user to login in for the table in my database to select, insert, update ...and others.

 The LOCK TABLE IN LOCK_MODE [NOWAIT] is not i want ...

 How about the command for ALTER TABLE table_name ENABLE TABLE lock?

 any option
0
Comment
Question by:pgsystech
  • 6
  • 5
  • 2
  • +1
15 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17088302
what you want is:
DENY SELECT, UPDATE, DELETE, INSERT FOR <username> ON <tablename>;

0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17088311
actually, REVOKE and not DENY:
REVOKE SELECT, UPDATE, DELETE, INSERT FOR <username> ON <tablename>;
0
 
LVL 25

Expert Comment

by:jrb1
ID: 17088359
Please delete that last question you entered.  Keep your comments/responses all in a single question.  (The question about lock modes is fine, but there seem to be three duplicate questions out there.)
0
 

Author Comment

by:pgsystech
ID: 17088382
Lock whole table in oracle ...

rgrds
Gt
0
 
LVL 25

Expert Comment

by:jrb1
ID: 17088412
Do you mean, lock all tables?  What users?  Even remove "select" access?  What are you trying to accomplish?
0
 
LVL 16

Expert Comment

by:MohanKNair
ID: 17088548
Use "SELECT FOR UPDATE statement"
http://www.experts-exchange.com/Databases/Oracle/Q_21010749.html

Set transaction mode
SET TRANSACTION ISOLATION LEVEL <mode>
http://www.ss64.com/orasyntax/10locking.html
0
 
LVL 16

Expert Comment

by:MohanKNair
ID: 17088573
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:pgsystech
ID: 17088768
I like to lock one of the my tables in my database

Thank
GT
0
 

Author Comment

by:pgsystech
ID: 17096197
Hi,
any opinion ..for me to lock the one of my tables in my database...


rgrds
tech
0
 
LVL 16

Expert Comment

by:MohanKNair
ID: 17097072
A LOCK TABLE statement manually overrides default locking. The following statement acquires exclusive table locks for the EMP_TAB and DEPT_TAB tables.

LOCK TABLE Emp_tab, Dept_tab IN EXCLUSIVE MODE NOWAIT;


LOCK TABLE Emp_tab IN ROW SHARE MODE;
LOCK TABLE Emp_tab IN ROW EXCLUSIVE MODE;
LOCK TABLE Emp_tab IN SHARE MODE;


See this link
http://www.stanford.edu/dept/itss/docs/oracle/10g/appdev.101/b10795/adfns_sq.htm#1024828
0
 

Author Comment

by:pgsystech
ID: 17105463
The question is where i peform locking in my table , pls refer below :

 SQL> LOCK TABLE HR.ABC IN EXCLUSIVE MODE;

The command, i perform once...can able to lock the table under schema name HR. However,  when I log in as another username as TONG...

 I able to select the table In HR schema and a I also can select the table .....

 any Opnion to lock this table ABC under HR.schema.  also, i and user also cannot perform select, insert,update in the particular locking table. Only Administrator got rights to done it.

I also did not want drop the table yet.. and lock the tables...

rgrds
GT
0
 
LVL 16

Expert Comment

by:MohanKNair
ID: 17105648
It is not possible to lock the table for select statements.
0
 

Author Comment

by:pgsystech
ID: 17106057
But the way.. Have any idea to turn off particular table in database?

rgrds
GT
0
 
LVL 16

Accepted Solution

by:
MohanKNair earned 250 total points
ID: 17106197
The best option is to rename the table. When it is required rename back to original name.
0
 

Author Comment

by:pgsystech
ID: 17119565
hI mohan,

Thank..for this option...I wish to use rename matter to solve it.


Rgrd
GT
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction: I have seen many questions on EE and elsewhere, asking about how to find either gaps in lists of numbers (id field, usually) ranges of values or dates overlapping date ranges combined date ranges I thought it would be a good …
This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now