『文件管理』在数据库打开时对非系统表空间的数据文件改名
2009-09-01 15:09
429 查看
如何在数据库打开时对非系统表空间的数据文件改名,参考下面步骤: 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 ..... 即可。
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 ..... 即可。
相关文章推荐
- 十四、oracle 数据库管理--管理表空间和数据文件
- Microsoft Jet 数据库引擎打不开文件'(未知的)'。 它已经被别的用户以独占方式打开,或没有查看数据的权限
- 用C#编程从数据库中读取图片数据导进Excel文件的方法(如何从数据库中读取保存的文件,直接打开,中间不保存到本地)
- 十四、oracle 数据库管理--管理表空间和数据文件
- ArcGIS Engine开发之旅07---文件地理数据库、个人地理数据库和 ArcSDE 地理数据库中的栅格存储加以比较 、打开栅格数据
- 数据库空间管理之数据文件分配(初)
- oracle数据库管理---- 管理表空间和数据文件
- 数据库open状态下,如何修改数据文件路径(可用于改名改路径)
- 12.数据库管理 -- 管理表空间和数据文件
- 学生管理系统----文件和数据库(oracle)两种保存数据方式
- 十四、oracle 数据库管理--管理表空间和数据文件
- ORACLE归档模式下的热备以及数据库打开状态状态下普通数据文件损坏后的还原
- mini学生管理系统。。。全部代码,4个java文件放在同一个包下面即可。用JDBC调用数据库取出数据。
- 电脑上打开iTunes产生数据库文件和影像数据的一些问题
- 数据库打开阶段,新增的数据文件损坏
- 十四、oracle 数据库管理--管理表空间和数据文件
- Oracle的学习四:数据库管理员、逻辑备份与恢复、数据字典、动态性能视图、管理表空间与数据文件
- Oracle数据文件损坏怎样打开数据库
- ArcGIS Engine开发之旅07---文件地理数据库、个人地理数据库和 ArcSDE 地理数据库中的栅格存储加以比较 、打开栅格数据
- ORA-01251错误oracle服务启动无法连接误删非法删除数据文件导致数据库不能打开ORA-01122 ORA-01251