问题1:
使用RMAN copy进行数据文件迁移位置时遇到的问题,(从一个磁盘组迁移到另外一块磁盘组)
采用如下拼接语句进行COPY拼接
select ‘copy datafile ‘||’’’’||file_name||’’’’||’ to ‘||’’’’||’+NEWDATA/rac/‘||substr(file_name,instr(file_name,’/‘,-1)+1)||’’’;’ from dba_data_files;
获得如下sql语句:
copy datafile ‘+DATA/racdb/datafile/users.259.1037590363’ to ‘+NEWDATA/rac/users
.259.1037590363’;
copy datafile ‘+DATA/racdb/datafile/undotbs1.258.1037590363’ to ‘+NEWDATA/rac/un
dotbs1.258.1037590363’;
copy datafile ‘+DATA/racdb/datafile/sysaux.257.1037590363’ to ‘+NEWDATA/rac/sysa
ux.257.1037590363’;
copy datafile ‘+DATA/racdb/datafile/system.256.1037590361’ to ‘+NEWDATA/rac/syst
em.256.1037590361’;
copy datafile ‘+DATA/racdb/datafile/example.264.1037590589’ to ‘+NEWDATA/rac/exa
mple.264.1037590589’;
copy datafile ‘+DATA/racdb/datafile/undotbs2.265.1037591117’ to ‘+NEWDATA/rac/un
dotbs2.265.1037591117’;
执行时报错:
ORA-01276: Cannot add file +NEWDATA/rac/system.256.1037590361. File has an Oracle Managed Files file name.
原因:由于数据文件是使用OMF自动文件管理功能创建的数据文件,属于OMF命名格式,当在ASM中,进行数据文件迁移时,从一个磁盘组迁移到另外一个磁盘组时,会报错ORA-01276,解决办法很简单,就是在使用RMAN COPY的同时并进行重命名,消除OMF命名规则。
修改后的拼接语句如下:
select ‘copy datafile ‘||’’’’||file_name||’’’’||’ to ‘||’’’’||’+NEWDATA/rac/‘||substr(file_name,instr(file_name,’/‘,-1)+1)||’’’;’ from dba_data_files;
获得如下SQL:
copy datafile ‘+DATA/racdb/datafile/users.259.1037590363’ to ‘+NEWDATA/rac/users
.259.1037590363.dbf’;
copy datafile ‘+DATA/racdb/datafile/undotbs1.258.1037590363’ to ‘+NEWDATA/rac/un
dotbs1.258.1037590363.dbf’;
copy datafile ‘+DATA/racdb/datafile/sysaux.257.1037590363’ to ‘+NEWDATA/rac/sysa
ux.257.1037590363.dbf’;
copy datafile ‘+DATA/racdb/datafile/system.256.1037590361’ to ‘+NEWDATA/rac/syst
em.256.1037590361.dbf’;
copy datafile ‘+DATA/racdb/datafile/example.264.1037590589’ to ‘+NEWDATA/rac/exa
mple.264.1037590589.dbf’;
copy datafile ‘+DATA/racdb/datafile/undotbs2.265.1037591117’ to ‘+NEWDATA/rac/un
dotbs2.265.1037591117.dbf’;
执行即可不会报错。
迁移完成后,为了确保数据文件名字与原名字相同,就需要进行两次重命名,但是最终重命名出来的数据文件仅仅是名字与原数据文件相同,与OMF则无关。
第一次重命名:
alter database rename file ‘+DATA/racdb/datafile/users.259.1037590363’ to ‘+NEWD
ATA/rac/users.259.1037590363.dbf’;
问题2:
迁移控制文件时:
(也是由于OMF)
ASMCMD> cp Current.260.1037590513 +NEWDATA/rac/
copying +DATA/RACDB/CONTROLFILE/Current.260.1037590513 -> +NEWDATA/rac/Current.260.1037590513
ASMCMD-8016: copy source ‘+DATA/RACDB/CONTROLFILE/Current.260.1037590513’ and target ‘+NEWDATA/rac/Current.260.1037590513’ failed
ORA-15056: additional error message
ORA-15046: ASM file name ‘+NEWDATA/rac/Current.260.1037590513’ is not in single-file creation form
ORA-06512: at “SYS.X$DBMS_DISKGROUP”, line 415
ORA-06512: at line 3 (DBD ERROR: OCIStmtExecute)
解决办法:
ASMCMD> cp Current.260.1037590513 Current01.ctl
copying +DATA/RACDB/CONTROLFILE/Current.260.1037590513 -> +DATA/RACDB/CONTROLFILE/Current01.ctl
ASMCMD> cp Current01.ctl +NEWDATA/rac/
copying +DATA/RACDB/CONTROLFILE/Current01.ctl -> +NEWDATA/rac/Current01.ctl
修改参数中记录的控制文件信息时要注意修改名字格式。
创建集群时还是不要开启OMF自动文件管理功能,要么后续迁移DATA盘会比较麻烦。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。