一、非ASM数据文件转发成ASM步骤:
1、创建测试表空间
SQL>create tablespace test datafile '/home/oracle/test.dbf' size 20M;
2、使用RMAN,将数据文件offline
SQL>rman target system/password
RMAN>sql 'alter tablespace test offline';
3、使用backup as copy命令迁移
RMAN>backup as copy tablespace 'TEST' format 'ASM_DISKGROUP';
4、切换表空间
RMAN>switch tablespace 'TEST' to copy;
5、将表空间online
RMAN>sql 'alter tablespace test online';
6、查看表空间信息
select file_name from dba_data_files where tablespace_name='TEST';
二、将数据文件从一个diskgroup迁移到另一个diskgroup
1、查看需要迁移的数据文件#
SQL> select file_id from dba_data_files where TABLESPACE_NAME='TEST';
FILE_ID
----------
5
2、备份数据文件
RMAN> sql 'alter tablespace test offline';
RMAN>backup device type disk as copy datafile 5 format '+DG1';
3、切换
RMAN>switch datafile 5 to copy;
RMAN>recover datafile 5;
4、启动
RMAN>sql 'alter tablespace test online';
三、将ASM文件转发成OS文件(除RMAN外的另一种方法)
1、查看数据文件
SQL> select file_name from dba_data_files
where tablespace_name='TEST';
FILE_NAME
--------------------------------------------------------------------------------
+DG1/ora10g/datafile/test.261.713925727
2、将表空间offline
SQL>alter tablespace test offline;
3、创建ASM目录
SQL> create directory asmsrc as '+DG1/ora10g/datafile';
SQL> create directory osdesc as '/home/oracle';
4、执行转化
SQL> begin
dbms_file_transfer.copy_file('ASMSRC',
'TEST.261.713925727',
'OSDESC',
'TEST.DBF');
END;
/
5、将数据文件rename
SQL> alter database rename file
'+DG1/ora10g/datafile/test.261.713925727'
to '/home/oracle/TEST.DBF';
6、恢复数据文件
SQL> recover datafile 5;
7、将表空间online,并查看数据文件
SQL> alter tablespace test online;
SQL> select file_name from dba_data_files
where tablespace_name='TEST';
8、进入ASMCMD,将test.261.713925727删除
ASMCMD>rm test.261.713925727
1、创建测试表空间
SQL>create tablespace test datafile '/home/oracle/test.dbf' size 20M;
2、使用RMAN,将数据文件offline
SQL>rman target system/password
RMAN>sql 'alter tablespace test offline';
3、使用backup as copy命令迁移
RMAN>backup as copy tablespace 'TEST' format 'ASM_DISKGROUP';
4、切换表空间
RMAN>switch tablespace 'TEST' to copy;
5、将表空间online
RMAN>sql 'alter tablespace test online';
6、查看表空间信息
select file_name from dba_data_files where tablespace_name='TEST';
二、将数据文件从一个diskgroup迁移到另一个diskgroup
1、查看需要迁移的数据文件#
SQL> select file_id from dba_data_files where TABLESPACE_NAME='TEST';
FILE_ID
----------
5
2、备份数据文件
RMAN> sql 'alter tablespace test offline';
RMAN>backup device type disk as copy datafile 5 format '+DG1';
3、切换
RMAN>switch datafile 5 to copy;
RMAN>recover datafile 5;
4、启动
RMAN>sql 'alter tablespace test online';
三、将ASM文件转发成OS文件(除RMAN外的另一种方法)
1、查看数据文件
SQL> select file_name from dba_data_files
where tablespace_name='TEST';
FILE_NAME
--------------------------------------------------------------------------------
+DG1/ora10g/datafile/test.261.713925727
2、将表空间offline
SQL>alter tablespace test offline;
3、创建ASM目录
SQL> create directory asmsrc as '+DG1/ora10g/datafile';
SQL> create directory osdesc as '/home/oracle';
4、执行转化
SQL> begin
dbms_file_transfer.copy_file('ASMSRC',
'TEST.261.713925727',
'OSDESC',
'TEST.DBF');
END;
/
5、将数据文件rename
SQL> alter database rename file
'+DG1/ora10g/datafile/test.261.713925727'
to '/home/oracle/TEST.DBF';
6、恢复数据文件
SQL> recover datafile 5;
7、将表空间online,并查看数据文件
SQL> alter tablespace test online;
SQL> select file_name from dba_data_files
where tablespace_name='TEST';
8、进入ASMCMD,将test.261.713925727删除
ASMCMD>rm test.261.713925727
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/354732/viewspace-629618/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/354732/viewspace-629618/
本文详细介绍了如何将非ASM数据文件转发至ASM步骤、数据文件从一个diskgroup迁移到另一个diskgroup的方法,以及将ASM文件转发成OS文件的另一种方法。
2709

被折叠的 条评论
为什么被折叠?



