惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
V2EX
量子位
博客园 - 司徒正美
IT之家
IT之家
V
Visual Studio Blog
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
Google DeepMind News
Google DeepMind News
Last Week in AI
Last Week in AI
Microsoft Security Blog
Microsoft Security Blog
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏
GbyAI
GbyAI
Vercel News
Vercel News
B
Blog
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
小众软件
小众软件
罗磊的独立博客
博客园 - 叶小钗
雷峰网
雷峰网
Martin Fowler
Martin Fowler
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学

博客园 - 深海蓝精灵

Linux-Nginx同一端口同时支持HTTP、HTTPS协议 Linux-arm离线Tomcat安装solr及国产数据库配置 Linux-2台服务器-Redis-集群模式安装配置 Linux 系统架构:aarch64,docker、Docker-compose,包下载安装配置 Linux aarch64 架构离线 Docker-compose 搭建 Nginx+Keepalived 双机热备(高可用集群) Linux 部署nacos3.1.2,修改Console默认8080端口,修改为8081的解决方案 CloudBeaver Community,web界面,查询表字段长度、及存储过程信息 Linux 服务器 mac 地址查询命令 Linux-LVM 方式挂载大于3T磁盘,详细操作过程 BCLinux,镜像安装GitLab社区版 v18.5.1 Bcliux-docker-nacos2.2.0升级至2.2.3版本 Linux-查询全部密码过期用户 Oracle删除表数据恢复方法 BcLinux-Redis-集群(cluster)安装配置 Bclinux离线安装PostgreSQL10.23+PostGIS2.5编译安装配置 Oracle-失效链接清理 Linux-shell脚本链接Oracle执行查询 Linux系统中,修改密码永不过期 Oracle中replace函数使用简介 BcLinux-Redis-集群(cluster)模式安装配置 Oracle-修改字段类型方法总结 Bclinux系统安装MongoDB Linux-下docker和主机之间的文件拷贝 解决:tcpdump -w xxxxx.cap 提示 Permission denied
ORA-01652: 无法通过 128 (在表空间 TEMP 中) 扩展 temp 段
深海蓝精灵 · 2024-04-10 · via 博客园 - 深海蓝精灵

1、报错信息
ORA-01652: 无法通过 128 (在表空间 TEMP 中) 扩展 temp 段

2、原因
临时表空间满了

3、解决办法
3.1 添加临时表空间的数据文件
alter tablespace TEST_TEMP add datafile '+DATA/ZYGLZXDB/F5324C63FB43C214E0536E9ECE0A6F9E/TEMPFILE/test_temp_01.dbf' size 30g;

注意:临时表空间的数据文件用tempfile ,而不是datafile

3.2 重启数据库释放表空间
登录oracle用户,依次执行以下命令
sqlplus '/as sysdba'
shutdown immediate;
startup;
select 1 from dual;

4、拓展-与临时表空间相关的语句
--查询用户所使用的临时表空间:
select username,default_tablespace,temporary_tablespace from dba_users;

--查询临时表空间大小以及使用率:
select tablespace_name, bytes, user_bytes, user_bytes/bytes,file_name from dba_temp_files;
 
--查询临时文件是否在线:
select name,status from v$tempfile;
 
--修改临时文件在线(离线)状态:
alter database tempfile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\TEMP02.DBF' online(offline);
 
--增加临时文件大小(增加原文件):
alter database tempfile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\TEMP01.DBF' resize 100m;
 
--通过增加新的临时文件,来扩大临时表空间:
alter tablespace temp add tempfile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\TEMP02.DBF' size 4000m;
 
--删除临时文件:
alter database tempfile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\TEMP02.DBF' drop;
 
--将临时文件设置为自动扩展:
alter database tempfile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\TEMP01.DBF' autoextend on next 5m maxsize unlimited;

--添加临时表空间的数据文件:
alter tablespace TEST_TEMP add datafile '+DATA/ZYGLZXDB/F5324C63FB43C214E0536E9ECE0A6F9E/TEMPFILE/test_temp_03.dbf' size 30g;

--修改为自动扩展
alter database datafile '+DATA/ZYGLZXDB/F5324C63FB43C214E0536E9ECE0A6F9E/TEMPFILE/test_temp_03.dbf' autoextend on;
 
--关闭(启动)临时文件的自动增长:
alter database tempfile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\TEMP01.DBF' autoextend off(on);

5.解决方法

5.1 查看表空间使用情况

	SELECT
		* 
	FROM
		(
		SELECT
			a.tablespace_name,
			round( a.bytes / 1024 / 1024, 2 ) total_bytes,
			round( b.bytes / 1024 / 1024, 2 ) free_bytes,
			round( a.bytes / 1024 / 1024 - b.bytes / 1024 / 1024, 2 ) use_bytes,
			round(( 1 - b.bytes / a.bytes ) * 100, 2 ) || '%' USE 
		FROM
			( SELECT tablespace_name, sum( bytes ) bytes FROM dba_data_files GROUP BY tablespace_name ) a,
			( SELECT tablespace_name, sum( bytes ) bytes FROM dba_free_space GROUP BY tablespace_name ) b 
		WHERE
			a.tablespace_name = b.tablespace_name UNION ALL
		SELECT
			c.tablespace_name,
			round( c.bytes / 1024 / 1024, 2 ) total_bytes,
			round( ( c.bytes - d.bytes_used ) / 1024 / 1024, 2 ) free_bytes,
			round( d.bytes_used / 1024 / 1024, 2 ) use_bytes,
			round( d.bytes_used * 100 / c.bytes, 2 ) || '%' USE 
		FROM
			( SELECT tablespace_name, sum( bytes ) bytes FROM dba_temp_files GROUP BY tablespace_name ) c,
			( SELECT tablespace_name, sum( bytes_cached ) bytes_used FROM v$temp_extent_pool GROUP BY tablespace_name ) d 
		WHERE
			c.tablespace_name = d.tablespace_name 
		) 
	ORDER BY
		tablespace_name;

5.2 查看表空间大小、位置、空间使用情况、空间拓展性

	select *
	from (
	select tablespace_name, file_id, file_name, round(bytes/(1024*1024),0) total_space, round(maxbytes/(1024*1024),0) maxbytes_space, autoextensible from dba_data_files 
	union all
	select tablespace_name, file_id, file_name, round(bytes/(1024*1024),0) total_space, round(maxbytes/(1024*1024),0) maxbytes_space, autoextensible from dba_temp_files 
	) a
	order by tablespace_name,file_id;

5.3 为表空间增加文件

alter tablespace temp add tempfile 'E:/ORADATA/NCENVIRO/temp05.dbf' size 2048M reuse autoextend on next 100M;