ASMCMD - ASM command line utility .
asmcmd can be used by Oracle database administrators to query and manage their ASM systems. Oracle Support Services engineers can use asmcmd to easily retrieve ASM related info for diagnosing and debugging purposes.
asmcmd can be used against ASM versions 10gR1 (10.1.0.n) and 10gR2 (10.2.0.n). In ASM version 10.2 asmcmd is provided by default ASM installation.
To use asmcmd in ASM version 10.1 environment we can just copy relevant files from 10.2 installation into the 10.1 environment as follows.
Linux/UNIX:
Copy/ftp asmcmd and asmcmdcore from 10.2 install into 10.1 $ORACLE_HOME/bin , where $ORACLE_HOME is the oracle home where ASM is installed. These two files should be owned by the oracle user and the dba group, and have the following permissions:
asmcmd: 550
asmcmdcore: 440
Windows:
Copy/ftp asmcmd.bat and asmcmdcore from 10.2 install into %ORACLE_HOME%/bin, where %ORACLE_HOME% is the oracle home where ASM is installed.
ASMCMD - ASM command line utility
Reference summary of asmcmd commands.
cd Changes the current directory to the specified directory.
du Displays the total disk space occupied by ASM files in the
specified ASM directory and all its subdirectories, recursively.
exit Exits ASMCMD.
find Lists the paths of all occurrences of the specified name (with
wildcards) under the specified directory.
help Displays the syntax and description of ASMCMD commands.
ls Lists the contents of an ASM directory, the attributes of the
specified file, or the names and attributes of all disk groups.
lsct Lists information about current ASM clients.
lsdg Lists all disk groups and their attributes.
mkalias Creates an alias for a system-generated filename.
mkdir Creates ASM directory.
pwd Displays the path of the current ASM directory.
rm Deletes the specified ASM files or directories.
rmalias Deletes the specified alias, retaining the file that the alias
points to.
一個小指令碼:
asm.sh, a Linux shell script, that demonstrates some of the asmcmd functionality.
#!/bin/bash
#
# asm.sh - ASM reports by Bane Radulovic, Oracle Corporation, 2005
#
# asm.sh [-db DBNAME]
# Report on all disk groups in the current ASM instance;
# Current ASM instance is determined by env variable ORACLE_SID;
# asmcmd should be in the PATH
# asm.sh [-db DBNAME] -space
# Report on space used by dataabase DBNAME
# If DBNAME not specified report on total disk space used by all databases
# asm.sh [-db DBNAME] -files
# Report all files for database DBNAME managed by this ASM instance
# If DBNAME not specified report all files managed by this ASM instance
#
# Usage notes:
# All arguments are optional.
# If database name is not supplied, report on all disk groups/space/files.
# Report on total space in all disk groups only if database name not specified.
#
# Open issues
# 1. We don't detect if ASM instance is not up and if the environment is
# not set up (ASM sid, asmcmd in PATH)
# 2. The script is not very useful - it's for demo purposes only :)
# 3. We may need to expand this to show the extents/AUs allocation
# or something more usefull;
#
#
# Parse command line arguments
#
while [ $# -gt 0 ]
do
case $1 in
-db) shift; DBNAME=$1;; # Database name
-space) SPACE=TRUE;; # User wants the space usage report
-files) FILES=TRUE;; # User wants the report on all files in db DBNAME
-help) echo "Usage: asm.sh [-db DBNAME] [-space] [-files]";exit 1;;
esac;
shift
done
echo ""
#
# Get all ASM disk groups using the 'asmcmd ls' command
#
for DIRECTORY in `asmcmd ls -d % 2>/dev/null`
do
echo $DIRECTORY | cut -f1 -d'/' >> /tmp/groups$$
done
if [ -s /tmp/groups$$ ]
then
echo "ASM instance $ORACLE_SID manages the following disk group(s):"
echo "=================================="
cat /tmp/groups$$
echo ""
else
echo "There are no disk groups in the ASM instance $ORACLE_SID"
echo ""
exit 2
fi
#
# If -files was specified, report on all files for database DBNAME
#
if [ $FILES ]
then
if [ $DBNAME ]
then
for GRP in `cat /tmp/groups$$`
do
asmcmd find $GRP/$DBNAME % >>/tmp/files$$ 2>/dev/null
done
if [ -s /tmp/files$$ ]
then
echo "$ORACLE_SID files for database $DBNAME:"
echo "=================================="
cat /tmp/files$$
else
echo "Database $DBNAME does not have any files in disk group $GRP."
fi
echo ""
else
echo "The list of all files managed by ASM instance $ORACLE_SID:"
echo "=================================="
for GRP in `cat /tmp/groups$$`
do
asmcmd find $GRP % 2>/dev/null
done
fi
fi
#
# If -space was specified, report on the space usage per ASM group
#
if [ $SPACE ]
then
if [ $DBNAME ]
then
for GRP in `cat /tmp/groups$$`
do
asmcmd du $GRP/$DBNAME > /tmp/grp$$ 2>/dev/null
if [ -s /tmp/grp$$ ]
then
echo "Space usage by database $DBNAME in disk group $GRP:"
echo "=================================="
cat /tmp/grp$$
echo ""
rm -f /tmp/grp$$
else
echo "Database $DBNAME does not use disk group $GRP."
fi
done
else
for GRP in `cat /tmp/groups$$`
do
asmcmd du $GRP > /tmp/grp$$ 2>/dev/null
if [ -s /tmp/grp$$ ]
then
echo "Total Space usage by all databases in disk group $GRP:"
echo "=================================="
cat /tmp/grp$$
echo ""
rm -f /tmp/grp$$
fi
done
fi
fi
#
# Clean up
#
rm -f /tmp/groups$$
rm -f /tmp/files$$
rm -f /tmp/grp$$
#
# All work done
#
exit 0
指令碼示例:
1. Default output
[oracle@rac1 bin]$ ./asm.sh
ASM instance +ASM1 manages the following disk group(s):
==================================
DATA
FRA
2. Report on disk space for database dave
[oracle@rac1 bin]$ ./asm.sh -db dave -space
ASM instance +ASM1 manages the following disk group(s):
==================================
DATA
FRA
Space usage by database dave in disk group DATA:
==================================
Used_MB Mirror_used_MB
226 226
Space usage by database dave in disk group FRA:
==================================
Used_MB Mirror_used_MB
3185 3185
3. Report all files for database dave
[oracle@rac1 bin]$ ./asm.sh -db dave -files
ASM instance +ASM1 manages the following disk group(s):
==================================
DATA
FRA
+ASM1 files for database dave:
==================================
+DATA/dave/ONLINELOG/
+DATA/dave/ONLINELOG/group_1.261.746989315
+DATA/dave/ONLINELOG/group_2.262.746989325
+DATA/dave/ONLINELOG/group_3.265.746989333
+DATA/dave/ONLINELOG/group_4.266.746989343
+DATA/dave/PARAMETERFILE/
+DATA/dave/PARAMETERFILE/spfile.268.746989771
+DATA/dave/PARAMETERFILE/spfile.269.746989859
+DATA/dave/spfiledave.ora
+FRA/dave/ARCHIVELOG/
+FRA/dave/ARCHIVELOG/2011_03_29/
+FRA/dave/ARCHIVELOG/2011_03_29/thread_1_seq_1.270.747082809
+FRA/dave/ARCHIVELOG/2011_03_29/thread_2_seq_1.269.747068457
...
+FRA/dave/ARCHIVELOG/2011_04_21/thread_1_seq_36.332.749084429
+FRA/dave/ARCHIVELOG/2011_04_21/thread_2_seq_28.331.749080839
+FRA/dave/ONLINELOG/
+FRA/dave/ONLINELOG/group_1.257.746989321
+FRA/dave/ONLINELOG/group_2.258.746989329
+FRA/dave/ONLINELOG/group_3.259.746989339
+FRA/dave/ONLINELOG/group_4.260.746989347
4. Report on space and all files for database dave
[oracle@rac1 bin]$ ./asm.sh -space -db dave -files
Some minor issues and usage warnings for asmcmd version 10.2.0.1.
1. When using asmcmd non interactively (e.g. in a shell scripts) it may be easier to use % (not *) for wildcard matching, to avoid shell substitution issues.
2. asmcmd does not support wildcard substitution in CD command. This will be addressed in later versions of asmcmd.
3. 'asmcmd du' always reports "Mirror_used_MB" space for all ASM disk groups. If the disk group is not mirrored, "Used_MB" and "Mirror_used_MB" values would be the same (represening the taken disk space in megabytes). In a normal redundancy disk group (i.e. with one mirror) the space reported under "Mirror_used_MB" would be double the ammout reported under "Used_MB". Similarly, for the triple mirrored disk group we would expect the three times the space reported under "Mirror_used_MB".
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/751371/viewspace-735266/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- OCP(11g)------> ASM Command-Line Utility (ASMCMD)和 使用 ASMCMDASM
- 【asmcmd】使用asmcmd工具管理ASMASM
- oracle asm asmcmdOracleASM
- ASM工具asmcmdASM
- 【ASM】ASMCMD cp 命令ASM
- ASM Metadata Dump UtilityASM
- asmcmd: command disallowed by current instance typeASM
- 【ASM】ASMCMD chtmpl 更改ASM 模版的屬性ASM
- ASM命令列管理工具asmcmdASM命令列
- Oracle AMDU- ASM Metadata Dump UtilityOracleASM
- Oracle 12C ASM asmcmd amdu_extractOracleASM
- 學習ASM技術(六)-- ASMCMD命令列ASM命令列
- 使用 ASMCMD 工具管理ASM目錄及檔案ASM
- 【ASM】ASMCMD 之md_backup,md_restore介紹ASMREST
- 用asmcmd 的rebal 代替 ASM_POWER_LIMIT 引數ASMMIT
- Oracle IZ0-053 Q36(ASM ASMCMD REMAP)OracleASMREM
- 關於"asmcmd: command disallowed by current instance type"問題解決ASM
- gnu inline asminlineASM
- Azure Command Line (一)入門
- JMeterPluginsCMD Command Line ToolJMeterPlugin
- [zt] ORACLE 10g中ASMCMD使用及ASM檔案Oracle 10gASM
- Command line is too long. Shorten command line for JooLunMallApiApplication or also for Spring Boot default configuration?APIAPPSpring Boot
- ASMCMD執行ASM後設資料備份與還原ASM
- MySQL 5.7 Command Line Client 閃屏退出MySqlclient
- idea遇見Command line is too long. Shorten command line for Main or also for Application default configuration?IdeaAIAPP
- asmcmdASM
- IDEA命令列縮短器助你解決此問題:Command line is too long. Shorten command line...Idea命令列
- Spring Boot Intellij 執行應用的時候 Command line is too long. Shorten command line for 錯誤Spring BootIntelliJ
- Install VMware Tools in CentOS 7 command line modeCentOS
- Error running ‘Application’Command line is too longErrorAPP
- Oracle ASM使用asmcmd中的cp命令來執行遠端複製OracleASM
- 【ASM】ASMCMD 磁碟後設資料的備份與恢復實踐ASM
- 【VMware VCF】使用 Offline Bundle Transfer Utility(OBTU)配置 VCF 離線庫。
- ASMCMD命令ASM
- ASMCMD - cpASM
- 使用asmcmdASM
- ORACLE 10g中ASMCMD使用及ASM檔案XML DB訪問-1Oracle 10gASMXML
- Mac appium.dmg. Xcode Command Line ToolsMacAPPXCode