oracle asm asmcmd

tolilong發表於2013-02-08
1,asmcmd command type[@more@]
asmcmd instance management command: dsget,dsset,lsct,lsop,lspwusr,orapwusr,shutdown
spbackup,spcopy,spget,spmove,spset,startup
asmcmd file management commands: cd,cp,du,find,ls,lsof,mkalias,pwd,rm,rmalias
asmcmd disk group management commands: chdg,chkdg,dropdg,iostat,lsattr,lsdg,lsdsk,lsod,md_backup,
md_restore,mkdg,mount,offline,online,rebal,remap,setattr,umount
asmcmd template management commands: chtmpl,lstmpl,mktmpl,rmtmpl
asmcmd file access control commands: chgrp,chmod,chown,groups,grpmod,lsgrp,lsusr,mkgrp,mkusr,passwd,
rmgrp,rmusr
asmcmd volume management commands:volcreate,voldelete,voldisable,volenable,volinfo,volresize,volset,volstat
2,asmcmd -p
[grid@asm ~]$ asmcmd -p
ASMCMD [+] > ls
DATA/
FLASH/
ASMCMD [+] > cd data
ASMCMD [+data] > ls
ASM/
ASMCMD [+data] > cd asm
ASMCMD [+data/asm] > ls -l
3,獲取asmcmd中comand的幫助文件
ASMCMD> help dsget
dsget [--normal|--parameter|--profile [-f]]

Retrieve the diskstring value from the ASM server and gPnP profile;
[--normal] gets the diskstring from gPnP profile and ASM instance.
[--profile] retrieves the diskstring from gPnP profile.
[-f] retrieves the diskstring from local gPnP profile.
used only with --profile
cluster stack should not be up while using this option
[--parameter] Retrieves the ASM_DISKSTRING parameter from ASM instance.
4,asmcmd instance management command
dsget :retrieves the discovery diskstring value that is used by the oracle asm instance and its clients
dsset :set the discovery diskstring value that is used by the oracle asm instance and its clients
lsct :list information about current oracle asm instance client
information from v$asm_client
lsop :list current operation on a disk group or oracle asm instance
information from v$asm_operation
lspwusr :lists the users from an oracle asm password file
orapwusr :adds,drops,or changes an oracle asm password usr
ASMCMD> orapwusr --add --privilege sysdba hr
Enter password: ******
ASMCMD> lspwusr
Username sysdba sysoper sysasm
SYS TRUE TRUE TRUE
ASMSNMP TRUE FALSE FALSE
ASM FALSE FALSE TRUE
HR TRUE FALSE FALSE
shutdown :shuts down an oracle asm instance
spbackup :backs up an oracle asm spfile
spbackup can backup an oracle asm spfile from a disk group to a disk group
or to an operating system file or an operating system file to diskgroup
ASMCMD [+data/asm/asmparameterfile] > spbackup REGISTRY.253.801072449 +data/asmspfilebackup.bak
ASMCMD [+data/asm/asmparameterfile] > spbackup REGISTRY.253.801072449 /oradata/asmspfilebackup.bak
spcopy : copies an oracle asm spfile
ASMCMD [+data/asm/asmparameterfile] > spcopy REGISTRY.253.801072449 +data/asmspfilecp.back
ORA-15056: additional error message
ORA-17502: ksfdcre:4 Failed to create file +data/asmspfilecp.back
ORA-15268: internal Oracle file +DATA.253.1 already exists.
ORA-06512: at line 7 (DBD ERROR: OCIStmtExecute)
present this error because of spcopy cannot make multiple copies of an oracle asm spfile
in the same disk group(can use spbackup for this purpose)
ASMCMD [+data/asm/asmparameterfile] > spcopy REGISTRY.253.801072449 +flash/asmspfilecp.bak
ASMCMD [+data/asm/asmparameterfile] > spcopy REGISTRY.253.801072449 /oradata/asmspfilecp.bak
ASMCMD [+data/asm/asmparameterfile] > spcopy -u REGISTRY.253.801072449 +flash/asmspfilecp25.bak
spget : retrieve the location of the oracle asm spfile
ASMCMD [+] > spget
+flash/asmspfilecp25.bak
spmove :move an oracle asm spfile
spset : sets the location of the oracle asm spfile
startup :starts up an oracle asm instance
5,asmcmd file management commands
cd :changes the current directory to the specified directory
cp :enables you to copy files between disk groups,and between a disk group and the operation system
cp [-i][-f] src_file[rem_connect_str:] tgt_file
cp [-i][-f] [rem_connect_str:]src_file tgt_file
-i :specifies the interactive option,promts before copying or overwriting a file
-f :specifies the force option,if the destination file exists,remove it and then try again without usr interaction
rem_connect_str :specifies the connection string for a remote instance
src_file :name of the source file to copy. must be either a fully qualified file name or an oracle asm alias
tgt_file :a user alias for the created target file name or alias directory name
rem_connect_str :user@host[.part_number].SID
some file bypes cannot be the source or destination of the cp command,these file types include
OCR and OCR backup file types. to backup,copy,or move an oracle asm spfile,use the spbakup,
spcopy,or spmove command.
ASMCMD [+data/asm] > cp users01.dbf +data/users01.dbf.cp
ASMCMD [+data/asm] > cp users01.dbf /oradata
ASMCMD [+data/asm] > cp /oradata/users01.dbf +flash
du :displays the total disk space occupied by files in the specified oracle asm directory and all of
its subdirectories,recursively,
ASMCMD [+data/asm] > du +data
Used_MB Mirror_used_MB
1501 1501
ASMCMD [+data/asm] > cd datafile
ASMCMD [+data/asm/datafile] > du
Used_MB Mirror_used_MB
1283 1283
find :lists the paths of all occurrences of the specified name(with wildcards) under the specified directory
ASMCMD [+] > find +data user*
ASMCMD [+] > find --type datafile +data user*
ls : lists the contents of an oracle asm directory,attributes of the specified file,or
the names and attributes of all disk groups
ASMCMD [+data/asm/datafile] > ls -l
ASMCMD [+data/asm/datafile] > ls -lt
ASMCMD [+data/asm/datafile] > ls -s
ASMCMD [+data/asm/datafile] > ls --permission
lsof :list the open files
mkalias :creates an alias for system-generaterd filenames
ASMCMD [+data/asm] > mkalias +DATA/ASM/DATAFILE/USERS.265.806511631 users01.dbf
mkdir : creates oracle asm directories
pwd :displays the path of the current oracle asm directory
rm : deletes the specified oracle asm files or directories.
rmalias : deletes the specified alias,retaining the file that the alias points to.
ASMCMD [+data/asm] > rmalias users01.dbf
6,asmcmd disk group management commands
chdg :change a disk group(add,drop or rebalance)
chkdg : check or repairs a disk group
ASMCMD> chkdg --repair flash
dropdg :drops a disk group
iostat :displays I/O statistics of disks
ASMCMD> help iostat
iostat [-etH][--io][--region] [-G dgname] [interval]

