当前位置: 首页 > news >正文

PLSQL专项学习之SYS_CONTEXT

SYS_CONTEXT

目的:SYS_CONTEXT返回与上下文命名空间关联的参数的值。您可以在SQL和PL/SQL语句中使用此函数。

对于名称空间和参数,可以指定一个字符串或一个表达式,该表达式解析为一个字符串,指定一个名称空间或属性。必须已经创建了上下文名称空间,并且还必须使用DBMS_SESSION设置了关联的参数及其值。set_context过程。名称空间必须是有效的SQL标识符。参数名可以是任何字符串。它不区分大小写,但长度不能超过30个字节。 

Oracle提供了一个名为USERENV的内置名称空间,用于描述当前会话。下面案例列出了名称空间USERENV的预定义参数。

语法:

 

SYS_CONTEXT('namespace', 'parameter' [, length ])

案例:

USERENV常用的预定义参数:

参数名称返回值

ACTION

标识模块(应用程序名称)中的位置,并通过DBMS_APPLICATION_INFO包或OCI进行设置。

AUDITED_CURSORID

返回触发审计的SQL的游标ID。此参数在细粒度审计环境中无效。如果在这样的环境中指定它,Oracle数据库总是返回NULL。

AUTHENTICATION_DATA

用于对登录用户进行身份验证的数据。对于经过认证的X.503证书会话,该字段以HEX2格式返回证书的上下文。

注意:可以使用语法的length参数更改AUTHENTICATION_DATAattribute的返回值。最多可接受4000个值。这是Oracle数据库实现这种更改的USERENV的惟一属性。

BG_JOB_ID

当前会话的作业ID(如果它是由Oracle数据库后台进程建立的)。如果会话不是由后台进程建立的,则为Null。

CLIENT_IDENTIFIER

返回应用程序通过DBMS_SESSION设置的标识符。SET_IDENTIFIER过程,OCI属性OCI_ATTR_CLIENT_IDENTIFIER,或Java类oracle .jdbc. oracleconnec.setclientidentifier。各种数据库组件都使用此属性来标识身份验证为相同数据库用户的轻量级应用程序用户。

CLIENT_INFO

返回最多64字节的用户会话信息,应用程序可以使用DBMS_APPLICATION_INFO包存储这些信息。

CURRENT_BIND

用于细粒度审计的绑定变量。

CURRENT_SCHEMA

当前模式中使用的默认模式的名称。可以在会话期间使用 ALTER session SET CURRENT_SCHEMA语句更改此值。

CURRENT_SCHEMAID

当前会话中使用的默认模式的标识符。

DB_NAME

数据库的名称,在DB_NAME初始化参数中指定。

DB_UNIQUE_NAME

数据库的名称,在db_unique_name初始化参数中指定。

HOST

客户机所连接的主机的名称。

INSTANCE

The instance identification number of the current instance.

INSTANCE_NAME

The name of the instance.

IP_ADDRESS

IP address of the machine from which the client is connected.

LANG

The ISO abbreviation for the language name, a shorter form than the existing 'LANGUAGE' parameter.

LANGUAGE

The language and territory currently used by your session, along with the database character set, in this form:

language_territory.characterset

MODULE

The application name (module) set through the DBMS_APPLICATION_INFO package or OCI.

NETWORK_PROTOCOL

Network protocol being used for communication, as specified in the 'PROTOCOL=protocol' portion of the connect string.

NLS_CALENDAR

The current calendar of the current session.

NLS_CURRENCY

The currency of the current session.

NLS_DATE_FORMAT

The date format for the session.

NLS_DATE_LANGUAGE

The language used for expressing dates.

NLS_SORT

BINARY or the linguistic sort basis.

NLS_TERRITORY

The territory of the current session.

OS_USER

Operating system user name of the client process that initiated the database session.

POLICY_INVOKER

The invoker of row-level security (RLS) policy functions.

PROXY_ENTERPRISE_IDENTITY

Returns the Oracle Internet Directory DN when the proxy user is an enterprise user.

