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
Similar Messages
-
Move schema to anothe tablespace
Hi
During installation of one Oracle application , this has created "WIRELESS" schema in system tablespace. "WIRELESS" schema consis of table/index/LOB Objects. Now I want to migrate entire wireless schema to xx_tablespace. kindly suggest me the ways to do this.
Thanks
KrishnaHave you read the documentation? Every single option for expdp and impdp is documented http://docs.oracle.com/cd/E11882_01/server.112/e22490/toc.htm
As Osama suggested:
a). Create a new schema with the default tablespace set to the tablespace to where you want to move the objects
b). expdp the old schema
c). impdp the using fromuser/touser to put the objects into the new schema
d). Drop the old schema
e). Rename the new schema to the old schema
Another alternative that wouldn't need expdp/impdp and a temporary new schema would be to use alter table move and alter index rebuild to move the tables/indexes directly. If you have partitioned tables, you'd need to account for that. You can do the same in online mode using DBMS_REDEFINITION
Which option you pick probably depends on a few things:
a). Downtime requirements - DBMS_REDEFNITION can possibly do the reorg with zero downtime.
b). Size of objects in the schema and whether you have enough space for the extra expdp file
John -
How to move indexes to another tablespace through script
Hi Dear,
How i can move indexes to another tablespace through a script which just gets new tablespace name, owner name and move and rebuild indexes in one go.
Thank u for your prompt Help.
RegardsHi,
alter session set sort_area_size = 15000000;
spool index.sql
select 'alter index '||owner||'.'||index_name||' rebuild tablespace TARGET_TBS;'
from dba_indexes
where tablespace_name = 'INIT_TBS'
@index.sql
This script move and rebuild index from one tablespace INIT_TBS to an other tablespace TARGET_TBS
Hope this help you
Nicolas. -
Help! How to transfer tablespace of certain schema into another tablespace?
Hi I'm using oracle 10g, i have schema name test which is in USERS tablespace.. how can I move it to different tablespace?thanks
Changing the default tablespace will only affect the creation of new objects. You could perform a "ALTER TABLE xxx MOVE ..." on all tables, followed by moves or rebuilds of all indexes. It might be simpler to do a datapump export of the schema and re-import it with the REMAP_TABLESPACE=USERS:NEW_TABLESPACE option
Bjoern -
Move Constraints on another tablespace
hi all!
I have to move my constraints (PK) on another tablespace (now they are on SYSTEM tablespace)...is there a statement? ALTER ..MODIFY.....ecc.ecc
THANKS!
milenaI think this question follows on from a User, Constraints and tablespaces. Basically the users had been created without a default tablespace. The constraints were then created without specifying a tablespace for the index. Result: a SYSTEM tablespace full of primary key indexes.
I think in these days of RAID a-plenty the argument for having separate tablespaces for indexes no longer applies. So there is frequently no need to specify a tablespace when creating indexes (providing the user has a proper value for default tablespace). Of course, YMMV.
Cheers, APC -
How to move a schema from one tablespace to another
I created a new user in a new Tablespace, Then export current user and import to new user(in new tablespace), but I found out that it was stored in previous Tablespace.
How can I move data to new tablespace?
Thanks
SoheilI created a new user in a new Tablespace, Then export current user and import to new user(in new tablespace), but I found out that it was stored in previous Tablespace.
How can I move data to new tablespace?
Thanks
Soheil Soheil,
Did the data make the transfer to the new tablespace or was it reimported vack into the old tablespace and never made it ot the new tablespace? Are the two users identified by the same name or different names? Did you try to specify which tablespace to import into or did you just use the fromuser and touser parameters? You can try this too:
1. revoke access by the 'old' user to the 'old' tablespace (alter user <user> quota 0 on <old tablespace>
2. grant access to the 'new' user on the 'new' tablespace (alter user <user> quota unlimited on <new tablespace>)
3. point the 'new' user to the 'new' tablespace (alter user <user> default tablespace <new tablespace>.
Then do the import. Then alter the default tablespace back to USERS or whatever if necessary. (thanks to Rita Kirby for this one) -
Can i move blob column one tablespace to another tablespace
When I ruining the following script
ALTER TABLE T_Transaction_Image
MOVE LOB(RCSCOMPRESSED_IMAGE,CAMERA_PHOTO_1,CAMERA_PHOTO_2,NUMBER_PLATE)
STORE AS TABLESPACE IMAGE
I found error
ORA-22853: invalid LOB storage option specification
Here we have more than one column having BLOB data type .
Question
I want to know can i move multiple column in single alter table ?
and how can i move blob column one tablespace to another tablespace
Thanks in advance
Edited by: abdul moyed on Feb 3, 2011 6:33 PMhttp://decipherinfosys.wordpress.com/2007/11/21/moving-lob-column-to-a-different-tablespace/
Regards
Asif Kabir -
How do I move a table from one schema to another schema on Oracle XE?
How do I move a table from one schema to another schema on Oracle XE?
Hi,
I tried to use the insert/select statement that you had given, it did not work.
The error is ORA-00913: too many values.
But finally what I did was, I went into the system schema where the table was and generated the DDL through the utilities and afterwards I imported them into the schema that I am currently working on. It solved the problem!
However I am still curious to know why the insert/select statement did not work? Do you know any site/tutorial which gives a real time example?
Thank you
Skye -
How do I move a table from one schema to another schema?
How do I move a table from one schema to another schema?
Grant access to the table from the source schema to destination schema.
GRANT SELECT ON <TABLE_NAME> TO <DESTINATION SCHEMA>A simple way would be to use CREATE Table with select syntax (in destination schema)
CREATE TABLE <TABLE_NAME> AS SELECT * FROM <SOURCE SCHEMA>.<TABLE_NAME><li>However, you would be in <b><u>trouble when the table has index,constraints and triggers</u></b>.
So you can better of grab the DDL statement of the table(and any additional components) andd then create the table in the destination schema.You can use SQL developer, Toad or Apex's Object browser for this.
After the table is created, Insert the records using SELECT.
INSERT INTO <TABLE_NAME> SELECT * FROM <SOURCE SCHEMA>.<TABLE_NAME>This question is discussed in great detail in this <b>AskTom thread</b> -
Move schema to a diff.tablespace
Dear all,
How can I move a particular shcema objects or the complete schema from his default tablespace to other tablespace ?
KaiKai,
Here are some ways you can move schema from its default tablespace to other tablespace.
Using anonymous pl/sql block or sql script;
DECLARE
CURSOR mcur
IS
SELECT table_name FROM user_tables;
v_sql VARCHAR2 (100);
c_tablespace_name CONSTANT VARCHAR2 (30) := 'MY_NEW_TS_NAME';
BEGIN
FOR x IN mcur
LOOP
v_sql :=
'alter table '
|| x.table_name
|| ' move tablespace '
|| c_tablespace_name;
DBMS_OUTPUT.put_line (v_sql);
-- execute immediate v_sql :
END LOOP;
END;*2nd Method*;
Using conventional export and import
exp username/password file=myuserexport.dmp log=myuserexport.log
Before importing
1. drop all the objects from user (except roles and db-link).
2. Setup a new default tablespace and revoke unlimited tablespace from the user and set quota 0 on old tablespace.
3. You can also drop entire user and recreate one with new default tablespace
imp username/password file=myuserexport.dmp log=myuserexport.log*3rd Method: (if using 10g), you can make use of datapump (remap tablespace)*
http://www.oracle-base.com/articles/10g/OracleDataPump10g.php
Regards
Edited by: OrionNet on Mar 11, 2009 12:27 AM -
Best LKM to move data from with in Oracle from one schema to another Schema
Hi Gurus,
What is the best KM to move data from one schema to another schema within same oracle database.
Thanks in advanceDear,
If your source and target are on the same database server then you dont need LKM.
You have to 1. create one data server for the database server
2. Create one physical schema for your source and another physical schema for your target under the above created data server.
3. Then create models for each above created physical schema
In this case you just need IKM knowledge module
Please refer http://oditrainings.blogspot.in/2012/08/odi-interface-source-target-on-same.html
If your source and target are on different server then you must create two different data servers in topology. You have to use LKM.
The best LKM to use is LKM oracle to Oracle dblink. But you should have proper grants to use it
If your source has very few records you can go with LKM SQL to Oracle other wise use LKM oracle to Oracle dblink -
After move tables and index another tablespace, indexes got unusable?
Hi,
I moved table and indexes another tablespace. After move many indexes got unusable state. I couldn't understand thiis?
How can I make them again usable?
regards and thanks?hi,
check this query below
create table test (id number(10));
create table succeeded.
insert into test values (10);
1 rows inserted
commit;
create index test_indx on test(id);
select index_name, status from user_indexes
where table_name = 'TEST';
INDEX_NAME STATUS
TEST_INDX VALID
alter table test move tablespace users;
select index_name, status from dba_indexes
where table_name = 'TEST';
INDEX_NAME STATUS
TEST_INDX UNUSABLE
rebuliding index
alter index test_indx rebuild
alter index test_indx succeeded.
then check
select index_name, status from user_indexes
where table_name = 'TEST';
INDEX_NAME STATUS
TEST_INDX VALID -
Transporting large amounts of data from one database schema to another
Hi,
We need to move large amount of data from one 10.2.0.4 database schema to another 11.2.0.3 database.
Am currently using datapump but quite slow still - having to do in chunks.
Also the datapump files quite large so having to compress and move across the network.
Is there a better/quicker way?
Habe haerd about transportable tablespaces but never used them and don't know about speed - if quicker thana datapump.
tablespace names different in both databases.
Also source database on solaris opertaing system on sun box
target database on aix on ibm power series box.
Any ideas would be great.
Thanks
Edited by: user5716448 on 08-Sep-2012 03:30
Edited by: user5716448 on 08-Sep-2012 03:31user5716448 wrote:
Hi,
We need to move large amount of data from one 10.2.0.4 database schema to another 11.2.0.3 database.
Pl quantify "large".
Am currently using datapump but quite slow still - having to do in chunks.
Pl quantify "quite slow".
Also the datapump files quite large so having to compress and move across the network.
Again, pl quantify "quite large".
Is there a better/quicker way?
Habe haerd about transportable tablespaces but never used them and don't know about speed - if quicker thana datapump.
tablespace names different in both databases.
Also source database on solaris opertaing system on sun box
target database on aix on ibm power series box.
It may be possible, assuming you do not violate any of these conditions
http://docs.oracle.com/cd/E11882_01/server.112/e25494/tspaces013.htm#ADMIN11396
Any ideas would be great.
Thanks
Edited by: user5716448 on 08-Sep-2012 03:30
Edited by: user5716448 on 08-Sep-2012 03:31Master Note for Transportable Tablespaces (TTS) -- Common Questions and Issues [ID 1166564.1]
HTH
Srini -
Splitting objects of a schema into 2 tablespaces
Hi is it possible in Oracle database to split a schema objects into 2 tablespaces (or more)?
I am trying to export and then import a schema to another machine but getting a : tablespace APEX_XXXXXX does not exist error. About 4 tables and respective constraints chucked this error while everything else got imported successfully.
I have granted quota unlimited on the tablespace when I created user.
I didnt' think it was possible but can't see why it would look for that APEX_xxxx tablespace for those particular tables. Exporting gave no errors btw.
Using Oracle Database 11G R2.Thanks for your replies.
Basically I am going to move objects from SYSTEM tablespace to a designated one called APEX_XXXX (later on). But trying to import into a local machine before I get into that.
Now looks like few of them already exist in APEX_XXXXX, so I need to move the rest across. I prefer to use REMAP_TABLESPACE option of Data Pump as Oracle docs recommend it as a cleaner way to move schema & objects from A to B.
However, would it have any implications if some tables already exists in APEX_XXXX tablespace?
I am planning to do something like this
impdb system/system schemas=lsprod REMAP_TABLESPACE=SYSTEM:APEX_XXXX logfile=export.logThank you.
here is the first 10 lines of the original import.
Connected to: Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production
Export file created by EXPORT:V11.02.00 via conventional path
Warning: the objects were exported by LSPROD, not by you
import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
import server uses AL32UTF8 character set (possible charset conversion)
export client uses US7ASCII character set (possible charset conversion) -
How to copy one schema into another
I need to copy one schema into another. That means, all the tables, views, constraints, etc, and all the data as well.
I have a dmp file of source-schema (created daily with expdp by our backup schedule).
Can I use impdp to import this dmp file into dest-schema? I'm thinking about something like this:
The dmp file was created with:
expdp source-schema/pwd DIRECTORY=dmpdir DUMPFILE=myproject.dmp
Create the copy on dest-schema with:
impdp dest-schema/pwd DIRECTORY=dmpdir DUMPFILE=myproject.dmp
(dest-schema is an existing schema on the same machine. I'll drop all the tables before executing the command. Is there anything else I should do first?)
If this approach is not feasible, kindly suggest me an alternative.
Thank you.
Edited by: mgro on Apr 16, 2010 3:22 AM (changed 2nd command: expdp to impdp)Thank you both. Dean, I've made a note of your proposed command. May use it next time.
In the end I used the following command and it worked for me. I added TABLE_EXISTS_ACTION=REPLACE since the destination was not empty.
First I ran these command logged in as SYS
GRANT Import Full Database TO dest-schema;
GRANT Create Any Directory TO dest-schema;
GRANT Unlimited Tablespace TO dest-schema;
impdp
dest-schema/pwd
DIRECTORY=dmpdir
DUMPFILE=myproject.dmp
REMAP_SCHEMA=source-schema:dest-schema
TABLE_EXISTS_ACTION=REPLACE
LOGFILE=implog.log
There were some errors though. The import process complained about constraints referencing non-existent primary keys.
It turns out that the source schema has some constraints that are marked with status DISABLED. These constraints either:
- are not part of the DUMP file
or
- are in the DUMP file but skipped during import
Don't know if this is a bug or by design behavior.
Maybe you are looking for
-
Problems with program not finding Fonts
Problems with Fonts on new iMac. I'm not sure if this is a problem because I switched to Snow Leopard or because I ported all my information using Migration assistant to the new iMac. Every time I open Firefox 3.6, I get the same annoying popup messa
-
Can not receive FT calls on the New Ipad Ipad3
I Recently Bought a new 16 GB Ipad 3 Cellular + Wifi. I have been facing a peculiar issue with receiving FT calls on my IPAD. IPad: Apple ID: [email protected], No Cellular Subscription IPhone: Apple ID: [email protected], ATT 1) When I try to make a
-
Getting money back from app store
how do you get money baack for the app stor when the app locks up your computer how do you get your money back for the maac app store when the app locks up your computer
-
Grid spacing in Windows Phone Runtime XAML
Hello I've got a simple problem with XAML UI in Windows Phone 8.1 Runtime. I always want my button control to appear on the very bottom of the page (just above an App Bar), horizontally stretched. On Windows Phone 8.0/8.1 Silverlight such a simple re
-
I purchased an 8 minute music track on itunes which only downloaded about 22 seconds. It does not give me the option to re-download what I purchased on itunes, only to play it - so it only re-plays the partially downloaded track. I know the full trac