I noticed that a Schema has been created in the USERS Tablespace but our local rule is that it should be in a Tablespace by itself. In Oracle how do you move a Schema to a different Tablespace?
Thanks to @ai10 for the suggestion: "For 10 & 11G, use data pump utility. Follow the tutorial here: techxploration.blogspot.com.au/2012/10/…"– Stuart WoodwardNov 5, 2012 at 0:42
expdp+impdp may be a solution.– user35841Mar 19, 2014 at 8:58
A schema itself can not be stored nor can have changed tablespace en bloc in any way. In fact, it is just a meta-structucre. Instead - there is
DEFAULT TABLESPACE attribute of underlying
USER. If you change it, then new objects are created in this tablespace by default (unless you excplicitly specify another one).
In addition, each type of structure (Table/Index/Partition...) has it's own way of moving to another tablespace. (i.e. moving a table does not move indexes built upon it - which would be rather undesirable, because you want to store indexes in another filesystem for better performance). This means, that you will have to move contents of the schema object by object.
6Having seperate tablespaces for tables and indexes isn't really considered neccessary for performance, though it can still be done for admin reasons. See this old SO thread, or various AskTom articles. Jun 20, 2012 at 7:02
2Also, keep in mind any LOB objects (BLOB, CLOB) have their storage separate from the rest of the table, with only a pointer stored in the table structure itself. If your intent is to move an entire table and its contents, you will need to move the LOB segments independently. "alter table t move lob(y) store as ( tablespace users )"– REWJun 23, 2012 at 4:41
For 10 & 11G, use data pump utility. Follow the tutorial here:
It is the safest if not the best way to do it.
I tried many scripts but didn't worked for all objects. You can't move clustered objects from one tablespace to another, for that you will have to use expdp. So I will suggest expdp is the best option to move all objects to different tablesapce.
Below is the command.
nohup expdp \"/ as sysdba\" DIRECTORY=test_dir DUMPFILE=users.dmp LOGFILE=users.log TABLESPACES=USERS &
For clear explanation: https://www.orahow.com/2018/06/move-all-objects-to-another-tablespace.html