温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》
  • 首页 > 
  • 教程 > 
  • 数据库 > 
  • 数据库open状态下,如何修改数据文件路径(可用于改名改路径)

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

发布时间:2020-08-14 15:21:14 来源:网络 阅读:690 作者:duxiutemp 栏目:数据库


数据库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


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI