Re: Lock problem
Posted in 1998
Hi Tom, Answer of your question depends on your database's logging status. If your database was created with transactions, LOCK TABLE statement succeeds only if it executes within a transaction. You must issue a BEGIN WORK statement before you can execute a LOCK TABLE statement. A COMMIT WORK or ROLLBACK WORK statement will release all locks within the transaction. BEGIN WORK LOCK TABLE tab_name IN EXCLUSIVE MODE ... COMMIT WORK If your database was created without transactions you must use UNLOCK TABLE tabname statement to release the lock LOCK TABLE tab_name IN EXCLUSIVE MODE ... UNLOCK TABLE tab_name By. Tom Grenier wrote: > > Last weekend I needed to drop one index and add another on a table. We > are a 24X7 shop, so I just wait until the wee hours of the morning and > try to grab the table. It kept giving me a 'non-exclusive access' > error. So... > > Instead of continuing to try to run the drop and create commands, I > added a 'lock table xxx in exclusive mode;' line. I got the lock -- but > then it still errored on the drop and create statements with the same > non-exclusive error. I'm confused -- if I got an exclusive lock on the > table -- why was it telling me I couldn't get exclusive access when I > tried to do the index commands? > > We're running 7.22UC2 on an HP9000 - 10.20. > > Any insights would be appreciated. > Tom Grenier > DBA, Biztravel.com