Loading...
  所在位置:论坛首页 -> ┈┋电脑网络技术区┋┈ -> 数据库技术 -> 如何对非系统表空间的数据文件进行改名
标题:如何对非系统表空间的数据文件进行改名收藏 编辑 删除 楼主 | 上一篇 下一篇
随便玩玩
等级:社区游民
权限:普通用户
积分:0
金钱:81
声望:0
经验:0
发帖数:16
注册:2008年6月24日
资料 短消息2008-7-4 11:05:13
如何在数据库打开时对非系统表空间的数据文件改名,参考下面步骤:

1. 确定数据文件状态

select file_name, status

from dba_data_files

where tablespace_name ='tablespace_name';

2. 将表空间置为read-only(时间可能会很长,比重启数据库的时间还长)

alter tablespace tablespace_name read only;

3. 确定表空间状态为read-only

select tablespace_name, status

from dba_tablespaces

where tablespace_name = 'tablespace_name';

4. 用操作系统命令将数据文件拷贝为新的文件名,确认大小一样

5. 将表空间offline(这时用户就不能访问这个表空间了)

alter tablespace tablespace_name offline;

6. 修改控制文件中的相应记录

alter database rename file

'/full_path_of_old_location/and_datafile_name.dbf'

to

'/full_path_of_new_location/and_datafile_name.dbf';

7. 将表空间online

alter tablespace tablespace_name online;

8. 将表空间置回为read-write

alter tablespace tablespace_name read write;

9. 备份控制文件

alter database backup controlfile to trace;

10. 在操作系统上删除原来的数据文件

 

说明:

1. 将表空间先置为read-only,是让用户不能访问(read)的时间尽量少点(少的时间为拷贝文件所需的时间)

2. 如果是standby环境,对standby的恢复没有影响,如果要保持一致的话,mount standby后用cp然后alter database rename file ..... 即可。

2008-7-4 11:05:13 顶部
第1页 共页 共0个回复     <<    >>    
 快速回复
  • 支持UBB,HTML标签

  • 高级回复

  • 操作选项:评分 加精 解精 奖惩 设专题 设公告 解公告 固顶 总固顶 解固顶 结帖 解结帖 锁帖 解锁 移帖 删帖
      首页 | 购买指南 | 商业版本 | 虚拟主机 | 特色介绍 | 下载中心 | 支付方式
    Copyright 2004-2008 BBSGood.com Powered By: BBSGood.Speed Version 5.0
      咨询电话:0575-85513832、0575-85513825(传真)、7*24小时咨询服务:13606552007 不良信息举报中心 浙ICP备05029817号
      业务QQ:38958768、客服QQ1:415896239、客服QQ2:343896043、MSN:jccsxx@hotmail.com