Managing Alias Names for Oracle ASM File Names

Alias names, or aliases, are intended to provide a more user-friendly means of referring to Oracle ASM files, rather than using the system-generated file names.

You can create an alias for a file when you create it in the database, or you can add an alias to an existing file using the ADD ALIAS clause of the ALTER DISKGROUP statement. You can create an alias in any system-generated or user-created Oracle ASM directory. An alias must include the disk group name; you cannot create an alias at the root level (+).

For more information about creating aliases with ASMCMD, refer to "mkalias".

This section contains the following sections:

Adding an Alias Name for an Oracle ASM File Name

Use the ADD ALIAS clause of the ALTER DISKGROUP statement to create an alias name for an Oracle ASM file name. The alias name must consist of the full directory path and the alias itself.

Example 5-4 adds a new alias name for a system-generated file name.

Example 5-4 Adding an alias name for an Oracle ASM file name

ALTER DISKGROUP data ADD ALIAS '+data/orcl/second.dbf'
     FOR '+data/orcl/datafile/mytable.342.123456789';

Renaming an Alias Name for an Oracle ASM File Name

Use the RENAME ALIAS clause of the ALTER DISKGROUP statement to rename an alias for an Oracle ASM file name. The old and the new alias names must consist of the full directory paths of the alias names.

Example 5-5 renames an alias.

Renaming an alias does not update the database reference to the alias.

Example 5-5 Renaming an alias name for an Oracle ASM file name

ALTER DISKGROUP data RENAME ALIAS '+data/orcl/datafile.dbf'
     TO '+data/payroll/compensation.dbf';

Dropping an Alias Name for an Oracle ASM File Name

Use the DROP ALIAS clause of the ALTER DISKGROUP statement to drop an alias for an Oracle ASM file name. The alias name must consist of the full directory path and the alias itself. The underlying file to which the alias refers is unchanged.

Example 5-6 drops an alias.

Example 5-7 fails because it attempts to drop a system-generated file name and this syntax is not allowed.

Example 5-6 Dropping an alias name for an Oracle ASM file name

ALTER DISKGROUP data DROP ALIAS '+data/payroll/compensation.dbf';

Example 5-7 Dropping an alias name for an Oracle ASM file name

ALTER DISKGROUP data 
     DROP ALIAS '+data/orcl/datafile/mytable.342.123456789';

Dropping Files and Associated Aliases from a Disk Group

You can delete Oracle ASM files and their associated aliases from a disk group using the DROP FILE clause of the ALTER DISKGROUP statement. You must use a fully qualified file name, or an alias name when specifying the file to delete. The underlying file on the file system is not dropped when the alias is dropped.

Some reasons why you may want to delete files include:

  • A file created using aliases is not an Oracle Managed File. Consequently, it is not automatically deleted.

  • A point-in-time-recovery of a database might restore the database to a time before a tablespace was created. The restore does not delete the tablespace, but there is no reference to the tablespace or its data file in the restored database. You could manually delete the data file.

In Example 5-8, the alias name for the file is used when deleting both the file and the alias from a disk group.

In Example 5-9, the Oracle Managed Files (system-generated) file name is used when dropping the file and any associated alias.

Example 5-8 Dropping a file and alias from a disk group using the alias name

ALTER DISKGROUP data DROP FILE '+data/payroll/compensation.dbf';

Example 5-9 Dropping a file and alias from a disk group using the system-generated name

ALTER DISKGROUP data
     DROP FILE '+data/orcl/datafile/mytable.342.123456789';