婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > oracle的一些tips技巧

oracle的一些tips技巧

熱門標簽:地圖標注原件 語音電話機器人缺點 百變地圖標注 南通防封外呼系統運營商 淮安自動外呼系統開發 語音電話機器人營銷方案 修改高德地圖標注 廣州市400電話辦理 宜賓外呼系統廠家
最近群里好多人討論oracle安全問題,今天找了些資料學習了下

獲取Oracle當前會話的一些屬性 (對于sql注射的環境判斷很有用哦)

SYS_CONTEXT 函數返回是與上下文名稱空間相關的屬性值。這個函數可以用在SQL和PL/SQL語句中。
注意: SYS_CONTEXT 返回的是用戶會話期間的屬性,所以,你無法使用它在并行的查詢或實時應用集群環境。

對于名稱空間和變量, 你可以定義它(們)為常量字符串,也可以定義一個變量,來代替名稱空間或屬性的字符串。名稱空間必須是已經在數據庫中定義好的, 并且相關的參數和值已經被指定到DBMS_SESSION中。名稱空間必須是一個合法的SQL標識符。變量名字可以是任意的字符串。它們不區分大小寫, 但是長度不能超出30個字節。

函數返回的數據類型是VARCHAR2,回歸值的缺省最大長度是256個字節。你也可以通過設置函數參數length來修改這個缺省長度值。值的合法的長度范圍是1到4000字節。(如果你指定的值不在這個范圍內, Oracle將使用缺省長度。)

Oracle9i 提供了一個內置的"USERENV"名稱空間, 用來表示當前的會話信息。該名稱空間預定義的參數如表1, 表的最后一列標識了返回值的長度。

語法:
SYS_CONTEXT(namespace, attribute[, length])

例子:
select SYS_CONTEXT ('USERENV', 'TERMINAL') TERMINAL,
SYS_CONTEXT ('USERENV', 'LANGUAGE') LANGUAGE,
SYS_CONTEXT ('USERENV', 'SESSIONID') SESSIONID,
SYS_CONTEXT ('USERENV', 'INSTANCE') INSTANCE,
SYS_CONTEXT ('USERENV', 'ENTRYID') ENTRYID,
SYS_CONTEXT ('USERENV', 'ISDBA') ISDBA,
SYS_CONTEXT ('USERENV', 'NLS_TERRITORY') NLS_TERRITORY,
SYS_CONTEXT ('USERENV', 'NLS_CURRENCY') NLS_CURRENCY,
SYS_CONTEXT ('USERENV', 'NLS_CALENDAR') NLS_CALENDAR,
SYS_CONTEXT ('USERENV', 'NLS_DATE_FORMAT') NLS_DATE_FORMAT,
SYS_CONTEXT ('USERENV', 'NLS_DATE_LANGUAGE') NLS_DATE_LANGUAGE,
SYS_CONTEXT ('USERENV', 'NLS_SORT') NLS_SORT,
SYS_CONTEXT ('USERENV', 'CURRENT_USER') CURRENT_USER,
SYS_CONTEXT ('USERENV', 'CURRENT_USERID') CURRENT_USERID,
SYS_CONTEXT ('USERENV', 'SESSION_USER') SESSION_USER,
SYS_CONTEXT ('USERENV', 'SESSION_USERID') SESSION_USERID,
SYS_CONTEXT ('USERENV', 'PROXY_USER') PROXY_USER,
SYS_CONTEXT ('USERENV', 'PROXY_USERID') PROXY_USERID,
SYS_CONTEXT ('USERENV', 'DB_DOMAIN') DB_DOMAIN,
SYS_CONTEXT ('USERENV', 'DB_NAME') DB_NAME,
SYS_CONTEXT ('USERENV', 'HOST') HOST,
SYS_CONTEXT ('USERENV', 'OS_USER') OS_USER,
SYS_CONTEXT ('USERENV', 'EXTERNAL_NAME') EXTERNAL_NAME,
SYS_CONTEXT ('USERENV', 'IP_ADDRESS') IP_ADDRESS,
SYS_CONTEXT ('USERENV', 'NETWORK_PROTOCOL') NETWORK_PROTOCOL,
SYS_CONTEXT ('USERENV', 'BG_JOB_ID') BG_JOB_ID,
SYS_CONTEXT ('USERENV', 'FG_JOB_ID') FG_JOB_ID,
SYS_CONTEXT ('USERENV', 'AUTHENTICATION_TYPE') AUTHENTICATION_TYPE,
SYS_CONTEXT ('USERENV', 'AUTHENTICATION_DATA') AUTHENTICATION_DATA
FROM DUAL;

