12c online move datafile

Oracle 12c版本可以实现在线move数据文件。

–移动pdb的数据文件

SQL> alter session set container=BLUE2;

Session altered.

SQL> 
SQL> select file#,name from v$datafile;

     FILE# NAME
---------- -----------------------------------------------------------------
         4 /u01/app/oracle/oradata/blue12c/undotbs01.dbf
        11 /u01/app/oracle/oradata/blue12c/blue2/system01.dbf
        12 /u01/app/oracle/oradata/blue12c/blue2/sysaux01.dbf
        13 /u01/app/oracle/oradata/blue12c/blue2/blue2_users01.dbf

SQL> alter database move datafile 11 to '/u01/app/oracle/oradata/system01.dbf';

Database altered.

SQL> select file#,name from v$datafile;
     FILE# NAME
---------- -----------------------------------------------------------------
         4 /u01/app/oracle/oradata/blue12c/undotbs01.dbf
        11 /u01/app/oracle/oradata/system01.dbf
        12 /u01/app/oracle/oradata/blue12c/blue2/sysaux01.dbf
        13 /u01/app/oracle/oradata/blue12c/blue2/blue2_users01.dbf

告警日志信息
alter database move datafile 11 to ‘/u01/app/oracle/oradata/system01.dbf’
Sat Jun 28 14:11:04 2014
Moving datafile /u01/app/oracle/oradata/blue12c/blue2/system01.dbf (11) to /u01/app/oracle/oradata/system01.dbf
Sat Jun 28 14:11:28 2014
Move operation committed for file /u01/app/oracle/oradata/system01.dbf
Completed: alter database move datafile 11 to ‘/u01/app/oracle/oradata/system01.dbf’

–移动cdb的数据文件

SQL> alter session set container=cdb$root;

Session altered.

SQL>  select file#,name from v$datafile;

     FILE# NAME
---------- -----------------------------------------------------------------
         1 /u01/app/oracle/oradata/blue12c/system01.dbf
         3 /u01/app/oracle/oradata/blue12c/sysaux01.dbf
         4 /u01/app/oracle/oradata/blue12c/undotbs01.dbf
         5 /u01/app/oracle/oradata/blue12c/pdbseed/system01.dbf
         6 /u01/app/oracle/oradata/blue12c/users01.dbf
         7 /u01/app/oracle/oradata/blue12c/pdbseed/sysaux01.dbf
         8 /u01/app/oracle/oradata/blue12c/blue1/system01.dbf
         9 /u01/app/oracle/oradata/blue12c/blue1/sysaux01.dbf
        10 /u01/app/oracle/oradata/blue12c/blue1/blue1_users01.dbf
        11 /u01/app/oracle/oradata/system01.dbf
        12 /u01/app/oracle/oradata/blue12c/blue2/sysaux01.dbf

     FILE# NAME
---------- -----------------------------------------------------------------
        13 /u01/app/oracle/oradata/blue12c/blue2/blue2_users01.dbf

12 rows selected.

SQL> alter database move datafile 1 to '/u01/app/oracle/system02.dbf';

Database altered.

SQL> select file#,name from v$datafile;

     FILE# NAME
---------- -----------------------------------------------------------------
         1 /u01/app/oracle/system02.dbf
         3 /u01/app/oracle/oradata/blue12c/sysaux01.dbf
         4 /u01/app/oracle/oradata/blue12c/undotbs01.dbf
         5 /u01/app/oracle/oradata/blue12c/pdbseed/system01.dbf
         6 /u01/app/oracle/oradata/blue12c/users01.dbf
         7 /u01/app/oracle/oradata/blue12c/pdbseed/sysaux01.dbf
         8 /u01/app/oracle/oradata/blue12c/blue1/system01.dbf
         9 /u01/app/oracle/oradata/blue12c/blue1/sysaux01.dbf
        10 /u01/app/oracle/oradata/blue12c/blue1/blue1_users01.dbf
        11 /u01/app/oracle/oradata/system01.dbf
        12 /u01/app/oracle/oradata/blue12c/blue2/sysaux01.dbf

     FILE# NAME
---------- -----------------------------------------------------------------
        13 /u01/app/oracle/oradata/blue12c/blue2/blue2_users01.dbf

告警日志信息
alter database move datafile 1 to ‘/u01/app/oracle/system02.dbf’
Sat Jun 28 14:15:07 2014
Moving datafile /u01/app/oracle/oradata/blue12c/system01.dbf (1) to /u01/app/oracle/system02.dbf
Sat Jun 28 14:16:46 2014
Move operation committed for file /u01/app/oracle/system02.dbf
Completed: alter database move datafile 1 to ‘/u01/app/oracle/system02.dbf’

新特性的好处
1.可以在库open的情况下move system表空间文件
2.对于其他表空间的数据文件move不用offline(意味着不用停业务)

此条目发表在Uncategorized分类目录。将固定链接加入收藏夹。

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s