/* //查询oracle的连接数 select count(*) from v$session; //当前用户连接数 select count(*) from v$session t where t.username='WIMS' ; //数据库允许的最大连接数 select value from v$parameter where name = 'processes' //修改最大连接数: alter system set processes = 300 scope = spfile; 2、查询oracle的并发连接数 select count(*) from v$session where status='ACTIVE'; 3、查看不同用户的连接数 select username,count(username) from v$session where username is not null group by username; 4、查看所有用户: select * from all_users; 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; 重启数据库: shutdown immediate; startup; --查看当前有哪些用户正在使用数据 SELECT osuser, a.username,cpu_time/executions/1000000||'s', sql_fulltext,machine from v$session a, v$sqlarea b where a.sql_address =b.address order by cpu_time/executions desc; select count(*) from v$session #连接数 select count(*) from v$session where status='ACTIVE' #并发连接数 show parameter processes #最大连接 alter system set processes = value scope = spfile; --1、查看表在那个表空间 select tablespace_name,table_name from user_talbes where table_name='employ'; --2、获取用户的默认表空间 select username, DEFAULT_TABLESPACE from dba_users where username='scott'; --3、查看表空间所有的文件 select * from dba_data_files where tablespace_name='USERS'; --4、查看表空间使用情况: SELECT tbs 表空间名, sum(totalM) 总共大小M, sum(usedM) 已使用空间M, sum(remainedM) 剩余空间M, sum(usedM)/sum(totalM)*100 已使用百分比, sum(remainedM)/sum(totalM)*100 剩余百分比 FROM( SELECT b.file_id ID, b.tablespace_name tbs, b.file_name name, b.bytes/1024/1024 totalM, (b.bytes-sum(nvl(a.bytes,0)))/1024/1024 usedM, sum(nvl(a.bytes,0)/1024/1024) remainedM, sum(nvl(a.bytes,0)/(b.bytes)*100), (100 - (sum(nvl(a.bytes,0))/(b.bytes)*100)) FROM dba_free_space a,dba_data_files b WHERE a.file_id = b.file_id GROUP BY b.tablespace_name,b.file_name,b.file_id,b.bytes ORDER BY b.tablespace_name ) GROUP BY tbs --5、扩展表空间 alter database datafile 'D:OraclePRODUCTORADATATESTUSERS01.DBF' resize 50m; --自动增长 alter database datafile 'D:oraclePRODUCTORADATATESTUSERS01.DBF' autoextend on next 50m maxsize 500m; --增加数据文件 alter tablespace yourtablespacename add datafile 'd: ewtablespacefile.dbf' size 5m; */