下面的語句返回登錄用戶的名字:

CONNECT OE/OE
select SYS_CONTEXT ('USERENV', 'SESSION_USER') 
FROM DUAL;
SYS_CONTEXT ('USERENV', 'SESSION_USER')




網上找的
[code]AUTHENTICATION_DATA 
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. 
256 


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. 


AUTHENTICATION_TYPE 
How the user was authenticated: 

DATABASE: username/password authentication 

OS: operating system external user authentication 

NETWORK: network protocol or ANO authentication 

PROXY: OCI proxy connection authentication 

30 

BG_JOB_ID 
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 

CLIENT_INFO 
Returns up to 64 bytes of user session information that can be stored by an application using the DBMS_APPLICATION_INFO package. 
64 

CURRENT_SCHEMA 
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. 
30 

CURRENT_SCHEMAID 
Identifier of the default schema being used in the current session. 
30 

CURRENT_USER 
The name of the user whose privilege the current session is under. 
30 

CURRENT_USERID 
User ID of the user whose privilege the current session is under 
30 

DB_DOMAIN 
Domain of the database as specified in the DB_DOMAIN initialization parameter. 
256 

DB_NAME 
Name of the database as specified in the DB_NAME initialization parameter 
30 

ENTRYID 
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. 
30 

EXTERNAL_NAME 
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. 
256 

FG_JOB_ID 
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. 
30 

HOST 
Name of the host machine from which the client has connected. 
54 

INSTANCE 
The instance identification number of the current instance. 
30 

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

ISDBA 
TRUE if you currently have the DBA role enabled and FALSE if you do not. 
30 

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

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

language_territory.characterset 
52 

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

NLS_CALENDAR 
The current calendar of the current session. 
62 

NLS_CURRENCY 
The currency of the current session. 
62 

NLS_DATE_FORMAT 
The date format for the session. 
62 

NLS_DATE_LANGUAGE 
The language used for expressing dates. 
62 

NLS_SORT 
BINARY or the linguistic sort basis. 
62 

NLS_TERRITORY 
The territory of the current session. 
62 

OS_USER 
Operating system username of the client process that initiated the database session 
30 

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

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

SESSION_USER 
Database user name by which the current user is authenticated. This value remains the same throughout the duration of the session. 
30 

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

SESSIONID 
The auditing session identifier. You cannot use this option in distributed SQL statements. 
30 

TERMINAL 
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.)  

標簽:通化 襄陽 聊城 南平 股票投資 嘉峪關 南平 池州

巨人網絡通訊聲明:本文標題《oracle的一些tips技巧》,本文關鍵詞  oracle,的,一些,tips,技巧,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《oracle的一些tips技巧》相關的同類信息!
  • 本頁收集關于oracle的一些tips技巧的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 天峨县| 潜江市| 汨罗市| 错那县| 武安市| 宜兴市| 饶河县| 渭源县| 监利县| 梨树县| 阿克苏市| 鸡西市| 水富县| 鹤壁市| 临泽县| 广州市| 岳阳市| 东阳市| 奎屯市| 九寨沟县| 双流县| 泸定县| 舞阳县| 闵行区| 抚顺市| 康保县| 中江县| 娄底市| 启东市| 湟中县| 五大连池市| 阜新| 永安市| 天气| 株洲县| 神木县| 富川| 石楼县| 环江| 彰武县| 沁源县|