Understanding ASM (6) ASM file management

Source: Internet
Author: User

① ASM file conversion


Take the created asmtest tablespace as an example.


(I) convert OS files to ASM files


Sys @ ORCL> create tablespace asmtest datafile size 10 m;


Tablespace created.


Sys @ ORCL> alter tablespace asmtest offline;


Tablespace altered.


[Oracle @ localhost ~] $ Rman target/



RMAN> backup as copy tablespace asmtest format '+ data ';



RMAN> switch tablespace asmtest to copy;


Datafile 6 switched to datafile copy "+ DATA/orcl/datafile/asmtest.256.798497595"



Sys @ ORCL> alter tablespace asmtest online;


Tablespace altered.



Sys @ ORCL> select file_name from dba_data_files where tablespace_name = 'asmtest ';


FILE_NAME

Bytes ----------------------------------------------------------------------------------------------------

+ DATA/orcl/datafile/asmtest.256.798497595



ASMCMD> mkalias ASMTEST.256.798497595 asmtest. dbf


ASMCMD> ls-al

Type Redund Striped Time Sys Name

Datafile mirror coarse nov 04 20:00:00 Y + DATA/ORCL/DATAFILE/asmtest. dbf => ASMTEST.256.798497595

N asmtest. dbf => + DATA/ORCL/DATAFILE/ASMTEST.256.798497595




(Ii) migrate data files from one diskgroup to another diskgroup


Idle> select file_id from dba_data_files where tablespace_name = 'asmtest ';


FILE_ID

----------

6


Idle> alter tablespace asmtest offline;



[Oracle @ localhost ~] $ Rman target/


RMAN> backup as copy datafile 6 format' + THINK ';



RMAN> switch datafile 6 to copy;



RMAN> recover datafile 6;



RMAN> SQL "alter tablespace asmtest online ";



ASMCMD> find THINK /*

+ THINK/ORCL/

+ THINK/ORCL/DATAFILE/

+ THINK/ORCL/DATAFILE/ASMTEST.256.798503425




(3) Forward the ASM file to the OS file


Sys @ ORCL> select file_name from dba_data_files where tablespace_name = 'asmtest ';


FILE_NAME

Bytes ----------------------------------------------------------------------------------------------------

+ THINK/orcl/datafile/asmtest.256.798503425


Sys @ ORCL> alter tablespace asmtest offline;


Sys @ ORCL> create directory ossrc as '/home/oracle ';


Sys @ ORCL> create directory asmsrc as '+ THINK/orcl/datafile ';


Sys @ ORCL> begin

2 dbms_file_transfer.copy_file ('asmsrc ', 'asmtest. 000000', 'ossrc', 'asm. dbf ');

3 end;

4/


PL/SQL procedure successfully completed.


Sys @ ORCL> alter database rename file '+ THINK/orcl/datafile/asmtest.256.798503425' to '/home/oracle/ASM. dbf ';


[Oracle @ localhost ~] $ Rman target/


RMAN> recover datafile 6;


RMAN> SQL "alter tablespace asmtest online ";



Sys @ ORCL> select file_name from dba_data_files where tablespace_name = 'asmtest ';


FILE_NAME

Bytes ----------------------------------------------------------------------------------------------------

/Home/oracle/ASM. DBF




② File name in ASM


ASM file name, such:

+ THINK/orcl/datafile/asmtest.256.798503425

The above names are generated in the following format:

+ Diskgroup/dbname/file_type/file_type_tag.file.incarnation

● + Diskgroup: disk group name

● Dbname: Database DB_UNIQUE_NAME parameter value

● File_type: the type of the created file, such as CONTROLFILE/DATAFILE/ONLINELOG/ARCHIVELOG/TEMPFILE/BACKUPSET/FLASHBACK.

● File_type_tag: file type label. For example, the tablespace name is usually

● File. incarnation: file number + incarnation, used to ensure that the file is unique

The actual file name and path cannot be specified during file creation. It is completely controlled and managed by oracle omf.

For example:


Sys @ ORCL> alter tablespace asmtest add datafile '+ data' size 10 m;


Tablespace altered.



If the initialization parameter db_create_file_dest is set, you do not need to write the disk name.

Other types of files, such as redo log files, are operated in the same way.

However, trace files, alert files, and dump files cannot be directly stored in ASM.



Oracle video tutorial follow: http://u.youku.com/user_video/id_UMzAzMjkxMjE2.html

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.