如何调整表空间的尺寸大小
表空间的大小等同它下的数据文件大小之和
当发生表空间不足的问题时常用的3个解决办法:
1)增加原有数据文件大小(resize)
2)增加一个数据文件(add datafile)
3)设置表空间自动增长(autoextend)
示例:
SQL> create tablespace prod datafile '/u01/oradata/prod/prod01.dbf' size 5m;
SQL> create table scott.test1 (id int) tablespace prod;
SQL> insert into scott.test1 values(1);
SQL> insert into scott.test1 select * from scott.test1;
SQL> /
SQL> /
报错:ORA-01653: unable to extend table SCOTT.TEST1 by 8 in tablespace prod
1)用第一种方法扩充表空间
SQL> alter database datafile '/u01/oradata/prod/prod01.dbf' resize 10m; ##resize参数不光能增长表空间,也可以缩减表空间
SQL> insert into scott.test1 select * from scott.test1;
SQL> /
SQL> /
报错:ORA-01653: unable to extend table SCOTT.TEST1 by 128 in tablespace prod
2)用第二种方法扩充表空间:
SQL> alter tablespace prod add datafile '/u01/oradata/prod/prod02.dbf' size 20m;
SQL> insert into scott.test1 select * from scott.test1;
SQL> /
SQL> /
报错:ORA-01653: unable to extend table SCOTT.TEST1 by 128 in tablespace prod
3)用第三种方法扩充表空间:
SQL> alter database datafile '/u01/oradata/prod/prod01.dbf' autoextend on next 10m maxsize 500m;
SQL> insert into scott.test1 select * from scott.test1;
删除表空间和数据文件
SQL> drop tablespace prod including contents and datafiles;
来源:https://www.cnblogs.com/yqp-1/p/12310255.html