oracle的一些tips技巧
62
OS_USER
DB_NAME
SYS_CONTEXT ('USERENV', 'NLS_DATE_FORMAT') NLS_DATE_FORMAT,
SYS_CONTEXT ('USERENV', 'NLS_DATE_LANGUAGE') NLS_DATE_LANGUAGE,
Job ID of the current session if it was established by an Oracle background process. Null if the session was not established by a background process.
30
The operating system identifier for the client of the current session. In distributed SQL statements, this option returns the identifier for your local session. In a distributed environment, this is supported only for remote select statements, not for remote insert, update, or delete operations. (The return length of this parameter may vary by operating system.)
SYS_CONTEXT ('USERENV', 'OS_USER') OS_USER,
62
NLS_DATE_LANGUAGE
对于名称空间和变量, 你可以定义它(们)为常量字符串,也可以定义一个变量,来代替名称空间或属性的字符串。名称空间必须是已经在数据库中定义好的, 并且相关的参数和值已经被指定到DBMS_SESSION中。名称空间必须是一个合法的SQL标识符。变量名字可以是任意的字符串。它们不区分大小写, 但是长度不能超出30个字节。
Oracle9i 提供了一个内置的"USERENV"名称空间, 用来表示当前的会话信息。该名称空间预定义的参数如表1, 表的最后一列标识了返回值的长度。
30
NETWORK: network protocol or ANO authentication
Identifier of the database user name by which the current user is authenticated.
SYS_CONTEXT ('USERENV', 'FG_JOB_ID') FG_JOB_ID,
最近群里好多人讨论oracle安全问题,今天找了些资料学习了下
62
SYS_CONTEXT ('USERENV', 'ISDBA') ISDBA,
language_territory.characterset
Database user name by which the current user is authenticated. This value remains the same throughout the duration of the session.
SYS_CONTEXT ('USERENV', 'NLS_CURRENCY') NLS_CURRENCY,
30
函数返回的数据类型是VARCHAR2,回归值的缺省最大长度是256个字节。你也可以通过设置函数参数length来修改这个缺省长度值。值的合法的长度范围是1到4000字节。(如果你指定的值不在这个范围内, Oracle将使用缺省长度。)
The language used for expressing dates.
SYS_CONTEXT ('USERENV', 'SESSIONID') SESSIONID,
NLS_TERRITORY
30
NLS_CALENDAR
SESSIONID
52
SYS_CONTEXT ('USERENV', 'NETWORK_PROTOCOL') NETWORK_PROTOCOL,
30
下面的语句返回登录用户的名字:
DATABASE: username/password authentication
256
30
30
SYS_CONTEXT ('USERENV', 'PROXY_USER') PROXY_USER,
Returns up to 64 bytes of user session information that can be stored by an application using the DBMS_APPLICATION_INFO package.
网上找的
LANGUAGE
How the user was authenticated:
FROM DUAL;
select SYS_CONTEXT ('USERENV', 'SESSION_USER')
TRUE if you currently have the DBA role enabled and FALSE if you do not.
SESSION_USER
62
Name of the database user who opened the current session on behalf of SESSION_USER.
BG_JOB_ID
FROM DUAL;
BINARY or the linguistic sort basis.
NLS_DATE_FORMAT
SYS_CONTEXT ('USERENV', 'SESSION_USER') SESSION_USER,
OS: operating system external user authentication
FG_JOB_ID
AUTHENTICATION_TYPE
54
SYS_CONTEXT ('USERENV', 'ENTRYID') ENTRYID,
PROXY_USER
30
SYS_CONTEXT ('USERENV', 'LANGUAGE') LANGUAGE,
External name of the database user. For SSL authenticated sessions using v.503 certificates, this field returns the distinguished name (DN) stored in the user certificate.
SYS_CONTEXT ('USERENV', 'INSTANCE') INSTANCE,
30
SYS_CONTEXT ('USERENV', 'NLS_TERRITORY') NLS_TERRITORY,
例子:
62
The name of the user whose privilege the current session is under.
Name of the default schema being used in the current schema. This value can be changed during the session with an alter SESSION SET CURRENT_SCHEMA statement.
CONNECT OE/OE
select SYS_CONTEXT ('USERENV', 'TERMINAL') TERMINAL,
IP_ADDRESS
ENTRYID
SYS_CONTEXT ('USERENV', 'SESSION_USERID') SESSION_USERID,
Job ID of the current session if it was established by a client foreground process. Null if the session was not established by a foreground process.
ISDBA
TERMINAL
The language and territory currently used by your session, along with the database character set, in this form:
SYS_CONTEXT ('USERENV', 'DB_NAME') DB_NAME,
Name of the host machine from which the client has connected.
The current calendar of the current session.
User ID of the user whose privilege the current session is under
SYS_CONTEXT ('USERENV', 'PROXY_USERID') PROXY_USERID,
NETWORK_PROTOCOL
SYS_CONTEXT ('USERENV', 'AUTHENTICATION_TYPE') AUTHENTICATION_TYPE,
Data being used to authenticate the login user. For X.503 certificate authenticated sessions, this field returns the context of the certificate in HEX2 format.
30
IP address of the machine from which the client is connected.
SYS_CONTEXT ('USERENV', 'NLS_CALENDAR') NLS_CALENDAR,
CURRENT_USER
The auditing session identifier. You cannot use this option in distributed SQL statements.
Name of the database as specified in the DB_NAME initialization parameter
30
30
30
SYS_CONTEXT 函数返回是与上下文名称空间相关的属性值。这个函数可以用在SQL和PL/SQL语句中。
30
SYS_CONTEXT ('USERENV', 'DB_DOMAIN') DB_DOMAIN,
CURRENT_SCHEMAID
62
NLS_SORT
CURRENT_USERID
30
注意: SYS_CONTEXT 返回的是用户会话期间的属性,所以,你无法使用它在并行的查询或实时应用集群环境。
PROXY_USERID
64
EXTERNAL_NAME
获取Oracle当前会话的一些属性 (对于sql注射的环境判断很有用哦)
语法:
The available auditing entry identifier. You cannot use this option in distributed SQL statements. To use this keyword in USERENV, the initialization parameter AUDIT_TRAIL must be set to true.
The ISO abbreviation for the language name, a shorter form than the existing 'LANGUAGE' parameter.
The date format for the session.
[code]AUTHENTICATION_DATA
Identifier of the default schema being used in the current session.
62
SYS_CONTEXT ('USERENV', 'CURRENT_USER') CURRENT_USER,
Note: You can change the return value of the AUTHENTICATION_DATA attribute using the length parameter of the syntax. Values of up to 4000 are accepted. This is the only attribute of USERENV for which Oracle implements such a change.
CLIENT_INFO
30
SYS_CONTEXT ('USERENV', 'AUTHENTICATION_DATA') AUTHENTICATION_DATA
256
30
INSTANCE
Identifier of the database user who opened the current session on behalf of SESSION_USER.
SYS_CONTEXT ('USERENV', 'IP_ADDRESS') IP_ADDRESS,
LANG
The territory of the current session.
SYS_CONTEXT ('USERENV', 'NLS_SORT') NLS_SORT,
SYS_CONTEXT ('USERENV', 'EXTERNAL_NAME') EXTERNAL_NAME,
CURRENT_SCHEMA
SESSION_USERID
256
NLS_CURRENCY
PROXY: OCI proxy connection authentication
SYS_CONTEXT ('USERENV', 'BG_JOB_ID') BG_JOB_ID,
DB_DOMAIN
The currency of the current session.
SYS_CONTEXT ('USERENV', 'CURRENT_USERID') CURRENT_USERID,
SYS_CONTEXT ('USERENV', 'HOST') HOST,
SYS_CONTEXT(namespace, attribute[, length])
Operating system username of the client process that initiated the database session
SYS_CONTEXT ('USERENV', 'SESSION_USER')
HOST
30
256
Domain of the database as specified in the DB_DOMAIN initialization parameter.
The instance identification number of the current instance.
Network protocol being used for communication, as specified in the 'PROTOCOL=protocol' portion of the connect string.
本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!
本文地址: https://www.juheyunku.com/sql/oracle/2339.shtml
相关文章
热门TAG
命令 外链 企业网站 白帽 php 织梦教程 dedecms修改内容 javascript 织梦 功能 标签 调用 详解 技巧 权重 服务器 网站流量 Dedecms 织梦cms HTML tags标签 python jquery教程 jquery windows 蜘蛛 搜索引擎 网站收录 JSP 实例解析最新文章
-
OracleRAC的五大优势及其劣
时间:2021-01-05
-
Oracle优化器 自适应执行计
时间:2021-01-05
-
Oracle行内链接不会引起U
时间:2021-01-05
-
Window下Oracle Database 11g 发行
时间:2020-12-29
-
Oracle如何实现like多个值的
时间:2020-12-29
-
maven添加oracle依赖失败问题
时间:2020-12-29
-
OracleRAC基本概念及入门
时间:2020-12-29
-
Azure File Storage 基本用法
时间:2020-12-26
热门文章
-
Azure Queue Storage 基本用法 Azure Storage 之
时间:2020-12-26
-
Oracle存储过程编程详解
时间:2020-12-07
-
win10下oracle 11g安装图文教程
时间:2020-12-25
-
oracle 数据库学习 基本结构介绍
时间:2020-12-13
-
Azure File Storage 基本用法 Azure Storage 之 F
时间:2020-12-26
-
windows使用sqlpus连接oracle 数据库的教程图
时间:2020-12-25
-
Window下Oracle Database 11g 发行版2安装教程
时间:2020-12-29
-
Oracle解锁的方式介绍
时间:2020-12-14
-
linux下oracle设置开机自启动实现方法
时间:2020-12-13
-
Oracle学习记录之使用自定义函数和触发器
时间:2020-12-07
