Oracle lock table, unlock statement, oracle unlock statement
Zookeeper
-- 1. the following statement is used to query which objects are locked: select object_name, machine, s. sid, s. serial # from v $ locked_object l, dba_objects o, v $ session s where l. object_id = o. object_id and l. session_id = s. sid; -- 2. the following statement is used to kill a process: alter system kill session '000000'; (24,111 is the sid found above, serial #)
Oracle lock table and unlock statement
After some ORACLE processes are killed, the state is set to "killed", but the locked resources are not released for a long time. Sometimes there is no way to restart the database. Now we provide a way to solve this problem, that is, it cannot be killed in ORACLE, and it can be killed again at the OS level.
1. The following statement is used to query which objects are locked:
Select object_name, machine, s. sid, s. serial #
From v $ locked_object l, dba_objects o, v $ session s
Where l. object_id = o. object_id and l. session_id = s. sid;
2. The following statement is used to kill a process:
Alter system kill session '123456'; (24,111 is the sid found above, serial #)
[Note] the preceding two steps can be performed on the Oracle console.
3. if the process state is set to "killed" after a process is killed by using the preceding command, but the locked resources are not released for a long time, then, the corresponding process (thread) can be killed at the OS level. First, execute the following statement to obtain the process (thread) Number:
Select spid, osuser, s. program
From v $ session s, v $ process p
Where s. paddr = p. addr and s. sid = 24 (24 is the sid above)
4. Killing the process (thread) on the OS ):
1) run the command as root on unix:
# Kill-9 12345 (that is, the spid obtained in step 1)
2) In windows (unix also applies), use orakill to kill the thread. orakill is an executable Command provided by oracle. The syntax is as follows:
Orakill sid thread
Where:
Sid: indicates the Instance name of the process to be killed.
Thread: the ID of the thread to be killed, that is, the spid obtained in step 1.
Example: c:> orakill orcl 12345
Oracle lock table statements
Lock the table and write an update statement at will. Do not commit;
Unlock, execute commit; or rollback