码迷,mamicode.com
首页 > 数据库 > 详细

数据库open状态下,如何修改数据文件路径(可用于改名改路径)

时间:2016-12-03 02:41:20      阅读:245      评论:0      收藏:0      [点我收藏+]

标签:数据文件 改名


数据库open下,将users表空间下的数据迁移到/home/oracle/dsk1下(可用作为改名)
 col name for a50
SQL> select file#,name,checkpoint_change# from v$datafile;

     FILE# NAME                                               CHECKPOINT_CHANGE#
---------- -------------------------------------------------- ------------------
         1 /u01/app/oracle/oradata/ORA11GR2/system01.dbf                 1043045
         2 /u01/app/oracle/oradata/ORA11GR2/sysaux01.dbf                 1043045
         3 /u01/app/oracle/oradata/ORA11GR2/undotbs01.dbf                1043045
         4 /u01/app/oracle/oradata/ORA11GR2/users01.dbf                  1043045
         5 /u01/app/oracle/oradata/ORA11GR2/example01.dbf                1043045
         6 /u01/app/oracle/oradata/ORA11GR2/users02.dbf                  1044441
SQL> alter system checkpoint;
select file#,name,checkpoint_change# from v$datafile;
 alter tablespace users offline;
select file#,name,checkpoint_change# from v$datafile;
 alter tablespace users rename datafile ‘/u01/app/oracle/oradata/ORA11GR2/users01.dbf‘ to ‘/home/oracle/dsk1/users01.dbf‘;
 alter tablespace users rename datafile ‘/u01/app/oracle/oradata/ORA11GR2/users02.dbf‘ to ‘/home/oracle/dsk1/users02.dbf‘;修改控制文件内容
  select name from v$datafile;
SQL> alter tablespace users online;
总结为四步
1 tablespace offline
2 cp datafile to dest
3 alter tablespace xxx rename
4 tbs online


数据库open状态下,如何修改数据文件路径(可用于改名改路径)

标签:数据文件 改名

原文地址:http://duxiutemp.blog.51cto.com/10788420/1878961

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!