ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 表空间重命名相关命令与测试

表空间重命名相关命令与测试

原创 Linux操作系统 作者:eric_zhyd 时间:2013-04-01 22:04:48 0 删除 编辑
[10.2.0.1]版本以后才具备快速重命名表空间功能!

对普通用户表空间进行重命名[成功]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-- 创建测试表空间
create tablespace tbs_zhong datafile 'E:\OraData\Zhong\tbs_zhong01.dbf' size 10m;
 
-- 查看表空间与数据文件的对应关系
col tablespace_name for a20
col file_name for a51
select tablespace_name,file_name from dba_data_files where file_name like '%zhong%';
 
-- 创建测试用户
create user zhong identified by zhong default tablespace tbs_zhong;
grant connect,resource to zhong;
 
-- 查询表空间与用户的对应关系
select username,default_tablespace from dba_users where username = 'ZHONG';
 
-- ZHONG用户内创建测试数据
create table t_zhong as select * from all_objects;
 
-- 查询表与表空间的对应关系
select segment_name,tablespace_name from dba_segments where segment_name='T_ZHONG';
 
-- 表空间名称变更
alter tablespace TBS_ZHONG rename to TBS_LIN;
 
-- 查看表空间与数据文件的对应关系
col tablespace_name for a20
col file_name for a51
select tablespace_name,file_name from dba_data_files where file_name like '%zhong%';
 
-- 查询表空间与用户的对应关系
select username,default_tablespace from dba_users where username = 'ZHONG';
 
-- 查询表与表空间的对应关系
select segment_name,tablespace_name from dba_segments where segment_name='T_ZHONG';
 
尝试对UNDO表空间进行重命名[成功]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
alter tablespace UNDOTBS1 rename to UNDOTBS1_new;
 
 
尝试对临时表空间进行重命名[成功]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
alter tablespace TEMP rename to TEMP_new;
 
 
尝试对系统表空间进行重命名[失败]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
alter tablespace SYSTEM rename to SYSTEM_new;
alter tablespace SYSTEM rename to SYSTEM_new
*
ERROR at line 1:
ORA-00712: cannot rename system tablespace
 
alter tablespace SYSAUX rename to SYSAUX_new;
alter tablespace SYSAUX rename to SYSAUX_new
*
ERROR at line 1:
ORA-13502: Cannot rename SYSAUX tablespace

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12974804/viewspace-757605/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-03-13

  • 博文量
    21
  • 访问量
    535952