Oracle数据库 v$access

v$access

V$ACCESS显示有关当前施加在库缓存对象上的锁的信息。

这些锁是为了确保它们在执行SQL时不会从库缓存中过时

V$ACCESS displays information about locks that are currently imposed on library cache objects.

The locks are imposed to ensure that they are not aged out of the library cache while they are required for SQL execution.

SQL> desc v$access
 Name       Null?    Type
 ---------- -------- ----------------
 SID                 NUMBER
 OWNER               VARCHAR2(64)
 OBJECT              VARCHAR2(1000)
 TYPE                VARCHAR2(64)
Column Datatype Description
SID NUMBER Session number that is accessing an object
OWNER VARCHAR2(64) Owner of the object
OBJECT VARCHAR2(1000) Name of the object
TYPE VARCHAR2(64) Type identifier for the object
CON_ID NUMBER The ID of the container to which the data pertains. Possible values include:0: This value is used for rows containing data that pertain to the entire multitenant container database (CDB). This value is also used for rows in non-CDBs.1: This value is used for rows containing data that pertain to only the rootn: Where n is the applicable container ID for the rows containing data

v a c c e s s 与 v access 与 v accessvlocked_object 的区别

v$locked_object定义:

V$LOCKED_OBJECT lists all locks acquired by every transaction on the system. 
It show which sessins are holding DML locks (that is, TM-type enqueues) on what objects and in what mode.

V$ACCESS定义

V$ACCESS displays information about locks that are currently imposed on library cache objects. 
The locks are imposed to ensure that they are not aged out of the library cache while they are required for SQL execution.

简单点说,只要存在在library cache中,通过表v a c c e s s 就能够查看到使用到的表,存储过程以及 c u r s o r 。 V access就能够查看到使用到的表,存储过程以及cursor。V access就能够查看到使用到的表,存储过程以及cursorVLOCKED_OBJECT只能查看到相关的表。此外,当语句执行完之后,就会消失,但是V$LOCKED_OBJECT必须提交或者rollback之后才会消失。

会话2279

-- 创建测试表
sys@testdba(2279)> create table test_t(id int);
Table created.

-- 执行存储过程
sys@testdba(2279)> set serveroutput on

begin
for i in 1..10 loop
insert into test_t values(i);
dbms_output.put_line(i);
dbms_lock.sleep(10);
end loop;
end;
/

当该session不执行其他语句时,在其他session会查看任然存在在v a c c e s s 表中,当该 s e s s i o n 执行其他语句时, v access表中,当该session执行其他语句时,v access表中,当该session执行其他语句时,vaccess表中就会消失。

sys@testdba(766)> select * from v$access where object='TEST_T';
 SID OWNER OBJECT   TYPE
-------------------------
2279 SYS   TEST_T   TABLE

sys@testdba(766)> SELECT * FROM V$LOCKED_OBJECT;
    XIDUSN    XIDSLOT     XIDSQN  OBJECT_ID SESSION_ID ORACLE_USERNAME
---------- ---------- ---------- ---------- ---------- ------------------------------
OS_USER_NAME                   PROCESS                  LOCKED_MODE
------------------------------ ------------------------ -----------
         7         33        715      87360       2279 SYS
oracle                         68254                              3

当执行session commit之后,在V$LOCKED_OBJECT中也不会找到

sys@testdba(2279)> commit;

Commit complete.


-- 766会话查询
sys@testdba(766)> select * from v$access where object='TEST_T';
 SID OWNER OBJECT   TYPE
-------------------------
2279 SYS   TEST_T   TABLE

sys@testdba(766)> SELECT * FROM V$LOCKED_OBJECT;

no rows selected

相关推荐

  1. Oracle数据库

    2024-07-20 21:32:04       45 阅读
  2. OracleOracle数据库中的数据类型

    2024-07-20 21:32:04       15 阅读
  3. 快速监控 Oracle 数据库

    2024-07-20 21:32:04       44 阅读
  4. 数据库oracle常见语句

    2024-07-20 21:32:04       46 阅读
  5. Oracle大型数据库技术

    2024-07-20 21:32:04       34 阅读
  6. Oracle数据库日志文件

    2024-07-20 21:32:04       38 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-20 21:32:04       52 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-20 21:32:04       54 阅读
  3. 在Django里面运行非项目文件

    2024-07-20 21:32:04       45 阅读
  4. Python语言-面向对象

    2024-07-20 21:32:04       55 阅读

热门阅读

  1. ZooKeeper 部署

    2024-07-20 21:32:04       17 阅读
  2. 【Webpack】提高打包速度

    2024-07-20 21:32:04       15 阅读
  3. Python(re模块的具体使用)

    2024-07-20 21:32:04       19 阅读
  4. 2024 暑假友谊赛 2

    2024-07-20 21:32:04       19 阅读
  5. Python正则表达式

    2024-07-20 21:32:04       14 阅读
  6. 【SpringBoot】SpringAOP实现公共字段自动填充

    2024-07-20 21:32:04       14 阅读
  7. Netty的线程模型是怎么样的

    2024-07-20 21:32:04       14 阅读
  8. python入门教程,小白10分钟快速入门

    2024-07-20 21:32:04       18 阅读