Batch operation records of moving table and rebuild index

Source: Internet
Author: User

Batch operation records of moving table and rebuild index

Batch move tables in the oldtablespace tablespace to newtablespace. query and execute the query results.

Select 'alter table' | table_name | 'move tablespace newtablespace'

From user_all_tables

Where table_space = 'oldtablespace ';

Rebuild indexes in the oldtablespace tablespace to newtablespace in batches. query and execute the query results.

Select 'alter Index' | index_name | 'rebuild tablespace newtablespace ;'
From user_indexes
Where tablespace_name = 'oldtablespace ';

When the table with the lob field is moved, the lob field needs to be moved separately.

Alter table AUDIT_RECORD move lob (lobrow1) store as (TABLESPACE newtablespace );

Alter table AUDIT_RECORD move lob (lobrow2) store as (TABLESPACE newtablespace );
 

Alter table AUDIT_RECORD move tablespace newtablespace;

 

Or
Alter table test2 MOVE

TABLESPACE users

LOB (lobrow1) store as lobsegment

(TABLESPACE newtablespace );

In addition, when executing imp for exp/IMP Migration with a lob field, you need to create and import the tablespace where the original lob field is located, and then consider moving it to other tablespaces.

You can use the remap_tablespace parameter to import data to the specified tablespace.

This article permanently updates the link address:

Related Article

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.