oracle锁表查询和解锁方法:首先使用【PL/SQL Developer】连接并操作oracle数据库;然后使用语句select for update来锁表;最后用语句【alter system kill session 'sid】解锁。
本文操作环境:Windows7系统,PL/SQL Developer 13.0.1.1893版本,Dell G3电脑。
oracle锁表查询和解锁方法:
1、使用常用的PL/SQL Developer 连接并操作oracle数据库。
2、比如常用的select for update语句就会锁表。
select * from table_name for update;
3、锁表后,有什么影响呢?另外的人再操作此表,对表进行修改就不允许了。与名字一样,把表锁起来,不让其他人操作。
如图操作,对其update时,提交不了。
4、如何查询哪些表被锁住了呢?
select p.spid,a.serial#, c.object_name,b.session_id,b.oracle_username,b.os_user_name from v$process p,v$session a, v$locked_object b,all_objects c where p.addr=a.paddr and a.process=b.process and c.object_id=b.object_id ;
5、如何进行解锁呢?
alter system kill session 'sid,serial#';(其中sid=l.session_id)
6、再查询,就没有锁表的记录了。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。