[Translated from mos] For file. idandfile. incarnationn of each file

Source: Internet
Author: User
For the file. idandfile. incarnationnumber of each file, to rename the file alias, refer to the original article: RenameAliasofDatafileasPerfile. idandfile. incarnationnumber (DocID1494661.1) applicable to: OracleDatabase

For each file. id and file. incarnation number. to Rename a file Alias, refer to the original article: Rename Alias of Datafile as Per file. id and file. incarnation number (Doc ID 1494661.1) applies to: Oracle Database-Enterprise Edition-Version 11.2.0.0 and late

Rename the file alias for each file. id and file. incarnation number

Reference Original:
Rename Alias of Datafile as Per file. id and file. incarnation number (Doc ID 1494661.1)

Applicable:
Oracle Database-Enterprise Edition-Version 11.2.0.0 and later
Information in this document applies to any platform.

Objectives:
For each database name, remove the data file alias and move them to the correct directory.

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

2. Verify the alias and omf file name from asmcmd

3. perform a full backup of the database

4. Make the tablespace offline. If the tablespace has only one datafile

5. Run the set new filename command using rman.

Restore tablespace ikp;
SWITCH DATAFILE ALL
RECOVER TABLESPACE

6. Check whether the control file has replaced the alias with a new name. Use the rmalias command to remove an alias from asmcmd

As an optional method, you can use the sqlplus command to rename datafile


Symptoms:

Asm file and alias

Transmit tablespace, and several tablespaces are appended to rac databases with asm.
In asm, the actual file appears to be located in the wrong path /ASM/directory
Instead of in the original path / /Datafile path
You need to move the file to the correct path in asm, such / /Datafile/path


Changes:

When you use various methods (asmcmd cp or DBMS_FILE_TRANSFER) to copy datafile at the asm level,

Assume that you use the asmcmd cp command to copy o1_mf_dcs_83w90ymg _. dbf from the file system to asm.

ASMCMD> cp/tmp/o1_mf_dcs_83w90ymg _. dbf + DATA/ORASV3/DATAFILE/o1_mf_dcs_83w90ymg _. dbf

ASMCMD> pwd
+ Data/asm/datafile

ASMCMD> ls-
+ DATA/ORASV3/DATAFILE/o1_mf_dcs_83w90ymg _. dbf => ow.wf_dcs_83w90ymg _. dbf.350.792589015

The database show the datafile to be:
+ DATA/ORASV3/DATAFILE/o1_mf_dcs_83w90ymg _. dbf

Cause:

In the preceding example,
ASMCMD> ls-
+ DATA/ORASV3/DATAFILE/o1_mf_dcs_83w90ymg _. dbf => ow.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 through dbca or rman restore, these datafiles will be created in the correct directory --- diskgroup name/database name/datafile

However, when files are copied using the asmcmd cp method, these files are unknown to asm and an identity is assigned to these files. Asm gives a file_id and incarnation_number

In other words, this is an alias created when you choose to store data files (target,
Then, datafile is actually stored in + DATA/ASM/DATAFILE, such as 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.

If you want to move the database in another disk group,
Please refer to How to move ASM database files from one diskgroup to another? (Docid 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, that is, fully qualified filename.
The fully qualified filename represents a full path name 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 reference (read or retrieve) An asm file.
You can use other short file name formats, such as alias ASM filename. the alias ASM filename is described as "Alias ASM Filenames" to reference an asm file.

Based on the file creation request, asm generates fully qualified filename. The fully qualified filename cannot be specified for a file creation request.

As an alternative, use a simpler syntax to specify a file, such as an alias (alias) or a disk group name.

Then, asm creates a file, places the file in the correct asm path according to the file type, and assigns a fully qualified filename

If alias is specified in the file creation request, asm can also create alias so that the alias can reference fully qualified filename

The asm file creation request can be a single file creation request or multiple file creation requests.

You can use the following query to find the alias (enter the keyword). This query needs to be executed in the asm instance.
Here, we use 'test' as the 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
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/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 aug 22 10:00:00 Y big1.20..791388381
Datafile unprot coarse aug 22 10:00:00 Y BIG2.313.791388437
Datafile unprot coarse aug 22 10:00:00 Y SYSAUX.257.779883619
Datafile unprot coarse aug 22 10:00:00 Y SYSTEM.256.779883617
Datafile unprot coarse aug 22 10:00:00 Y UNDOTBS1.258.779883619
Datafile unprot coarse aug 22 10:00:00 Y UNDOTBS2.261.779883897
Datafile unprot coarse aug 22 10:00:00 Y USERS.259.779883619

ASMCMD>

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.