Report statistics and input/output statistics. The statistics
are reported just for mounted devices.

[interval] Refresh interval.
[--io] Display information in IOs, instead of bytes.
[--region] Display regions information
[-e] Display error statistics.
[-t] Display time statistics.
[-G ] List statistics for a specific disk group.
[-H] Suppress column headers.
ASMCMD> iostat 3 --region
lsattr :lists the attributes of a disk group
ASMCMD> lsattr -l
Name Value
access_control.enabled FALSE
access_control.umask 066
au_size 1048576
cell.smart_scan_capable FALSE
compatible.asm 11.2.0.0.0
compatible.rdbms 10.1.0.0.0
disk_repair_time 3.6h
sector_size 512
access_control.enabled FALSE
access_control.umask 066
au_size 1048576
cell.smart_scan_capable FALSE
compatible.asm 11.2.0.0.0
compatible.rdbms 10.1.0.0.0
disk_repair_time 3.6h
sector_size 512
lsdg :list disk groups and their information
ASMCMD> lsdg --discovery
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N 512 4096 1048576 6134 4579 0 4579 0 N DATA/
MOUNTED EXTERN N 512 4096 1048576 4094 4026 0 4026 0 N FLASH/
lsdsk :list disks oracle asm disks
ASMCMD> lsdsk -t -p -G data
Group_Num Disk_Num Incarn Mount_Stat Header_Stat Mode_Stat State Create_Date Mount_Date Repair_Timer Path
1 0 3915912477 CACHED MEMBER ONLINE NORMAL 03-DEC-12 05-FEB-13 0 ORCL:DATA01
1 1 3915912478 CACHED MEMBER ONLINE NORMAL 03-DEC-12 05-FEB-13 0 ORCL:DATA02
lsod :lists open devices
ASMCMD> lsod -G data --process LGWR
Instance Process OSPID Path
1 oracle@asm (LGWR) 4076 ORCL:DATA01
1 oracle@asm (LGWR) 4076 ORCL:DATA02
md_backup :create a backup of the metadata of mounted disk groups
ASMCMD> md_backup /oradata/disk_md_backup
Disk group metadata to be backed up: DATA
Disk group metadata to be backed up: FLASH
Current alias directory path: users01-a
Current alias directory path: ASM/ONLINELOG
Current alias directory path: ASM/ASMPARAMETERFILE
Current alias directory path: ASM/CONTROLFILE
Current alias directory path: ASM
Current alias directory path: ASM/PARAMETERFILE
Current alias directory path: ASM/DATAFILE
Current alias directory path: ASM/TEMPFILE
Current alias directory path: ASM
Current alias directory path: ASM/ASMPARAMETERFILE
Current alias directory path: ASM/DATAFILE
ASMCMD> md_backup /oradata/disk_md_backup_data -G data
Disk group metadata to be backed up: DATA
Current alias directory path: users01-a
Current alias directory path: ASM/ONLINELOG
Current alias directory path: ASM/ASMPARAMETERFILE
Current alias directory path: ASM/CONTROLFILE
Current alias directory path: ASM
Current alias directory path: ASM/PARAMETERFILE
Current alias directory path: ASM/DATAFILE
Current alias directory path: ASM/TEMPFILE
md_restore :restore disk group from a backup of the metadata
mkdg :create a disk group;
mount : mount a disk group
offline :offlines a disk or a failure group
online :onlines a disk or a failure group
rebal :rebalance a disk group
remap :relocates data in a range of physical blocks on a disk
setattr : set attributes a disk group
umount : diskmount a diskgroup
7,asmcmd template management commands
chtmpl : change the attribute of a template
lstmpl : lists disk group templates
ASMCMD> lstmpl -l -G data
Group_Name Group_Num Name Stripe Sys Redund PriReg MirrReg
DATA 1 ARCHIVELOG COARSE Y UNPROT COLD COLD
DATA 1 ASMPARAMETERBAKFILE COARSE Y UNPROT COLD COLD
DATA 1 ASMPARAMETERFILE COARSE Y UNPROT COLD COLD
DATA 1 ASM_STALE COARSE Y UNPROT COLD COLD
DATA 1 AUTOBACKUP COARSE Y UNPROT COLD COLD
DATA 1 BACKUPSET COARSE Y UNPROT COLD COLD
DATA 1 CHANGETRACKING COARSE Y UNPROT COLD COLD
DATA 1 CONTROLFILE FINE Y UNPROT COLD COLD
DATA 1 DATAFILE COARSE Y UNPROT COLD COLD
DATA 1 DATAGUARDCONFIG COARSE Y UNPROT COLD COLD
DATA 1 DUMPSET COARSE Y UNPROT COLD COLD
DATA 1 FLASHBACK COARSE Y UNPROT COLD COLD
DATA 1 FLASHFILE COARSE Y UNPROT COLD COLD
DATA 1 OCRBACKUP COARSE Y UNPROT COLD COLD
DATA 1 OCRFILE COARSE Y UNPROT COLD COLD
DATA 1 ONLINELOG COARSE Y UNPROT COLD COLD
DATA 1 PARAMETERFILE COARSE Y UNPROT COLD COLD
DATA 1 TEMPFILE COARSE Y UNPROT COLD COLD
DATA 1 XTRANSPORT COARSE Y UNPROT COLD COLD
mktmpl : adds a template to a disk group
ASMCMD> mktmpl -G data --redundancy unprotected --striping coarse mytemplate
rmtmpl :removes a template from a disk group
ASMCMD> rmtmpl -G data mytemplate
8,asmcmd file access control commands
chgrp : changes the user group of a file or list of files
chmod : change permissions of a file or list of files
chown : change the owner of a file or list of files
groups : lists the user groups to which a user belongs
grpmod : adds or removes users from an existing user group
lsgrp : lists user groups
lsusr : lists users in a disk group
mkgrp : creates a new nusr group
mkusr : adds a user to disk group
passwd : changes the password of a user
rmgrp : deletes a user group
rmusr : deletes a user from a disk group
9,asmcmd volume management commands
volcreate : create an oracle advm volume in the specified group
voldelete : deletes an oracle advm volume
voldisable :disable oracle advm volumes in mounted disk groups
volenable :enables oracle advm volumes in mounted disk groups
volinfo :diskplays information about oracle advm volumes
volresize :resize an oracle advm volume
volset : sets attributes of an oracle advm volume in mounted disk groups
volstat : reports volume i/o statistics.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24237320/viewspace-1060202/,如需轉載,請註明出處,否則將追究法律責任。

相關文章