forked from jeanron100/dbm_lite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
showusers.sh
38 lines (33 loc) · 963 Bytes
/
showusers.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#*********************************************************
# This script is used to show all users with default and temporary tablespace,created date and size
#
# USAGE : showusers
#
#*********************************************************
echo "set pages 70 lines 99 feedback off
col DEFAULT_TABLESPACE head 'Default TBS' for a15 trunc
col TEMPORARY_TABLESPACE head 'TEMP TBS' for a15 trunc
col MB head 'Size (Mb)' for 999,999,999
col username format a30
set linesize 150
break on report
compute sum of MB on report
select
USERNAME,
DEFAULT_TABLESPACE,
TEMPORARY_TABLESPACE,
CREATED,
nvl(sum(seg.blocks*ts.blocksize)/1024/1024,0) MB
from
sys.ts$ ts,
sys.seg$ seg,
sys.user$ us,
dba_users du
where
us.name (+)= du.username
and seg.user# (+)= us.user#
and ts.ts# (+)= seg.ts#
group by USERNAME,DEFAULT_TABLESPACE,TEMPORARY_TABLESPACE,CREATED
order by MB desc,username,created
/
" | sqlplus -s $DB_CONN_STR@$SH_DB_SID