- 浏览: 4402807 次
- 性别:
- 来自: 厦门
文章分类
- 全部博客 (634)
- Oracle日常管理 (142)
- Oracle体系架构 (45)
- Oracle Tuning (52)
- Oracle故障诊断 (35)
- RAC/DG/OGG (64)
- Oracle11g New Features (48)
- DataWarehouse (15)
- SQL, PL/SQL (14)
- DB2日常管理 (9)
- Weblogic (11)
- Shell (19)
- AIX (12)
- Linux/Unix高可用性 (11)
- Linux/Unix日常管理 (66)
- Linux桌面应用 (37)
- Windows (2)
- 生活和工作 (13)
- 私人记事 (0)
- Python (9)
- CBO (15)
- Cognos (2)
- ORACLE 12c New Feature (2)
- PL/SQL (2)
- SQL (1)
- C++ (2)
- Hadoop大数据 (5)
- 机器学习 (3)
- 非技术 (1)
最新评论
-
di1984HIT:
xuexilee!!!
Oracle 11g R2 RAC高可用连接特性 – SCAN详解 -
aneyes123:
谢谢非常有用那
PL/SQL的存储过程和函数(原创) -
jcjcjc:
写的很详细
Oracle中Hint深入理解(原创) -
di1984HIT:
学习了,学习了
Linux NTP配置详解 (Network Time Protocol) -
avalonzst:
大写的赞..
AIX内存概述(原创)
在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
参考至:http://www.ningoo.net/html/2008/oracle11g_asmcmd_new_command.html
http://www.dba-oracle.com/t_asmcmd.htm
http://www.reachdba.com/showthread.php?386-asmcmd-Usage-with-Examples
http://www.isnetne.ch/lbd/SGBD/oracle/documents/ASM/ASMCMD%20Quick%20Reference%20Guide.pdf
http://blog.chinaunix.net/uid-23622436-id-3196692.html
http://www.cnblogs.com/zlja/archive/2011/01/13/2449338.html
本文原创,转载请注明出处、作者
如有错误,欢迎指正
邮箱:czmcj@163.com
发表评论
-
Oracle 11g、12c大量错误登陆尝试带来的数据库异常
2018-07-16 09:21 1524APPLIES TO: Oracle Database - ... -
如何定位那些SQL产生了大量的redo日志
2018-05-15 14:38 1757在ORACLE数据库的管理、 ... -
When Memory_target Is Set and Swap Size Is Not Big (Doc ID 2356025.1)
2018-03-16 18:13 1180Kkjcre1p: unable to sp ... -
Transparent Hugepage is not getting disabled (Doc ID 2279458.1)
2018-03-16 18:10 816Transparent Hugepage is ... -
Troubleshooting: "log file sync" Waits (文档 ID 1376916.1)
2017-03-09 14:32 1359What is a 'log file sync' wai ... -
log file sync总结
2017-03-09 14:36 3247log file sync等待时间发生在redo log从 ... -
Oracle Log File Sync Wait Event
2017-03-08 18:46 1166The Oracle “log file sync” wai ... -
Tuning ‘log file sync’ Event Waits
2017-03-08 18:41 849Tuning ‘log file sync’ Event ... -
Diagnosing buffer busy waits with the ash_wait_chains.sql script (v0.2)
2017-03-08 16:56 845Diagnosing buffer busy waits w ... -
Advanced Oracle Troubleshooting Guide – Part 11: Complex Wait Chain Signature An
2017-03-08 16:05 1088Here’s a treat for the hard-co ... -
Oracle 10046 SQL TRACE
2017-03-08 15:19 938为什么我们要使用10046 trace? 10046 ... -
Automatic Storage Management
2016-11-03 15:33 856SYSASM Role When Automatic ... -
ASM FAQ
2016-11-03 15:29 721ASM FAQ Oracle Automatic ... -
Oracle ALTER PROFILE语法
2016-10-10 11:36 3402ALTER PROFILE Purpose Use th ... -
Oracle FGA审计
2016-09-20 09:42 1380大家对trigger可能比较熟悉,但Oracle还有一个叫 ... -
Secret.txt
2016-09-14 17:20 0考试登录账号:YAMAC0043865 Chen1988协会网 ... -
Oracle Data Pump Internals
2016-09-13 16:38 774IntroductionOracle Data Pump w ... -
UDEV SCSI Rules Configuration for ASM in Oracle Linux 5, 6 and 7
2016-09-12 16:32 836UDEV SCSI Rules Configuration ... -
Cannot Allocate New Log
2016-02-21 12:28 5439故障报错 Thread 1 cannot allocat ... -
Oracle flashback dropped tablespace(原创)
2015-11-15 22:21 2008Oracle官方并不推荐在数据库物理结构发生改变的情况下进行 ...
相关推荐
端口详解 端口详解 端口详解 端口详解 端口详解
dm分区详解dm分区详解dm分区详解dm分区详解dm分区详解dm分区详解dm分区详解dm分区详解dm分区详解dm分区详解dm分区详解dm分区详解dm分区详解dm分区详解dm分区详解dm分区详解dm分区详解dm分区详解dm分区详解dm分区详解...
C++编程实例详解C++编程实例详解C++编程实例详解C++编程实例详解C++编程实例详解C++编程实例详解C++编程实例详解C++编程实例详解C++编程实例详解C++编程实例详解C++编程实例详解C++编程实例详解C++编程实例详解C++...
本人收集的EXT详解,EXT开发中组件详解
在udhcp源码详解(一)中,可能会详细介绍这些模块的基本功能和相互关系。配置文件解析是udhcp启动时的关键步骤,它读取用户的配置参数,如IP地址池、租约时间等。内存管理则涉及到如何有效地存储和检索DHCP请求和...
路由配置路由配置详解及案例路由配置详解及案例路由配置详解及案例路由配置详解及案例路由配置详解及案例路由配置详解及案例路由配置详解及案例路由配置详解及案例路由配置详解及案例路由配置详解及案例路由配置详解...
gpiogpio详解及应用实例gpio详解及应用实例gpio详解及应用实例gpio详解及应用实例gpio详解及应用实例gpio详解及应用实例gpio详解及应用实例gpio详解及应用实例gpio详解及应用实例gpio详解及应用实例gpio详解及应用...
gcc参数详解 gcc参数详解 gcc参数详解 gcc参数详解
MATLAB通信仿真及应用实例详解pdf-MATLAB通信仿真及应用实例详解.part03.rar 论坛里有兄弟发过了。但是出了问题,这次补充一个完整的。 MATLAB通信仿真及应用实例详解.part09.rar ...
BMP文件格式详解BMP文件格式详解BMP文件格式详解BMP文件格式详解BMP文件格式详解BMP文件格式详解BMP文件格式详解BMP文件格式详解BMP文件格式详解BMP文件格式详解
cisco最完美的ACL配置详解及配置全过程cisco最完美的ACL配置详解及配置全过程cisco最完美的ACL配置详解及配置全过程cisco最完美的ACL配置详解及配置全过程cisco最完美的ACL配置详解及配置全过程cisco最完美的ACL配置...
Labview实用工具详解源码第三部分,压缩包比较大,分八个上传。
上传限制无奈分卷压缩 一共12卷 要12卷在同目录才可以解压 给大家带来不便请你们谅解 VC++深入详解pdf版 VC++深入详解 VC++深入详解电子档
**MFC类库详解中文详解中文版** MFC(Microsoft Foundation Classes)是微软提供的一套C++类库,用于简化Windows应用程序开发。它基于面向对象的设计原则,将Windows API进行了封装,使得开发者能够以更高级、更...
xshellxshell详解及实际案例分析xshell详解及实际案例分析xshell详解及实际案例分析xshell详解及实际案例分析xshell详解及实际案例分析xshell详解及实际案例分析xshell详解及实际案例分析xshell详解及实际案例分析...
Oracle详解Oracle详解Oracle详解Oracle详解
TCP/IP详解系列是由W. Richard Stevens撰写的经典网络技术书籍,包括《TCP/IP详解 卷一:协议》、《TCP/IP详解 卷二:实现》和《TCP/IP详解 卷三:TCP事务》。这套书深入浅出地阐述了TCP/IP协议族的各个层面,是网络...
c语言指针详解 c语言指针详解 c语言指针详解 c语言指针详解 c语言指针详解 c语言指针详解 c语言指针详解 c语言指针详解 c语言指针详解 c语言指针详解 c语言指针详解 c语言指针详解 c语言指针详解 c语言指针详解 ...
MATLAB通信仿真及应用实例详解pdf-MATLAB通信仿真及应用实例详解.part08.rar 论坛里有兄弟发过了。但是出了问题,这次补充一个完整的。 MATLAB通信仿真及应用实例详解.part09.rar ...
液晶驱动详解(想写驱动的朋友请进!).zip液晶驱动详解(想写驱动的朋友请进!).zip液晶驱动详解(想写驱动的朋友请进!).zip液晶驱动详解(想写驱动的朋友请进!).zip液晶驱动详解(想写驱动的朋友请进!).zip液晶驱动详解(想...