Category Archives: UNIX/Linux

UNIX-like system

【RMAN】I/O Read Rate of Backups

如何控制RMAN备份时的I/O速度呢?
这是在客户生产环境中遇到的现实问题,因为客户的存储实在是弱爆了,RMAN备份的时候由于I/O较高,导致应用出现停顿,严重时存储直接挂掉。所以考虑限制RMAN备份时的速度。
在Oracle的Channel Control中提示可以通过两种哦国内方式控制I/O,单位为KB/s,MB/s,GB/s
Set limits on I/O bandwidth consumption in kilobytes, megabytes, or gigabytes (ALLOCATE CHANNEL … RATE, CONFIGURE CHANNEL … RATE)
下面是Oracle对Rate设置的案例介绍
I/O Read Rate of Backups
By default, RMAN uses all available I/O bandwidth to read/write to disk. You can limit the I/O resources consumed by a backup job with the RATE option of the ALLOCATE CHANNEL or CONFIGURE CHANNEL commands. The RATE option specifies the maximum number of bytes for each second that RMAN reads on the channel.
For example, you can configure automatic channels to limit each channel to read 1 MB a second:
CONFIGURE DEVICE TYPE sbt PARALLELISM 2;
CONFIGURE DEFAULT DEVICE TYPE TO sbt;
CONFIGURE CHANNEL DEVICE TYPE sbt RATE 1M;

根据Oracle给出的提示,我们在11.2.0.2的库上分别测试I/O限制为5M,20M及不限制IO时RMAN的备份速度,借助osw观察I/O变化情况。
备份的数据文件为system01.dbf,大小约为700MB。

-bash-3.2$ ls -lh system01.dbf
 -rw-r----- 1 oracle dba 701M Nov 21 15:30 system01.dbf

操作系统的块大小为4096(4KB),数据库的块大小为8192(8KB)

[[email protected] ~]# getconf PAGESIZE
 4096
 SQL> show parameter db_block_size
NAME TYPE VALUE
 ------------------------------------ ----------- ------------------------------
 db_block_size integer 8192

开启OSW(OS Watcher),收集信息时间间隔为10秒,保留10天(240小时)。

[[email protected] osw]# ./startOSW.sh 10 240 >> osw.log &
 [1] 16589
 [[email protected] osw]#
 [1]+ Done ./startOSW.sh 10 240 >> osw.log
 [[email protected] osw]#
 [[email protected] osw]# cat osw.log
Testing for discovery of OS Utilities...
VMSTAT found on your system.
 IOSTAT found on your system.
 MPSTAT found on your system.
 NETSTAT found on your system.
 TOP found on your system.
Discovery completed.
Starting OSWatcher v3.0.1 on Mon Nov 21 15:56:22 CST 2011
 With SnapshotInterval = 10
 With ArchiveInterval = 240
OSWatcher - Written by Carl Davis, Center of Expertise, Oracle Corporation
Starting Data Collection...
osw heartbeat:Mon Nov 21 15:56:22 CST 2011

1.I/O限制为5M,备份时间为2分25秒

RMAN> configure CHANNEL DEVICE TYPE DISK RATE 5M;
new RMAN configuration parameters:
 CONFIGURE CHANNEL DEVICE TYPE DISK RATE 5 M;
 new RMAN configuration parameters are successfully stored
RMAN> show CHANNEL;
RMAN configuration parameters for database with db_unique_name ORCL are:
 CONFIGURE CHANNEL DEVICE TYPE DISK RATE 5 M;
RMAN> backup datafile '/oracle/oradata/orcl/system01.dbf';
Starting backup at 21-NOV-11
 allocated channel: ORA_DISK_1
 channel ORA_DISK_1: SID=143 device type=DISK
 channel ORA_DISK_1: starting full datafile backup set
 channel ORA_DISK_1: specifying datafile(s) in backup set
 input datafile file number=00001 name=/oracle/oradata/orcl/system01.dbf
 channel ORA_DISK_1: starting piece 1 at 21-NOV-11
 channel ORA_DISK_1: finished piece 1 at 21-NOV-11
 piece handle=/oracle/fast_recovery_area/ORCL/backupset/2011_11_21/o1_mf_nnndf_TAG20111121T155646_7dn11yc3_.bkp tag=TAG20111121T155646 comment=NONE
 channel ORA_DISK_1: backup set complete, elapsed time: 00:02:25
 channel ORA_DISK_1: throttle time: 0:02:14
 Finished backup at 21-NOV-11
