临时表空间
查看表空间使用:select USERNAME,TABLESPACE,BLOCKS from v$sort_usage where USERNAME='SCOTT';
临时表空间使用:临时表 oracle排序的中间数据
临时表创建:
1.事务级临时表:事务结束,数据消失
create global tempoary table temp as select * from t_user;
2.会话级临时表:会话结束,数据消失
create global tempoary table temp2 on commit preserve rows as select * from t_user;
oracle排序的中间数据(临时表):当排序数据多,pga不足时会创建临时表存储排序的中间数据
使中间表数据产生:
查看pga:show parameter pga
查看内存:show parameter memory
修改内存大小:alter system set memory_target=0;
修改pga空间:alter system set pga_agreegate_target=10m;
临时表空间路径:
select name from v$tempfile;
select file_name from dba_temp_files;
临时表空间文件删除后,数据库启动时会自动创建一个新的文件
创建临时表空间:create tempoary tablespace temp02 tempfile '/u01/app/oracle/oradata/myorcl/temp02.dbf' size 20m;
查看默认的临时表空间:
select * from database_properties where rownum<4;
select tempoary_tablespace from dba_users where username='SCOTT';
修改数据库默认临时表空间:alter database default tempoary tablespace temp02;
修改临时表空间名称:alter tablespace temp rename to temp01;
临时表空间组:oracle10之后新增的,多个用户排序时,分散到不同的临时表空间,解决IO瓶颈;临时表空间组无法显式创建,只能通过将临时表空间移动到临时表空间组的形式,由oracle自动创建。(只有临时表空间有组的概念,其他表空间没有)
查看临时表空间组:select * from dba_tablespace_groups;
将表空间移动到组中:
alter tablespace temp01 tablespace group tempgroup;
alter tablespace temp02 tablespace group tempgroup;
用户临时表空间使用组:alter user scott tempoary tablespace TEMPGROUP;
修改临时表空间文件大小:alter database tempfile '/u01/app/oracle/oradata/myorcl/temp02.dbf' resize 5m;--这种情况下排序数据过大时会报错需要扩容临时表空间
扩容临时表空间:
alter database tempfile '/u01/app/oracle/oradata/myorcl/temp02.dbf' resize 15m;--直接修改文件大小
alter database tempfile '/u01/app/oracle/oradata/myorcl/temp02.dbf' autoextend on;--打开文件自动扩展
alter tablespace temp02 add tempfile '/u01/app/oracle/oradata/myorcl/temp03.dbf' size 10m;--追加一个10m的临时表空间文件
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
· 如何调用 DeepSeek 的自然语言处理 API 接口并集成到在线客服系统