如何分析asmcmd,相信很多没有经验的人都不知所措。因此,本文总结了出现问题的原因和解决方法,希望大家可以通过这篇文章来解决这个问题。
在ASM实例中,操作系统命令无法访问存储在ASM磁盘组中的所有文件,因此
您不能使用常规命令来操作ASM磁盘中的文件。幸运的是,我们有ASMCMD工具来代替操作系统命令来完成这部分工作。ASMCMD工具提供了一个类似于操作的工具
制作系统常用命令,如ls、du、find、cd、rm、mkdir等。有了这些工具,更容易完成ASM实例的相关管理。ASMCMD使用实例
启动前设置ORACLE_SID环境变量。
$ export ORACLE_SID=ASM
$ asmcmd
asmcmdhelp-在asmcmd命令提示符下,输入help [command],将显示该命令的帮助信息。
Asmcmd[-p][command]-]-该方法无需进入ASM cmd提示即可直接完成相应的功能。
环境变量ORACLE_HOME和ORACLE_SID决定了
实例,ASMCMD建立一个
以与SQLPLUS/AS相同的方式将连接遗留给它
SYSDBA。用户必须是SYSDBA组的成员。
指定-p选项允许显示当前目录
在命令提示符下,如so:
数据文件/ORCL/控制文件
[command]指定下列命令之一及其
参数。
键入“help [command]”以获取特定ASMCMD命令的帮助。
命令:
-
激光唱片
杜
发现
帮助
限位开关(Limit Switch)
利脑测验
lsdg
mkalias
n
bsp; mkdir
pwd
rm
rmalias
ASMCMD> help lsct --查看命令的具体用法,本例为lsct
lsct [-H] [group]
List all clients and their attributes from V$ASM_CLIENT. If group is
specified, then return only information on that group.
The -H flag suppresses the column headers from the output.
$ asmcmd -p ls -l --无需进入到ASMCMD命令提示符下完成相应的功能
State Type Rebal Unbal Name
MOUNTED NORMAL N N DG1/
MOUNTED NORMAL N N DG2/
MOUNTED EXTERN N N REV/
ASMCMD> ls -l --查看磁盘组的基本信息
State Type Rebal Unbal Name
MOUNTED NORMAL N N DG1/
MOUNTED NORMAL N N DG2/
MOUNTED EXTERN N N REV/
ASMCMD> ls -s --查看磁盘组的详细信息,如磁盘大小,可用空间,扇区大小等
Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Name
512 4096 1048576 3058 1498 0 749 0 DG1/
512 4096 1048576 200 98 0 49 0 DG2/
512 4096 1048576 3074 2949 0 2949 0 REV/
ASMCMD> ls -ld --查看目录信息
Type Redund Striped Time Sys Name
Y czmmiao/
ASMCMD> du --查看当前目录磁盘已使用的容量
Used_MB Mirror_used_MB
804 1541
ASMCMD> pwd --显示当前路径
+
ASMCMD> cd DG1 --cd 命令改变当前目录
ASMCMD> pwd
+DG1
ASMCMD> find -t datafile +DG1/asmdb sys* --find 用于查找对象,-t参数指定对象类型,对象类型必须是v$asm_file.type中的对象类型
+DG1/asmdb/DATAFILE/SYSAUX.261.734885459
+DG1/asmdb/DATAFILE/SYSTEM.259.734885389
ASMCMD> cd +DG1/asmdb/DATAFILE/
ASMCMD> mkalias EXAMPLE.264.800386585 aaa --给对象创建别名
ASMCMD> ls
EXAMPLE.264.800386585
SYSAUX.257.800386397
SYSTEM.256.800386395
UNDOTBS1.258.800386397
UNDOTBS2.265.800386713
USERS.259.800386397
aaa
ASMCMD> ls -a --查看别名信息,该信息来自v$asm_alias
+DATA/CZMMIAO/DATAFILE/aaa => EXAMPLE.264.800386585
none => SYSAUX.257.800386397
none => SYSTEM.256.800386395
none => UNDOTBS1.258.800386397
none => UNDOTBS2.265.800386713
none => USERS.259.800386397
aaa
ASMCMD> rmalias aaa --删除对象别名
ASMCMD> ls -a
none => EXAMPLE.264.800386585
none => SYSAUX.257.800386397
none => SYSTEM.256.800386395
none => UNDOTBS1.258.800386397
none => UNDOTBS2.265.800386713
none => USERS.259.800386397
ASMCMD> lsdg --查看磁盘组信息
State Type Rebal Unbal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Name
MOUNTED EXTERN N N 512 4096 1048576 3815 2529 0 2529 0 DATA/
ASMCMD> lsct --查看asm客户端信息
DB_Name Status Software_Version Compatible_version Instance_Name
czmmiao CONNECTED 10.2.0.1.0 10.2.0.1.0 czmmiao1
ASMCMD> mkdir bbb ccc -- 创建bbb和ccc目录
ASMCMD> ls
EXAMPLE.264.800386585
SYSAUX.257.800386397
SYSTEM.256.800386395
UNDOTBS1.258.800386397
UNDOTBS2.265.800386713
USERS.259.800386397
bbb/
ccc/
ASMCMD> rmdir bbb ccc --删除bbb和ccc目录,rm命令有-r和-f两个参数,用法同linux的rm命令
11g R2新增命令
cp:不仅可以在ASM和OS之间复制文件,也可以在不同的ASM Instance和Diskgroup之间复制文件;
cp +dgtest/test/datafile/USERS.264.646186565 users.dbf
md_backup: 将disk group中的metadata备份到文件;
md_backup /tmp/backupfile -G DATAGP
md_restore: 将备份文件中的metadata恢复到disk group;
md_restore -full -G data --silent /tmp/file
lsattr: 列出disk group的属性;
lsattr -l -G DATAGP
setattr: 设置disk group的属性;
setattr -G DATAGP compataible.asm 11.2.0.0.0
lsof: 显示local clients的open files;
lsof -G DATAGP
chdg: 修改disk group, add或drop disk;
chdg DATAGP_config.xml
chkdg: check 或 repair disk group 的metadata;
chkdg --repair DATAGP
dropdg: drop disk group;
dropdg -r -f DATAGP
iostat: 查看I/O statics通过v$asm_disk_iostat;
iostat -G DATAGP
lsdsk: list ASM disks;
lsdsk -p -G DATAGP /dev/raw/* ;
lsdsk --candidate -p
lsod: list open ASM disks;
lsod -G DATAGP
mkdg: create disk group based on a xml file;
mkdg DATAGP_config.xml
mount: mount a disk group;
mount -f DATAGP;
mount --restrict DATAGP;
mount -a
offline: offline disks or failure groups that belong to disk group.
offline -G DATAGP -F FG1
online: online disks or a failure group;
online -G DATAGP -D data_0001 --power=3
rebal: rebalance a disk group;
rebal --power 4 DATAGP
remap: mark blocks as unusable on the disk and relocates data;
remap DATAGP data_0001 500-700
umount: dismount a disk group;
unmount -f DATAGP
pwcopy: copy password file;
pwcopy --asm +DG/mydir/mypwfile +DG1/mypwfile
pwcreate: create password file for sys;
pwcreate --asm +DG/mdir/mypwfile 'welcome'
pwdelete: delete password file;
pwdelete --asm +DG/mydir/mypwfile
pwget: get the location of password file;
pwget --asm
pwmove: move password file;
pwmove --asm +DG/mydir/mypwfile +DG1/mypwfile
pwset: set the location of password file;
pwset -dbuniquename aime1 +DG/mydir/mypwfile
dsget: get the discovery disk string;
dsget
dsset: set the discovery disk string;
dsset /dev/raw/*
lsop: list current operations on disk group from v$asm_operation;
lsop
shutdown: shutdown ASM instance;
shut immediate
spbackup: backup ASM Spfile;
spbackup +DATA/asm/asmprameterfile/register.323.234 +DATA/spf.bak
spcopy: copy spfile;
spcopy +DATA/asm/asmprameterfile/register.323.234 +DATA/spf.ora
spget: get the spfile location;
spget
spmove: move spfile;
spmove +DATA/spf.ora +DATA1/spf.ora
spset: set the location of spfile;
spset +DATA/spf.ora
startup: start up ASM instance;
startup --nomount --pfile asm.ora
chtmpl:改变template的属性;
chtmpl -G DATAGP --redundancy high --striping fine mytemplate
lstmpl: list templates;
ls -l -G DATAGP
mktmpl: add template to disk group;
mktmpl -G DATA --redundancy mirror --striping coarse
rmtmpl: remove template from disk group;
rmtmpl -G DATAGP mytp
chgrp: change user group of files;
chgrp asm-data +data/mydir/a.f
chmod: change permissions of files;
chmod 640 a.f
chown: change owner of files;
chown user:usergroup a.f
groups: list all user groups of a user;
groups DATAGP user
grpmod: add or remove OS users to ASM user group;
grpmod --add fra asm_fra oracle1 oracle2
lsgrp: list all ASM user groups;
lsgrp -a
lspwusr: list users from ASM password file;
lspwusr
lsusr: list users in a disk group;
lsusr -G DATAGP
mkgrp: create new ASM user group;
mkgrp DATAGP asm_data oracle1 oracle2
mkusr: add OS user to a disk group;
mkusr DATA oracle1
orapwusr: add, drop, modify ASM password file user;
orapwusr --add --privilege sysdba hrusr
passwd: change password of a user;
passwd oracle2
rmgrp: remove a user group from disk group;
rmgrp DATAGP asm_data
rmusr: remove a OS user from disk group;
rmusr DATAGP oracle2
rpusr: replace OS user1 with OS user2;
rpusr DATAGP oracle1 oracle2
volcreate: create an ADVM volume in disk group;
volcreate -G DATA -s 10G --width 64K --column 8 volume1
voldelete: delete an ADVM volume;
voldelete -G DATAGP volume1
voldisable: disable an ADVM volumes in mounted disk groups and remove the volume device on the local node;
voldisable -G DATAGP volume1
volenable: enable ADVM volume in mounted disk groups;
volenable -G DATAGP volume1
volinfo: display information of ADVM volumes;
volinfo -G DATAGP volume1
volresize: resize an ADVM volume;
volresize -G DATAGP -s 20G volume1
volset: set attributes of ADVM volume;
volset -G DATA --usagestring 'no file system attached' volume1
volstat: report I/O statistics of ADVM volume;
volstat -G DATAGP
看完上述内容,你们掌握如何进行asmcmd的分析的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注行业资讯频道,感谢各位的阅读!
内容来源网络,如有侵权,联系删除,本文地址:https://www.230890.com/zhan/126273.html