Starting Control File and SPFILE Autobackup at 21-NOV-11
 piece handle=/oracle/fast_recovery_area/ORCL/autobackup/2011_11_21/o1_mf_s_767807951_7dn16hq2_.bkp comment=NONE
 Finished Control File and SPFILE Autobackup at 21-NOV-11

2.I/O限制为20M,备份时间为45秒

RMAN> configure CHANNEL DEVICE TYPE DISK RATE 20M;
old RMAN configuration parameters:
 CONFIGURE CHANNEL DEVICE TYPE DISK RATE 5 M;
 new RMAN configuration parameters:
 CONFIGURE CHANNEL DEVICE TYPE DISK RATE 20 M;
 new RMAN configuration parameters are successfully stored
 released channel: ORA_DISK_1
RMAN> show CHANNEL;
RMAN configuration parameters for database with db_unique_name ORCL are:
 CONFIGURE CHANNEL DEVICE TYPE DISK RATE 20 M;
RMAN> backup datafile '/oracle/oradata/orcl/system01.dbf';
Starting backup at 21-NOV-11
 allocated channel: ORA_DISK_1
 channel ORA_DISK_1: SID=143 device type=DISK
 channel ORA_DISK_1: starting full datafile backup set
 channel ORA_DISK_1: specifying datafile(s) in backup set
 input datafile file number=00001 name=/oracle/oradata/orcl/system01.dbf
 channel ORA_DISK_1: starting piece 1 at 21-NOV-11
 channel ORA_DISK_1: finished piece 1 at 21-NOV-11
 piece handle=/oracle/fast_recovery_area/ORCL/backupset/2011_11_21/o1_mf_nnndf_TAG20111121T160009_7dn1896h_.bkp tag=TAG20111121T160009 comment=NONE
 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45
 channel ORA_DISK_1: throttle time: 0:00:30
 Finished backup at 21-NOV-11
Starting Control File and SPFILE Autobackup at 21-NOV-11
 piece handle=/oracle/fast_recovery_area/ORCL/autobackup/2011_11_21/o1_mf_s_767808054_7dn19ptr_.bkp comment=NONE
 Finished Control File and SPFILE Autobackup at 21-NOV-11

3.RMAN I/O无限制,备份时间为15秒

 RMAN> configure CHANNEL DEVICE TYPE DISK clear;
old RMAN configuration parameters:
 CONFIGURE CHANNEL DEVICE TYPE DISK RATE 20 M;
 old RMAN configuration parameters are successfully deleted
 released channel: ORA_DISK_1
RMAN> show CHANNEL;
RMAN configuration parameters for database with db_unique_name ORCL are:
 RMAN configuration has no stored or default parameters
RMAN> backup datafile '/oracle/oradata/orcl/system01.dbf';
Starting backup at 21-NOV-11
 allocated channel: ORA_DISK_1
 channel ORA_DISK_1: SID=143 device type=DISK
 channel ORA_DISK_1: starting full datafile backup set
 channel ORA_DISK_1: specifying datafile(s) in backup set
 input datafile file number=00001 name=/oracle/oradata/orcl/system01.dbf
 channel ORA_DISK_1: starting piece 1 at 21-NOV-11
 channel ORA_DISK_1: finished piece 1 at 21-NOV-11
 piece handle=/oracle/fast_recovery_area/ORCL/backupset/2011_11_21/o1_mf_nnndf_TAG20111121T160152_7dn1cjf8_.bkp tag=TAG20111121T160152 comment=NONE
 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
 Finished backup at 21-NOV-11
Starting Control File and SPFILE Autobackup at 21-NOV-11
 piece handle=/oracle/fast_recovery_area/ORCL/autobackup/2011_11_21/o1_mf_s_767808127_7dn1czqj_.bkp comment=NONE
 Finished Control File and SPFILE Autobackup at 21-NOV-11

根据数据文件大小列出预计的RMAN备份时间与实际RMAN备份时间:
IO test chat

