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

[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博客 ” ,链接:http://blog.itpub.net/12974804/viewspace-757605/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/12974804/viewspace-757605/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值