The other day I had to move a crapload of Oracle table indicies into a different Oracle tablespace …

Here’s what I ended up doing

begin
  for C in (select * from DBA_INDEXES where OWNER = 'UCSC' and TABLESPACE_NAME = 'UCSC' and INDEX_TYPE = 'NORMAL')
  LOOP
    execute immediate 'alter index "' || C.index_name || '" rebuild tablespace ucscidx';
  end LOOP;
end;
/