oracle 查询非自增长分区的最大分区

时间:2024-10-14 12:35:50

select a.table_owner, a.table_name, a.max_partition
  from (select table_owner, table_name, max(partition_name) max_partition
          from dba_tab_partitions
         where table_owner not in ('SYS', 'SYSTEM')
           and partition_name not in ('PMAXVAL', 'PMAX')
           and table_name not in (select distinct table_name
                                    from dba_tab_partitions
                                   where interval = 'YES')
         group by table_owner, table_name
         order by 3) a