ORACLE扩容表空间

查看表空间的名称和文件所在位置
SELECT
	tablespace_name,
	file_id,
	file_name,
	round( bytes / ( 1024 * 1024 ), 0 ) total_space 
FROM
	sys.dba_data_files 
ORDER BY
	tablespace_name

查询表空间信息
SELECT
	username,
	default_tablespace,
	t.* 
FROM
	dba_users t;

二 查询当前表空间下使用情况

SELECT
	username,
	default_tablespace,
	t.* 
FROM
	dba_users t;
SELECT
	a.tablespace_name,
	a.bytes / 1024 / 1024 "sum MB",
	( a.bytes - b.bytes ) / 1024 / 1024 "used MB",
	b.bytes / 1024 / 1024 "free MB",
	round((( a.bytes - b.bytes ) / a.bytes ) * 100, 2 ) "used%" 
FROM
	( SELECT tablespace_name, sum( bytes ) bytes FROM dba_data_files GROUP BY tablespace_name ) a,
	( SELECT tablespace_name, sum( bytes ) bytes, max( bytes ) largest FROM dba_free_space GROUP BY tablespace_name ) b 
WHERE
	a.tablespace_name = b.tablespace_name 
ORDER BY
	(( a.bytes - b.bytes ) / a.bytes ) DESC;

将需要的表空间扩容
    alter database datafile '表空间位置' resize 新的尺寸
    
	alter database datafile '/home/data/tablespace/RENCAI_CENTER_DATA.dbf' resize 4096m

增加后查看表空间的大小,看看你要扩容的表空间是否增加了大小(我截图是已经经过扩容的所以没有变化)


版权声明:本文为qq_40744629原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。