oracle:批量修改sequence-cache

-- 批量批改sequence cache
SELECT 'alter sequence ' || SEQUENCE_OWNER || '.' || SEQUENCE_NAME || ' cache 1000;' INC_SEQ_CMD
  FROM DBA_SEQUENCES
 WHERE LAST_NUMBER > 100000
   AND CACHE_SIZE < 200
   AND SEQUENCE_OWNER IN
       (SELECT USERNAME
          FROM DBA_USERS
         WHERE ACCOUNT_STATUS = 'OPEN'
           AND USERNAME NOT IN
               ('SYS', 'SYSTEM', 'ZABBIX', 'DBSNMP', 'MGMT_VIEW', 'SYSMAN')) 
   AND EXISTS (SELECT 1
          FROM V$DATABASE
         WHERE OPEN_MODE = 'READ WRITE'
           AND DATABASE_ROLE = 'PRIMARY');

posted on 2022-04-07 10:13  数据派  阅读(511)  评论(0编辑  收藏  举报