1、创建表空间
create tablespace haqp datafile ‘D:/app/Administrator/oradata/haqp/haqp.DBF’ size 15000m;
2、查询表空间大小及使用情况
SELECT a.tablespace_name “表空间名”,
total “表空间大小”,
free “表空间剩余大小”,
(total - free) “表空间使用大小”,
total / (1024 * 1024 * 1024) “表空间大小(G)”,
free / (1024 * 1024 * 1024) “表空间剩余大小(G)”,
(total - free) / (1024 * 1024 * 1024) “表空间使用大小(G)”,
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 order by “使用率 %”;
3、查询表空间存放位置
SELECT * FROM dba_data_files WHERE tablespace_name = ‘EXAMPLE’;
4、修改表空间大小
ALTER DATABASE DATAFILE ‘D:\APP\ADMINISTRATOR\ORADATA\OCEANSGJ\SYSAUX01.DBF’ RESIZE 2500M;
5、设置表空间自动增长500M
ALTER DATABASE datafile ‘D:\APP\ADMINISTRATOR\ORADATA\OCEANSGJ\EXAMPLE01.DBF’ autoextend ON NEXT 500M;
6.删除表空间,及对应的表空间文件也删除掉
drop tablespace haqp including contents and datafiles cascade constraint;