LoginSignup
1
0

More than 5 years have passed since last update.

Oracle限定 indexを再ビルドするためのコマンドを自動?作成【ネタ】

Last updated at Posted at 2016-08-15

書いた理由

将来の自分に向けたメモ書き

考えた理由

インデックス領域が壊れたのでインデックス全般を再ビルドする必要があったが、コマンドを作るのが面倒だった。

SQL

status <> 'VALID' 条件を入れると、壊れているもののみが抜き出される。
全部やり直す時はwhere条件は不要。

select 'alter index ' || INDEX_NAME || ' rebuild tablespace ' || TABLESPACE_NAME || ';' 
from USER_INDEXES 
-- where  status <> 'VALID'
order  by INDEX_NAME
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0