首页 > 数据库 > Oracle > oracle asm asmcmd
asmcmd file management commands: cd,cp,du,find,ls,lsof,mkalias,pwd,rm,rmaliasspbackup,spcopy,spget,spmove,spset,startup
asmcmd template management commands: chtmpl,lstmpl,mktmpl,rmtmplmd_restore,mkdg,mount,offline,online,rebal,remap,setattr,umount
asmcmd volume management commands:volcreate,voldelete,voldisable,volenable,volinfo,volresize,volset,volstatrmgrp,rmusr
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 groupor to an operating system file or an operating system file to diskgroupASMCMD [+data/asm/asmparameterfile] > spbackup REGISTRY.253.801072449 +data/asmspfilebackup.bakASMCMD [+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 spfilein the same disk group(can use spbackup for this purpose)ASMCMD [+data/asm/asmparameterfile] > spcopy REGISTRY.253.801072449 +flash/asmspfilecp.bakASMCMD [+data/asm/asmparameterfile] > spcopy REGISTRY.253.801072449 /oradata/asmspfilecp.bakASMCMD [+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 directorycp :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_filecp [-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 interactionrem_connect_str :specifies the connection string for a remote instancesrc_file :name of the source file to copy. must be either a fully qualified file name or an oracle asm aliastgt_file :a user alias for the created target file name or alias directory namerem_connect_str :user@host[.part_number].SIDsome file bypes cannot be the source or destination of the cp command,these file types includeOCR 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.cpASMCMD [+data/asm] > cp users01.dbf /oradataASMCMD [+data/asm] > cp /oradata/users01.dbf +flash
du :displays the total disk space occupied by files in the specified oracle asm directory and all ofits 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,orthe names and attributes of all disk groups
ASMCMD [+data/asm/datafile] > ls -lASMCMD [+data/asm/datafile] > ls -ltASMCMD [+data/asm/datafile] > ls -sASMCMD [+data/asm/datafile] > ls --permission
lsof :list the open filesmkalias :creates an alias for system-generaterd filenames
ASMCMD [+data/asm] > mkalias +DATA/ASM/DATAFILE/USERS.265.806511631 users01.dbf
mkdir : creates oracle asm directoriespwd :displays the path of the current oracle asm directoryrm : 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 groupiostat :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 -lName Valueaccess_control.enabled FALSEaccess_control.umask 066au_size 1048576cell.smart_scan_capable FALSEcompatible.asm 11.2.0.0.0compatible.rdbms 10.1.0.0.0disk_repair_time 3.6hsector_size 512access_control.enabled FALSEaccess_control.umask 066au_size 1048576cell.smart_scan_capable FALSEcompatible.asm 11.2.0.0.0compatible.rdbms 10.1.0.0.0disk_repair_time 3.6hsector_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 metadatamkdg :create a disk group;mount : mount a disk groupoffline :offlines a disk or a failure grouponline :onlines a disk or a failure grouprebal :rebalance a disk groupremap :relocates data in a range of physical blocks on a disksetattr : set attributes a disk groupumount : 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 fileschmod : change permissions of a file or list of fileschown : change the owner of a file or list of filesgroups : lists the user groups to which a user belongsgrpmod : adds or removes users from an existing user grouplsgrp : lists user groupslsusr : lists users in a disk groupmkgrp : creates a new nusr groupmkusr : adds a user to disk grouppasswd : changes the password of a userrmgrp : deletes a user grouprmusr : deletes a user from a disk group
9,asmcmd volume management commands
volcreate : create an oracle advm volume in the specified groupvoldelete : deletes an oracle advm volumevoldisable :disable oracle advm volumes in mounted disk groupsvolenable :enables oracle advm volumes in mounted disk groupsvolinfo :diskplays information about oracle advm volumesvolresize :resize an oracle advm volumevolset : sets attributes of an oracle advm volume in mounted disk groupsvolstat : reports volume i/o statistics.
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24237320/viewspace-1060202/ ,如需转载,请注明出处,否则将追究法律责任。