可以通过OSW收集的数据,很明显的看到percent busy(PB), reads per second(RPS) and writes per second(WPS)变化
percent busy(PB)
OSWg sda OS IO PB
reads per second(RPS)
OSWg sda OS IO RPS
writes per second(WPS)
OSWg sda OS IO WPS

从OSW生成的图片的整体趋势上,已经能看到设置RATE参数对磁盘I/O的影响。
但是可能是由于一些暂时未知的原因,RPS的趋势并非如我们所愿,限制为10M后仍有个别时段物理读超出限制。
今天看到一款可以监控程序IO的软件,改天重新进行一下测试。

总结:
Oracle 11gR2在做RMAN备份时,可以通过设置RATE参数限制磁盘IO。
设置方式如下:
configure CHANNEL DEVICE TYPE DISK RATE 20M;
重置方式如下:
configure CHANNEL DEVICE TYPE DISK clear;
单位可以设置为KB,MB,GB

参考:

Oracle® Database Backup and Recovery Advanced User’s Guide 10g Release 1 (10.1) Part Number B10734-01
计算机中KB与Kb的技术差别详解
RMAN备份数据文件和控制文件
利用RATE参数限制RMAN备份的IO速度
Unix/Linux 磁盘 I/O 性能监控命令

Linux命令——history查看用户操作记录及时间

默认情况下Linux里使用history命令,只显示序列和命令,不含执行时间和执行用户:

image

修改/etc/profile文件,在末尾添加:export HISTTIMEFORMAT=”%F %T `whoami` ”

[[email protected] ~]# history | tail
  515  2011-09-08 15:34:46 root exit
  516  2011-09-08 15:34:02 root history | grep passwd
  517  2011-09-08 15:34:47 root exit
  518  2011-09-08 15:34:52 root su - marshall
  519  2011-09-08 15:58:45 root exit
  520  2011-09-08 16:02:12 root cat /etc/pro
  521  2011-09-08 16:02:15 root cat /etc/profile
  522  2011-09-08 16:02:24 root history
  523  2011-09-08 16:02:40 root history tail
  524  2011-09-08 16:02:45 root history | tail

因为某用户密码被修改,才想到了修改history命令的显示输出。可结合last命令查看谁在何时做了啥操作。

参考:http://www.itdhz.com/post-74.html

NMON使用(一)

NMON是AIX和Linux上的免费性能分析工具,对于分析系统性能有较大帮助。

今天进行了简单测试,发现诸多问题,记录如下:

IBM官网对安装NMON的介绍是:

该工具是一个独立的二进制文件(不同的 AIX 或 Linux 版本中该文件也有所不同),您可以在五秒钟内完成该工具的安装,如果您的输入速度更快的话,也许时间更短。安装过程非常简单:

  • nmonXXX.tar.Z 文件复制到计算机。如果使用 FTP,请记住使用二进制模式。
    注意:示例中的 XXX 由实际的版本代替。
  • 要解压该文件,可以运行 uncompress nmonXX.tar.Z
  • 要提取该文件,可以运行 tar xvf nmonXX.tar
  • 阅读自述文件。
  • 要启动 nmon 工具,输入 nmon
  • 如果您是 root 用户,可能需要输入 ./nmon

read more »

开启Ubuntu 3D特效

大二时在学校做Linux宣讲时,就是以3D特效作为开始,吸引眼球。

今天再次装Ubuntu,闲的蛋疼玩玩而已。

开启3D特效步骤简单,简述为:

装显卡驱动

compizconfig-settings-manager   emerald

看不明白?那看这里吧:

中文详述:http://linux.chinaunix.net/news/2008/05/09/1001510.shtml

英文原版:http://www.howtoforge.com/compiz-fusion-ubuntu-8.04-nvidia-geforce-fx-5200

Modify Linux Hostname修改Linux主机名

经常会用到,记录以备忘

第一步:这一步只是临时改动
#hostname oratest
第二步:修改前备份
修改/etc/sysconfig/network中的hostname
第三步:修改前备份
修改/etc/hosts文件

 

修改完毕后重新连接,主机名会变为新主机名

普人特福的博客cnzz&51la for wordpress,cnzz for wordpress,51la for wordpress