oracle 10g 推出了一个强大的特性,你可以修改已存在表空间的名称了
for examples:
SQL> create tablespace tbsold;
Tablespace created.
SQL> conn anbob/anbob
Connected.
SQL> create table testtbs (id int) tablespace tbsold;
Table created.
SQL> conn / as sysdba;
Connected.
SQL> col table_name for a10
SQL> select table_name,tablespace_name from dba_tables where table_name='TESTTBS'
TABLE_NAME TABLESPACE_NAME
---------- ------------------------------------------------------------
TESTTBS TBSOLD
SQL> alter tablespace tbsold rename to tbsnew;
Tablespace altered.
SQL> select table_name,tablespace_name from dba_tables where table_name='TESTTBS';
TABLE_NAME TABLESPACE_NAME
---------- ------------------------------------------------------------
TESTTBS TBSNEW
总结:
alter tablespace :oldname rename to :newname
However, you must follow the rules when renaming a tablespace:
Tablespace rename provides the following benefits:
for examples:
SQL> create tablespace tbsold;
Tablespace created.
SQL> conn anbob/anbob
Connected.
SQL> create table testtbs (id int) tablespace tbsold;
Table created.
SQL> conn / as sysdba;
Connected.
SQL> col table_name for a10
SQL> select table_name,tablespace_name from dba_tables where table_name='TESTTBS'
TABLE_NAME TABLESPACE_NAME
---------- ------------------------------------------------------------
TESTTBS TBSOLD
SQL> alter tablespace tbsold rename to tbsnew;
Tablespace altered.
SQL> select table_name,tablespace_name from dba_tables where table_name='TESTTBS';
TABLE_NAME TABLESPACE_NAME
---------- ------------------------------------------------------------
TESTTBS TBSNEW
总结:
alter tablespace :oldname rename to :newname
However, you must follow the rules when renaming a tablespace:
- You must set compatibility level to at least 10.0.1.
- You cannot rename the SYSTEM or SYSAUX tablespaces.
- You cannot rename an offline tablespace.
- You cannot rename a tablespace that contains offline datafiles.
- Renaming a tablespace does not changes its tablespace identifier.
- Renaming a tablespace does not change the name of its datafiles.
Tablespace rename provides the following benefits:
- It simplifies the process of tablespace migration within a database.
- It simplifies the process of transporting a tablespace between two databases.
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




