you can move an index with the command REBUILD
but as far as I know you can
not move the table.
Yes you can, but involves little work.
I had done this while ago so make
sure that parameters are correct as you
go through these steps.
First export the specific table(s) to a dump
file such as xyz.dmp under
dba account such as ops$dba.
exp parfile=export_tables_parfile.txt
The content of this parfile, export_tables_parfile.txt
is given below.
To import all the tables, delete tables=(...,...)
userid = /
file =/r1/export/xyz.dmp
rows =n
log =$HOME/log/export.log
tables =(
table1,
table2
)
____________________________________________________________________________
Then import the tables. This import
will ceate only the script file,
import_script.sql. THE STRUCTURES
AND DATA WILL NOT BE IMPORTED.
imp parfile=import_tables_parfile1.txt
Contents of the import_tables_parfile1.txt
is given below. The file,
import_script.sql will contain the SQL script
for tables (table1, table2 in
this case), their indexes, constraints,
grants, triggers etc. with
appropriate storage parameters. Alter
this script to suit your needs and
use it to create the tables/indexes/grants/constraints/triggers
or any of
the above in the appropriate tablespace
for any user with your own storage
parameters.
userid = /
file =/r1/export/xyz.dmp
log =$HOME/log/import_script.sql
show = y
tables =(
table1,
table2
)
----------------------------------------------------------------------------
----------------------------------------------
Drop the tables. Before dropping production
tables, you may want to make
sure that your export file,xyz.dmp is good
by importing few tables in
some account, ops$abc, as given below or
by copying them to something else.
----------------------------------------------------------------------------
-----------------------------------------------
Use the above altered script to create the
tables in appropriate tablespace
and/or user.
----------------------------------------------------------------------------
-----------------------------------------------
Then do the real import with the following
script. You may want to add
other import options to this script.
Find out about these option by entering:
imp help = y.
imp parfile=import_tables_parfile2.txt
Contents of the import_tables_parfile2.txt is given below.
userid = /
commit =y
file =/r1/export/xyz.dmp
fromuser=ops$dba
touser = ops$abc
ignore =y
log =$HOME/log/importing_in_new_tablespace.log
tables =(
table1,
table2
)
Good luck !!!
Oracleguru
www.oracleguru.net
[email protected]
This is why what you must do is :
exp username/password owner=username file=username.dmp
then, from a DBA account :
alter user username
default tablespace B
quota unlimited on B
quota 0K on A;
and then
imp username/password file=username.dmp full=Y commit=Y
Note that if you had indexes in another tablespace
than A and you also
want to move them, you will have either
to rebuild the indexes as
somebody suggested you, or use the INDEXFILE
parameter of imp to
generate a (directly usable!) .sql which
contains the CREATE INDEX
statements which you can edit and modify.
In this case, you can import
without the indexes and run the .sql afterwards.
This being Oracle, you
will still have problems with the indexes
associated with PRIMARY KEY
and UNIQUE constraints, but, well ...
--
Regards,
Stéphane Faroult
Oriole Corporation