Oracle SYS.AUDSES$ 序列 说明
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
一.S YS.AUDSES$ 序列说明
1.1 MOS 说明
MOS 文档:How Sessions get Their AUDSID Identifier [ID 122230.1] Sessions connecting to an Oracle database have a number of identifiersassigned to them which can be found in the V$SESSION dynamic view.
--当session 连接到Oracle 数据库时,会分配一个标识号,这个标识号可以从v$session这个视图里查询。
One of these identifiers is V$SESSION.AUDSID. This identifier is particularlyuseful because it can also be obtained by a session using the SQL functionUSERENV('SESSIONID'). In this way, a session can find its own session-related information.
--其中一个标识符就是v$session.audsid. 这个标识符非常有用,因为它也可以用SQL 函数USERENV(‘SESSIONID’) 来获取,这样,session 就可以发现其关联的信息。
1.2 SESSION 获取v$session.audsid说明
A session connected to an Oracle database may obtain one of its sessionidentifiers, the Auditing Session ID, by use of the built-in USERENV SQLfunction.
For example, in SQL*Plus, a query like the following can be used:
SQL> select userenv('SESSIONID') from dual;
USERENV('SESSIONID')
--------------------
13591
--查看当前的Auditing session id
This value may be used to find out more information about the current sessionas it is also recorded in the column AUDSID of the V$SESSION dynamic view.
--通过这个audid,然后和v$session结合,就可以查看session 的更多信息。Continuing the previous example:
SQL> select sid,serial#,audsid,program from v$session where audsid=13591;
SID SERIAL# AUDSID PROGRAM
---------- ---------- ---------- ------------------------------------------
13 2904 13591 sqlplus@sunclient1 (TNS V1-V2)
This Auditing Session ID is determined when the user connects to the databaseand is a constant value for the duration of the session.
--AUDID 决定用户是什么时候连接到数据库的,在session 活动期间,该值是不变的。
The value that is assigned to AUDSID is taken from a sequence in the OracleData Dictionary, the sequence SYS.AUDSES$. When AUDSID is assigned to a newsession the SYS.AUDSES$ sequence is incremented using NEXTVAL and the newvalue is assigned to the session.
--那么session 分配的AUDSID 值是从SYS.AUDSES$序列中获取的,当分配时,SYS.AUDSES$会使用nextval增加,然后赋值给session。
However, not all sessions get an AUDSID: Sessions connecting as 'internal'do not increment the SYS.AUDSES$ sequence and the value of their AUDSID is 0.
--但是,不是所有的session 都可以获取到AUDSID值。用internal 连接时,就不会增加SYS.AUDSES$序列,其对应session 的AUDSID 值是0.
For example, see what happens when we connect internal in svrmgrl:
SVRMGR> connect internal
Connected.
SVRMGR> select userenv('SESSIONID') from dual;
USERENV('S
----------
1 row selected.
Connect internal gets an AUDSID of 0 irrespective of which tool was used.
--不管使用什么工具连接,只要用的是internal用户,那么AUDSID 就是0
For example, connecting internal from SQL*Plus:
SQL> connect internal/oracle
Connected.
SQL> select userenv('SESSIONID') from dual;
USERENV('SESSIONID')
--------------------
Background processes also have 0 as their AUDSID value。