asm中的文件命名
ASM generates filenames according to the following scheme:
+diskGroupName/databaseName/fileType/fileTypeTag.file.incarnation
例如+dgroup2/sample/controlfile/Current.256.541956473
在磁盘组dgroup1中创建自己的目录mydir
mkdir +dgroup1/mydir
要是启用asmcmd的时候带了-p,那么在prompt中总是会显示当前目录
准备运行asmcmd
1登录设置ORACLE_HOME和ORACLE_SID变量,这些变量要指定到asm实例上。在rac中asm sid是+ASMnode#
2确认oracle home的bin目录在PATH环境变量中
% asmcmd -p
ASMCMD [+] > cd dgroup1/mydir
ASMCMD [+DGROUP1/MYDIR] >
du
Purpose
Displays the total space used for files in the specified directory and in the entire directory tree under it.
Syntax and Description
du [-H] dir
find
Purpose
Displays the absolute paths of all occurrences of the specified name (with wildcards) in a specified directory and its subdirectories.
Syntax and Description
find [-t type] dir name
找到指定目录下面的文件或路径,-t可以指定要找文件的类型,可以使用类型如下:
CONTROLFILE
DATAFILE
ONLINELOG
ARCHIVELOG
TEMPFILE
BACKUPSET
DATAFILE
PARAMETERFILE
DATAGUARDCONFIG
FLASHBACK
CHANGETRACKING
DUMPSET
AUTOBACKUP
XTRANSPORT
Examples
下面的例子找都group1中的包含undo的文件
ASMCMD> find +dgroup1 undo*
+dgroup1/SAMPLE/DATAFILE/UNDOTBS1.258.555341963
+dgroup1/SAMPLE/DATAFILE/UNDOTBS1.272.557429239
下面的例子返回在+dgroup1/sample这个目录下的所有的控制文件的绝对路径
ASMCMD> find -t CONTROLFILE +dgroup1/sample *
+dgroup1/sample/CONTROLFILE/Current.260.555342185
+dgroup1/sample/CONTROLFILE/Current.261.555342183
ls参数列表

lsct
这个是列出所有的asm客户端,就是使用asm实例的数据库
Syntax and Description
lsct [-H] [group]
If group is specified, information about only that disk group is displayed. The -H flag suppresses column headings.
Example
This example displays information about the client accessing the dgroup1 disk group.
ASMCMD [+] > lsct dgroup1
DB_Name Status Software_Version Compatible_version Instance_Name
sample CONNECTED 10.2.0.0.0 10.2.0.0.0 sample
lsdg
Purpose
Lists all disk groups and their attributes.
Syntax and Description
lsdg [-H] [group]
输出说明
mkalias
Purpose
Creates an alias for the specified system-generated filename.
Syntax and Description
mkalias file alias
在sqlplus中创建别名
ALTER DISKGROUP dg_name ADD ALIAS user_alias FOR file
rmalias
Purpose
Deletes the specified aliases, retaining the files that the aliases reference.
Syntax and Description
rmalias [-r] alias [alias] . . .
在sqlplus中删除别名:
ALTER DISKGROUP dg_name DROP ALIAS user_alias
To recursively delete, use the -r flag. This enables you to delete all aliases in the current directory and in the entire directory tree beneath the current directory. If any user-created directories become empty as a result of deleting aliases, they are deleted also. System-created files and directories are not deleted.
Example
The following example deletes the alias sysaux.f, retaining the datafile that it references.
ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > rmalias sysaux.f