Home>Article>Database> How to modify tablespace in Oracle

How to modify tablespace in Oracle

WBOY
WBOY Original
2022-01-06 16:04:14 12761browse

Method: 1. Use the "alter table table name move tablespace table space name" statement to modify the table space; 2. Use the "alter index index name rebuild tablespace table space name" statement to modify the index space of the table.

How to modify tablespace in Oracle

The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.

How does Oracle modify the table space

1. Use imp/exp. Export the source database first, then create a new database, create the table space, and then import it. (It is said that this is possible, provided that the new library cannot have a table space with the same name as the source library. It needs to be verified!)

2. Use a script to make modifications. According to current understanding, the table space and table index space need to be modified in the case of full length. If a table with BOLB fields is involved, the modification method is different!

Modification script under normal circumstances:

1. Modify the table space

alter table TABLE_NAME move tablespace TABLESPACENAME

Query all tables under the current user

select 'alter table '|| table_name ||' move tablespace tablespacename;' from user_all_tables;

2. Modify the table The index space

alter index INDEX_NAME rebuild tablespace TABLESPACENAME

Query all indexes under the current user

select 'alter index '|| index_name ||' rebuild tablespace tablespacename;' from user_indexes;

Recommended tutorial: "Oracle Tutorial"

The above is the detailed content of How to modify tablespace in Oracle. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn