表空间重命名及其限制
可以对永久表空间或者临时表空间进行重命名。当重命名一个表空间的时候将会更新所有参照该
表空间的数据字典,控制文件,和在线的数据文件头。但是表空间的ID不会改变。
确定该数据库的compatible参数,必须大于10.0.0
SQL> show parameter compatible
NAME TYPE VALUE
------------------------------------ ----------- -----------------------
compatible string 11.2.0.0.0
不能重命名system,sysaux 表空间
SQL> alter tablespace system rename to sys;
alter tablespace system rename to sys
*
ERROR at line 1:
ORA-00712: cannot rename system tablespace
SQL> alter tablespace sysaux rename to sys;
alter tablespace sysaux rename to sys
*
ERROR at line 1:
ORA-13502: Cannot rename SYSAUX tablespace
不能对offline 的表空间进行重命名,重命名的表空间中所有的数据文件必须online。
SQL> alter tablespace data offline normal;
Tablespace altered.
SQL> alter tablespace data rename to dbdata;
Tablespace altered.
*
ERROR at line 1:
ORA-00946: missing TO keyword
处于read only 模式下的表空间重命名的时候,会更新数据字典,空间文件,但是不会更新数据
文件头信息,导致往alert 写入一条警告信息。
SQL> alter tablespace data online;
Tablespace altered.
SQL> alter tablespace data read only;
Tablespace altered.
SQL> alter tablespace data rename to dbdata;
Tablespace altered.
查看写入alert log 中的信息。
adrci> set homepath diag/rdbms/oracl/oracl
adrci> show home
ADR Homes:
diag/rdbms/oracl/oracl
adrci> show alert -tail 5
2012-03-14 17:18:53.702000 +08:00
alter tablespace data rename to dbdata
Tablespace 'DATA' is renamed to 'DBDATA'.
Tablespace name change is not propagated to file headersbecause the tablespace is read only.
Completed: alter tablespace data rename to dbdata
参照该表空间文件名的数据字典已经更新。
SQL> select name from V$tablespace;
NAME
---------------------------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP
USERS
TEMP01
TBS
DBDATA
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26110315/viewspace-718611/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/26110315/viewspace-718611/