I. Management of ASM files
1. ASM file Overview:
The names of ASM files are different from those of common files. The names of their files are not directly specified.
And the management method is OMF. If specified, the file management method is no longer OMF.
When the ASM file name is used:
A. reference the ASM file
B. Create an ASM file
2. File naming rules:
1) Full name:
Format: + diskgroup_name/database_name/filetype/file_name.xxx.xxxx
Purpose: it can only be used for reference and cannot be specified when an ASM file is created.
Note: xxx indicates a number, which is unique.
Example: + dgdata/info/datafile/system.256.78684974
2) digital naming:
Format: file_name.xxx.xxxx
Purpose: it can only be used for reference and cannot be specified when an ASM file is created.
Note: xxx indicates a number, which is unique.
Example: system.256.78684974
3) incomplete naming:
Format: + diskgroup_name
Purpose: used to create an ASM file. It is specified when the file is created. The corresponding file name is automatically generated by ASM.
Note: The file is OMF.
Example: create tablespace test datafile '+ dgdata' size 100 m;
4) incomplete names with templates:
Format: + diskgroup_nametemplate_name)
Purpose: used to create an ASM file. It is specified when the file is created. The corresponding file name is automatically generated by ASM.
Note: The file is OMF.
Example: create tablespace test datafile '+ dgdatamy_template) 'size 100 m;
5) Alias Name:
Format: + diskgroup_name/directory1 /... /DirectoryN/file_name.dbf
Purpose: Create an ASM file, which is specified during file creation. Essentially, it creates an alias and
And the alias points to the ASM file.
Note: If you create a file by specifying an alias, the file is not OMF.
In ASM, directories cannot be recursively created and must be created on a layer-by-layer basis. The same is true for deletion.
Example: create tablespace test
Datafile '+ dgdata/info/test_01.dbf 'size 150 m;
Ii. Management of the ASM directory can be replaced by ASMCMD)
1. The directory concept also exists in ASM.
2. + ------ indicates the root directory
3. directories in ASM cannot be recursively created.
4. The non-empty directory cannot be deleted directly in ASM. You need to delete the contents in the directory first, and then delete the upper directory.
5. Directory operations in ASM:
A. Add a directory
Command:
Alter diskgroup diskgroup_name
Add directory '+ diskgroup_name/directory1/directory_name'
Note:
When adding a directory, the upper-level directory must exist; otherwise, the addition fails.
E.g .:
Alter diskgroup dgdata1 add
Add directory '+ dgdata1/info/datafile ';
B. delete a directory
Command:
Alter diskgroup diskgroup_name
Drop directory '+ diskgroup_name/directory1/directory_name'
Note:
When deleting a directory, the directory should be empty; otherwise, the deletion fails.
E.g .:
Alter diskgroup dgdata1 add
Drop directory '+ dgdata1/info/datafile ';
3. Management of ASM aliases can be replaced by ASMCMD)
1. Alias addition:
Command:
Alter diskgroup diskgroup_name
Add alias alias_name for 'asm _ file ';
E.g .:
Alter diskgroup dgdata1
Add alias '+ dgdata1/salse. dbf' for' + dgdata1/info/datafile/system.256.78684974 ';
2. Alias deletion:
Command:
Alter diskgroup diskgroup_name
Drop alias alias_name;
E.g .:
Alter diskgroup dgdata1
Add alias '+ dgdata1/salse. dbf ';
3. view the alias:
The alias information is stored in view v $ asm_alias. View
ALIAS_DIRECTORY ----- indicates whether the alias is a directory
SYSTEM_CREATED ------ indicates whether the alias is created by the system.
By default, each ASM file has its own Alias.
Run the following command to View Details:
Select * from v $ asm_alias;
4. aliases can only be used for files and cannot be used to create aliases for directories.
Iv. Use of ASMCMD
ASMCMD is a tool provided by ASM. It manages files and directories on the ASM disk. You can implement the following functions:
1. Create the directory mkdir)
2. Delete the rm directory)
3. Switch the directory to cd)
4. Create an alias mkalias)
5. Delete the alias rmalias)
6. display the current directory pwd)
7. display file entries ls)
Command usage:
Each command in ASMCMS has its own help system. The usage is as follows: help command
Instructions for use:
1) Create the directory mkdir)
Asmcmd> mkdir directory_name
E. g:
Asmcmd> mkdir info
2) Delete the directory rm)
Asmcmd> rm file_name
E. g:
Asmcmd> rm test_01.dbf
Asmcmd> rm *
3) switch the directory cd)
Asmcmd> cd directory_name
E. g:
Asmcmd> cd info
4) Create an alias mkalias)
Asmcmd> mkalias asm_file_name alias_name
Note: you cannot create an alias for a directory.
E. g:
Asmcmd> mkalias '+ dgdata/info/datafile/system.256.78684974' system. dbf
5) Delete the alias rmalias)
Asmcmd> rmalias alias_name
Asmcmd> rmalias system. dbf
Note: The alias cannot be deleted using the rm command. Otherwise, the original file will be deleted.
6) display the current directory pwd)
Asmcmd> pwd
7) display file entries ls)
Asmcmd> ls
Note:
1) directories in ASM cannot be recursively created and must be created at different layers. The non-empty directory cannot be deleted either. You need to delete the directory first.
Directory before deleting the directory.
2) In ASMCMD:
Mkdir = alter diskgroup diskgroup_name add directory
Rm directory_name = alter diskgroup diskgroup_name drop directory 'xxxx'
Mkalias = alter diskgroup diskgroup_name add alias
Rmalias = alter diskgroup diskgroup_name drop alias
They have different forms of expression, but they are essentially the same and have the same effect.
3) aliases are only valid for files and cannot be used to create aliases for directories.
V. Others
1. Modify the ASM disk rebalancing speed.
Command:
Alter diskgroup diskgroup_name rebalance power N; N = 0, 1, 2 ,... 11)
Note:
Letter N represents the speed of rebalancing. 0 indicates that the rebalance function is disabled; 1 indicates the minimum speed and throughput,
The minimum impact on users, the fastest speed at 11, the maximum throughput, and the greatest impact on users. The default value is 1.
E. g:
Alter diskgroup dgdata2 rebalance power 3;
# Modify the rebalancing speed of the disk group dgdata2 to 3.
Oracle video tutorial follow: http://u.youku.com/user_video/id_UMzAzMjkxMjE2.html