Select $lock and $session for locked objects : session « System Tables Data Dictionary « Oracle PL/SQL Tutorial

Oracle PL/SQL Tutorial
1. Introduction
2. Query Select
3. Set
4. Insert Update Delete
5. Sequences
6. Table
7. Table Joins
8. View
9. Index
10. SQL Data Types
11. Character String Functions
12. Aggregate Functions
13. Date Timestamp Functions
14. Numerical Math Functions
15. Conversion Functions
16. Analytical Functions
17. Miscellaneous Functions
18. Regular Expressions Functions
19. Statistical Functions
20. Linear Regression Functions
21. PL SQL Data Types
22. PL SQL Statements
23. PL SQL Operators
24. PL SQL Programming
25. Cursor
26. Collections
27. Function Procedure Packages
28. Trigger
29. SQL PLUS Session Environment
30. System Tables Data Dictionary
31. System Packages
32. Object Oriented
33. XML
34. Large Objects
35. Transaction
36. User Privilege
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Oracle PL/SQL Tutorial » System Tables Data Dictionary » session 
30. 62. 3. Select $lock and $session for locked objects
SQL> set echo on;
SQL>
SQL> create table t1 int );

Table created.

SQL>
SQL> create table t2 int );

Table created.

SQL>
SQL> insert into t1 values );

row created.

SQL>
SQL> insert into t2 values );

row created.

SQL>
SQL> select username,
  2         v$lock.sid,
  3             id1, id2,
  4         lmode,
  5             request, block, v$lock.type
  6  from v$lock, v$session
  7  where v$lock.sid = v$session.sid
  8    and v$session.username = USER
  9  /

USERNAME                              SID        ID1        ID2      LMODE    REQUEST      BLOCK TY
------------------------------ ---------- ---------- ---------- ---------- ---------- ---------- --
JAVA2S                                 20      25832          1          3          0          0 TO
JAVA2S                                 20      26171          0          3          0          0 TM
JAVA2S                                 20      26172          0          3          0          0 TM
JAVA2S                                 20     589851       2897          6          0          0 TX

rows selected.

SQL> select object_name, object_id from user_objects;


OBJECT_NAME                                                                                                               OBJECT_ID
-------------------------------------------------------------------------------------------------------------------------------- ----------
ADDRESSTYPE                                                                                                                   24496
ADDRESS_OBJ                                                                                                                   15867
ADD_NEW_EMPLOYEE                                                                                                              14738
AOBJ                                                                                                                          15944
AOBJ                                                                                                                          15945
AUTHORS_SEL                                                                                                                   25781
AUTHOR_FIRST_NAME_UPD                                                                                                         25820
AUTHOR_SEL                                                                                                                    25798
BIN$dgfyftgCSZSBnu0LqVJzrQ==$0                                                                                                25904
BIN$fKX+qNArQt+8GLZvNQJlrQ==$0                                                                                                25901
BIN$zbJqSAxnQA2up7MHjGauHw==$0                                                                                                25900
BIND_TEST                                                                                                                     25769
CHANGEPRICE                                                                                                                   26031
COMPILE_WARNING                                                                                                               25789
COMPUTE_DISCOUNTS                                                                                                             25731
DELETEEMPLOYEE                                                                                                                14633
DELETEMYEMPLOYEE                                                                                                              14636
EMPLOYEETYPE                                                                                                                  24499
EMPLOYEETYPE                                                                                                                  24500
EMPLOYEE_COUNT                                                                                                                25744
EMPLOYEE_TAB                                                                                                                  14797
EMP_CHANGE_S                                                                                                                  25936
EMP_DATA                                                                                                                      25672
EMP_DEPT                                                                                                                      14838
EMP_NAME_CHANGE                                                                                                               25966
EXITFUNC                                                                                                                      14840
F_GETDIFF                                                                                                                     25928
GETAREA                                                                                                                       25925
HELLO                                                                                                                         15128
HELLOFLE                                                                                                                      15126
HIKE_PRICES                                                                                                                   25730
INSERT_NUMBERS                                                                                                                14934
LOG_SHUTDOWN                                                                                                                  25669
LOG_STARTUP                                                                                                                   25666
MEASURE_USAGE                                                                                                                 26103
MULTIPLE_CURSORS_PROC                                                                                                         14638
MYPROCEDURE                                                                                                                   15863
MY_FIRST_PROC                                                                                                                 25729
NAMED_BLOCK                                                                                                                   25786
NEWYORKEMP                                                                                                                    15452
P                                                                                                                             25830
PEOPLE                                                                                                                        25899
PERSONTYPE                                                                                                                    24497
PKG                                                                                                                           25930
PKG_TEST1                                                                                                                     25932
PKG_TEST1                                                                                                                     25931
PRODUCTTYPE                                                                                                                   24498
P_HELLO                                                                                                                       25913
P_HELLOTO                                                                                                                     25914
P_PRINT                                                                                                                       25924
P_SPLIT                                                                                                                       25929
SESS_EVENT                                                                                                                    25832
STATE_PACKAGE                                                                                                                 14962
SWAP                                                                                                                          15064
T1                                                                                                                            26171
T2                                                                                                                            26172
TEMP_ALL_OBJECTS                                                                                                              26112
TEMP_ALL_OBJECTS_IDX                                                                                                          26113
TEST_TIME                                                                                                                     25740
TRANSACTION_TAB                                                                                                               14799
UNQ_1                                                                                                                         14839
UPDATEEMPLOYEE                                                                                                                14695
UPDATEMYEMPLOYEE                                                                                                              14667
UPDATE_EMP                                                                                                                    25736

64 rows selected.

SQL>
SQL> drop table t1;

Table dropped.

SQL> drop table t2;

Table dropped.

SQL>
SQL>
30. 62. session
30. 62. 1. Query v$session
30. 62. 2. Query v$session for user name, sid and serial#
30. 62. 3. Select $lock and $session for locked objects
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.