Home  >  Article  >  Database  >  What are the methods of querying and unlocking Oracle lock table?

What are the methods of querying and unlocking Oracle lock table?

coldplay.xixi
coldplay.xixiOriginal
2021-01-15 14:50:3448668browse

Oracle lock table query and unlocking method: First use [PL/SQL Developer] to connect and operate the oracle database; then use the statement select for update to lock the table; finally use the statement [alter system kill session 'sid] to unlock .

What are the methods of querying and unlocking Oracle lock table?

The operating environment of this article: Windows7 system, PL/SQL Developer version 13.0.1.1893, Dell G3 computer.

Recommended (free): oracle tutorial

oracle lock table query And unlocking method:

1. Use commonly used PL/SQL Developer to connect and operate the oracle database.

What are the methods of querying and unlocking Oracle lock table?

#2. For example, the commonly used select for update statement will lock the table.

select * from table_name for update;

What are the methods of querying and unlocking Oracle lock table?

3. What is the impact after locking the table? If other people operate this table, modifications to the table are not allowed. As the name suggests, lock the watch and prevent others from operating it.

As shown in the figure, when updating it, it cannot be submitted.

What are the methods of querying and unlocking Oracle lock table?

#4. How to query which tables are locked?

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 ;

What are the methods of querying and unlocking Oracle lock table?

#5. How to unlock it?

alter   system     kill   session   'sid,serial#';(其中sid=l.session_id)

6. If you query again, there will be no record of the lock table.

What are the methods of querying and unlocking Oracle lock table?

The above is the detailed content of What are the methods of querying and unlocking Oracle lock table?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn