Try this. After having spool file , just change tablespace name from x to y.
set echo off linesize 199 pagesize 9999 head off feedback off verify off
spool alter_index_rebuild_&&1
select 'connect system/password' from dual;
select 'alter tablespace &&1 coalesce;' from dual;
select 'connect &&2/&&2' from dual;
select 'set echo on time on timing on' from dual;
select 'spool run_alter_index_rebuild_&&1' from dual;
select 'alter index ' || ind.owner || '.' || ind.index_name ||
' rebuild unrecoverable tablespace &&1;'
from dba_indexes ind, dba_segments seg
where ind.index_name = seg.segment_name
and ind.owner not in ('SYS', 'SYSTEM')
and ind.tablespace_name = upper ('&&1')
order by ind.owner,seg.bytes asc;
select 'exit' from dual;
undefine 1 2
exit
Reply-To: [EMAIL PROTECTED]
To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]>
Date: Fri, 02 Feb 2001 08:30:24 -0800
Has anyone ever written a script or something that moved indexes to a
different tablespace? One of our schemas has indexes in the wrong
tablespace and instead of going throught hem one by one I was wondering if
it was possible to move all of them at once? Any ideas, am I out of my
mind?
Sincerely,
Kevin Kostyszyn
DBA
Dulcian, Inc
www.dulcian.com
[EMAIL PROTECTED]
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Kevin Kostyszyn
INET: [EMAIL PROTECTED]
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Mohammad Rafiq
INET: [EMAIL PROTECTED]
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).