ITPub博客

首页 > 数据库 > Oracle > Online Move Datafile in Oracle Database 12c

Online Move Datafile in Oracle Database 12c

原创 Oracle 作者:lucyne 时间:2015-10-20 11:34:14 0 删除 编辑
[oracle@odb12c ~]$ sqlplus  / as sysdba


SQL*Plus: Release 12.1.0.2.0 Production on Tue Oct 20 11:27:52 2015


Copyright (c) 1982, 2014, Oracle.  All rights reserved.




Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> SELECT file#, name FROM v$datafile WHERE con_id = 1 ORDER BY file#;


     FILE# NAME
---------- ----------------------------------------------------------------------------------------------------
         1 /U01/app/oracle/oradata/ODB12C/datafile/o1_mf_system_bz56y35w_.dbf
         3 /U01/app/oracle/oradata/ODB12C/datafile/o1_mf_sysaux_bz56wd04_.dbf
         4 /U01/app/oracle/oradata/ODB12C/datafile/o1_mf_undotbs1_bz5705kc_.dbf
         6 /U01/app/oracle/oradata/ODB12C/datafile/o1_mf_users_bz5704dv_.dbf

SQL> SELECT file#, name FROM v$datafile WHERE con_id = 1 ORDER BY file#;


     FILE# NAME
---------- ----------------------------------------------------------------------------------------------------
         1 /U01/app/oracle/oradata/ODB12C/datafile/o1_mf_system_bz56y35w_.dbf
         3 /U01/app/oracle/oradata/ODB12C/datafile/o1_mf_sysaux_bz56wd04_.dbf
         4 /U01/app/oracle/oradata/ODB12C/datafile/o1_mf_undotbs1_bz5705kc_.dbf
         6 /U01/app/oracle/oradata/ODB12C/datafile/o1_mf_users_bz5704dv_.dbf


SQL> ALTER DATABASE MOVE DATAFILE '/U01/app/oracle/oradata/ODB12C/datafile/o1_mf_users_bz5704dv_.dbf' to '/tmp/user.dbf';


Database altered.


SQL> SELECT file_id, file_name FROM dba_data_files WHERE file_id = 6;


   FILE_ID FILE_NAME
---------- ----------------------------------------------------------------------------------------------------
         6 /tmp/user.dbf
SQL> ALTER DATABASE MOVE DATAFILE 6 to '/U01/app/oracle/oradata/ODB12C/datafile/user.dbf';


Database altered.
SQL> SELECT file_id, file_name FROM dba_data_files WHERE file_id = 6;


   FILE_ID FILE_NAME
---------- ----------------------------------------------------------------------------------------------------
         6 /U01/app/oracle/oradata/ODB12C/datafile/user.dbf


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26390465/viewspace-1815113/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
. . 一个 DBA. . .

注册时间:2012-01-06

  • 博文量
    84
  • 访问量
    741694