Move tables to new tablespace
Hi,
I have 2 tablespaces
(a) DATA_TBS
(b) INDEX_TBS
So, i am going to create another DATA_TBS_1 Tablespace..and move the some smaller tables from DATA_TBS to DATAB_TBS_1 Tablespace...
All the Tables Indexes are in INDEX_TBS...i am going to move only Tables..
If i move some tables to DATA_TBS_1..
do we need to rebuild the indexes of those tables...i think it is no necessary..because we are not touching indexes...
please help me
Stop thinking. Read:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/tables.htm#sthref2297
Similar Messages
-
How can we move table with long col to new tablespace(LMT) from DMT?
Well, converting LONGs to LOBs is always "painful" :-)
But it is doable, however, the solution depends upon the version of the database.
There are several metalink notes coverting this matter:
Note 137160.1 Oracle 9i PLSQL LONG-TO-LOB API For Easier LONG to LOB Migration
Note 282464.1 How to convert LONG to a CLOB
However here is one that I used recently and it needs one 10g instance as a staging site. (I don't know if this approach has been documented on Metalink. It worked for me, it might work for you as well, but you should test it first).
My production database was 8i and it contained a table with LONG column. The requirement was to convert this column to CLOB.
I exported the table and imported it in 10g database.
Once in 10g I used ALTER TABLE tablename MODIFY longcolumn CLOB; which worked perfectly fine.
Finally I exported the table with CLOB column from the 10g database and imported it back in 8i database.
example:
SQL> create table t
2 (c1 long);
Table created.
SQL> insert into t values ('foo');
1 row created.
SQL> desc t
Name Null? Type
C1 LONG
SQL> alter table t
2 modify c1 clob;
Table altered.
SQL> desc t
Name Null? Type
C1 CLOB
SQL> select c1 from t;
C1
foo
SQL>Cheers,
Mihajlo -
How to move table from one tablespace to other tablespace?
how to move table from one tablespace to other tablespace?
887274 wrote:
how to move table from one tablespace to other tablespace?
alter table <table_name> move tablespace <new_tablespace_name>;
Rebuild the indexes; alter index <index_name> rebuild <new_tablespace_name> online;Example;:
SQL> create table ttt( ID NUMBER PRimary key);
Table created.
SQL> insert into ttt values (1);
1 row created.
SQL> commit;
Commit complete.
SQL> select index_name, status from dba_indexes where table_name='TTT';
INDEX_NAME STATUS
SYS_C0010863 VALID
SQL> alter table ttt move tablespace users;
Table altered.
SQL> select index_name, status from dba_indexes where table_name='TTT';
INDEX_NAME STATUS
SYS_C0010863 UNUSABLE
SQL> alter index SYS_C0010863 rebuild tablespace users online;
Index altered.
SQL> select index_name, status from dba_indexes where table_name='TTT';
INDEX_NAME STATUS
SYS_C0010863 VALID
SQL> -
How to relocate table in new tablespace in Oracle 8i
Hi all
I would like to know how to relocate table from one tablespace to another tablespace in Oracle 8i. Currently, I create new table without data in new tablespace and then load data from old table in old tablespace. However, I think it is not efficient at all. Could anyone kindly advise any method to proceed it
ThanksNick has pointed out the best way to relocate a table. With the alter table move command you do not have to worry about FK or any other kind of constraints, table triggers, or grants. They all remain in place. You just need to rebuild the indexes as Nick pointed out.
There were some restrictions on the types of tables that could be moved with alter table move when the command first was introduced. I think LOB columns were unsupported at first. The old exp/imp had to be used for those cases.
HTH -- Mark D Powell -- -
Move FLOWS_FILES to new tablespace
Hi
is there any restrictions on moving FLOWS_FILES schema to a new tablespace?
I'm planning to use export/import as I can see there is a lob there.
Is there a better way?Mistakenly thought about LONG restrictions. Moved wwv_flow_file_objects$ via ALTER TABLE MOVE with subsequent index rebuilds
-
Move tables to application tablespace
Hai All,
In my application many tables and indexes stay in system tablespace. Use query 'Alter table table_name move tablespace app_tbs' and 'Alter table index_name move tablespace indx_tbs'. we can move objects from system tablespace to application tablespace. Any other solution for this kind of activity.
Please help,
ShijuAlter table index_name move tablespace indx_tbsThis is not move but rebuild for index.
Nicolas. -
Create new table on new tablespace
new (downloaded - non-licensed) 8i install.
create new database
connect to new database (as both sys,system, and new user with just connect priv - as both normal and sysdba)
create new tablespace
create new table - schema is the new user,
tablespace is the new tablespace,
error - ORA-01950: no privileges on tablespace 'TS2' (new tablespace)
How do I set privileges to allow this?Hi
Use this command
alter user username
quota 50M on tablespace_name;
Hope this will work.
Thanks and regards
Sarju Patel
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Jim Connors ([email protected]):
new (downloaded - non-licensed) 8i install.
create new database
connect to new database (as both sys,system, and new user with just connect priv - as both normal and sysdba)
create new tablespace
create new table - schema is the new user,
tablespace is the new tablespace,
error - ORA-01950: no privileges on tablespace 'TS2' (new tablespace)
How do I set privileges to allow this?<HR></BLOCKQUOTE>
null -
Relocating objects into new tablespace?
I was looking for an easy way to relocate all objects from one table space to another table space? Is there a utility or any way to have all objects in one table space move to a new tablespace with out have to either move or rebuild each object one at a time.
We have a tablespace that is 50 gig but is only 2% utilized so I am looking to shrink the overall db size by relocating the objects, and the dropping the 50 gig table space.
I am trying to avoid extracting all of the ddl for all of the objects as well as the ddl to rebuild all of the indexes as there are over 200 objects that need relocating?
Thanks.HI..
To relocate the tables into another tablespace you can spool the output of below query and run it.
select 'alter table '||owner||'.'||table_name||' move tablespace new_tbs_name parallel N;' from dba_tables where tablespace_name='XXX';
Note:- N = cpu_count-1
parallel --> to fasten the activity
After its done,
Rebuild the indexes of these tables:-
select 'alter index '||owner||'.'||index_name||' rebuild parallel N;' from dba_indexes where table_name in (select table_name from dba_tables where tablespace_name='XXX');
Then change the degree back:--
select 'alter table '||owner||'.'||table_name||' parallel (degree 1);' from dba_tables where degree > 1;
select 'alter index '||owner||'.'||index_name||' parallel (degree 1);' from dba_indexes where degree > 1;
If on 10g
select 'alter table '||owner||'.'||table_name||' parallel (degree 1);' from dba_tables where degree > '1';
select 'alter index '||owner||'.'||index_name||' parallel (degree 1);' from dba_indexes where degree > '1';
HTH
Anand -
How to move all the tables from one tablespace to other for a whole schema
Hi,
Is there any way to move all the tables in a schema from one tablespace to other?
If so please help me out to do that.
Thanks
Regards
Gathahi,
here is the steps to move SCOTT's objects from their current tablespace to a NEW_TABLESPACE
would be:
1) do an export of all of scott's objects. Make sure no one modifies them after you
begin this process. You will lose these changes if they do.
$ exp userid=scott/tiger owner=scott
2) you would drop all of scotts tables. This will get the indexes as well. I don't
suggest dropping the user SCOTT but rather dropping scott's objects. Dropping scott
would cause any system priveleges SCOTT has to disappear and the import would not restore
them. This script can be used to drop someones tables:
set heading off
set feedback off
set verify off
set echo off
spool tmp.sql
select 'drop table &1..' || table_name || ' cascade constraints;'
from dba_tables
where owner = upper('&1')
spool off
@tmp.sql
3) You would modify the user to not have unlimited tablespace (else the IMP will just
put the objects right back into the tablespace they came from) and then give them
unlimited quota's on the new tablespace you want the objects to go into and on their
temporary tablespace (for the sorts the index creates will do)
alter user SCOTT default tablespace NEW_TABLESPACE
revoke unlimited tablespace from SCOTT
alter user SCOTT quota unlimited on NEW_TABLESPACE
alter user SCOTT quota unlimited on SCOTTS_TEMPORARY_TABLESPACE
4) you will IMP the data back in for that user. IMP will rewrite the create statements
to use the users default tablespace when it discovers that it cannot create the objects
in their original tablespace. Please make sure to review the file imp.log after you do
this for any and all errors after you import.
imp userid=scott/tiger full=y ignore=y log=imp.log
5) you can optionally restore 'unlimited tablespace' to this user (or not). If you do
not, this user can only create objects in this new tablespace and temp (which in itself
is not a bad thing)...
Regards,
Mohd Mehraj Hussain
http://mehrajdba.wordpress.com -
Migrating a new partition table with transportable tablespace
I created a partitioned table with 2 partitions (2010 and 2011) and used transportable tablespace to migrate the data over to a new envionment. My question is, if I decide to add a partition (2012) in the future, can I simply move that new partition along with the associated datafile via transportable tablespace or would I have to move all the partitions (2010, 2011, 2012).
user564785 wrote:
I created a partitioned table with 2 partitions (2010 and 2011) and used transportable tablespace to migrate the data over to a new envionment. My question is, if I decide to add a partition (2012) in the future, can I simply move that new partition along with the associated datafile via transportable tablespace or would I have to move all the partitions (2010, 2011, 2012).Yes why not.
1) create a table as CTAS from 2012 in new Tablespace on source
2) transport the tablespace
3) Add partition to existing partition table Or exchange partition
Oracle has also documented this procedure:
http://docs.oracle.com/cd/B28359_01/server.111/b28310/tspaces013.htm#i1007549 -
Moving table with XMLTYPE to a new tablespace
I want to move my all tables with XMLTYPE to a seprate tablespace. One of my tables which is causing me greif is XML_SL_MESSAGE. Here is its structure;
Name Type
XML_SL_MESSAGE_ID NUMBER(11)
DTE_TIMESTAMP TIMESTAMP(6)
VALID_SL_MESSAGE_XML SYS.XMLTYPE Y
INVALID_XML CLOB Y
VALID_SL_MESSAGE_XML_V2 SYS.XMLTYPE Y
Would any one of you guide me to how to move this monster in a new tablespace XML_DAT.
Thanks
Qazi Ahmed
Canadahi SRK
assumptions: both the table structures are the same.
the primary keys are the same.
data: begin of itabA.
include structure A.
data: end of itabA.
data: begin of itabB.
include structure B. <<<<< if needed.
data: end of itabB.
select * from A into table itab.
delete table B.
modify table B by itab.
The structure of Itab will the same structure of the Ztable we are updating.
in the above case it will be of type B,
Edited by: Jackandjay on Jan 27, 2008 6:09 PM -
BRSPACE create new tablespace for compressed table
Dear expert,
I'm plannng to create new tablespace PSAPCOMP for compressed table by brspace.
the current total size of the tables that i want to compression is 1T.
Now i have 2 question about the brspace script
1.How big size should the PSAPCOMP be , let's say 500G?
2. i'm confused about the datafile_dir value i should put (please refer to the attachment for current datafile_dir design)
Could you help to correct/improve the scritpts as following?
scriptA : brspace -f tscreate -t PSAPCOMP -s 5120 -a yes -i 100 -m 15360 -f sapdata4 -l 2 --> assign to sapdata4
repeat scriptB for 20 times
scriptB : brspace -f tsextend -t PSAPCOMP -s 5120 -a yes -i 100 -m 15360 -f sapdata4 -l 2 -f1 4 -f2 4 -f3 4 -f4 4 -f5 4 --> extend 25G in one run
Qestion: is it OK to assign the PSAPCOMP only to "sapdata4"? or i should specify "-f sapdata1 sapdata2 sapdata3 sapdata4" so the table data can distribute among different sapdata_dir?
Thank you!hi Kate,
some of the questions depend on the "customer" decision.
is it OK to assign the PSAPCOMP only to "sapdata4"?
how much space is available? what kind of storage do they have? is totally stripped or not? is there "free" space on the other filesystems?
1.How big size should the PSAPCOMP be , let's say 500G?
as I explained to you already, it is expected that applying all compressions you can save 1/2 of the space but you have to test this as it depends on the content of the tables and selectivity of the indexes. Use the oracle package to simulate the savings for the tables you are going to compress.
do you want the scripts interactive (option -c) or not?
The SAP Database Guide: Oracle has all possible options so you only have to check them
brspace -f tscreate -t PSAPCOMP -s 5120 -a yes -i 100 -m 15360 -f sapdata4 -l 2 --> assign to sapdata4
if you want to create a 500 GB, why you limit the maximum size to 15360? -
10.2.0.3 Linux x86-64
I have a table with 2 very large lobs at 180GB each. This was do to the Lobs doing Disabled in row storage with a chunk size of 8k and tablespace and max length is only 400bytes. Around 23.5mill records
My question is best way to reduce Prod down time getting the data moved over to new table with enable in row storage. My thoughts was to do an export of the old table and import it into the new table using the remap_table and data_only. Then do a quick rename switch of the old table to new table.
Is this the best way?You should investigate DBMS_REDEFINITION usage. See Moving a Table section in the following Oracle Magazine article: http://www.oracle.com/technology/oramag/oracle/05-mar/o25asktom.html
-
Move Table on Ora 9.2 from tablespace to another (dictionary managed)
Hello,
is it possible to move tables with brtools from dictionary managed tablespace to another dictionary managed tablespace on Oracle 9.2 ?Hello Axel,
this is a case where the BRSPACE error is not nice, because you have no easy chance to move this one table to a LMTS tablespace. In this case I would propose you to execute ALTER TABLE MOVE directly on Oracle side:
ALTER TABLE <table_name> MOVE TABLESPACE <target_tablespace>;
Afterwards all indexes of the table have to be rebuilt in order to validate them again:
ALTER INDEX <index_name> REBUILD ONLINE;
Kind regards
Martin -
Move schema to another tablespace
I want to move one schema and all objects own by particular schema to it's own tablespace (new_tablespace).
will command provided below move all existing schema objects to new tablespace or just new objects?
alter user default tablespace new_tablespace;mishomor wrote:
I know it's long time since I posted this but I finally had a change to implement it.
Thing is, if I execute command on one-by-one basis it works fine, but if I try block you guys posted it doesn't work. It ends with error:
Error starting at line 1 in command:
begin
for tbl in (select table_name from all_tables where owner = 'FLOWS_020000') loop
execute immediate 'alter table ' || tbl.table_name || ' move tablespace flows';are you executing this as the owner of 'tbl_name'?
end loop;
end;
Error report:
ORA-00942: table or view does not exist
ORA-06512: at line 3
00942. 00000 - "table or view does not exist"
Cause:
Action:
begin
for tbl in (select table_name from all_tables where owner = 'FLOWS_020000') loop
execute immediate 'alter table ' || tbl.table_name || ' move tablespace flows';
end loop;
end;
output of
select table_name from all_tables where owner = 'FLOWS_020000';
brings bunch of tables!!
If I just run ...
alter table FLOWS_020000.whatever_table move tablespace flows;
alter index FLOWS_020000.whatever_index rebuild tablespace flows;
... it works fine.
Because here you specifically qualified the table name with the owner. In your procedure above, you did not do that, so 'whatever_table' was assumed to be owned by whoever was executing the procedure.
I am using SqlDeveloper 1.5.4
Maybe you are looking for
-
Adding excel workbooks with visual studio
Im using visual studio 2013 visual basic to read and create files, but Im having trouble importing the correct reference so I can create and write to Excel workbooks and worksheets, the visual studio help tell me to go to project, add reference and s
-
Vendor in freight condtion of scheduling agreement
Hi, I have problem, in scheduling agreement unable to see vendor field in ZFR1 condition or any other conditions, above is possible in development server,quality server above is possible in P.O. preparation by ME21N in development server, quality ser
-
Photoshop 11 Editor will not open. Also I can edit in quick edit, but when I do copy of picture is sent to recycle bin. I am using Windows 7
-
Ap_bank_account_uses_pkg in R12
Hi, I am trying to find the package ap_bank_account_uses_pkg in Oracle E-Business Suite R12. But i don't found one. I want to know if this package is being obsoleted from the R12???????????????? If yes, can guys tell me the replaced package in r12. H
-
JInternalFrame - how to add an editor pane to it
hello i have created a internalframe by using JDesktopPane. And i want to display some external file in that internal frame(JInternalFrame) through the editor pane. But i couldnt get it. help me