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.dbfmd_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
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29209863/viewspace-2126226/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- asmcmd工具的詳細介紹ASM
- 【asmcmd】使用asmcmd工具管理ASMASM
- asmcmdASM
- ASMCMD命令ASM
- ASMCMD - cpASM
- 使用asmcmdASM
- oracle asm asmcmdOracleASM
- ASM工具asmcmdASM
- ASMCMD簡介(1)ASM
- asmcmd命令學習ASM
- 【ASM】ASMCMD cp 命令ASM
- asmcmd命令用法教程ASM
- asmcmd does not exist in directoryASM
- Oracle ASMCMD命令參考OracleASM
- OCP(11g)------> ASM Command-Line Utility (ASMCMD)和 使用 ASMCMDASM
- ASMCMD中的各個命令ASM
- asmcmd的cp命令小bugASM
- asmcmd的一個問題ASM
- 關於"asmcmd: command disallowed by current instance type"問題解決ASM
- asmcmd對磁碟組的處理ASM
- ASMCMD處理問題一則ASM
- ASMCMD - ASM command line utility .ASM
- asmcmd: command disallowed by current instance typeASM
- ASM命令列管理工具asmcmdASM命令列
- Oracle 12C ASM asmcmd amdu_extractOracleASM
- asmcmd lsdsk和lsdg檢視asmdisk和asmdiskgroupASM
- grid使用者asmcmd命令相關ASM
- 【ASM】ASMCMD chtmpl 更改ASM 模版的屬性ASM
- 學習ASM技術(六)-- ASMCMD命令列ASM命令列
- 使用 ASMCMD 工具管理ASM目錄及檔案ASM
- oracle 11gR2 asmcmd工具增加 cp命令OracleASM
- http協議/cookie詳解/session詳解HTTP協議CookieSession
- Lombok 註解詳解Lombok
- Java註解詳解Java
- Java 註解詳解Java
- asmcmd:connected to an idle instance ORA12705ASM
- 【ASM】ASMCMD 之md_backup,md_restore介紹ASMREST
- 用asmcmd 的rebal 代替 ASM_POWER_LIMIT 引數ASMMIT