Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Rebuild implicit index for primary key
Mark D Powell wrote:
> Franz Kruse wrote:
> > Jim Smith:
> >
> > > ...
> > > Or you could use an anonymous PL/SQL block
> > >
> > > declare
> > > sqlstmt varchar2(1000);
> > > begin
> > > SELECT
> > > 'ALTER INDEX '||OWNER||'.'||INDEX_NAME||' REBUILD;'
> > > into sqlstmt
> > > FROM
> > > DBA_INDEXES
> > > WHERE
> > > STATUS='INVALID'
> > > AND OWNER='owner_name_here'
> > > AND TABLE_NAME='table_name_here';
> > >
> > > execute immediate sqlstmt;
> > >
> > > end;
> > >
> > > (with appropriate error checking of course)
> >
> > Perfect. That's exactly what I was looking for.
> > Thank you very much.
> >
> > Franz
>
One of the main advantages of the spool 'solution' you always hage to
remember
set pagesize 0 newpage 0 feedback off.
The other advantage is when you don't pay attention it will definitely
clutter the O/S with spool junk.
I don't see why generating a spool file would be 'easier'.
Actually such a script takes more time to type than the anonymous block
solution.
-- Sybrand Bakker Senior Oracle DBAReceived on Sat Jan 06 2007 - 13:11:46 CST
![]() |
![]() |