怎么用脚本监控asm磁盘的磁盘使用率总是100阿

top监控CPU、内存、磁盘脚本
CPU、内存使用率:
-b | grep -E '^[[:alpha:]]' & $(date
+%Y-%m-%d-%H)_cpu_mem.txt
进程占用内存(降序):
-b | grep -v -E '^[[:alpha:]]|^$|COMMAND' | awk '{print $9 "\t" $10
"\t" $11 "\t\t" $12}' | sort -k2nr & $(date
+%Y-%m-%d-%H)_process_mem.txt
进程占用CPU率(降序):
-b | grep -v -E '^[[:alpha:]]|^$|COMMAND' | awk '{print $9 "\t" $10
"\t" $11 "\t\t" $12}' | sort -k1nr & $(date
+%Y-%m-%d-%H)_process_cpu.txt
进程数量:
& $(date +%Y-%m-%d-%H)_process.txt
磁盘使用率:
& $(date +%Y-%m-%d-%H)_disk.txt
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。创建ASM磁盘组
创建ASM磁盘组
  ASM磁盘组是作为一个逻辑单元管理的一个ASM磁盘池。与其他任何LVM一样,ASM管理大量物理卷并将其作为一个或多个逻辑卷呈交给Oracle。物理卷可以是实际的磁盘或磁盘的分区,或者是隶属操作系统的卷管理器的卷。无论采用哪种方式,都不能使用任何文件系统格式化,必须是裸设备。
  在Linux上,ASM能引用磁盘作为裸设备,或通过使用ASMLib软件。
  直接使用裸设备的方法:
  1. 在RHEL6以前的可以直接通过rawdevices的管理方法,系统安装后默认已存在/etc/init.d/rawdevices和/etc/sysconfig/rawdevices这两个文件。
  # cat /etc/RedHat-release
  Red Hat Enterprise Linux Server release 5.8 (Tikanga)
  # rpm -qf /etc/init.d/rawdevices /etc/sysconfig/rawdevices
  initscripts-8.45.42-1.el5
  initscripts-8.45.42-1.el5
  # cat /etc/init.d/rawdevices
  #!/bin/bash
  # rawdevices& & & This shell script assignes rawdevices to block devices
  # chkconfig: 345 56 44
  # description: This scripts assignes raw devices to block devices \
  #& & & & & & & (such as hard drive partitions). This is for the use \
  #& & & & & & & of applications such as Oracle. You can set up the \
  #& & & & & & & raw device to block device mapping by editing \
  #& & & & & & & the file /etc/sysconfig/rawdevices.
  # config: /etc/sysconfig/rawdevices
  [ -f /bin/raw ] || exit 0
  [ -f /etc/sysconfig/rawdevices ] || exit 0
  # Exit if the file just has the default comments.
  LC_ALL=C /bin/egrep -q -v "^ *#" /etc/sysconfig/rawdevices 2&/dev/null || exit 0
  . /etc/init.d/functions
  function assign_raw()
  LC_ALL=C egrep -v '^ *#' /etc/sysconfig/rawdevices |
  while read RAW BLOCK; do
  if [ -n "$RAW" -a -n "$BLOCK" ]; then
  rawdirname=${RAW%/*}
  if [ "$rawdirname" = "/dev" -a -d /dev/raw ]; then
  echo $"& Please correct your /etc/sysconfig/rawdevices:"
  echo $"& & rawdevices are now located in the directory /dev/raw/ "
  echo $"& If the command 'raw' still refers to /dev/raw as a file."
  echo $"& you'll have to upgrade your util-linux package"
  exit 0
  if [ "$rawdirname" = "/dev/raw" -a -f /dev/raw ]; then
  echo $"& Please correct your /etc/sysconfig/rawdevices:"
  echo $"& & rawdevices are now located in the directory /dev/raw/ "
  echo $"& If the command 'raw' still refers to /dev/raw as a file."
  echo $"& you'll have to upgrade your util-linux package"
  exit 0
  echo "& & & & & $RAW& --&& $BLOCK";
  raw $RAW $BLOCK
  # See how we were called.
  case "$1" in
  start)
  # Assign devices
  echo $"Assigning devices: "
  assign_raw
  #添加以下两行(默认不存在),即默认情况下生成的裸设备为root所有,
  #所以必须修改属主,否则oracle用户无法使用裸设备
  sleep 5
  chown -R oracle:oinstall /dev/raw/
  echo $"done"
  # No action to be taken here
  status)
  ID=`id -u`
  if [ $ID -eq 0 ]; then
  raw -qa
  echo $"You need to be root to use this command ! "
  restart|reload)
  $0 start
  echo $"Usage: $0 {start|stop|status|restart}"
  exit 1
  exit 0
  ------------------------------------------------------
  # vi /etc/sysconfig/rawdevices& & & & & & & & //映射将要绑定的裸设备
  /dev/raw/raw10& /dev/sda10
  /dev/raw/raw11& /dev/sda11
  /dev/raw/raw12& /dev/sda12
  /dev/raw/raw13& /dev/sda13
  /dev/raw/raw14& /dev/sda14
  # chkconfig rawdevices on
  # service rawdevices start
  Assigning devices:
  /dev/raw/raw10& --&& /dev/sda10
  /dev/raw/raw10: bound to major 8, minor 10
  /dev/raw/raw11& --&& /dev/sda11
  /dev/raw/raw11: bound to major 8, minor 11
  /dev/raw/raw12& --&& /dev/sda12
  /dev/raw/raw12: bound to major 8, minor 12
  /dev/raw/raw13& --&& /dev/sda13
  /dev/raw/raw13: bound to major 8, minor 13
  /dev/raw/raw14& --&& /dev/sda14
  /dev/raw/raw14: bound to major 8, minor 14
  # ls -l /dev/raw/
  total 0
  crw-rw----. 1 oracle oinstall 162, 10 May 27 08:37 raw10
  crw-rw----. 1 oracle oinstall 162, 11 May 27 08:37 raw11
  crw-rw----. 1 oracle oinstall 162, 12 May 27 08:37 raw12
  crw-rw----. 1 oracle oinstall 162, 13 May 27 08:37 raw13
  crw-rw----. 1 oracle oinstall 162, 14 May 27 08:37 raw14
  crw-rw----. 1 oracle oinstall 162,& 0 May 27 08:19 rawctl
  # raw -qa
  /dev/raw/raw10: bound to major 8, minor 10
  /dev/raw/raw11: bound to major 8, minor 11
  /dev/raw/raw12: bound to major 8, minor 12
  /dev/raw/raw13: bound to major 8, minor 13
  /dev/raw/raw14: bound to major 8, minor 14  2. 在RHEL6中,系统里面虽然已经不存在/etc/sysconfig/rawdevices和/etc/init.d/rawdevices文件了,但是依然支持rawdevices的方式,可以通过如下方法来管理raw文件。
  a.手动创建/etc/sysconfig/rawdevices和/etc/init.d/rawdevices文件,然后依然以rawdevices的方式
  b.通过udev来管理raw,同样也可以通过udev固定磁盘对应的设备名
  以下介绍udev的方式:
  # fdisk -l /dev/sdb
  Disk /dev/sdb: 2147 MB,
  255 heads, 63 sectors/track, 261 cylinders
  Units = cylinders of 16065 * 512 = 8225280 bytes
  Device Boot& & & Start& & & &
End& & & Blocks&
Id& System
  /dev/sdb1& & & & & & &
2096451& & 5& Extended
  /dev/sdb5& & & & & & &
1& & & & & 25& & & 200749+& 83& Linux
  /dev/sdb6& & & & & & & 26& & & & & 50& & & 200781&
  /dev/sdb7& & & & & & & 51& & & & & 75& & & 200781&
  /dev/sdb8& & & & & & & 76& & & &
100& & & 200781&
  /dev/sdb9& & & & & &
101& & & &
125& & & 200781&
  # vi /etc/udev/rules.d/60-raw.rules
  ACTION=="add",KERNEL=="sdb5",RUN+="/bin/raw /dev/raw/raw5 %N",OWNER="Oracle", GROUP="oinstall", MODE="660"
  ACTION=="add",KERNEL=="sdb6",RUN+="/bin/raw /dev/raw/raw6 %N",OWNER="oracle", GROUP="oinstall", MODE="660"
  ACTION=="add",KERNEL=="sdb7",RUN+="/bin/raw /dev/raw/raw7 %N",OWNER="oracle", GROUP="oinstall", MODE="660"
  ACTION=="add",KERNEL=="sdb8",RUN+="/bin/raw /dev/raw/raw8 %N",OWNER="oracle", GROUP="oinstall", MODE="660"
  ACTION=="add",KERNEL=="sdb9",RUN+="/bin/raw /dev/raw/raw9 %N",OWNER="oracle", GROUP="oinstall", MODE="660"
  # raw -qa
  # start_udev
  Starting udev: [& OK& ]
  # raw -qa
  /dev/raw/raw5:& bound to major 8, minor 21
  /dev/raw/raw6:& bound to major 8, minor 22
  /dev/raw/raw7:& bound to major 8, minor 23
  /dev/raw/raw8:& bound to major 8, minor 24
  /dev/raw/raw9:& bound to major 8, minor 25
  # ls -l /dev/raw
  total 0
  crw-rw---- 1 oracle oinstall 162,& 5 Jun& 9 17:15 raw5
  crw-rw---- 1 oracle oinstall 162,& 6 Jun& 9 17:15 raw6
  crw-rw---- 1 oracle oinstall 162,& 7 Jun& 9 17:15 raw7
  crw-rw---- 1 oracle oinstall 162,& 8 Jun& 9 17:15 raw8
  crw-rw---- 1 oracle oinstall 162,& 9 Jun& 9 17:15 raw9
  ASMLib:(非Linux系统只能使用裸设备的方法)
  ASMLib是一组可选的位于ASM和硬件之间的一个内核驱动程序工具,也是作为一个应用程序库通过Oracle数据库软件访问ASM磁盘。
  它是Oracle 10g和11g单实例数据库以及RAC的ASM特性支持库。ASM和数据库实例可以使用ASMLib作为可替代的磁盘访问接口。
  ASMLib有以下三个组件:
  内核驱动:oracleasm& & & & & & Linux中支持oracle ASMLib的内核驱动程序(需根据内核版本下载)
  支持工具:oracleasm-support& & 提供用于配置和启动ASM驱动程序的实用工具
  应用程序库:oracleasmlib& & &
提供了实际的ASM库
  # uname -r
  2.6.18-308.el5
  # ls oracleasm*
  oracleasm-2.6.18-308.el5-2.0.5-1.el5.x86_64.rpm
  oracleasm-support-2.1.8-1.el5.x86_64.rpm
  oracleasmlib-2.0.4-1.el5.x86_64.rpm
  # rpm -ivh oracleasmlib*
  warning: oracleasm-2.6.18-308.el5-2.0.5-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
  Preparing...& & & & & & & & ########################################### [100%]
  1:oracleasm-support& & & ########################################### [100%]
  2:oracleasm-2.6.18-308.el########################################### [100%]
  3:oracleasmlib& & & & &
########################################### [100%]
  # /etc/init.d/oracleasm configure
  Configuring the Oracle ASM library driver.
  This will configure the on-boot properties of the Oracle ASM library
  driver.& The following questions will determine whether the driver is
  loaded on boot and what permissions it will have.& The current values
  will be shown in brackets ('[]').& Hitting &ENTER& without typing an
  answer will keep that current value.& Ctrl-C will abort.
  Default user to own the driver interface []: oracle
  Default group to own the driver interface []: oinstall
  Start Oracle ASM library driver on boot (y/n) [n]: y
  Scan for Oracle ASM disks on boot (y/n) [y]:
  Writing Oracle ASM library driver configuration: done
  Initializing the Oracle ASMLib driver: [& OK& ]
  Scanning the system for Oracle ASMLib disks: [& OK& ]
  # /etc/init.d/oracleasm enable
  Writing Oracle ASM library driver configuration: [& OK& ]
  Loading module "oracleasm": [& OK& ]
  Mounting ASMlib driver filesystem: [& OK& ]
  Scanning system for ASM disks: [& OK& ]
  # /etc/init.d/oracleasm createdisk VOL1 /dev/sda5
  Marking disk "VOL2" as an ASM disk: [& OK& ]
  # /etc/init.d/oracleasm createdisk VOL2 /dev/sda6
  Marking disk "VOL2" as an ASM disk: [& OK& ]
  # /etc/init.d/oracleasm createdisk VOL3 /dev/sda7
  Marking disk "VOL3" as an ASM disk: [& OK& ]
  # /etc/init.d/oracleasm createdisk VOL4 /dev/sda8
  Marking disk "VOL4" as an ASM disk: [& OK& ]
  # /etc/init.d/oracleasm createdisk VOL5 /dev/sda9
  Marking disk "VOL5" as an ASM disk: [& OK& ]
  # /etc/init.d/oracleasm scandisks
  Scanning system for ASM disks:[& OK& ]
  # /etc/init.d/oracleasm listdisks
  # ll /dev/oracleasm/disks/
  total 0
  brw-rw---- 1 oracle oinstall 8, 5 Jun& 3 09:53 VOL1
  brw-rw---- 1 oracle oinstall 8, 6 Jun& 3 10:00 VOL2
  brw-rw---- 1 oracle oinstall 8, 7 Jun& 3 10:00 VOL3
  brw-rw---- 1 oracle oinstall 8, 8 Jun& 3 10:00 VOL4
  brw-rw---- 1 oracle oinstall 8, 9 Jun& 3 10:00 VOL5
  //到这里ASM的工作就完成了,这里的磁盘可以被Oracle所使用,使用oracleasm-discover来探测ASM硬盘:
  # oracleasm-discover
  Using ASMLib from /opt/oracle/extapi/64/asm/orcl/1/libasm.so
  [ASM Library - Generic Linux, version 2.0.4 (KABI_V2)]
  Discovered disk: ORCL:VOL1 [4899762 blocks ( bytes), maxio 512]
  Discovered disk: ORCL:VOL2 [4899762 blocks ( bytes), maxio 512]
  Discovered disk: ORCL:VOL3 [4899762 blocks ( bytes), maxio 512]
  Discovered disk: ORCL:VOL4 [4899762 blocks ( bytes), maxio 512]
  Discovered disk: ORCL:VOL5 [7373772 blocks ( bytes), maxio 512]
&&&主编推荐
H3C认证Java认证Oracle认证
基础英语软考英语项目管理英语职场英语
.NETPowerBuilderWeb开发游戏开发Perl
二级模拟试题一级模拟试题一级考试经验四级考试资料
港口与航道工程建设工程法规及相关知识建设工程经济考试大纲矿业工程市政公用工程通信与广电工程
操作系统汇编语言计算机系统结构人工智能数据库系统微机与接口
软件测试软件外包系统分析与建模敏捷开发
法律法规历年试题软考英语网络管理员系统架构设计师信息系统监理师
高级通信工程师考试大纲设备环境综合能力
路由技术网络存储无线网络网络设备
CPMP考试prince2认证项目范围管理项目配置管理项目管理案例项目经理项目干系人管理
Powerpoint教程WPS教程
电子政务客户关系管理首席信息官办公自动化大数据
职称考试题目
就业指导签约违约职业测评
招生信息考研政治
网络安全安全设置工具使用手机安全
3DMax教程Flash教程CorelDraw教程Director教程
Dreamwaver教程HTML教程网站策划网站运营Frontpage教程
生物识别传感器物联网传输层物联网前沿技术物联网案例分析
互联网电信IT业界IT生活
Java核心技术J2ME教程
Linux系统管理Linux编程Linux安全AIX教程
Windows系统管理Windows教程Windows网络管理Windows故障
组织运营财务资本
视频播放文件压缩杀毒软件输入法微博
数据库开发Sybase数据库Informix数据库
&&&&&&&&&&&&&&&
希赛网 版权所有 & &&&&湘教QS2-164&&增值电信业务经营许可证湘B2-candon123 的BLOG
用户名:candon123
文章数:269
评论数:498
访问量:1313840
注册日期:
阅读量:3178
阅读量:15050
51CTO推荐博文
本篇介绍了如何在windows下创建裸设备,并创建ASM磁盘组以及安装oracle grid组件和database。以前做的Oracle ASM实验都是基于Linux或者Unix的,最近突发奇想的试试如何在windows环境下使用Oracle ASM。经研究,必须在windows下创建RAW设备,才能创建ASM磁盘。在此分享下实验实验过程,希望对在windows下玩oracle的朋友们有所帮助。
一、环境介绍:
虚拟机上安装有windows 2008 R2 操作系统,具体配置如下图所示:
这里的20G硬盘用于ASM,目前处于脱机状态。由于在windows下使用ASM,所以不能对硬盘进行分区操作,必须创建裸设备,这个和在linux下使用asm相反。这里的oracle版本是11g r2。
二、创建裸设备以及创建ASM磁盘组:
1、创建裸设备:
目前20G的硬盘处于脱机状态(对应于磁盘1),如图:
要创建裸设备,硬盘必须已经联机并且已经初始化,右键点击磁盘1选择联机即可。联机后如图所示:
紧接着右击磁盘1进行初始化:
完成之后,就可以进行分区等操作了:
右击选择”新建简单卷”:
然后根据向导进行操作:
在此步务必选择”不分配驱动器号或驱动器路径(D)”,然后下一步:
在此选择”不要格式化这个卷”,下一步:
点击完成即可。
磁盘1已经是一个大小为20G的裸设备了。
2、创建asm磁盘组:
这个在grid软件包里提供了一个asmtoolg图形界面操作和asmtool命令行界面,位于grid文件夹的asmtool文件夹里,如图:
初次使用建议使用asmtoolg工具方便直观点。双击asmtoolg开始创建,如图所示:
\Device\Harddisk1\Partition1就是磁盘1,磁盘组名使用默认的DATA。如果所选分区不是裸设备,就像上面的disk0的几个分区一样是灰色的,无法进行后续操作。下一步:
点击完成后,ASM磁盘组+DATA就已经创建成功了。
三、安装oracle grid:
这个在安装过程中选择“独立服务器配置”即可,如下图所示:
这里已经认到了先前创建ASM磁盘,磁盘组名称为DATA。
四、oracle database的安装:
五、后续管理:
1、设置oracle数据库实例伴随OHAS的启动而启动:
设置AUTO_START=1即可:
2、查看各个资源的状态:
3、启动与关闭ohas服务:
本文出自 “” 博客,谢绝转载!
了这篇文章
类别:┆阅读(0)┆评论(0)
15:22:28 16:32:23 19:02:10 20:38:47 14:37:57 15:25:22 11:05:22 14:47:47 10:07:38

我要回帖

更多关于 win10磁盘使用率100 的文章

 

随机推荐