RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
如何进行asmcmd的分析

如何进行asmcmd的分析,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。

成都创新互联是一家集网站建设,北川羌族企业网站建设,北川羌族品牌网站建设,网站定制,北川羌族网站建设报价,网络营销,网络优化,北川羌族网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。

在ASM实例中,所有的存储于ASM磁盘组中的文件对于操作系统命令而言是不可访问的,因此 也无法使用常规的命令来操纵ASM磁盘中的文件。所幸的是,我们有ASMCMD工具来代替操作系统命令来完成这部分工作。ASMCMD工具提供了类似于操 作系统的常用命令,如ls , du ,find,cd ,rm ,mkdir等等。借助这些工具可以更轻松的完成ASM实例的相关管理工作。
ASMCMD使用实例
启动前要设定ORACLE_SID环境变量
$ export ORACLE_SID=+ASM    
$ asmcmd

ASMCMD> help                 --在asmcmd命令提示符下,输入help [命令] ,则显示该命令帮助信息
        asmcmd [-p] [command]           --该方式可以直接完成相应的功能而不需要进入到ASMCMD提示符下
        The environment variables ORACLE_HOME and ORACLE_SID determine the 
        instance to which the program connects, and ASMCMD establishes a 
        bequeath connection to it, in the same manner as a SQLPLUS / AS 
        SYSDBA.  The user must be a member of the SYSDBA group.
        Specifying the -p option allows the current directory to be displayed 
        in the command prompt, like so:
        ASMCMD [+DATAFILE/ORCL/CONTROLFILE] >
        [command] specifies one of the following commands, along with its
        parameters.
        Type "help [command]" to get help on a specific ASMCMD command.
        commands:
        --------
        cd
        du
        find
        help
        ls
        lsct
        lsdg
        mkalias
        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的分析的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注创新互联行业资讯频道,感谢各位的阅读!


网站标题:如何进行asmcmd的分析
URL标题:http://scpingwu.com/article/ijcpgp.html