表空间重命名(rename tablespace name)
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:
- 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.
目前这篇文章有3条评论(Rss)评论关闭。