"Translated from MoS article" for each file's file.id and file.incarnation number, rename the file alias

Source: Internet
Author: User

For each file's file.id and file.incarnation number, rename the file alias

References:
Rename Alias of DataFile as Per file.id and file.incarnation number (DOC ID 1494661.1)

Suitable for:
Oracle database-enterprise edition-version 11.2.0.0 and later
Information in this document applies to any platform.

Goal:
For each database name, remove the alias for the data file and move them to the correct folder.

Method:
1. Check the current file alias from the control file.

2. Verifying aliases and Omf file names from Asmcmd

3. Do a full database backup

4. Offline The tablespace, assuming that the table space has only one datafile, then make this datafile offline

5. Use Rman to execute the command for set new filename.

RESTORE tablespace IKP;
SWITCH datafile All
RECOVER tablespace

6. Verify that the control file does not replace the alias with a new name. Remove aliases from asmcmd using the Rmalias command

As an optional method, you can use the Sqlplus command to rename DataFile


Symptoms:

ASM File and aliases

Using the transport table space, several tablespace are attached with the RAC database using ASM.
In ASM, the actual file appears to be under the wrong path, located under the <diskgroup_name>/asm/folder
Instead of the original path under the <diskgroup_name>/<database_sid>/datafile path
Need to move file to the correct path in ASM, for example <diskgroup_name>/<database_sid>/datafile/path


Change:

When DataFile is copied at the ASM level through various methods (Asmcmd CP or Dbms_file_transfer),

If you use the Asmcmd CP command to copy o1_mf_dcs_83w90ymg_.dbf from the file system to ASM

ASMCMD&GT;CP/TMP/O1_MF_DCS_83W90YMG_.DBF +data/orasv3/datafile/o1_mf_dcs_83w90ymg_.dbf

Asmcmd>pwd
+data/asm/datafile

Asmcmd> ls-a
+DATA/ORASV3/DATAFILE/O1_MF_DCS_83W90YMG_.DBF = o1_wf_dcs_83w90ymg_.dbf.350.792589015

The database show the datafile to be:
+data/orasv3/datafile/o1_mf_dcs_83w90ymg_.dbf

Reason:

In the example above,
Asmcmd> ls-a
+DATA/ORASV3/DATAFILE/O1_MF_DCS_83W90YMG_.DBF = o1_wf_dcs_83w90ymg_.dbf.350.792589015


+DATA/ORASV3/DATAFILE/O1_MF_DCS_83W90YMG_.DBF------------This is alias
o1_wf_dcs_83w90ymg_.dbf.350.792589015--------------------Original file

Whenever you create a dataifle with DBCA or Rman restore, these datafile are created under the correct folder---diskgroup name/database name/datafile

However, when files are copied using the Asmcmd CP method, these files are unknown to ASM and give them an identity. ASM to a file_id and Incarnation_number

In other words, this is an alias that you choose to place as a data file (target),
Then datafile is actually stored in +data/asm/datafile, for example DiskGroup Name/asm/datafile/filename.file_id.incarnation_number

In the same disk group, we only have alias. In the same disk group, we cannot move Dataiile

Suppose you want to move the database in a different disk group,
Please see how to move ASM database files from one diskgroup to another? (Doc ID 330103.1)
This is mentioned in the following connection: in http://docs.oracle.com/cd/B28359_01/server.111/b31107/asmfiles.htm#i1023283


Each file created in ASM obtains a system-generated filename, the fully qualified filename.
The fully qualified filename represents a fully pathname in the ASM file system.

An example of a fully qualified filename is:
+dgroup2/sample/controlfile/current.256.541956473

You can use fully qualified filename to refer to (read or retrieve) an ASM file
You can use other short file name formats, such as alias ASM filename, which describes the alias ASM filename description as "Alias ASM Filenames" to refer to an ASM file

ASM generates fully qualified filename based on the request to establish the file. A request to create a file does not and cannot specify fully qualified filename

Instead, use a simpler syntax to specify a file, such as an alias or a disk group name.

ASM then creates a file that, depending on the document type, places the file under the correct ASM path and assigns a fully qualified filename

Assuming that ALIAS,ASM is specified in the Create file request, you can also create alias so that the alias can reference fully qualified filename

The ASM file creation request can be either a single file setup or multiple file creation requests.

You can use the following query to find the alias (input keyword), this query needs to run in ASM instance.
Here, we use ' test ' as keyword.



Sql> Select F.file_number, A.name, (' + ' | | | g.name| | '. ' | | f.file_number| | '. ' | | F.
2 incarnation) Asm_filename, F.type
3 from V$asm_diskgroup G, V$asm_file F, V$asm_alias a
4 where G.group_number=f.group_number
5 and G.group_number=a.group_number
6 and F.file_number=a.file_number
7 and a.name like '%test% '
8 ORDER by F.file_number;

File_number NAME Asm_filename TYPE
----------- ------------------------------ ----------------------------------- --------------------
267 Test.ctl +data1.267.790251625 Controlfile
291 test.291.784665795 +data.291.784665795 DataFile
291 Test +data.291.784665795 DataFile
296 test.dbf.296.790030721 +data.296.790030721 DataFile
296 test.dbf +data.296.790030721 DataFile




asmcmd> pwd
+data/data/datafile

Asmcmd> Ls-lt

Type redund striped Time Sys Name
N test = +data/asm/datafile/test.291.784665795>>>>>>>>>>>>>>
N test.dbf = +data/asm/datafile/test.dbf.296.790030721>>>>>>>>
datafile Unprot Coarse 10:00:00 Y BIG1.316.791388381
datafile Unprot Coarse 10:00:00 Y BIG2.313.791388437
datafile Unprot Coarse 10:00:00 Y sysaux.257.779883619
datafile Unprot Coarse 10:00:00 Y system.256.779883617
datafile Unprot Coarse 10:00:00 Y UNDOTBS1.258.779883619
datafile Unprot Coarse 10:00:00 Y UNDOTBS2.261.779883897
datafile Unprot Coarse 10:00:00 Y users.259.779883619

Asmcmd>




"Translated from MoS article" for each file's file.id and file.incarnation number, rename the file alias

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.