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
Thanks
Nick 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 --
Similar Messages
-
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 reorganization index in new tablespace
How to reorganization index in new tablespace? for size? for? number of extents? or both?
What's Oracle version?
Why you want to reorg your index?
You could rebuild your index
alter index <index_name> rebuild tablespace <tablespace_name>check Jonathan's note regarding index rebuild,
http://jonathanlewis.wordpress.com/2008/02/09/index-rebuild-10g/ -
Can we create new tablespace in Oracle Database 10g Express Edition?
Hi,
Can we create new tablespace in Oracle Database 10g Express Edition instead of using the default "users" tablespace provided?
Please advise.
Thank you.Correct. The sum of all user tablespaces is not allowed to exceed 4 GIG.
You could try shrinking your tablespaces. Theres a script called maxshrink on http://asktom.oracle.com which is useful for this.
You could compress your tables.
If you are storing lobs, you could consider storing them as bfiles.
Or upgrade to Oracle Standard Edition 1. Its not that expensive. -
How do l create a new database in Oracle 10g Express
How do l create a new database in Oracle 10g Express, other than the one that is created on installation?
Hello,
You cannot create a second XE database on the same server.
But, Oracle database can support as many Schema as you want.
"Oracle database" is like "SQL Server Instance" and "Oracle Schema" is like "SQL Server database". I means by this shortcut that for
the end users accessing to different Schemas looks like accessing to different databases.
You can have several applications on the same database. Each application has its own Schema and Datafile (Tablespace) structure.
So on your XE database you can add a new Tablespace and create a new User/Schema as follows:
sqlplus /nolog
connect / as sysdba
create tablespace {color:red}new_tablespace_name{color}
extent management local autoallocate
SEGMENT SPACE MANAGEMENT AUTO
datafile '{color:red}complete_datafile_name{color}' size 100M autoextend on next 10M maxsize unlimited;
create user {color:red}new_schema_name{color} identified by {color:red}password{color}
default tablespace {color:red}new_tablespace_name{color}
temporary tablespace TEMP
quota unlimited on {color:red}new_tablespace_name{color}
grant connect, resource to {color:red}new_schema_name{color};Then you can connect to this new User/Schema as you defined it and create your new structure and load datas.
Hope it can help.
Best regards,
Jean-Valentin -
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 -
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 -
Moving partioned tables to different tablespaces in oracle 11g.
Dear All,
I need to move the partitioned table to different tablespace. I moved all the partitions individually and also the index.
however i have a issue now, when i check the view user_tables or dba_tables, i see null tablespaces correspomding to the table in the tablespace_name column.
how can i see the tablespace name in these views.Even thouh Sb has given you the correct answer, I am just showing you below cut and paste sqlplus screen of 11.2.0.1 :
test1@ORCL> create table t (x number)
2 partition by list (x)
3 (partition p1 values (10),
4 partition p2 values (20));
Table created.
test1@ORCL> select table_name,tablespace_name from user_tables;
TABLE_NAME TABLESPACE_NAME
T
1 row selected.
---Means tablespace_name.user_tables is always null for partition table(s).
---Ok, then how do I see the tablespace name?
test1@ORCL> select table_name, partition_name,tablespace_name
2 from user_tab_partitions
3 where table_name = 'T';
TABLE_NAME PARTITION_NAME TABLESPACE_NAME
T P1 USERS
T P2 USERS
2 rows selected.
test1@ORCL> ALTER TABLE T MOVE PARTITION P1 TABLESPACE EXAMPLE;
Table altered.
test1@ORCL> select table_name, partition_name,tablespace_name
2 from user_tab_partitions
3 where table_name = 'T';
TABLE_NAME PARTITION_NAME TABLESPACE_NAME
T P1 EXAMPLE
T P2 USERS
2 rows selected.
test1@ORCL> select table_name,tablespace_name from user_tables;
TABLE_NAME TABLESPACE_NAME
T
1 row selected.Just for your information please.
Regards
Girish Sharma -
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 meStop thinking. Read:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/tables.htm#sthref2297 -
How can I create a new DB with Oracle XE ?
Hi
I'm a newbie with XE. I'd like to migrate an MS SQL Server DB to XE. How do I go about it ?
Thanks for help.
BernardCREATE USER ...
GRANT CREATE TABLE TO USER
In many ways, Sybase (and therefore it's derivative SQL Server) use the term 'database' in a similar way to Oracle's 'schema'. Ninety-nine times out of a hundred, when a person wants to migrate from SQL Server to Oracle and asks this question, they will be happy simply to create a schema.
In Oracle terms, a schema is a named collection of database objects (tables, indexes, stored procedures, etc.). The confusing part is that the 'name' is simply the Oracle user that is designated the owner (or adminstrator) of that collection.
So, all you need to do is create a user designated to own the collection; give that user the privileges to create the object; start creating the objects; grant permission to other users to access those objects.
The most painful difference for a Microsoft specialist is the 'granting permission to access'. Oracle takes the 'unix' view of security - provide minimum access and explicitly grant as required, whereas Microsoft products (or at least typical Microsoft product administrators) by default tend to use the 'grant access and use restrictions when required' approach.
Oracle's approach to access and security seems to 'create roles, grant them appropriate access, assign users to those roles'. The benefit is accountability. The drawback is extra administration. -
Tablespace in oracle 8.1.6
we had an oracle server running in linux machine.im maintaining 4 databases on it. we dont create tablespaces for each of them. so the default tablespace of all my schema is using the tablespace 'system'. i reconfigure by creating users for default tablespace and temp for temporary. when i create a new user
i follow this syntax
create username identified by password
default tablespace users
temporary tablespace temp;
grant connect,resource to username;
why is it when i open my oem. my table for that user still uses the system tablespace not the user tablespace which i define.
regards
jeromejerome,
I assume from what you said about "reconfiguring", the problem could be because you changed the default tablespace after you created those tables.
drop and recreate those tables after setting the default tablespace. or else
use this syntax to move tables to new tablespaces.
alter table table1 move tablespace users;
make sure you have given quota to create objects in users tablespace to the new user.
alter user user1 default tablespace users;
alter user user1 quota 10m on tablespace users;
after you set the default tablespace any new created will go to that tablespace.
this should work.
Mukundan. -
How to import partitioned tables in different tablespace
Hi everyone,
I try to import the partitioned tables in different tablespace.
Consider the following situation:
I have a dump file which is created by using "Export" utility. Some data are in partitioned tables, some of them are in non-partitioned tables. Also, all tables are located in "MYTBS" tablesapce. I try to import all data from this dump file to another database. I didn't get error messages when importing the data from non-partitioned tables. However, I got error message when importing the data from partitioned tables. The error message is: tablespace 'MYTBS' does not exist.
I just want to how I can solve this problem other than create 'MYTBS' tablespace for my new database.
Thanks in advance.
AngelHi,
I got the following error message:
IMP-00017: following statement failed with ORACLE error 959:
"CREATE TABLE "FACILITYCONNECTION",....., "CONNECTIONTYPE" "
"NUMBER(1, 0) NOT NULL ENABLE) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 25"
"5 PARALLEL ( DEGREE DEFAULT INSTANCES 1) NOLOGGING STORAGE( PCTINCREASE 0) "
"TABLESPACE "MYTBS" PARTITION BY RANGE ("CONNECTIONTYPE" ) (PARTITION "
""EXT" VALUES LESS THAN (1) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 S"
"TORAGE(INITIAL 65536) TABLESPACE "MYTBS" NOLOGGING, PARTITION "FAC" VA"
"LUES LESS THAN (2) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(I"
"NITIAL 65536) TABLESPACE "MYTBS" NOLOGGING )"
IMP-00003: ORACLE error 959 encountered
ORA-00959: tablespace 'MYTBS' does not exist
Thanks.
Angel -
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? -
How do you list tables within the tablespace?
Does anyone know how to list and view the tables within the tablespace. I am new to Oracle and I would like to view the tables, but my documentation is telling me how to create everything, but not to view it. Please advise, and thanks again.
select owner, table_name
from user_tables -- or all_tables, or dba_tables
where tablespace_name = :ts_name; -
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
Maybe you are looking for
-
How to add serial number contolled item with serial numbers in sales order.
Hi OM Functional Experts, I need a help on sales order booking. We have serial controlled items in our inventory. At the time of booking a sales order, we need to call the items with the appropriate serial numbers [ for example, if i book an item for
-
Facebook only displays text in any browser
For the last two weeks, whenever I go to Facebook (https://www.facebook.com) all is see is a plain text page with a thumbnail of my profile picture. This happens whether I'm using Safari, Firefox or Chrome, so it's not a browser issue. Facebook still
-
How to boost wifi from AirPort Extreme
Is there a way or additional hardware that will boost the strength of wifi in my house. I have router connected to AirPort Extreme which is great in that part of the home but very weak reception on second floor far from unit.
-
How to find count of records based on batch wise.
Hi All, We are working on OWB10gr2. I would like share one requirement. Any one can suggest me how to do it and which is the best way to get accurate information. We have 2 schemas' like nia_src and nia_tgt. currently we are moving data from nia_src
-
Delete and stay on the same page!!!!
Hi guys, As elaborated in the following Picture: http://www.9m.com/upfiles/PlT97853.png I have a report and a form on the same page. When press delete I want to delete the checked boxes and refresh "DOWNLOAD" region or stay on the same page. NOTE: "T