ITPub博客

首页 > Linux操作系统 > Linux操作系统 > How to rename/move a datafile in the same ASM diskgroup [ID 564993.1]

How to rename/move a datafile in the same ASM diskgroup [ID 564993.1]

原创 Linux操作系统 作者:spider0283 时间:2011-09-14 21:10:48 0 删除 编辑

修改时间 31-JUL-2011     类型 HOWTO     状态 PUBLISHED 

In this Document
  Goal
  Solution
     ASM Instance:
     Database instance:


Applies to:

Oracle Server - Enterprise Edition - Version: 10.1.0.2 to 11.1.0.6 - Release: 10.1 to 11.1
Information in this document applies to any platform.

Goal

ASM files can be renamed like any other files in a standard filesystem. For ASM, rename is peformed through some type of statements (ADD ALIAS, RENAME ALIAS, ADD DIRECTORY) to manipulate filenames, alias, and directories. 

Renaming datafiles is sometimes needed when database file names still contains old database name after a database on ASM is renamed (for example with nid). Then, it is required to change ASM datafile names accordingly with new database name.  RMAN backup copy doesn't work in this case as file still remains in the same diskgroup.

Solution

Please see the steps below for such a rename:

ASM Instance:


1- Create directory names within diskgroup.


alter diskgroup dg1 add directory '+/';
alter diskgroup dg1 add directory '+/‘;

Example:

old datafile name: +DG1/ee1020/datafile/books.256.652915493
new datafile name: +DG1/DD1020/datafile/books.dbf

alter diskgroup dg1 add directory '+DG1/DD1020';
alter diskgroup dg1 add directory '+DG1/DD1020/datafile';



2- Create an alias for the target datafile name with new path and filename

alter diskgroup dg1 add alias 
'
for 
'';

Example:

alter diskgroup dg1 add alias '+DG1/DD1020/datafile/books.dbf'
for '+DG1/ee1020/datafile/books.256.652915493';

Database instance:

3- Startup database in mount mode and rename the datafile. To use this clause for a datafile or tempfile, the database needs to be in mount mode. The database can also be open, but the datafile or tempfile being renamed must be offline. 

startup mount

alter database rename file ''
to '';


Example:

alter database rename file '+DG1/ee1020/datafile/books.256.652915493'
to '+DG1/DD1020/datafile/books.dbf';


Note: "Rename Alias" on system-created filenames  fails with ORA-15177. There is no way to rename a system generated ASM filename. Once a user-created-alias is added in the diskgroup, then you can use "rename alias" to rename the filename within ASM.

Example:

alter diskgroup dg1 
rename alias '+DG1/DD1020/datafile/books.dbf' 
to '+DG1/DD1020/datafile/books2.dbf';


显示相关信息 相关的


产品
  • Oracle Database Products > Oracle Database > Oracle Database > Oracle Server - Enterprise Edition
错误
ORA-15177

返回页首返回页首

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

请登录后发表评论 登录
全部评论

注册时间:2011-03-29

  • 博文量
    194
  • 访问量
    646223