1、-查看ORACLE表
空间的使用情况直接使用情况:
SELECT D.TABLESPACE_NAME "表
空间名字", D.STATUS "状态",
(A.BYTES / 1024 / 1024) as "总共多少M",
((A.BYTES - DECODE(F.BYTES, NULL, 0, F.BYTES)) / 1024 / 1024) as "已经用了多少M",
(DECODE(F.BYTES, NULL, 0, F.BYTES) / 1024 / 1024) as "剩余多少M",
((A.BYTES - DECODE(F.BYTES, NULL, 0, F.BYTES)) / 1024 / 1024)/(A.BYTES / 1024 / 1024) as "利用率",
DECODE(sign(((A.BYTES - DECODE(F.BYTES, NULL, 0, F.BYTES)) / 1024 / 1024)/(A.BYTES / 1024 / 1024)-0.9),1,'剩余不到10%
,请考虑扩表空间','正常') as "温馨提示"
FROM SYS.DBA_TABLESPACES D, SYS.SM$TS_AVAIL A, SYS.SM$TS_FREE F
WHERE D.TABLESPACE_NAME = A.TABLESPACE_NAME
AND F.TABLESPACE_NAME (+) = D.TABLESPACE_NAME;
2、查看oracle连接数
select count(*) from v$session --连接数
Select count(*) from v$session where status='ACTIVE' --并发连接数
alter system set processes = value scope = spfile;--重启数据库 修改连接
3、为表空间扩容
--为表空间增加数据文件
alter tablespace users add datafile 'c:oracleora81oradatasiduser002.dbf' size 100M;
--增加表空间原有数据文件尺寸
alter database datafile 'c:oracleora81oradata\sidusers.dbf' resize 1000M;
4、查询表空间大小
select tablespace_name,file_id,bytes/1024/1024,file_name
from dba_data_files order by file_id;