0

我必须为新报告创建sql查询。问题是我必须做 11 Left Outer Join!哦,是的,这是不好的部分。当我执行查询 Oracle 生成此错误:

ORA-01652: unable to extend temp segment by 128 in tablespace TEMP
01652. 00000 -  "unable to extend temp segment by %s in tablespace %s"
*Cause:    Failed to allocate an extent of the required number of blocks for
           a temporary segment in the tablespace indicated.
*Action:   Use ALTER TABLESPACE ADD DATAFILE statement to add one or more
           files to the tablespace indicated.

我确信这个错误会被触发,因为有很多记录需要处理。你有什么建议可以帮助我吗?

谢谢, 瓦卢德

4

3 回答 3

2

报告的结果是否以任何方式汇总?如果是这样,您可以将查询分解为多个阶段并存储中间结果,而不是一次完成。如果不查看查询本身并对领域和需求有基本的了解,就很难进一步提供帮助。

于 2013-05-22T16:23:59.320 回答
2

If it's not to do with aggregation, as ninesided mentions ...

Oracle 9i and below had a problem with outer joins, particularly with hash outer joins, that might be relevant -- until 10g the driving table for table_a = table_b(+) had to be table_a, and this could mean that an efficient hash join where table_a was smaller than table_b could not occur. The alternative often turned out to be a sort-merge, which could require a lot of temp storage.

The cure could be to upgrade from a version for which extended support ended three years ago ;)

于 2013-05-22T16:28:36.480 回答
0

检查您的临时表空间设置。对表进行排序或散列所需的临时表空间通常与该表的段大小大致相同。使用如下查询查找这些数字:

select bytes/1024/1024/1024 GB, dba_segments.*
from dba_segments
where segment_name = '<table_name>';

然后将其与可用的临时表空间进行比较:

select free_space/1024/1024/1024 GB, dba_temp_free_space.*
from dba_temp_free_space;

如果您正在对大于临时空间的表进行排序或散列,最简单的解决方案可能是添加更多空间。

还要检查其他进程是否正在使用大量临时表空间。假设 8K 块大小:

select blocks * 8 * 1024 /1024/1024 MB, v$sort_usage.*
from gv$sort_usage;
于 2013-05-22T18:14:00.547 回答