我在Oracle数据库中处理分区表时遇到了一个有趣的问题。
观察:
当我执行查询时
select partition_name, high_value
from all_tab_partitions
where table_name = 'TABLE_NAME_P';
我收到了一个错误
ORA-01653:无法在表空间SYSAUX中用128个扩展表SYS.SQLOBJ$PLAN
但是,查询在没有high_value的情况下成功运行。例如:查询
select partition_name from all_tab_partitions where table_name = 'TABLE_NAME_P';
select partition_position from all_tab_partitions where table_name = 'TABLE_NAME_P';
不会犯任何错误。
此外,当我将table_name替换为tablespace_name列时,如下所示:
select partition_name, high_value from all_tab_partitions where tablespace_name = 'TABLESPACE_D1'
然后,查询也成功地运行,没有任何错误。但是,我需要使用table_name来为用户表空间中的特定表查找分区及其对应的high_value。
帮助我理解:
发布于 2022-07-09 22:58:21
广告1.
不知道--我可以假设这个查询是“一个新的查询”,数据库试图保存有关它的统计数据。但也可能是个窃听器。
广告2
您可以查询v$sysaux_occupants
以获得有关SYSAUX使用的信息。
可以在SYSAUX表中收缩对象。这将释放一些对象(例如)分配但不使用的空间。被删除的行占用)。
通常,您可以使用alter table
语句收缩表:
-- You have to enable row movement:
ALTER TABLE <table name> ENABLE ROW MOVEMENT;
-- This command will recover space, but it doesn't change the high water mark
-- so it will not free up space (it just moves free block at the "end of table")
-- but it's an "online" operation and makes only row locks
-- so it's better to use this one as first for big tables
ALTER TABLE <table name> SHRINK SPACE COMPACT;
--
-- This one will recover free space and it will amend the high water mark
ALTER TABLE <table name> SHRINK SPACE;
-- This statement will do the same but for all dependant objects too:
ALTER TABLE <table name> SHRINK SPACE CASCADE;
请注意,您不能遵循任何有关收缩表和索引的一般指南,因为不支持通过ALTER TABLE
从SYSAUX表空间中移动一些对象,因为它可能导致损坏。其中一些物体有特别程序。您可以访问“我的Oracle支持”吗?有一篇题为How to Reduce SYSAUX Tablespace Occupancy Due to Fragmented TABLEs and INDEXes
的文章(Doc 1563921.1),它解释了SYSAUX表空间的过程。因此,在不签入上述文章之前,不要使用上述语句,因为这是允许的.。
广告3.
您可以删除一个未使用的基线(不启用,不接受)-它应该是安全的。您可以查询DBA_SQL_PLAN_BASELINES
以找到这些。有关它的更多信息,请参阅文档的管理SQL计划基线一章。
https://stackoverflow.com/questions/66435118
复制相似问题