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

How to modify tablespace in Oracle

WBOY
Release: 2022-01-06 16:04:14
Original
12915 people have browsed it

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
Copy after login

Query all tables under the current user

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

2. Modify the table The index space

alter index INDEX_NAME rebuild tablespace TABLESPACENAME
Copy after login

Query all indexes under the current user

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template