----临时表空间
SELECT a.tablespace_name "表空间名",
total "表空间大小",
total - used "表空间剩余大小",
used "表空间使用大小",
ROUND(used / total, 4) * 100 "使用率 %"
FROM (SELECT tablespace_name, SUM(bytes_used) used
FROM v$temp_space_header
GROUP BY tablespace_name) a,
(SELECT tablespace_name, SUM(bytes) total
FROM dba_temp_files
GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name
----查看表空间
SELECT a.tablespace_name "表空间名",
total / 1024 / 1024 "表空间大小",
free / 1024 / 1024 "表空间剩余大小",
(total - free) / 1024 / 1024 "表空间使用大小",
ROUND((total - free) / total, 4) * 100 "使用率 %"
FROM (SELECT tablespace_name, SUM(bytes) free
FROM DBA_FREE_SPACE GROUP BY tablespace_name) a,
(SELECT tablespace_name, SUM(bytes) total
FROM DBA_DATA_FILES
GROUP BY tablespace_name) b WHERE a.tablespace_name = b.tablespace_name
---创建临时表空间组
create temporary tablespace tempsum1 TEMPFILE '/dosp/data02/tablespace/tempsum1.dbf' SIZE 20G tablespace group tempsum;
create temporary tablespace tempsum2 TEMPFILE '/dosp/data02/tablespace/tempsum2.dbf' SIZE 20G tablespace group tempsum;
----产看每个用户占了多少表空间
select owner,tablespace_name,sum(bytes)/1024/1024MB
from dba_segments group by owner,tablespace_name
SELECT a.tablespace_name "表空间名",
total "表空间大小",
total - used "表空间剩余大小",
used "表空间使用大小",
ROUND(used / total, 4) * 100 "使用率 %"
FROM (SELECT tablespace_name, SUM(bytes_used) used
FROM v$temp_space_header
GROUP BY tablespace_name) a,
(SELECT tablespace_name, SUM(bytes) total
FROM dba_temp_files
GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name
----查看表空间
SELECT a.tablespace_name "表空间名",
total / 1024 / 1024 "表空间大小",
free / 1024 / 1024 "表空间剩余大小",
(total - free) / 1024 / 1024 "表空间使用大小",
ROUND((total - free) / total, 4) * 100 "使用率 %"
FROM (SELECT tablespace_name, SUM(bytes) free
FROM DBA_FREE_SPACE GROUP BY tablespace_name) a,
(SELECT tablespace_name, SUM(bytes) total
FROM DBA_DATA_FILES
GROUP BY tablespace_name) b WHERE a.tablespace_name = b.tablespace_name
---创建临时表空间组
create temporary tablespace tempsum1 TEMPFILE '/dosp/data02/tablespace/tempsum1.dbf' SIZE 20G tablespace group tempsum;
create temporary tablespace tempsum2 TEMPFILE '/dosp/data02/tablespace/tempsum2.dbf' SIZE 20G tablespace group tempsum;
----产看每个用户占了多少表空间
select owner,tablespace_name,sum(bytes)/1024/1024MB
from dba_segments group by owner,tablespace_name