PROXY_GLOBAL_UID

Returns the global user ID from Oracle Internet Directory for Enterprise User Security (EUS) proxy users; returns NULL for all other proxy users.

PROXY_USER

Name of the database user who opened the current session on behalf of SESSION_USER.

PROXY_USERID

Identifier of the database user who opened the current session on behalf of SESSION_USER.

SERVER_HOST

The host name of the machine on which the instance is running.

SERVICE_NAME

The name of the service to which a given session is connected.

SESSION_USER

For enterprises users, returns the schema. For other users, returns the database user name by which the current user is authenticated. This value remains the same throughout the duration of the session.

SESSION_USERID

Identifier of the database user name by which the current user is authenticated.

SESSIONID

The auditing session identifier. You cannot use this attribute in distributed SQL statements.

SID

The session number (different from the session ID).

STATEMENTID

The auditing statement identifier. STATEMENTID represents the number of SQL statements audited in a given session. You cannot use this attribute in distributed SQL statements. The correct auditing statement identifier can be seen only through an audit handler for standard or fine-grained audit.

TERMINAL

The operating system identifier for the client of the current session. In distributed SQL statements, this attribute returns the identifier for your local session. In a distributed environment, this is supported only for remote SELECT statements, not for remote INSERTUPDATE, or DELETEoperations. (The return length of this parameter may vary by operating system.)

AUTHENTICATION_TYPE

This parameter returned a value indicating how the user was authenticated. The same information is now available from the new AUTHENTICATION_METHOD parameter combined with IDENTIFICATION_TYPE.

CURRENT_USER

Use the SESSION_USER parameter instead.

CURRENT_USERID

Use the SESSION_USERID parameter instead.

EXTERNAL_NAME

This parameter returned the external name of the user. More complete information can now be obtained from the AUTHENTICATED_IDENTITYand ENTERPRISE_IDENTITY parameter.

 由于预定义参数比较多,就不一个一个翻译,其实看一下就可以明白的。

至此为止,欢迎浏览探讨。

http://www.xdnf.cn/news/819865.html

相关文章:

  • 【转】OrCAD 16.3安装和破解方法
  • 第五届管理科学与工程管理国际学术会议 2024 5th International Conference on Management Science and Engineering Manage
  • 电脑桌面图标变大了怎么恢复?5种简单方法帮你恢复正常
  • 不得不知的3个现货白银的基本规则!第3个很多人都忽略了
  • PKI/CA与数字证书学习笔记
  • c语言编程题经典100例
  • SmartUpload组件实现文件上传
  • 数据库是什么
  • 网页三剑客
  • 一步一步指导 车机的备份 掌迅92XX系列固件导出步骤
  • codejock中托盘的实现
  • 一步一步搭建11gR2 rac+dg之安装rac出现问题解决(六)
  • Android 初始化Setup Wizard——Provision
  • 软考 | 2012年上半年 软件设计师 下午试卷
  • 个人博客论坛系统测试报告
  • 高等数学基础篇(数二)之二重积分(解析版)
  • Zero Sum 和为零
  • 【AI】2114- 汇总 11 个 AI 领域的优质飞书知识库,完全免费,赶紧收藏起来!
  • 【高校主办!国际高级别组委加入!EIScopus检索】2024年经济决策与人工智能国际学术会议 (EDAI 2024)
  • 什么是a站、b站、c站、d站、e站、f站、g站、h站、i站、j站、k站、l站、m站、n站?00后的世界我不懂!
  • centos7下升级openssh9.6版本以上远程连接报ssh服务器不能连接错误
  • Windows运行命令大全
  • 这儿有你所需要的所有关于科研的网址
  • Linux 命令chmod(文件管理)
  • Lightbox JS v2.0
  • 百度笔试题面试题集总
  • checklistbox控件用法总结
  • 软件外包公司对比:海辉、软通、东软集团等
  • surfacecreated啥时被调用_小豪爱上JVM--运行时数据区 | 面试必问
  • Macbook air(2012 MID)乞丐版升级——继续发挥余热