--查询oracle版本信息
select * from v$version;
--当前的连接数
select count(*) from v$process;
--数据库允许的最大连接数(默认150)
select value from v$parameter where name = 'processes';
--各DBF文件大小
SELECT ROUND(a.BYTES/(1024*1024),2) AS "SIZE(M)", a.* FROM SYS.DBA_DATA_FILES a;
--查询各表空间当前大小
SELECT DD.TABLESPACE_NAME,
ROUND(SUM(DD.BYTES) / (1024 * 1024), 2) "表空间总大小(M)"
FROM SYS.DBA_DATA_FILES DD
GROUP BY DD.TABLESPACE_NAME;
--查找分区表
select table_name from user_tables where partitioned='YES';
--查看分区表的索引
select index_name,tablespace_name,table_name from user_indexes where PARTITIONED='YES' and table_name='TABLENAME';
--表空间使用情况
SELECT UPPER(F.TABLESPACE_NAME) "表空间名",
D.TOT_GROOTTE_MB "表空间大小(M)",
D.TOT_GROOTTE_MB - F.TOTAL_BYTES "已使用空间(M)",
TO_CHAR(ROUND((D.TOT_GROOTTE_MB - F.TOTAL_BYTES) / D.TOT_GROOTTE_MB * 100, 2), '990.99')||'%' "使用比(%)",
F.TOTAL_BYTES "空闲空间(M)",
F.MAX_BYTES "最大块(M)"
FROM (SELECT TABLESPACE_NAME,
ROUND(SUM(BYTES) / (1024 * 1024), 2) TOTAL_BYTES,
ROUND(MAX(BYTES) / (1024 * 1024), 2) MAX_BYTES
FROM SYS.DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME
) F,
(SELECT DD.TABLESPACE_NAME,
ROUND(SUM(DD.BYTES) / (1024 * 1024), 2) TOT_GROOTTE_MB
FROM SYS.DBA_DATA_FILES DD
GROUP BY DD.TABLESPACE_NAME
) D
WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME
ORDER BY F.TABLESPACE_NAME;
--各用户下对象占用空间大小
SELECT owner, segment_name, ROUND(SUM(bytes)/1024/1024,2) AS "SIZE(M)" FROM dba_extents
WHERE tablespace_name='KDCC_INDEX' GROUP BY owner,segment_name ORDER BY 3 DESC;
--JOB查询
select * from user_jobs m where m.WHAT like 'f_zqs%';
select * from v$version;
--当前的连接数
select count(*) from v$process;
--数据库允许的最大连接数(默认150)
select value from v$parameter where name = 'processes';
--各DBF文件大小
SELECT ROUND(a.BYTES/(1024*1024),2) AS "SIZE(M)", a.* FROM SYS.DBA_DATA_FILES a;
--查询各表空间当前大小
SELECT DD.TABLESPACE_NAME,
ROUND(SUM(DD.BYTES) / (1024 * 1024), 2) "表空间总大小(M)"
FROM SYS.DBA_DATA_FILES DD
GROUP BY DD.TABLESPACE_NAME;
--查找分区表
select table_name from user_tables where partitioned='YES';
--查看分区表的索引
select index_name,tablespace_name,table_name from user_indexes where PARTITIONED='YES' and table_name='TABLENAME';
--表空间使用情况
SELECT UPPER(F.TABLESPACE_NAME) "表空间名",
D.TOT_GROOTTE_MB "表空间大小(M)",
D.TOT_GROOTTE_MB - F.TOTAL_BYTES "已使用空间(M)",
TO_CHAR(ROUND((D.TOT_GROOTTE_MB - F.TOTAL_BYTES) / D.TOT_GROOTTE_MB * 100, 2), '990.99')||'%' "使用比(%)",
F.TOTAL_BYTES "空闲空间(M)",
F.MAX_BYTES "最大块(M)"
FROM (SELECT TABLESPACE_NAME,
ROUND(SUM(BYTES) / (1024 * 1024), 2) TOTAL_BYTES,
ROUND(MAX(BYTES) / (1024 * 1024), 2) MAX_BYTES
FROM SYS.DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME
) F,
(SELECT DD.TABLESPACE_NAME,
ROUND(SUM(DD.BYTES) / (1024 * 1024), 2) TOT_GROOTTE_MB
FROM SYS.DBA_DATA_FILES DD
GROUP BY DD.TABLESPACE_NAME
) D
WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME
ORDER BY F.TABLESPACE_NAME;
--各用户下对象占用空间大小
SELECT owner, segment_name, ROUND(SUM(bytes)/1024/1024,2) AS "SIZE(M)" FROM dba_extents
WHERE tablespace_name='KDCC_INDEX' GROUP BY owner,segment_name ORDER BY 3 DESC;
--JOB查询
select * from user_jobs m where m.WHAT like 'f_zqs%';