Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Move user to different tablespace

Re: Move user to different tablespace

From: Niall Litchfield <n-litchfield_at_audit-commission.gov.uk>
Date: Wed, 15 May 2002 12:45:52 +0100
Message-ID: <3ce24a71$0$225$ed9e5944@reading.news.pipex.net>


"Vladimir M. Zakharychev" <bob_at_dpsp-yes.com> wrote in message news:abtgi9$pr5$1_at_babylon.agtel.net...
> You didn't mention version of Oracle...
> On 8i and later you can do the following:
>
> alter user xxx default tablespace new_tbs
> then connect as xxx and
>
> begin
> for t in (select table_name from user_tables) loop
> -- won't work for tables with LONGs
> begin
> execute immediate 'alter table '||t.table_name||' move tablespace
new_tbs';
> exception
> -- ignore errors
> when others then null;
> end;
> end loop;

you might prefer to catch any errors but change the loop to

for t in (select count(*) from user_tables tabs where not exists (
select table_name from user_tab_columns cols where data_type in ('LONG','LONG RAW')
and tabs.table_name=cols.table_name)) loop

--
Niall Litchfield
Oracle DBA
Audit Commission UK
*****************************************
Please include version and platform
and SQL where applicable
It makes life easier and increases the
likelihood of a good answer

******************************************
Received on Wed May 15 2002 - 06:45:52 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US