LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1173|回复: 5

oracle sql命令求助

[复制链接]
发表于 2006-2-22 11:08:29 | 显示全部楼层 |阅读模式
select sid,serial#,status from v$session where audsid=userenv('sessionid');

谁可以告诉我这是查询什么的命令。

还有查询建表的命令,类似于mysql里的show create tables.

谢谢啦
发表于 2006-2-23 00:37:12 | 显示全部楼层
Post by soccer
select sid,serial#,status from v$session where audsid=userenv('sessionid');

查询的是当前会话的信息,使用desc v$session可以查看v$session这个数据字典所有列。


Post by soccer

还有查询建表的命令,类似于mysql里的show create tables.

谢谢啦

使用oracle企业管理器可以实现
回复 支持 反对

使用道具 举报

发表于 2006-2-23 09:48:00 | 显示全部楼层
select table_name from user_tables;---查询当前用户schema下的所有表
select table_name from all_tables;---查询当前用户能够访问的所有表
select table_name from dba_tables;---数据库中所有的表,只有sys用户和有dba角色权限的用户可以访问
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-2-24 14:30:56 | 显示全部楼层
select sid,serial#,status from v$session where audsid=userenv('sessionid');

audsid这个字段是什么意思? sessionid是代表什么意思?userenv函数和是什么意思吗?


谢谢,嘿嘿
回复 支持 反对

使用道具 举报

发表于 2006-2-24 16:40:27 | 显示全部楼层
USERENV ( 'parameter' )
USERENV returns information about the current session. This information can be useful for writing an application-specific audit trail table or for determining the language-specific characters currently used by your session. You cannot use USERENV in the condition of a CHECK constraint.


Table 6-3  Parameters of the USERENV Function
Parameter Return Value
CLIENT_INFO
CLIENT_INFO returns up to 64 bytes of user session information that can be stored by an application using the DBMS_APPLICATION_INFO package.

Caution: Some commercial applications may be using this context value. Check the applicable documentation for those applications to determine what restrictions they may impose on use of this context area.

See Also:

Oracle9i Database Concepts for more on application context
CREATE CONTEXT and SYS_CONTEXT

ENTRYID
ENTRYID returns available auditing entry identifier. You cannot use this attribute in distributed SQL statements. To use this keyword in USERENV, the initialization parameter AUDIT_TRAIL must be set to TRUE.

ISDBA
ISDBA returns 'TRUE' if the user has been authenticated as having DBA privileges either through the operating system or through a password file.

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

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

language_territory.characterset


SESSIONID
SESSIONID returns your auditing session identifier. You cannot use this attribute in distributed SQL statements.

TERMINAL
TERMINAL returns the operating system identifier for your current session's terminal. 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 INSERT, UPDATE, or DELETE operations.
回复 支持 反对

使用道具 举报

发表于 2006-2-24 17:00:22 | 显示全部楼层
AUDSID

NUMBER
Auditing session ID
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表