Oracle Table Space Transfer

Source: Internet
Author: User

--View the table under table space

Select T.table_name,t.tablespace_name from Dba_tables t where T.tablespace_name = ' ${spacename} ' and owner = ' ${owner} ';

--View the index under Table space

Select T.index_name,t.tablespace_name from dba_indexes t where T.tablespace_name = ' ${spacename} ' and owner = ' ${owner} ';

The above statement owner can not add, if there are multiple users in the case can be used as appropriate.

--Migrating a table to a new table space

Select ' ALTER TABLE ' | | T.table_name | | ' Move tablespace ${newspacename} ' from Dba_tables t where T.tablespace_name = ' ${spacename} ' and owner = ' ${owner} ';

--Migrating an index to a new table space

Select ' Alter index ' | | T.index_name | | ' Rebuild tablespace ${newspacename} ' from Dba_indexes t where T.tablespace_name = ' ${spacename} ' and owner = ' ${owner} ' ;

After performing the resulting set of results, the table space migration is complete:

The above statement is purely hand-punched, there are spelling mistakes please forgive me.

Two exceptions occurred during the actual execution:

1. When a database index is migrated, a partially indexed field is LOB type, which causes the error to be executed at the time of migration.

Solution:

Alter Tabe ${table name} mobe LOB (${field name}) STORE as (Tablespace ${newspacename}); Perform the transfer in turn

The 2.rebuild index causes the index to be in the unabled state, and a warning appears when the export is exported to a new database. Index unavailable State

You can dba_indexes a table with a status of unable, and then rebuild the index.

Oracle Table Space Transfer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.