adian的个人空间

暂无签名

  • 博客访问: 90540
  • 博文数量: 23
  • 用 户 组: 普通用户
  • 注册时间: 2008-07-25 23:34
个人简介

暂无介绍

ITPUB论坛APP

ITPUB论坛APP



APP发帖 享双倍积分

文章分类

全部博文(23)

文章存档

2007年(10)

2006年(13)

我的朋友
微信关注

IT168企业级官微



微信号:IT168qiye



系统架构师大会



微信号:SACC2013

订阅
热词专题

分类: Oracle

察看当前Session登录的数据库[@more@]如果可以访问V$表,可以通过
select instance_name, version from v$instance;

如果没有相关权限,也可以通过SYS_CONTEXT得到Session登录的数据库。
select SYS_CONTEXT('USERENV' ,'DB_NAME') db_name from dual;

通过sys_context( namespace, parameter, [ length ] ),可以获取Oracle相关的环境信息。如果需要得到当前session的Oracle相关信息,在namespace的参数值为'USERENV'。还可以通过userenv函数来获取当前session的Oracle相关信息,这是一个遗留函数,Oracle推荐使用sys_context来获取。DBMS_SESSION.set_context设置parameter的值。
select SYS_CONTEXT('USERENV' ,'TERMINAL') terminal from dual;
select SYS_CONTEXT('USERENV' ,'LANGUAGE') language from dual;
select SYS_CONTEXT('USERENV' ,'SESSIONID') sessionid from dual;
select SYS_CONTEXT('USERENV' ,'INSTANCE') instance from dual;
select SYS_CONTEXT('USERENV' ,'ENTRYID') entryid from dual;
select SYS_CONTEXT('USERENV' ,'ISDBA') isdba from dual;
select SYS_CONTEXT('USERENV' ,'NLS_TERRITORY') nls_territory from dual;
select SYS_CONTEXT('USERENV' ,'NLS_CURRENCY') nls_currency from dual;
select SYS_CONTEXT('USERENV' ,'NLS_CALENDAR') nls_calendar from dual;
select SYS_CONTEXT('USERENV' ,'NLS_DATE_FORMAT') nls_date_format from dual;
select SYS_CONTEXT('USERENV' ,'NLS_DATE_LANGUAGE') nls_date_language from dual;
select SYS_CONTEXT('USERENV' ,'NLS_SORT') nls_sort from dual;
select SYS_CONTEXT('USERENV' ,'CURRENT_USER') current_user from dual;
select SYS_CONTEXT('USERENV' ,'CURRENT_USERID') current_userid from dual;
select SYS_CONTEXT('USERENV' ,'SESSION_USER') session_user from dual;
select SYS_CONTEXT('USERENV' ,'SESSION_USERID') session_userid from dual;
select SYS_CONTEXT('USERENV' ,'PROXY_USER') proxy_user from dual;
select SYS_CONTEXT('USERENV' ,'PROXY_USERID') proxy_userid from dual;
select SYS_CONTEXT('USERENV' ,'DB_DOMAIN') db_domain from dual;
select SYS_CONTEXT('USERENV' ,'DB_NAME') db_name from dual;
select SYS_CONTEXT('USERENV' ,'HOST') host from dual;
select SYS_CONTEXT('USERENV' ,'OS_USER') os_user from dual;
select SYS_CONTEXT('USERENV' ,'EXTERNAL_NAME') external_name from dual;
select SYS_CONTEXT('USERENV' ,'IP_ADDRESS') ip_address from dual;
select SYS_CONTEXT('USERENV' ,'NETWORK_PROTOCOL') network_protocol from dual;
select SYS_CONTEXT('USERENV' ,'BG_JOB_ID') bg_job_id from dual;
select SYS_CONTEXT('USERENV' ,'FG_JOB_ID') fg_job_id from dual;
select SYS_CONTEXT('USERENV' ,'AUTHENTICATION_TYPE') authentication_type from dual;
select SYS_CONTEXT('USERENV' ,'AUTHENTICATION_DATA') authentication_data from dual;
阅读(4921) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
请登录后评论。

登录 注册