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

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

coldplay.xixi
Release: 2023-01-13 00:40:17
Original
48768 people have browsed it

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;
Copy after login

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 ;
Copy after login

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)
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template