我的网络应用程序运行非常缓慢,看起来它是由于数据库耗尽表空间。目前我正在使用SYSTEM用户将我的网络应用程序连接到数据库,我知道这不是一个好习惯,但现在就是这样。任何人都知道如何使用Query增加SYSTEM用户表空间?也许可以做些什么来清理一些SYSTEM表空间?关闭审核?
获取表空间统计信息查询:
SELECT a.tablespace_name,
ROUND (((c.BYTES - NVL (b.BYTES, 0)) / c.BYTES) * 100,2) percentage_used,
c.BYTES / 1024 / 1024 space_allocated,
ROUND (c.BYTES / 1024 / 1024 - NVL (b.BYTES, 0) / 1024 / 1024,2) space_used,
ROUND (NVL (b.BYTES, 0) / 1024 / 1024, 2) space_free,
c.DATAFILES
FROM dba_tablespaces a,
( SELECT tablespace_name,
SUM (BYTES) BYTES
FROM dba_free_space
GROUP BY tablespace_name
) b,
( SELECT COUNT (1) DATAFILES,
SUM (BYTES) BYTES,
tablespace_name
FROM dba_data_files
GROUP BY tablespace_name
) c
WHERE b.tablespace_name(+) = a.tablespace_name
AND c.tablespace_name(+) = a.tablespace_name
ORDER BY NVL (((c.BYTES - NVL (b.BYTES, 0)) / c.BYTES), 0) DESC;
查询结果:
TABLESPACE_NAME PERCENTAGE_USED SPACE_ALLOCATED SPACE_USED SPACE_FREE DATAFILES
SYSTEM 97.45 380 370.31 9.69 1
SYSAUX 94.48 740 699.19 40.81 1
UNDOTBS1 83.44 40 33.38 6.63 1
USERS 2.56 100 2.56 97.44 1
TEMP 0
答案 0 :(得分:1)
SELECT FILE_NAME, TABLESPACE_NAME,BYTES
FROM DBA_DATA_FILES
WHERE TABLESPACE_NAME = 'SYSTEM';
ALTER DATABASE DATAFILE '<FILENAME>' RESIZE 500M;
示例:
ALTER DATABASE DATAFILE '/u02/oracle/rbdb1/stuff01.dbf'
RESIZE 100M;