1.使用裸设备建立EYGLE测试表空间:
[oracle@danaly ~]$ sqlplus "/ as sysdba"
SQL> create tablespace eygle
Tablespace created.
SQL> create table eygle tablespace eygle as select * from dba_objects;
Table created.
//创建表eygle,跟dba_objects一样的
SQL> select count(*) from eygle;
----------
SQL> alter tablespace eygle offline;
SQL> exit
2.使用RMAN的COPY功能备份裸设备文件为文件系统文件
[oracle@danaly ~]$ rman target /
RMAN> copy datafile '/dev/cciss/c0d0p11' to '/opt/oracle/eygle01.dbf';
RMAN> exit
3.通过rename修改文件位置
[oracle@danaly ~]$ sqlplus "/ as sysdba"
SQL> alter database rename file '/dev/cciss/c0d0p11' to '/opt/oracle/eygle01.dbf';
SQL> alter tablespace eygle online;
SQL> select file_name from dba_data_files where tablespace_name='EYGLE';
FILE_NAME
--------------------------------------------------------------------------------
/opt/oracle/eygle01.dbf
4.进行数据修改
SQL> alter database datafile '/opt/oracle/eygle01.dbf' resize 20m;
SQL> insert into eygle select * from eygle;
SQL> commit;
SQL> alter tablespace eygle offline;
Tablespace altered.
SQL> exit
5.从文件系统迁移文件至裸设备
[oracle@danaly ~]$ rman target /
RMAN> copy datafile '/opt/oracle/eygle01.dbf' to '/dev/cciss/c0d0p11';
RMAN> exit
[oracle@danaly ~]$ sqlplus "/ as sysdba"
SQL> alter database rename file '/opt/oracle/eygle01.dbf' to '/dev/cciss/c0d0p11';
SQL> alter tablespace eygle online;
SQL> select count(*) from eygle;
----------