查看oracle用户数据库连接数
1、查询oracle的连接数
select count(*) from v$session;
SQL> select count(*) from v$session;
COUNT(*)
----------
109
2、查询oracle的并发连接数
select count(*) from v$session where status='ACTIVE';
SQL> select count(*) from v$session where status='ACTIVE';
COUNT(*)
----------
19
3、查看不同用户的连接数
select username,count(username) from v$session where username is not null group by username;
SQL> select username,count(username) from v$session where username is not null group by username;
USERNAME COUNT(USERNAME)
------------------------------ ---------------
CSSADMIN 91
SYS 1
4、查看所有用户:
select * from all_users;
SQL> select * from all_users;
USERNAME USER_ID CREATED
------------------------------ ---------- ---------
CSSADMIN 85 26-AUG-13
SCOTT 84 15-AUG-09
OWBSYS_AUDIT 83 15-AUG-09
OWBSYS 79 15-AUG-09
APEX_030200 78 15-AUG-09
APEX_PUBLIC_USER 76 15-AUG-09
FLOWS_FILES 75 15-AUG-09
MGMT_VIEW 74 15-AUG-09
SYSMAN 72 15-AUG-09
SPATIAL_CSW_ADMIN_USR 70 15-AUG-09
SPATIAL_WFS_ADMIN_USR 67 15-AUG-09
USERNAME USER_ID CREATED
------------------------------ ---------- ---------
MDDATA 65 15-AUG-09
MDSYS 57 15-AUG-09
SI_INFORMTN_SCHEMA 56 15-AUG-09
ORDPLUGINS 55 15-AUG-09
ORDDATA 54 15-AUG-09
ORDSYS 53 15-AUG-09
OLAPSYS 61 15-AUG-09
ANONYMOUS 46 15-AUG-09
XDB 45 15-AUG-09
CTXSYS 43 15-AUG-09
EXFSYS 42 15-AUG-09
USERNAME USER_ID CREATED
------------------------------ ---------- ---------
XS$NULL 2147483638 15-AUG-09
WMSYS 32 15-AUG-09
APPQOSSYS 31 15-AUG-09
DBSNMP 30 15-AUG-09
ORACLE_OCM 21 15-AUG-09
DIP 14 15-AUG-09
OUTLN 9 15-AUG-09
SYSTEM 5 15-AUG-09
SYS 0 15-AUG-09
5、查看用户或角色系统权限(直接赋值给用户或角色的系统权限):
select * from dba_sys_privs;
select * from user_sys_privs;
6、查看角色(只能查看登陆用户拥有的角色)所包含的权限
select * from role_sys_privs;
7、查看用户对象权限:
select * from dba_tab_privs;
select * from all_tab_privs;
select * from user_tab_privs;
8、查看所有角色:
select * from dba_roles;
9、查看用户或角色所拥有的角色:
select * from dba_role_privs;
select * from user_role_privs;
10、查看哪些用户有sysdba或sysoper系统权限(查询时需要相应权限)
select * from V$PWFILE_USERS;
修改数据库允许的最大连接数:
alter system set processes = 300 scope = spfile;
查看游标数量
Select * from v$open_cursor Where user_name=''
查询数据库允许的最大连接数:
select value from v$parameter where name = 'processes';
或者:show parameter processes;
查询数据库允许的最大游标数:
select value from v$parameter where name = 'open_cursors'
查看oracle版本
select banner from sys.v_$version;
按降序显示用户"SYSTEM"为每个会话打开的游标数
select o.sid, osuser, machine, count(*) num_curs from v$open_cursor o, v$session s where user_name = 'SYSTEM' and o.sid=s.sid group by o.sid, osuser, machine order by num_curs desc;