首页 技术 正文
技术 2022年11月8日
0 收藏 662 点赞 1,600 浏览 1462 个字

测试场景下,使用的oralce遇到表空间的占用超大,可以采用如下的方式进行空间的清理

首先使用sqlplus连接数据库
sqlplus sys/password@orcl as sysdba 之类进行数据库的连接没然后进行如下的操作

##创建表空间
对于自己的测试库和表等最好都建立自己的表空间,以方便清理和删除

create tablespace abc datafile ‘/opt/oracle/app/oradata/orcl/users02.dbf’ size 1024m autoextend on next 100m maxsize 10240m extent management local;      创建表空间

##查看表空间的情况
oracle查询表空间文件所在路径

select * from dba_data_files
       
通过这个命令可以查看各表空间所在的路径位置

##temp表空间的重建
+ 新建1个

当数据库进行索引重建,或者大量数据导入导出时,会使得temp表空间暴增,很可能撑满数据文件,因为数据库安装的时候,temp表空间默认很自由一个数据文件
        并且数据库中单个数据文件最大只能自增到32G,当超过32G时就不可用了,为了防止此故障发生,在做索引重建或者大量数据导入导出时,需要关注temp表空间
        的增长情况,temp表空间过大时,可通过如下方法重建
        SQL> create temporary tablespace temp2 tempfile ‘C:\oracle\product\10.2.0\oradata\ORCL\temp2.dbf’ size 200M autoextend off;
        SQL> alter database default temporary tablespace temp2;
        SQL> drop tablespace temp;
        或者SQL> drop tablespace temp including contents and datafiles cascade constraints(彻底删除包括操作系统中的临时表空间的数据文件)
        最后在操作系统上把temp的文件删除,就可以释放空间。

+ 还原回来

还可以改为原来的temp
        SQL> create temporary tablespace temp tempfile ‘C:\oracle\product\10.2.0\oradata\ORCL\temp.dbf’ size 200M autoextend off;
        SQL> alter database default temporary tablespace temp;
        SQL> drop tablespace temp2;
        最后在操作系统上把temp的文件删除,就可以释放空间。

如上就可以把非常大temp表空间清理掉

##system表空间用满解决
        alter database datafile ‘C:\oracle\product\10.2.0\oradata\ORCL\system01.dbf’ autoextend on; 
        alter database datafile ‘C:\oracle\product\10.2.0\oradata\ORCL\system01.dbf’ resize 2096M;
如果出现“ORA-03297: 文件包含在请求的 RESIZE 值以外使用的数据”这个错误,调整表空间的大小即可,
完成后即可释放多余的表空间

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,492
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,907
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,740
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,494
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,132
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,295