sqlplus系统变量
今天看老盖的书《循序渐进Oracle》,书中有提到看DBA_USERS视图的定义,语句如下:
SELECT TEXT FROM DBA_VIEWS WHERE VIEW_NAME='DBA_USERS';
查询结果却差强人意:
TEXT
--------------------------------------------------------------------------------
select u.name, u.user#, u.password,
m.status,
decode(u.astatus, 4,
一个view的定义语句,被阉割了,不成样子。很久不碰Oracle,总不免有些生疏。我先修改了列的显示格式:
COL TEXT FORMAT A500;
当然,这是无效的,只是在我的屏幕上,多出了很多“---------”。后来百度,终于明白,字段内容长度,是由long这个sqlplus的环境变量来控制的,索性将这个变量设置的巨大:
set long 2000;
Technorati 标签: sqlplus,sqlprompt,lang,pagesize
终于有了自己想要的结果:
SQL> /
TEXT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
select u.name, u.user#, u.password,
m.status,
decode(u.astatus, 4, u.ltime,
5, u.ltime,
6, u.ltime,
8, u.ltime,
9, u.ltime,
10, u.ltime, to_date(NULL)),
decode(u.astatus,
1, u.exptime,
2, u.exptime,
5, u.exptime,
6, u.exptime,
9, u.exptime,
10, u.exptime,
decode(u.ptime, '', to_date(NULL),
decode(pr.limit#, 2147483647, to_date(NULL),
decode(pr.limit#, 0,
decode(dp.limit#, 2147483647, to_date(NULL), u.ptime +
dp.limit#/86400),
u.ptime + pr.limit#/86400)))),
dts.name, tts.name, u.ctime, p.name,
nvl(cgm.consumer_group, 'DEFAULT_CONSUMER_GROUP'),
u.ext_username
from sys.user$ u left outer join sys.resource_group_mapping$ cgm
on (cgm.attribute = 'ORACLE_USER' and cgm.status = 'ACTIVE' and
cgm.value = u.name),
sys.ts$ dts, sys.ts$ tts, sys.profname$ p,
sys.user_astatus_map m, sys.profile$ pr, sys.profile$ dp
where u.datats# = dts.ts#
and u.resource$ = p.profile#
and u.tempts# = tts.ts#
and u.astatus = m.status#
and u.type# = 1
and u.resource$ = pr.profile#
a
相关新闻>>
- 发表评论
-
- 最新评论 更多>>