2009年6月25日星期四

ZT:使用Xtrabackup备份MySQL数据库

MySQL数据库 的备份,一直是个比较头痛的问题。各种工具虽然不少,但一个真正好用易用的,却又非常难找。Mysqldump做为数据的逻辑备份工具还行,但是无法进行 在线热备,而没有物理备份工具,在数据量比较大的时候,恢复的时间也会长得无法接受。InnoDB倒是有个商业的InnoDB Hotbackup,可以对InnoDB引擎的表实现在线热备。最近发现了一个工具,percona出品的Xtrabackup,是InnoDB Hotbackup的一个开源替代品,可以在线对InnoDB/XtraDB引擎的表进行物理备份,试用了一下,非常的不错,值得向MySQL DBA们推荐。

下面是一个实际备份的例子,采用了gzip将备份流进行压缩,约20GB的数据库,压缩后大小为340MB,当然,压缩后的大小跟数据库中实际使用的空间是相关的。备份时间约6分44秒。

innobackupex是参考了InnoDB Hotbackup的innoback脚本修改而来的,主要是为了方便的同时备份InnoDB和MyISAM引擎的表,并且加入了一些使用的选项。如 –slave-info可以记录备份恢复后,作为slave需要的一些信息,根据这些信息,可以很方便的利用备份来重做slave。

注意,从备份后的tar包解包的时候,需要使用-i参数。
  1. $innobackupex-1.5.1 --user=root --stream=tar /bak/ --slave-info | gzip > /bak/bak_mysql.tar.gz

  2. InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy.
  3. All Rights Reserved.

  4. This software is published under
  5. the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.

  6. IMPORTANT: Please check that the backup run completes successfully.
  7. At the end of a successful backup run innobackup
  8. prints "innobackup completed OK!".

  9. innobackupex: Using mysql Ver 14.12 Distrib 5.0.67, for redhat-linux-gnu (x86_64)
  10. using EditLine wrapper
  11. innobackupex: Using mysql server version 5.0.67-log

  12. innobackupex: Created backup directory /bak
  13. 090625 15:23:00 innobackupex: Starting mysql with options: --unbuffered --user=root
  14. 090625 15:23:00 innobackupex: Connected to database with mysql child process (pid=3431)
  15. 090625 15:23:04 innobackupex: Connection to database server closed

  16. 090625 15:23:04 innobackupex: Starting ibbackup with command:
  17. xtrabackup --backup --suspend-at-end --log-stream --target-dir=./
  18. innobackupex: Waiting for ibbackup (pid=3565) to suspend
  19. innobackupex: Suspend file '/opt/mysqldata/xtrabackup_suspended'

  20. xtrabackup: suspend-at-end is enabled.
  21. xtrabackup: uses posix_fadvise().
  22. xtrabackup: cd to /opt/mysqldata
  23. xtrabackup: Target instance is assumed as followings.
  24. xtrabackup: innodb_data_home_dir = /opt/mysqldata
  25. xtrabackup: innodb_data_file_path = ibdata1:10G;ibdata2:10G
  26. xtrabackup: innodb_log_group_home_dir = ./
  27. xtrabackup: innodb_log_files_in_group = 4
  28. xtrabackup: innodb_log_file_size = 104857600
  29. xtrabackup: use O_DIRECT
  30. xtrabackup: Stream mode.
  31. >> log scanned up to (0 3053406941)

  32. 090625 15:23:06 innobackupex: Continuing after ibbackup has suspended

  33. innobackupex: Starting to backup InnoDB tables and indexes
  34. innobackupex: from original InnoDB data directory '/opt/mysqldata'
  35. innobackupex: Backing up as tar stream 'ibdata1'
  36. >> log scanned up to (0 3053416714)
  37. ...这里省略若干行
  38. >> log scanned up to (0 3054123851)
  39. tar: ibdata1: file changed as we read it
  40. innobackupex: Backing up as tar stream 'ibdata2'
  41. >> log scanned up to (0 3054142116)
  42. ...这里省略若干行
  43. >> log scanned up to (0 3054618483)
  44. innobackupex: Backing up file '/opt/mysqldata/test/sp.ibd'
  45. innobackupex: Backing up file '/opt/mysqldata/test/tmp_dy.ibd'
  46. innobackupex: Backing up files '/opt/mysqldata/testdb/*.ibd' (206 files)
  47. >> log scanned up to (0 3054638401)
  48. >> log scanned up to (0 3054668860)
  49. tar: testdb/group_group_thread_0027.ibd: file changed as we read it
  50. >> log scanned up to (0 3054695015)
  51. >> log scanned up to (0 3054928216)
  52. tar: testdb/group_thread_reply_0007.ibd: file changed as we read it
  53. >> log scanned up to (0 3054952588)
  54. >> log scanned up to (0 3055005439)
  55. tar: testdb/group_user_0001.ibd: file changed as we read it
  56. >> log scanned up to (0 3055028610)
  57. >> log scanned up to (0 3055044650)
  58. tar: testdb/group_user_0006.ibd: file changed as we read it
  59. >> log scanned up to (0 3055060461)
  60. innobackupex: Backing up file '/opt/mysqldata/testdb/comments.ibd'
  61. innobackupex: Backing up file '/opt/mysqldata/testdb/testdb.ibd'
  62. innobackupex: Backing up file '/opt/mysqldata/testdb/testdb_content.ibd'
  63. innobackupex: Backing up file '/opt/mysqldata/testdb/testdb_ids.ibd'
  64. 090625 15:29:17 innobackupex: Starting mysql with options: --unbuffered --user=root
  65. 090625 15:29:17 innobackupex: Connected to database with mysql child process (pid=5458)
  66. >> log scanned up to (0 3055072495)
  67. 090625 15:29:21 innobackupex: Starting to lock all tables...
  68. >> log scanned up to (0 3055087148)
  69. >> log scanned up to (0 3055119993)
  70. 090625 15:29:39 innobackupex: All tables locked and flushed to disk

  71. 090625 15:29:39 innobackupex: Starting to backup .frm, .MRG, .MYD, .MYI,
  72. innobackupex: .TRG, .TRN, and .opt files in
  73. innobackupex: subdirectories of '/opt/mysqldata'
  74. innobackupex: Backing up file '/opt/mysqldata/test/sp.frm'
  75. innobackupex: Backing up file '/opt/mysqldata/test/tmp_dy.frm'
  76. innobackupex: Backing up files '/opt/mysqldata/testdb/*.{frm,MYD,MYI,MRG,TRG,TRN,opt}' (207 files)
  77. innobackupex: Backing up file '/opt/mysqldata/testdb/comments.frm'
  78. innobackupex: Backing up file '/opt/mysqldata/testdb/testdb.frm'
  79. innobackupex: Backing up file '/opt/mysqldata/testdb/testdb_content.frm'
  80. innobackupex: Backing up file '/opt/mysqldata/testdb/testdb_ids.frm'
  81. innobackupex: Backing up file '/opt/mysqldata/testdb/db.opt'
  82. innobackupex: Backing up files '/opt/mysqldata/mysql/*.{frm,MYD,MYI,MRG,TRG,TRN,opt}' (52 files)
  83. 090625 15:29:40 innobackupex: Finished backing up .frm, .MRG, .MYD, .MYI, .TRG, .TRN, and .opt files

  84. innobackupex: Resuming ibbackup

  85. xtrabackup: The latest check point (for incremental): '0:3054881736'
  86. >> log scanned up to (0 3055120013)
  87. xtrabackup: Transaction log of lsn (0 3053102766) to (0 3055120013) was copied.
  88. 090625 15:29:44 innobackupex: All tables unlocked
  89. 090625 15:29:44 innobackupex: Connection to database server closed

  90. innobackupex: Backup created in directory '/bak/'
  91. innobackupex: MySQL binlog position: filename '', position
  92. innobackupex: MySQL slave binlog position: master host '127.0.0.1',
  93. filename 'mysql-bin.000006', position 227207755
  94. 090625 15:29:44 innobackupex: innobackup completed OK!
  95. innobackupex: You must use -i (--ignore-zeros) option for extraction of the tar stream.
复制代码
本文网址:http://www.ningoo.net/html/2009/ ... mysql_database.html

收藏之,以备后查!

Credential--信任状

A credential is
something you know, such as number or PIN;
something you have, such as an access badge;
something you are, such as a biometric feature;
or some combination of these.

The typical credential is an access card, key fob, or other key.
There are many card technologies including magnetic stripe, bar code, Wiegand, 125 kHz proximity, 26 bit card-swipe, contact smart cards, and contactless smart cards.
Also available are key-fobs which are more compact than ID cards and attach to a key ring.
Typical biometric technologies include fingerprint, facial recognition, iris recognition, retinal scan, voice, and hand geometry.

ref: Access control wikipedia http://en.wikipedia.org/wiki/Access_control

2009年6月24日星期三

find 过期的文件删除前先打包的实验

记录一下,以备后查
find -type f -mtime -1 |xargs tar cvfz `date +"%Y%m%d"`.tar.gz
./c
./a
./b
./d
[oracle@croracle01 tartest]$ ll
total 20
-rw-r--r-- 1 oracle oinstall 195 Jun 25 10:11 20090625.tar.gz
-rw-r--r-- 1 oracle oinstall 6 Jun 25 09:36 a
-rw-r--r-- 1 oracle oinstall 6 Jun 25 09:37 b
-rw-r--r-- 1 oracle oinstall 7 Jun 25 09:37 c
-rw-r--r-- 1 oracle oinstall 8 Jun 25 09:37 d
[oracle@croracle01 tartest]$ tar tvfz 20090625.tar.gz
-rw-r--r-- oracle/oinstall 7 2009-06-25 09:37:05 ./c
-rw-r--r-- oracle/oinstall 6 2009-06-25 09:36:47 ./a
-rw-r--r-- oracle/oinstall 6 2009-06-25 09:37:00 ./b
-rw-r--r-- oracle/oinstall 8 2009-06-25 09:37:14 ./d



=====================
完整的脚本,当在cron.daily下面自动跑了
#!/bin/sh
su - oracle
cd /the_directory_of_you_work/
find -mtime +15 -type f |xargs tar cvfz `date +"%Y%m%d"`.tar.gz ##这里打包是15天之前的文件
echo "work at " `pwd;date "+%Y-%m-%d %H:%M:%S"` >>/tmp/test.log
find -mtime +15 -type f -ls -exec rm {} \; >>/tmp/test.log ##这里删除
echo "end at " `date "+%Y-%m-%d %H:%M:%S"` >>/tmp/test.log

2009年6月22日星期一

ORA-19809: limit exceeded for recovery files 處理

在做rman backup試驗的時候如下:
[oracle@croracle01 ~]$ rman target / Recovery Manager: Release 11.1.0.6.0 - Production on Tue Jun 23 18:26:39 2009 Copyright (c) 1982, 2007, Oracle. All rights reserved. connected to target database: CRPROD (DBID=1130088604) RMAN> list backupset; using target database control file instead of recovery catalog RMAN> backup database; Starting backup at 23-JUN-09 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=142 instance=crprod1 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=00002 name=+CRPROD_DATA/crprod/datafile/sysaux.260.686193539 input datafile file number=00001 name=+CRPROD_DATA/crprod/datafile/system.259.686193501 input datafile file number=00003 name=+CRPROD_DATA/crprod/datafile/undotbs1.261.686193551 input datafile file number=00006 name=+CRPROD_DATA/crprod/datafile/undotbs3.268.686702841 input datafile file number=00007 name=+CRPROD_DATA/crprod/datafile/undotbs4.271.687230073 input datafile file number=00004 name=+CRPROD_DATA/crprod/datafile/undotbs2.263.686193591 input datafile file number=00005 name=+CRPROD_DATA/crprod/datafile/users.264.686193611 channel ORA_DISK_1: starting piece 1 at 23-JUN-09 RMAN-03009: failure of backup command on ORA_DISK_1 channel at 06/23/2009 18:41:44 ORA-19809: limit exceeded for recovery files ORA-19804: cannot reclaim 53477376 bytes disk space from 2147483648 limit continuing other job steps, job failed will not be re-run channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set including current SPFILE in backup set channel ORA_DISK_1: starting piece 1 at 23-JUN-09 channel ORA_DISK_1: finished piece 1 at 23-JUN-09 piece handle=+FLASH_RECOVERY_AREA/crprod/backupset/2009_06_23/ncsnf0_tag20090623t182731_0.267.690316919 tag=TAG20090623T182731 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03009: failure of backup command on ORA_DISK_1 channel at 06/23/2009 18:41:44 ORA-19809: limit exceeded for recovery files ORA-19804: cannot reclaim 53477376 bytes disk space from 2147483648 limit
RMAN>

處理辦法:
SQL> show parameter db_recovery_file_dest

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string +FLASH_RECOVERY_AREA
db_recovery_file_dest_size big integer 2G
SQL>

SQL> alter system set db_recovery_file_dest_size=4g;

System altered.

SQL> quit

[oracle@croracle01 ora_arch]$ rman target /

Recovery Manager: Release 11.1.0.6.0 - Production on Tue Jun 23 19:01:41 2009

Copyright (c) 1982, 2007, Oracle. All rights reserved.

connected to target database: CRPROD (DBID=1130088604)

RMAN> backup database;

Starting backup at 23-JUN-09
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=130 instance=crprod1 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=00002 name=+CRPROD_DATA/crprod/datafile/sysaux.260.686193539
input datafile file number=00001 name=+CRPROD_DATA/crprod/datafile/system.259.686193501
input datafile file number=00003 name=+CRPROD_DATA/crprod/datafile/undotbs1.261.686193551
input datafile file number=00006 name=+CRPROD_DATA/crprod/datafile/undotbs3.268.686702841
input datafile file number=00007 name=+CRPROD_DATA/crprod/datafile/undotbs4.271.687230073
input datafile file number=00004 name=+CRPROD_DATA/crprod/datafile/undotbs2.263.686193591
input datafile file number=00005 name=+CRPROD_DATA/crprod/datafile/users.264.686193611
channel ORA_DISK_1: starting piece 1 at 23-JUN-09
channel ORA_DISK_1: finished piece 1 at 23-JUN-09
piece handle=+FLASH_RECOVERY_AREA/crprod/backupset/2009_06_23/nnndf0_tag20090623t190153_0.268.690318119 tag=TAG20090623T190153 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:11:16
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 23-JUN-09
channel ORA_DISK_1: finished piece 1 at 23-JUN-09
piece handle=+FLASH_RECOVERY_AREA/crprod/backupset/2009_06_23/ncsnf0_tag20090623t190153_0.269.690318809 tag=TAG20090623T190153 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 23-JUN-09

RMAN>
SQL> show parameter recovery

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /u01/app/ora_arch
db_recovery_file_dest_size big integer 4G
recovery_parallelism integer 0
SQL>

ZT:Linux减少time_wait方法

Linux减少time_wait方法
检查Apache的连接数,有时会发现很多无用的Time_Wait连接。有人说这是正常的,是因为一个请求中途中断造成的;还有人说微软的 IE连接时产生的Time_wait会比用Firefox连接时多。个人认为有一定的Time_wait是正常的,如果超过了连接数的比例就不是很正常, 所以还是找来方法解决一下。

检查net.ipv4.tcp_tw当前值,将当前的值更改为1分钟:
[root@aaa1 ~]# sysctl -a|grep net.ipv4.tcp_tw
net.ipv4.tcp_tw_reuse = 0
net.ipv4.tcp_tw_recycle = 0
[root@aaa1 ~]#
vi /etc/sysctl

增加或修改net.ipv4.tcp_tw值:
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1

使内核参数生效:
[root@aaa1 ~]# sysctl -p

[root@aaa1 ~]# sysctl -a|grep net.ipv4.tcp_tw
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1

设置这两个参数: reuse是表示是否允许重新应用处于TIME-WAIT状态的socket用于新的TCP连接; recyse是加速TIME-WAIT sockets回收

用netstat再观察正常
这里解决问题的关键是如何能够重复利用time_wait的值,我们可以设置时检查一下time和wait的值

#sysctl -a | grep time | grep wait
net.ipv4.netfilter.ip_conntrack_tcp_timeout_time_wait = 120
net.ipv4.netfilter.ip_conntrack_tcp_timeout_close_wait = 60
net.ipv4.netfilter.ip_conntrack_tcp_timeout_fin_wait = 120

这样的现象实际是正常的,有时和访问量大有关,设置这两个参数: reuse是表示是否允许重新应用处于TIME-WAIT状态的socket用于新的TCP连接; recyse是加速TIME-WAIT sockets回收。

原文:http://www.syitren.com/bbs/thread-8973-1-1.html
收藏之,以备后查!

oracle 務虛應該可以告一段落了

昨天(2009/06/21)也是父親節,順利的passed Oracle 11g new Features,如果沒有意外的話已經upgrade 為Oracle 11g OCP了,留了幾號,記錄一下.
以後的任務是以動手實踐為主了.

实验:oracle 11g RAC change archive log mode

[oracle@croracle01 ~]$ sqlplus / as sysdba;

SQL*Plus: Release 11.1.0.6.0 - Production on Thu Jun 25 04:15:26 2009

Copyright (c) 1982, 2007, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> archive log list
Database log mode No Archive Mode <--Here!!!
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 114
Current log sequence 115
SQL> quit





[oracle@croracle01 bin]$ ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE croracle01
ora....01.lsnr application ONLINE ONLINE croracle01
ora....e01.gsd application ONLINE ONLINE croracle01
ora....e01.ons application ONLINE ONLINE croracle01
ora....e01.vip application ONLINE ONLINE croracle01
ora....SM2.asm application ONLINE ONLINE croracle02
ora....02.lsnr application ONLINE ONLINE croracle02
ora....e02.gsd application ONLINE ONLINE croracle02
ora....e02.ons application ONLINE ONLINE croracle02
ora....e02.vip application ONLINE ONLINE croracle02
ora....SM3.asm application ONLINE ONLINE croracle03
ora....03.lsnr application ONLINE ONLINE croracle03
ora....e03.gsd application ONLINE ONLINE croracle03
ora....e03.ons application ONLINE ONLINE croracle03
ora....e03.vip application ONLINE ONLINE croracle03
ora....SM4.asm application ONLINE ONLINE croracle04
ora....04.lsnr application ONLINE ONLINE croracle04
ora....e04.gsd application ONLINE ONLINE croracle04
ora....e04.ons application ONLINE ONLINE croracle04
ora....e04.vip application ONLINE ONLINE croracle04
ora....d1.inst application ONLINE ONLINE croracle01
ora....d2.inst application ONLINE ONLINE croracle02
ora....d3.inst application ONLINE ONLINE croracle03
ora....d4.inst application ONLINE ONLINE croracle04
ora.crprod.db application ONLINE ONLINE croracle01
[oracle@croracle01 bin]$



SQL> alter system set cluster_database=false scope=spfile;

System altered.


[oracle@croracle01 ~]$ srvctl stop database -d crprod
[oracle@croracle01 ~]$




[oracle@croracle04 bin]$ ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE croracle01
ora....01.lsnr application ONLINE ONLINE croracle01
ora....e01.gsd application ONLINE ONLINE croracle01
ora....e01.ons application ONLINE ONLINE croracle01
ora....e01.vip application ONLINE ONLINE croracle01
ora....SM2.asm application ONLINE ONLINE croracle02
ora....02.lsnr application ONLINE ONLINE croracle02
ora....e02.gsd application ONLINE ONLINE croracle02
ora....e02.ons application ONLINE ONLINE croracle02
ora....e02.vip application ONLINE ONLINE croracle02
ora....SM3.asm application ONLINE ONLINE croracle03
ora....03.lsnr application ONLINE ONLINE croracle03
ora....e03.gsd application ONLINE ONLINE croracle03
ora....e03.ons application ONLINE ONLINE croracle03
ora....e03.vip application ONLINE ONLINE croracle03
ora....SM4.asm application ONLINE ONLINE croracle04
ora....04.lsnr application ONLINE ONLINE croracle04
ora....e04.gsd application ONLINE ONLINE croracle04
ora....e04.ons application ONLINE ONLINE croracle04
ora....e04.vip application ONLINE ONLINE croracle04
ora....d1.inst application OFFLINE OFFLINE
ora....d2.inst application OFFLINE OFFLINE
ora....d3.inst application OFFLINE OFFLINE
ora....d4.inst application OFFLINE OFFLINE
ora.crprod.db application OFFLINE OFFLINE



[oracle@croracle01 ~]$ sqlplus / as sysdba;

SQL*Plus: Release 11.1.0.6.0 - Production on Tue Jun 23 01:53:51 2009

Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup mount;
ORACLE instance started.

Total System Global Area 801701888 bytes
Fixed Size 2148680 bytes
Variable Size 461375160 bytes
Database Buffers 335544320 bytes
Redo Buffers 2633728 bytes
Database mounted.
SQL>



[oracle@croracle01 ~]$ sqlplus / as sysdba;

SQL*Plus: Release 11.1.0.6.0 - Production on Tue Jun 23 01:53:51 2009

Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup mount;
ORACLE instance started.

Total System Global Area 801701888 bytes
Fixed Size 2148680 bytes
Variable Size 461375160 bytes
Database Buffers 335544320 bytes
Redo Buffers 2633728 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL> alter system set cluster_database=true scope=spfile;

System altered.


SQL> shutdown immediate;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL>


[oracle@croracle04 bin]$ ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE croracle01
ora....01.lsnr application ONLINE ONLINE croracle01
ora....e01.gsd application ONLINE ONLINE croracle01
ora....e01.ons application ONLINE ONLINE croracle01
ora....e01.vip application ONLINE ONLINE croracle01
ora....SM2.asm application ONLINE ONLINE croracle02
ora....02.lsnr application ONLINE ONLINE croracle02
ora....e02.gsd application ONLINE ONLINE croracle02
ora....e02.ons application ONLINE ONLINE croracle02
ora....e02.vip application ONLINE ONLINE croracle02
ora....SM3.asm application ONLINE ONLINE croracle03
ora....03.lsnr application ONLINE ONLINE croracle03
ora....e03.gsd application ONLINE ONLINE croracle03
ora....e03.ons application ONLINE ONLINE croracle03
ora....e03.vip application ONLINE ONLINE croracle03
ora....SM4.asm application ONLINE ONLINE croracle04
ora....04.lsnr application ONLINE ONLINE croracle04
ora....e04.gsd application ONLINE ONLINE croracle04
ora....e04.ons application ONLINE ONLINE croracle04
ora....e04.vip application ONLINE ONLINE croracle04
ora....d1.inst application ONLINE ONLINE croracle01
ora....d2.inst application ONLINE ONLINE croracle02
ora....d3.inst application ONLINE ONLINE croracle03
ora....d4.inst application ONLINE ONLINE croracle04
ora.crprod.db application ONLINE ONLINE croracle02
[oracle@croracle04 bin]$


[oracle@croracle01 bin]$ sqlplus / as sysdba;

SQL*Plus: Release 11.1.0.6.0 - Production on Tue Jun 23 02:02:37 2009

Copyright (c) 1982, 2007, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL>

SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 116
Next log sequence to archive 117
Current log sequence 117
SQL>

成了!

2009年6月19日星期五

ZT:读品选择标准

上次和俊煜讨论过写博客的一些想法之后, 我就一直想一个问题, 什么样的东西值得反复读, 或者说耐读.

大约几个星期之前, 我写了一篇没发出来的博客, 大体是说, 读品分成收藏品和消费品两种. 收藏品是那些读完了要放在脑子里的, 对以后做事情有用的. 消费品则是过脑子一下, 为了娱乐或者为了知道某件事情而阅读的那些. 除此两个集合之外, 就是广袤的暗物质, 既看不到, 也想不到. 读者应该注意常常阅读收藏品, 把一部分消费品提取出精华变成收藏品, 并且随机的读一些”暗物质”里面的东西, 就像逛古董市场一样, 以便能找到好的收藏品.

随着更加深入的思考, 我认识到上面的这个分类过于主观. 比如我认为收藏品的东西, 别人不认为是的; 甚至, 我几年前认为是收藏品的东西, 现在完全不觉得有价值. 那么, 判断一样东西有没有阅读的价值, 到底有没有一个相对客观一点的标准呢. 我觉得有, 并且总结了新的两条.

1. 建立了一种全新的框架, 或者全新的思考体验的; 读了之后能够改变人固有的观念或方法的

读了 The Structure of Scientific Revolution 之后, 我就被 paradigm shift 这个词给迷住了, 现在看问题也自觉不自觉的用 paradigm shift 的眼光. 用 paradigm shift 的眼光来看, 像< 黑天鹅> 这样的书, 就是典型的建立一种新的框架的例子. 很多时候, 我们认识不到某种现象后面的道理, 或者不明白一个道理. 这时候, 通过阅读, 我们可以在大脑中建立起一个新的框架, 甚至是用一种全新的思维方式看问题. 常常有人说, 读过了某样东西, 如沐春风, 看世界都不一样了, 我觉得那样的读物就是这个例子.

其实这个不仅限于科学, 在社会, 哲学等领域, 都有这样的例子. 像马克思韦伯, 亨廷顿这样的学者的书, 像开山立派的经济学家的书等等, 都是这样的例子. 就算在文学领域, 也是有大开眼界这一说法的. 比如说没看王朔老师之前, 我从来不知道写文章能写得那么油里油气且聪明好笑的. 这样的例子在各个领域不胜枚举, 都有这类让人大开眼界, “洗心革面”的经典书. 这类书, 当属一品读物.

当然, 也要防止陷入两种极端. 一种是拼命的陷入只读经典书的信息焦虑中, 觉得每天的脑袋都要不一样才行, 每天都要读经典改变自己才行. 其实世界上没那么多经典, 完全不要害怕自己还没读某某经典, 使得自己比起别人来变得笨了. 人的脑袋, 只要充分自恰就行了, 不需要面面俱到. 这种信息焦虑也不是好事, 它会让人频繁的处于搜索新知识的过程中, 而放弃了对已有知识的咀嚼和再认识. 大凡一本好书, 如果作者写得非常自恰, 那基本上是不需要立即按照去找相关的书看的. 一本书, 总是要读个几遍, 才能完全领会其中的精髓, 然后再去找类似的书看, 才事半功倍. 比如读些通俗经济学的书, 立即就跳出去看统计学, 然后跳到数学, 跳到计算机, 本本都是跳经典, 本本都读不完, 再多的经典也是白搭.

第二个极端是陷入对阴谋论的崇拜中. 人初次读一个让自己洗心换髓的书的时候, 往往会陷入对书中理论疯狂的信仰中. 这种信仰可以是好事, 也可以是坏事. 好事是, 如果这本书是一个在相关领域有高深基础的专业人士所写的, 那么这种脱胎换骨往往很快让读者进入状态. 比如读 Knuth 的计算机书, 或者 SICP, 就是这样的例子. 坏事是, 如果这本书只是一个半调子写的, 又为了看上去很牛逼, 那么在书中, 就必然有很多惊世骇俗的言谈. 这种言谈常常是没有什么事实依据, 也没法证伪的. 但因为观点耸人听闻, 显得非常时髦, 比如 < 货币战争>. 我的标准是, 在选择读品的时候, 一定要对那些号称”革命”, “颠覆” 的出版物保持必要的警惕. 比如当年奇书< 学习的革命>, 看了受益的能有几个, 现在还反复阅读这本书的, 又有几个? 再比如< 货币战争> 这样的书, 其中观点如何证伪? 我个人觉得, 这类过分宣扬颠覆, 革命的书, 往往只是宣传的噱头而已. 一定要避免把自己的脑袋用在阴谋论分析里面.

还有一种读品, 也算是建立了一个新的框架, 但是知识密度不够, 或者被更加新的知识取代. 这类读品我觉得也不值得阅读. 比方说, 佛经有很多种读法, 其中有一种读的方法是把佛经当成心理学读. 如果是这样, 那么读佛经, 绝对抵不上读现代心理学的书籍. 现代心理学, 无论是在框架完整性, 还是在对问题的研究深入程度上, 都胜过于佛经不知道多少倍(我不想打口水仗, 我只谈把佛经解读为心理学和现代西方心理学之间的关系). 况且, 佛经当中, 其他知识和心理学知识淆杂, 知识密度比较低. 像< 黑天鹅>这样的书, 其实也是废话太多. 如果读者肯花功夫认真研究概率论, 则这本书绝对抵不上概率论的深度和广度. 像牛顿的< 原理>, 现在更加好的物理教科书太多了, 完全没有必要读牛顿的原作. 事实上, 有很多学科, 最经典的书不见得是最好的读品, 如果经典书已经被新的理论取代, 则最好还是读现代的书籍. 在社会科学领域, 有些 18XX 年蒸汽时代写成的哲学书还被人奉为圭臬, 有些原本写给农民看的文章, 或者教育幼儿园小朋友的学说, 直到今天还有人觉得价值巨大. 其实早就有更多深刻有价值的内容完全的胜出这些思想贫瘠的内容了. 最好的理念是, 如果有一个富矿, 就不要先去采一个贫矿. 有时, 或作者自己文笔不够好, 或作者表达能力不够强, 或作者思考能力不够深入, 或者因为写作年代较早, 相关理论不健全等等, 一些读品总让你感到有个如骨鲠在喉的结论作者一直没说出来, 然后自己也悟不出来, 痛苦至死. 对于这一类读品, 我认为用”读百遍, 义自现”的方法去读完全是浪费时间, 因为有更加好的读物只要读一次两次就明白了相同的道理. 在科学学习上也有类似的例子, 比如说任凭看多少科普, 都比不上自己找本教科书学得踏实; 任凭上多少维基百科看多少条目, 抵不上自己从课本看起. 因此, 我们最好要选择知识密度高的, 框架严密的读品, 这样才是阅读的捷径. 常常纠结于过时和劣质读品的一个原因, 是因为并不知道有更加高价值的东西存在. 因此在选择读品时, 如果有高人指点, 或者花点时间看看书评等等, 选择的时候就会少一点盲目, 快速的选到富矿, 而不需要在贫矿上纠结.

还有一种读物, 整本书就可以用一句话概括, 非要絮絮叨叨的写一本书. 这样的书, 作为读物本身是没有价值的, 但是作为一本放在书架上随时用标题提醒自己还是有价值的. 比方说, < ##决定成败> 和 <> 这样的书, 只要每天瞄瞄提醒自己一下要注意细节, 要勤奋工作投入时间, 大致上就差不多了. 就算把整本书背下来, 效果也和天天见封面差不多. 大部分成功学的书, 讲经济管理方法的书, 讲处理人际关系的书, 基本上都是只有标题(或目录)有价值. 如果书店允许人只买封面, 我相信不少人只需要买个封面回家就够了, 里面东西读了和不读是一样的.

2. 需要被反复推敲, 语料型读物. 能够从里面挖掘出思考

这类书, 主要是史料, 参考资料和人物传记, 加上一些小说. 在我的计算机专业中, 我喜欢读图灵奖论文集这些玩意, 看上去和自己研究没啥关系, 但是读一遍思考一遍就觉得又学了一个新东西, 又重新沐浴了一遍. 还有史书或者人物传记. 这些书, 应该仁者见仁的读. 不同的读者用视角能读出不同的东西. 有的时候能读出文学, 有的时候读出做事情的方法, 有的时候能读出如何追MM 等等, 读法不是固定的, 所以完全不要按照别人既定的读法去剖析. 只要有脑子, 完全可以自己从中找到有益的东西. 这些读品, 比上面说的成功学, 管理学的读品要有价值的多. 因为这是别人告诉你的他们经历的一手人生体验, 完全可以结合自己的经历融入自己的血液.

有些史料, 语料, 人物传记等, 过于简略和微言大义, 我觉得不可看. 因为与其花精力咬文嚼字的研究一个字, 一段话的深刻含义, 不如找点平实的文字; 有些资料过于八卦, 过于琐碎, 我也建议不要看, 因为整理碎片的工作很麻烦, 比如有些老师的文字, 基本上就是东拉西扯的毫无体系的文学碎片. 作者不好好说事情, 东一榔头西一棒显示博学的, 把博学部分可以撕了再看, 比如< 梦断代码>, 只有真实的故事有价值. 有些老师的书撕了八卦和卖弄, 基本就剩下封面了, 所以可以只买封面看. 大多数权贵人士的回忆录, 基本都不值得看, 因为已经被化妆了, 而第三方写的人物传记, 倒是价值巨大; 还有一些资料, 作者倒是有很多一手资料, 也研究了很多一手资料, 但行文流于戏说, 或附加太多没有根据的猜测和个人观点, 而将有价值的资料掩盖. 这一类的, 除非作者观点属于第一类, 否则大可撕了再看.

除了史料和小说, 人物传记等等, 还有一种就是新闻和信息类消息博客, 理论上也能得到一些思考材料. 不过信息类博客和新闻的阅读比较耗时间, 而且信噪比不大, 很多东西其实自己不需要的, 也给读了. 我现在也没有很好的办法, 所以我现在干脆就不读. 当然这是因噎废食了, 如果读者有更好的方法, 不妨推荐.

我说的第二类读品, 和第一类一样, 都是属于耐读的范畴. 这种耐读, 在于每多读一次, 就能吸取一次营养. 第一种提供思考的方法, 第二种提供思考的材料来源. 看上去很完美. 但实际中, 人不可能这么理想化的去阅读, 往往最是闲书, 在某些时候最是有用. 所以, 我觉得还要在上面这两种读品之外, 外加一品, 一切觉得好玩的喜欢的有意思的读品. 这类东西, 不见得耐读, 可能读了之后都忘得差不多了, 如洗发水一样, 用完就扔了的那种, 算得上是消费品类型. 如果用纯粹功利的眼光去看, 这样的读品一本不读最好. 但是耐读的东西, 其实总是由不耐读的慢慢积淀成的, 况且如果光读所谓的耐读, 生活也显得颇为无趣. 一个人用持续的, 轻松愉快的心态, 每天读些消费品, 让这些有趣的东西过过脑子, 他的知识结构和思想认识就不会僵化, 不会显得掉书袋, 且富有幽默感和时代精神. 一个很普遍的现象就是, 很偶然机会读到了某样东西, 东西本身可能不是好东西, 但是却打开了一扇新的窗, 发现了很多好东西. 就像金库的铜钥匙一样, 还是要随手捡一点比较好玩.

三种读品都消化, 应该可以造就一个敏锐, 靠谱和有幽默感的人.

原文在此 ref:http://blog.youxu.info/2009/05/17/read/

Object-C StudyNote-1

Method:
.. Behavior associated with an object

-(NSString *) name
{
// implementation
}
-(void)setName:(NSString *) name
{
//implementation
}

selector --有点引用的意思
. name for referring to a method
. include colons to indicate arguments
. Doesn't actually include arguments or indicate types
SEL mySelector = @selector(name);
SEL anotherSelector = @selector(setName:);
SEL lastSelector = @selector(doStuff:withThing:andThing:);

Message
. the act of performing a selector on an object
. with arguments, if necessary
NSString * name = [myPerson name];
[myPerson setName:@"New Name"];

2009年6月16日星期二

ZT Oracle.Rac - Enabling Archive Logs in a RAC Environment - (Oracle11g)

  1. Login to one of the nodes (i.e. linux1) and disable the cluster instance parameter by setting cluster_database to FALSE from the current instance:
    sqlplus "/ as sysdba"
    SQL> alter system set cluster_database=false scope=spfile sid='rac1';

  2. Shutdown all instances accessing the clustered database:
    srvctl stop database -d rac

  3. Using the local instance, MOUNT the database:
    sqlplus "/ as sysdba"
    SQL> startup mount

  4. Enable archiving:
    SQL> alter database archivelog;

  5. Re-enable support for clustering by modifying the instance parameter cluster_database to TRUE from the current instance:
    SQL> alter system set cluster_database=true scope=spfile sid='rac1';

  6. Shutdown the local instance:
    SQL> shutdown immediate

  7. Bring all instance back up using srvctl:
    srvctl start database -d rac

  8. (Optional) Bring any services (i.e. TAF) back up using srvctl:
    srvctl start service -d rac
  9. Login to the local instance and verify Archive Log Mode is enabled:
    sqlplus "/ as sysdba"
    SQL> archive log list
    Database log mode Archive Mode
    Automatic archival Enabled
    Archive destination USE_DB_RECOVERY_FILE_DEST
    Oldest online log sequence 83
    Next log sequence to archive 84
    Current log sequence 84
After enabling Archive Log Mode, each instance in the RAC configuration can automatically archive redologs!

好文收藏,原文在此:http://boulayp.free.fr/articles.php?lng=en&pg=386

ZT: 割斷慾念之繩

【割斷慾念之繩~~】

◎劉誠龍

有一則故事,
一個後生從家裡到一座禪院去,在路上他看到了一件有趣的事,他想以此去考考禪院裡的老禪師。
來到禪院,他與禪師一邊品茗,一邊閒扯,冷不防他問了一句:「什麼是團團轉?」
「皆因繩未斷。」老禪師隨口答道。
後生聽到禪師這樣回答,頓時目瞪口呆。

禪師見狀,問道:「什麼使你如此驚訝?」
「老師父,我驚訝的是,您怎麼知道?」
後生接著說:「今天在來的路上,看到一頭牛被繩子穿了鼻子,拴在樹子,這頭牛想離開這棵樹,到草地上去吃草,誰知牠轉來轉去都不得脫身。
我以為師父您既沒看到,肯定答不出來,哪知師父隨口便答對了。」

老禪師微笑著說:「你問的是事,我答的是理,你問的是牛被繩縛而不得解脫,我答的是心被俗務糾纏而不得超脫,一理通百事啊!」
後生大悟!一只風箏,再怎麼飛,也飛不上萬里高空,是因為被繩牽住; 一匹壯碩的馬,再怎麼頑烈,只要被馬鞍套上,就任由鞭抽,也因為被繩牽住。


那麼,我們的人生,又常常被什麼牽住了呢?

一塊圖章,常常讓我們坐想行思;
一個職稱,常常讓我們輾轉反側;
一回輸贏,常常讓我們殫精竭慮;
一次得失,常常讓我們痛心疾首;
一段情緣,常常讓我們愁腸百結;
一份殘缺,常常讓我們蹙眉千度。


為了錢,我們東西南北團團轉;
為了權,我們上下左右團團轉;
為了慾,我們百轉千迴奔竄;
為了名,我們日日夜夜竄奔。
快樂哪去了?幸福哪去了?

因為一根繩子,風箏失去了天空;
因為一根繩子,水牛失去了草原;
因為一根繩子,駿馬失去了馳騁。

塵世的誘惑或牽掛都是繩。
人生三千煩惱絲,你斬斷了多少?

禪師說:「眾生就像那頭被繩束縛的牛,被許多煩惱與慾念纏縛著,生生死死不得解脫。」

【心得感想】

一條看不見的繩子
每天將自己纏繞而不自知
看見繩子無用
還要敢剪斷他.......

好文收藏
原文在此:http://bbs1.mychat.to/reads.php?tid=429779

2009年6月14日星期日

virtual Desktop Manager 好東西!

昨日看 第3章 專注法則,解釋如何focus on sth,在window環境下M$有自己的工具叫 PowerToy,其中的vitrual Desktop Manager 可以切分多個窗口,具體說是4個.
分別設置為"交流" "文檔" "開發" 等桌面

不錯的提高效率的方法,來公司的第一件事就是,download試用一下,效果還可以.

東西在這: http://www.microsoft.com/windowsxp/Downloads/powertoys/Xppowertoys.mspx
free的.

參考文件在這裡: http://briian.com/?p=3562 圖文並茂.

2009年6月13日星期六

Systems architect

In systems engineering, the systems architect is the high-level designer of a system to be implemented. 
The systems architect establishes the basic structure of the system, defining the essential core design features and elements that provide the framework for all that follows, and are the hardest to change later. 
The systems architect provides the engineering view of the users' vision for what the system needs to be and do, and the paths along which it must be able to evolve, and strives to maintain the integrity of that vision as it evolves during detailed design and implementation.


ref:http://en.wikipedia.org/wiki/Systems_architect

2009年6月12日星期五

ZT last message repeated N times

在production环境中也经常出现last message repeated N times 这类信息,从网上找到一个解决办法,系统稳定了,测试一下, 感谢google, 感谢google reader


作者:thinkinginlamp
作者:老王

偶然发现系统日志/var/log/messages里出现大量错误信息:

Jun 8 13:20:49 SERVER snmpd[14281]: Connection from UDP: [192.168.0.178]:9632
Jun 8 13:25:07 SERVER last message repeated 7 times
Jun 8 13:30:49 SERVER last message repeated 8 times

先来想办法重现一下这个问题,在shell里使用logger命令:

logger "foo"
logger "foo"
logger "foo"
logger "bar"

logger命令会向/var/log/messages日志里写入相应的信息,可以用tail -f /var/log/messages查看:

Jun 8 21:23:32 SERVER root: foo
Jun 8 21:23:34 SERVER last message repeated 2 times
Jun 8 21:23:37 SERVER root: bar

大致了解了last message repeated N times信息产生的原因。至于它的作用,无非是为了屏蔽不必要的重复信息,感觉用处不大,看着还闹心。真实的重复信息也就是last message repeated N times上面的信息,如此一来,回到文章开头,就能猜到本文中出现大量last message repeated N times的原因在于有一个IP不断的连接snmpd服务,且中间没有插入其他日志信息。

查看一下snmpd的启动脚本/etc/init.d/snmpd,会发现里面有如下参数设置:

OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd.pid -a"

通过man snmpd和man snmpcmd查到-Lsd参数的作用就是向syslog里系日志,没什么大用,直接去掉:

OPTIONS="-Lf /dev/null -p /var/run/snmpd.pid -a"

修改后别忘了重启一下服务:/etc/init.d/snmpd restart,唐僧不再唠叨,世界终于清净了。

原文在此: http://hi.baidu.com/thinkinginlamp  
纪录一下!

ZT: 学习方法



“在改变世界方面,绝大多数人缺乏的并不是改变的事物的勇气,而是改变事物的技巧”
这句话,跟我办这个博客的本意相近,大多数人都对快速学习有兴趣,就是不知道从什么地方开始,这个博客就是帮助大家提高学习的效率。

  “一个关键理念就是:少数的行为能够带来巨大的变化”。如果你能仔细观察和反思自己的行为,找出是哪一点阻碍学习,并想出改进办法,学习的速度和效率就会突飞猛进。

  观察他人的行为会极大地影响我们自己的行为”你和你身边的人在互相影响,不管是好的还是坏的行为都会互相影响,要是你能找到一个有好学习习惯的人并跟他一起学习的话,自己也会改变。最好去跟杰出人士或专家成为朋友,你也会受他影响并做出改变的

  “如果你改变世界,必须改变人们的行为;而如果你要改变他们的行为,必须首先改变他们的思维方式“想做出实际行为之前,必须要改变观念,相信自己能办到,并考虑好怎么去做再去行为,效果能更好一些。

  书中提到了影响力的三条原则,大家应该知道:

  1、谨慎地寻找那些关注关键行为的策略;

2、发现并改变少数关键行为;

3、找到补救行为。



《影响力2》(Influencer)阅读心得(2)--超越你的极限


《影响2》这本书在学习方面带来给我不少的新的想法和心得。特别是第5章,我把这章的主要内容摘录一下,非常推荐你自己阅读一遍这章。

1、每个人都有希望

基因并不像学者者过去认为的那样,对人的体能、思维灵敏度,甚至自律能力起决定性作用。学者及哲学学们一直以来所说的基因天才或终身的性格特点是后天习得的,就像人们学习走路、说话或吹口哨一样。

这意味着你可以改变现状,就能够养成德韦克所说的“成长型思维模式”。只是尚未找到正确的方法去发挥它

注:“成长型思维模式”:在遇到挫折的时候,并不认为自己失败,而是不断尝试使用新的方法来解决问题。这种人虽然先天能力并不是非常突出,但往往能在后来取得更大的成就。

2、意志力很大程度上源于技巧

书中以中著名的糖果实验为例。1965年,米契尔博士和艾伯特 班德拉进行一项研究。在多次观察中发现,将不能推迟享受的孩子们和懂得如何推迟享受的示范人员放在一起。不能推迟享受的孩子们可以通过观察成功者来效仿这些行为。实验得到结论,推迟享受者更善于抵制短期诱惑。他们不仅仅是绕开诱惑;他们运用具体、可学习的技巧转移自己的注意力,关注获得第二块糖果的长期目标,而非眼前短期的享受。

3、大多数技巧源自练习

心理学家安德斯 埃里克森(Anders Ericsson)提出,任何领域的佼佼者之所以使同行相形见拙,是因为他们非常注重“刻意练习”(deliberate practic)。

“熟生成巧”的前提是有正确的练习法。但里克森主张,取得杰出成就的人之所以成功,依靠的就是细心而有指导的练习,也就是有技巧的练习,除此别无他法。他的研究显示,超凡的技巧、不凡的成就、社会精英的地位,并不是由基因决定的;而在于是否能够通过“刻意练习”提高自己的技能。

例如,埃里克森描述了花样滑冰运动员在冰上的不同训练;有望参加奥林匹克运动会的选手们要不断练习他们尚未掌握的技巧;滑冰俱乐部孤人则相反;他们练习已经掌握的技能;业余滑冰者可能会有一半的时间在滑冰场和朋友聊天,而根本不练习。简 单来说,花同等时间滑冰的滑冰者,由于他们不同的练习方法,最终取得的成绩也各不相同。在埃里克森的研究中,这一发现适用于任何一种技能,包括记忆复杂的 清单、下棋、比赛拉小提琴以及学习各种现有的运动技能等等。它也适用于一些较复杂的活动,如演讲、与人相处、进行谈判等等。

通过刻意练习提高成功,不仅仅适用于花样滑冰、下棋和学习小提琴等活动,而且适用于与同事相处、激励团队成员改善质量标准、情感交流、以及细腻、敏感的人际交往等。

我们之所以面临许多重大而顽固的问题,是因为我们缺乏技巧(这又源于缺乏刻意练习),而不是源于基因的优劣、缺乏勇气或性格缺陷。长期以来,人们认为自律能力是一种性格物质,杰出的成就源于天赋,而实际上它们增均源于一种能力,即正确的练习具体技巧的能力。学会练习正确的行动,就能学会抵制各种诱惑,学会与上司的谈话不再尴尬。

继续《影响力2》的读书笔记,这本书的第5章中所讲到的理论,正是我这段时间一直思考而得来的心得,补充一些我没有想到的地方,相互验证,有了不少新的想法和心得。

4、完善复杂的技巧

并非所有的练习都是积极的练习。正因如此,会遭遇“发展受阻”(arrested development)。对于简单的运动,只要50小时练习时间就能达到非常熟练的水平。随后技巧就会稳定下来。能娴熟加以运用,但却无法得到进一步的提高。是因为脑中的权衡告诉我们,为发现并学习新事物所付出的额外努力很可能只会带来不断减少的边际回报,因此我们停止学习。

大多数专业人士一直学习提升自己,当他们达到一种“可接受的”水平时,便达到学习高原。比如:软件工程师一般在进入职场五年后达到能力的最高峰。在安德斯●埃里克森博士看来,提高不仅仅与练习有关,更与“刻意练习”有关。埃里克森发现,不论在体种技术领域,要成为佼佼者,在职时间和业绩水平之间并不存在相互联系。

比如说一位有二十年工作经验的脑部外科医生,并不会因为工作时间更长而比仅工作五年的新人技术更精湛。他们之间的不同点与经验毫无关系,而与刻意练习有 关。时间是必不可少的(许多领域的佼佼者从事自己的职业至少达十年或十年以上,如音乐作曲、舞蹈、科学、小说创造、下棋及得等等)但它并不是成功的关键因 素。关键因素在于明智地使用时间。练习的技巧才能使人臻于完美。

何谓刻意练习到底是什么?我们应该怎样将这些技巧运用于关键行为,从而增强自身的影响策略?

(1)要求在短时间内高度集中精力

进行刻意练习要求全神贯注。不允许分心,学生们将这种能力视为最困难的挑战,优秀的音乐家和运动员认为,注意力是他们无法“刻意练习”的最大限制因素。

(2)依据明确的标准提供及时反馈

练习某种技巧所花时间的长短,远没有获得按照标准提出的明确而频繁的反馈重要。快速的反馈,特别是与最优秀者的比较之后,加入全力的投入,能加速学习过程。

伊丝娜●↑里德告诉我们,极有效率的老师们一个关键行为就是,他们安排的教学与测试之间的时间跨度很短。一旦测试测试变得频繁,它就成为熟悉的事物,就不再是令人畏惧的大事。它使人们能看到自己在特定标准下的表现。

(3)将成功分解为一个个小目标

一直以来,影响力大师都知道设立明确且可实现的目标非常重要。首先,他们明白设立具体目标的重要性。人们声称自己明白这一理念,但实际上很少有人真正将其付诸实践。在关注具体成绩水平时,优秀者设立目标旨在改善行为和过程,而非结果。

班德拉博士指出,要鼓励人们尝试自己惧怕的事物,必须给他们提供快速、积极的反馈,以帮助他们树立信心。要实现这一点,你可以提供明确具体的方法,并为这一方法设定短期、具体、简单且低风险的目标,以使复杂、长期、笼统、高风险的任务变成简单、短期、具体而零风险的任务。

书中举了几个例子,比如篮球运动中,投篮命中率70%以上的与50%以下的人,训练方式完成不同,优秀球员关注的是技术性的目标,如“将手肘放在身体两侧”和“出手的角度”。差一点的运动员关注的是结果性的目标,如“这次我要连续得十分”。

(4)准备应对挫折:增强抗风险能力

在学习初期,用婴儿学步的方式保证成功在实现短期目标很重要,但如果学习者刚开始只有成功的经验,那么失败很容易使他们失去信心。初期的成功会使人们产生错误的观念,以为成功并不需要太多的努力。而一旦遇到问题,他们就会变得气馁。

要有效的处理这个问题,需要付出努力、坚持不懈和韧性。因此,练习中应增加需要更多努力和韧性才能完成的任务。随着学习者们完成的任务越来越艰巨,不断从失败中振作,他们发现挫折并不是永远的路障,而是需要继续学习的信号


全文在此: http://www.read.org.cn/html/634-influencer2-reading-experience-1.html

http://www.read.org.cn/html/648-influencer2-reading-experience-2.html

2009年6月11日星期四

oracle 11g 中的result_cache_mode

找机会测试一下
SQL> show parameter result_cache_mode

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
result_cache_mode string MANUAL
SQL>

value: manual , auto , force
记录一下,备查

Gnome Linux Disable / Turn Off Hardware Beep Sound For Terminal(Linux & FreeBSD)

如何幹掉機器的嘟嘟聲

This beep sound is annoying under Linux, how do I disable it forever under Debian / Fedora / RHEL / Red Hat / Ubuntu Linux?

There are diffrent methods to disable / turn of beep under Linux (turn off terminal beep). Use any one of the following method as per your requirements.

Ubuntu Linux / Gnome Terminal

a) Open Gnome terminal

b) Click on Settings > Preferences > Silence Terminal Bell

Alternatively, Click on General Tab -> General -> Un-Check Terminal bell option

If you are using xterm

Open ~/.xsession file (i.e. /home/you/.xession)
$ cd
$ vi .xession

Append the following line:
xset b off
Save and close the file.

If you are using bash shell

Open you ~/.inputrc file (i.e. /home/you/.inputrc file
$ cd
$ vi .inputrc

Append following line:
set bell-style none

Save and close the file.

If you just want to turn off beep for VIM text editor

Open vim config file ~/.vimrc (i.e. /home/you/.vimrc)
$ cd
$ Vi .vimrc

Append following line
set vb

Save and close the file.

If you are using Ubuntu Linux

a) Click on Applications > Accessories > Terminal
b) Now click on Edit Menu > Current Profile
c) Click on General Tab > General > Remove check box (Terminal bell)

You can also remove the driver, enter:
$ sudo modprobe -r pcspkr
Append the following line to your /etc/modprobe.d/blacklist so that beep remains off after the system reboot:
blacklist pcspkr



FreeBSD Disable Bell / Beep ( Hardware beep )

I know how to disable beep sound under Linux, but the settings are not working under FreeBSD laptop. How do I disable beep sound under FreeBSD operating system?

To enable or disable bell use MIB hw.syscons.bell under FreeBSD operating systems. Type the following command to disable for current session:
# sysctl hw.syscons.bell=0
Make sure settings remains same after you reboot the laptop, enter:
# echo "hw.syscons.bell=0" >> /etc/sysctl.conf


原文在此:http://www.cyberciti.biz/faq/how-to-linux-disable-or-turn-off-beep-sound-for-terminal/

http://www.cyberciti.biz/faq/turning-off-freebsd-system-hardware-beep-linux/

The Unix family tree


有意思的東西
原文在此:http://www.computerworld.com/action/article.do?command=viewArticleBasic&articleId=9133696

Security administrator tasks list

Implements and maintains security devices and software
--security products require monitoring and maintenance in order to provide their full value.

carries out security assessments
--security assessments enable the business to understand the risks it faces, and make sensible business decisions about products and services it considers purchasing, and risk mitigation strategies it chooses to fund versus risks it chooses to accept, transfer, avoid.


configures and maintains security labels in mandatory access control(MAC) environment.
--MAC environment,mostly found in government and military agencies, have security labels set on data objects and subjects.

Sets initial passwords for users

Reviews audit logs

Administrative Management--行政管理

常用手段:
job rotation: Means that , over time, more than one person fulfills the tasks of one position within the company.
Least privilege: means an individual should have just enough permissions and rights to fulfill his role in the company and no more.
Mandatory vacations

2009年6月10日星期三

好文轉了再轉:我对YardLife的看法

早上转了一篇《一个美国文科博士的YardLife》,里面有不少可以学习的地 方。100个人可能有100种看法,简单说一下我的看看,欢迎大家发表自己的看法

1、一定对所学习的东西有兴趣。当你对一件事情产生兴趣,自然会有学习 的动力,才能长年坚持下去。文中提到的YardLife对有兴趣来说是天堂,对 没有兴趣的人是地狱。如果不是真正喜欢,过这种生活就是在受罪,人生苦 短,还找些自己喜欢的事情来做。

2、培养阅读的习惯,早点学习些速读技巧。一般来说,一个领域内的专家 都需要大量的经验和阅读。而你阅读的专业书籍和资料比其它人更多,你的 成就也就更大。现在这个时代,各种各样的书籍和资料就是一直看到死也看 不到,速读可以帮助你阅读海量的资料花上更少的时间。阅读的时候,要学习有所选择,尽量阅读经典,关注书中最主要的部分,而不是从头读到尾。

3、多学几门语言。除了英语之后,更好再花时间多学几门语言。现在这个 时代,多会一门外语,就比别人多了一些机会。语言学习方面,阅读高于一 切。语言不好的原因就是阅读不够。阅读给语言以内涵,口语和写作可以从 读书中练。书看多了,思想和表达都有变化。

而学习语言最见效的方面就是高强度的学习。文中提到的“他当年在 纽约上过一个古希腊语虐习班,每天实打实上课8小时,其他的时间,除了 睡觉吃饭,全部用于写各种作业练习,大概也要花上6小时。每天一小考, 每周一大考,每天学习到深夜两三点,如此坚持了10个星期,学了大约相当 两年的课程。语言班很多,没有最疯狂,只有更疯狂,报这个班的必定是强 悍的人,否则神经必然崩溃。”高强度10星期的学习=2年的课程,而这10个 星期很可能会改变你的一生。

4、培养每天锻炼的习惯。高强度的学习,没有足够好的身体素质基本没有 办法坚持下来。当你养成每天锻炼的习惯之后,会发现不是有意识地下指令 ,而是顺应身体的需要。让你的意志跟着身体走,而不是身体勉强服从于意 志!

5、学会利用网络来寻找自己需要的东西。现 在是网络时代,要想生存下去 ,一定要学会利用网络来寻找自己需要的东西。使用Google、维基百科、电 驴、BT来寻找资料只是最基本的技巧。一定要学习利用网络来寻找,跟你志 同道合的人,这些人会告诉哪些东西最有用,而且能互相帮助。大家一起来 研究或学习,要比你自己学的更快、更有效率。

6、充分利用一切业余时间来学习。可以在网上下载各种有声书、视频或教 程,放到你的IPOD、手机、MP3/4,利用平时的空闲时间能学到很多东西。 学习就是一点一滴的积累。

7、离开网络。网络能找到任何想要的东西,同时也在浪费大量的时间,生 活中不是只有网络。每天拿出一部分时间,离开网络,陪陪家人,好好思考,会对你帮 助更大。我现在写作之前或思考时,先定个时间,利用网络来搜索所需要的 时间。时间一到,就拔掉网线,这样才能专心做自己想做的事情。

8、离专家、牛人更近一点。想办法跟你这个专业的专家在一起。在他身边好好观察,能让你更快的成长。跟牛人在一起,自然会有压力和动力,比你自己独自学习,要快上很多。人以类聚, 物以群分。还是很有道理的一句话。


原文在此:http://www.read.org.cn/html/641-i-yardlife-views.html

BBCchina 学习英文的好地方

发现BBC英语教学是个很不错的地方
记录一下备查
http://news.bbc.co.uk/chinese/simp/hi/learn_english/default.stm

14 rules for better web performance

• Rule 1: Make Fewer HTTP Requests
• Rule 2: Use a Content Delivery Network
• Rule 3: Add an Expires Header
• Rule 4: Gzip Components
• Rule 5: Put Stylesheets at the Top
• Rule 6: Put Scripts at the Bottom
• Rule 7: Avoid CSS Expressions
• Rule 8: Make JavaScript and CSS External
• Rule 9: Reduce DNS Lookups
• Rule 10: Minify JavaScript
• Rule 11: Avoid Redirects
• Rule 12: Remove Duplicate Scripts
• Rule 13: Configure ETags
• Rule 14: Make Ajax Cacheable

出自《Even Faster Web Sites》 Steve Souders 还没有看,备查

ZT: 高效阅读法九要点

总觉得自己的阅读有问题,找到一篇文章记录之,查阅使用!

 好象很久没有跟大家分享关于阅读技巧的文章了,今天来说说高效率阅读时要注意的九个要点:

  一、必须将自己的注意力集中于你所阅读的材料上

  首先你要注意标题。你若还没有读过标题,那么你就得立即回过头去看看。 一本书、一部小说、一篇文章或者一个章节的标题,对你可能大有助益,因为它可能有这样几个作用:

  1、它能告诉你,现在你正在读什么。

  2、它能告诉你,为什么你要读这本书、这篇文章或者这一章节。

  3、它能激发你的好奇心,从而使你更想读这本书、这篇文章或者这一章节。 集中注意力之必要性和重要性是显而易见的。无数事实已经证明:没有一个人能够一边有效地阅读一本科学读物,一边却还在想着别的事情。

  二、必须明确自己阅读的目的

  书名、篇名、大标题、小标题以及开头的提示性问题能够帮助你确立阅读的目的。只有明确自己阅读目的的读者才能成为一个好的读者,因为只有这样的 读者才能知道自己想通过阅读得到点什么,于是他(她)就能很好地集中自己的注意力。 “这真的是有魔力的吗?” 上面这个标题对你是否有吸引力?如果有吸引力的话,那么你一定是充满了好奇心,急于想知道这本书的下一章或者下一节里到底讲点什么。而一个充满好奇心的读 者必定是一个比较好的读者。

  三、要能够正确地读出每个词语并且懂得它的意义

  1、要善于从上下文的联系中准确而完整地理解每个词语特别是关键词的意义。

  2、要充分地利用书里为你提供的注释如果还有别的你不识的字、词或者你不懂的专门术语,你就必须查阅语言字典、词典或者各种专业辞典。 有时候即使只有一个词(特别是反复出现多次的关键词)你不懂,你也可能读不懂那篇文章或那本书。

  四、要善于根据自己的需要调节阅读速度

  为了从你的科学读物中获取全部重要的科学知识,你一定要慢慢地、仔细地阅读。 一般地说,开始阶段宜读得慢一点。待你对阅读内容比较熟悉之后,方才可提高自己的阅读速度。 如果你只是为了消遣而去读一本文学作品,那你就尽可以读得快一点。但你若是为了研究或者评论的目的去读的话,那就另当别论了。

  五、必须理解阅读的内容

  1、 做简洁、准确的笔记(可以利用提示性问题和小标题)

  2、 善于利用总结来帮助自己回忆并记住那些重要的事实。

  3、 写出一份简单的大纲。 让各种大、小标题帮助你找出各章开头的那些提示性问题的答案。然后,你阅读时记下那些你认为重要的事实。如果在一章的结尾部分有小结的话,那么你一定要仔细地阅读。你应该注意一下,你自己做的笔记中是否包含了书中小结里的每一个要点。

  六、必须懂得阅读材料各部分内容之间的内在联系

  你有必要花点时间去研究跟阅读内容有关的各种图片、图表、地图、地球、立体几何图形的模型和其它各种形象化的辅助手段。它们往往能帮助你对一些抽象问题的理解,并能使你把阅读内容记得更牢。

  七、阅读时必须充分运用想象力

  1、当作者选用了正确的词语来表达他的思想时,他就好象画出了一幅幅用那些词语构成的图画,而你就能用自己心灵的眼睛去感知个欣赏那些画。

  2、当作者将一件事物与另一件事物作比较时,他就能将那幅由词语构成的图画描绘得更加清晰,同时也画得更快。

  3、当作者使用的词语在你的脑海中形成了一幅幅鲜明的图画时,阅读将变得更轻松容易,也更令人愉快。

  4、当作者使用的词语形成了你心灵的眼睛能够感知和欣赏的一幅幅图画时,你就必定能更好地理解并记住阅读的内容。

  八、要能够从众多的细节中辨别出那些是重要的

  一般地说,细节是不重要的,是可有可无的。但并不尽然。有些细节对你准确而完整地理解阅读的内容并不是可有可无的,而是必不可少的。

  九、不要把自己的学习手段局限于阅读,不要把自己的学习范围局限于书本知识

原文在此: http://www.read.org.cn/html/426-high-performance-reading-nine-points.html

好文转:稻盛和夫清华演讲谈抵御经济危机笔记

稻盛先生被誉为日本的经营之神,其麾下京瓷和KDDI都是世界500强企业,其经营的核心思想是打造企业高收益的经营体制,坚持企业积累留存,在危机萧条中成长。 

首先乐观面对危机,当然这种乐观不是盲目的,而是建立在一个坚实的基础上。即使没有坚实的基础,也应该坚韧不拔的对待危机,这样才有机会度过危机。 

稻盛先生领导的企业,利润率都在30%以上,并且具有核心竞争力,如产品只有自己能作,或者服务不可替代,所以即使销售额下降50%,依然会保持盈利,而不是亏损。甚至在1973年石油危机中,京瓷的销售额从27亿日元下降到3亿日元,企业依然保持盈利。 

稻盛坦言自己谨小慎微,特别注意企业积累留存,因此才能面对危机充满自信,告诉员工,即使企业2~3年销售额为0,企业依然能够生存,可以保证员工的工作岗位。当然,这种做法,收到投资家的反对,认为稻盛的企业ROE低,应该进行主动投资。然而稻盛先生认为这是一种短视的做法,无法保持企业长期繁荣,抵御各种冲击。同样是Google,也坦言发展不会根据华尔街的预测,采取双重股权确保企业管理层控制企业发展方向。 

在危机中飞跃,是稻盛企业的特点,特别是危机过后,企业都会得到大发展。在高收益和高企业留存的支持下,在危机时刻,无论是设备,人力,还是市场拓展,相对成本都较低,企业正好可以进行充分调整,等到市场恢复是得到大发展。特别举了竹节的例子,认为经济危机中企业才能形成竹节,才能发展。 

稻盛重点谈了五项危机对策: 

1. 全员营销 
销售是企业的根本,必须团结一致,即使是生产线的人员,也要开动脑筋,提出好的想法,提交客户方案,来增加销售。生产人员进行营销,能够更加对销售的困难有切身体会,这种轮岗,能够增加团队的和谐。必须保持客户至上,对待客户自己就像学徒和仆人一样,恳请客户下订单,缺乏这种精神,就无法成功。 

2. 工作量的减少的萧条期正式全力开发新产品的好机会 
全员参与,甚至客户也参与其中,因为危机期,客户相对也有时间提出新需求,重视对现有产品的改进,而更重要的是用现有产品开拓新需求。然后举了鱼竿案例,一个小小的鱼竿滑轮,每年为京瓷带来5百万的订单。 

3. 彻底消减成本,萧条期是降低成本的唯一机会 
销量下降,价格下降,成本必须进一步降低,必须以面临山穷水尽的态度认真对待。对于人工费用,是不可能降低的,所以更要提高工作效率,其余都需要重新审视,如原材料等,需要全面进行合理化改革,这样恢复正常是,利润会迅速上升。当销售只是原来的一半,而企业依然盈利,那末恢复是企业就就能成为高收益企业。并且,如何增强体制,也只有萧条时才会认真对待,为再次腾飞打下坚实基础。 
相反,如果企业只是坐以待毙,正常是也只能成为微利企业,经营如履薄冰。 
--(我没看明白:()

4. 萧条时必须保持高生产率 
必须保持高生产率,多余的人员必须进行精简,如订单只有原来1/3,现场工作人员也精简到1/3,甚至跟少。但是无论如何不能让员工失业,可以进行企业培训,学习,进行企业文化的深化,甚至从事企业美化等工作,成为企业前进的推动力。而这一切,充足的企业留存是根本。 

5. 经营者必须与员工形成共同经营的伙伴关系 
危机时刻,劳资关系受到考验,更能看出团队能否同甘共苦。而能否做到不离不弃的伙伴关系,管理者平日努力营造好的企业氛围非常重要更加重要的是,管理者要自觉爱好员工,员工要体谅管理者,结成利益共同体。管理者平时要珍惜,创造和员工交流沟通的机会,和员工谈心,知道他们的想法。危机期间,要对员工严格要求,即使没有奖金,工作也要更加努力。相反,如果没有形成好的伙伴关系,当危机来临,就会众叛亲离,企业随之土崩瓦解。 
所以,管理者需要每日认真反省,彻底思考,如何不断改善员工关系。 
举了70年代石油危机时刻,京瓷如恶化齐心协力度过难关的案例。 

另外,稻盛先生强调了克服内心贪欲,保持关爱善良的本质。也谈到可以向美国企业学习经营技巧,但是需要向中国文化学习如何保持企业久盛不衰。 


好文章,原文在此:http://cto.csdn.net/Hot_Discuss.aspx?Name=lipengtao&pointid=799

2009年6月9日星期二

Oracle 11g new Feature -- I/O calibration

Oracle Database 11g introduces an I/O Calibration mechanism, whereby you can run I/O calibration tests either through the Enterprise Manager Performance page or a PL/SQL package.
--Calibration mechanism 调校机制
--可以在EM中使用也可以使用pl/sql包

Oracle's I/O calibration is a variation on the Clarion tool.

In an Oracle database, the I/O workload is of two basic types--small random I/O and large sequential I/O.
--基本上Oracle Database中的I/O(不限于Oracle Database)分两类: 小的随机I/O,和大量的串行化I/O.

OLTP applications usually experience the small random I/O workload, where the speed with which small I/O requests are serviced is paramount.
--paramount--首要的,

Thus, disk spinning and seeking times are of critical importance.

OLAP applications, on the other hand, employ the large sequential I/O in general.

Oracle uses the following two metrics, each measuring the efficacy of one type of I/O workload:
IOPS(I/O per second): the IOPS rate is the number of small random I/Os the system can perform in a second and depends on the spin speed of disks.
--看样子IOPS是测量小规模随机访问模式的测试工具,而且系统的IOPS指标跟disks的转速有很大关系。

MBPS (megabytes per second) this metric measures the data transfer rate between the server and the storage array and depends on the capacity of the I/O channel between the two systems. A larger I/O channel means a higher MBPS rate.
--MBPS是服务器和存储设备之间传输数据的衡量指标,依赖于I/O的通道,通道越大MBPS越好。


Calibrating I/O Using PL/SQL
You can also use the new procedure CALIBRATE_IO from the DBMS_
RESOURCE_MANAGER package to run the I/O Calibration task. Here is an
example:
begin
exec dbms_resource_manager.calibrate_io(-
num_disks => 1, -
max_latency => 10, -
max_iops => :max_iops, -
max_mbps => :max_mbps, -
actual_latency => :actual_latency);
end;
/
In the CALIBRATE_IO procedure, the following are the key parameters:
■ num_disks Approximate number of disks in the storage array.
■ max_latency Maximum tolerable latency (in milliseconds) for an I/O
request.
■ max_ios Maximum number of random DB block-sized read requests that
can be serviced.
■ max_mbps Maximum number of randomly distributed 1MB reads that can
be serviced (in megabytes per second).
■ actual_latency Average latency of DB block-sized I/O requests at
max_iops rate (in milliseconds).

Once you execute the CALIBRATE_IO procedure, you can query the V$IO_
CALIBRATION_STATUS and the DBA_RSRC_IO_CALIBRATE views to check
the results. Here’s a sample query:
SQL> select max_iops, max_mbps, max_pmbps, latency
from dba_rsrc_io_calibrate;
MAX_IOPS MAX_MBPS MAX_PMBPS LATENCY
---------- ------------ ------------ ----------
133 12 6 64
SQL>
Oracle Database 11g collects I/O statistics in three different dimensions to
provide a consistent set of statistics for I/O calls. These dimensions are
■ RDBMS components grouped into 12 functional groups. The V$IOSTAT_
FUNCTION view provides the details.
■ I/O statistics are collected for each consumer group that’s part of the currently
enabled resource plan. The V$IOSTAT_CONSUMER_GROUP view has
the details.
■ Individual file level I/O statistics are collected and stored in the V$IOSTAT_
FILE view for details.

Oracle11g RAC use the vip in the address list

[oracle@croracle04 admin]$ sqlplus / as sysdba;

SQL*Plus: Release 11.1.0.6.0 - Production on Thu Jun 11 10:53:49 2009

Copyright (c) 1982, 2007, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> show parameter listener

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string
remote_listener string LISTENERS_CRPROD
SQL>!


[oracle@croracle04 admin]$ vi tnsnames.ora

LISTENERS_CRPROD =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = croracledb01)(PORT = 1521)) <--vip
(ADDRESS = (PROTOCOL = TCP)(HOST = croracledb02)(PORT = 1521)) <--vip
(ADDRESS = (PROTOCOL = TCP)(HOST = croracledb03)(PORT = 1521)) <--vip
(ADDRESS = (PROTOCOL = TCP)(HOST = croracledb04)(PORT = 1521)) <--vip
)

CRPROD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = croracledb01)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = croracledb02)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = croracledb03)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = croracledb04)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = crprod)
)
)

CRPROD4 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = croracledb04)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = crprod)
(INSTANCE_NAME = crprod4)
)
)

CRPROD3 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = croracledb03)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = crprod)
(INSTANCE_NAME = crprod3)
)
)

CRPROD2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = croracledb02)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = crprod)
(INSTANCE_NAME = crprod2)
)
)
CRPROD1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = croracledb01)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = crprod)
(INSTANCE_NAME = crprod1)
)
)

2009年6月8日星期一

dmidecode cmd

剛學的,記錄一下瞭解當前伺服器 環境的設施的

dmidecode |more

比如:
[root@CRRACTEST ~]# dmidecode |grep Product
Product Name: OptiPlex 755
Product Name: 0DR845
[root@CRRACTEST ~]#



[root@croracle01 ~]# dmidecode |grep Product
Product Name: VMware Virtual Platform
Product Name: 440BX Desktop Reference Platform
[root@croracle01 ~]#

備查

ZT: ORA-01157 - Mount状态下的文件存在性校验


&copy作者:eygle 发布在 eygle.com

在我的新书里,曾经有一小段描述到在Mount状态下,Oracle对于文件存在性的校验,也就是你可能在Mount状态下看到如下提示信息:

Fri Jun 5 17:34:38 2009
Errors in file /opt/oracle/admin/eygle/bdump/eygle_dbw0_2424.trc:
ORA-01157: cannot identify/lock data file 3 - see DBWR trace file
ORA-01110: data file 3: '/opt/oracle/eygle01.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
那么在什么状态下可以得到这样的信息输出呢?
在以下测试中,展示了这一过程,测试来自Oracle9i 9.2.0.4环境:
SQL> ! mv /opt/oracle/eygle01.dbf /opt/oracle/eygle01.dbf.b

SQL> startup mount;
ORACLE instance started.

Total System Global Area 420549952 bytes
Fixed Size 451904 bytes
Variable Size 268435456 bytes
Database Buffers 150994944 bytes
Redo Buffers 667648 bytes
Database mounted.
SQL> set linesize 120
SQL> col error for a20
SQL> select * from v$recover_file;

FILE# ONLINE ONLINE_ ERROR CHANGE# TIME
---------- ------- ------- -------------------- ---------- ---------
3 ONLINE ONLINE FILE NOT FOUND 0

在查询v$recover_file视图时,查询进程触发了后台检查,在告警日志中将看到如下信息:
Fri Jun 5 17:34:25 2009
Database mounted in Exclusive Mode.
Completed: ALTER DATABASE MOUNT
Fri Jun 5 17:34:38 2009
Errors in file /opt/oracle/admin/eygle/bdump/eygle_dbw0_2424.trc:
ORA-01157: cannot identify/lock data file 3 - see DBWR trace file
ORA-01110: data file 3: '/opt/oracle/eygle01.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
也就是说,虽然在Mount状态,数据库并不会主动校验文件的存在性,但是会被前台进程触发,去判断文件的存在性,从而报出出错信息。DBWR进程的日志与以上输出相类似
*** 2009-06-05 17:34:38.048
*** SESSION ID:(2.1) 2009-06-05 17:34:38.047
ORA-01157: cannot identify/lock data file 3 - see DBWR trace file
ORA-01110: data file 3: '/opt/oracle/eygle01.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
如果没有查询触发,在Open状态数据库才会一一校验文件的存在性、一致性,并根据不同情况给出不同的提示信息。
在Oracle Database 10g中,情况有所不同,对于以上情况,Oracle10g并不好触发后台DBWR进程的判断及错误信息,而是由前台进程去检查文件存在性,并给出v$recover_file的视图信息,并不会记录错误日志。

然而何时判断,如何判断,如何记录,心中了了即可。

-The End-

本文网址:http://www.eygle.com/archives/2009/06/ora_01157_mount_database.html

2009年6月5日星期五

Red Hat Top Tools

Red Hat Top Tools
CPU Tools
1 – top
2 – vmstat
3 – ps aux
4 – mpstat P
all
5 – sar u
6 – iostat
7 – oprofile
8 – gnomesystemmonitor
9 – KDEmonitor
10 – /proc
Memory Tools
1 – top
2 – vmstat s
3 – ps aur
4 – ipcs
5 – sar r
B
W
6 – free
7 – oprofile
8 – gnomesystemmonitor
9 – KDEmonitor
10 – /proc
Process Tools
1 – top
2 – ps o
pmem
3 – gprof
4 – strace,ltrace
5 – sar
Disk Tools
1 – iostat x
2 – vmstat D
3 – sar DEV
#
4 – nfsstat
5 – NEED MORE!

top press
h – help,1- show cpus, m-memory,t-threads, > column sort

2009年6月4日星期四

Oracle11g RAC add node steps

在測試環境已經做過了,翻閱了oracle 官方的文檔,記錄如下,看看還有沒有思維的死角:
Add a node


1 About Preparing Access to the New Node

To prepare the new node prior to installing the Oracle software, see Chapter 2, "Preparing Your Cluster".

It is critical that you follow the configuration steps in order for the following procedures to work. These steps include, but are not limited to the following:
需要的,但是不限於一下操作

* Adding the public and private node names for the new node to the /etc/hosts file on the existing nodes, docrac1 and docrac2
/etc/hosts 中增加public,private 名字
* Verifying the new node can be accessed (using the ping command) from the existing nodes
從已存在的node驗證新節點 ping
* Running the following command on either docrac1 or docrac2 to verify the new node has been properly configured:
從已經存在的節點驗證新節點
cluvfy stage -pre crsinst -n docrac3

2 Extending the Oracle Clusterware Home Directory
Oracle Clusterware安裝

Now that the new node has been configured to support Oracle Clusterware, you use Oracle Universal Installer (OUI) to add a CRS home to the node being added to your Oracle RAC cluster. This section assumes that you are adding a node named docrac3 and that you have already successfully installed Oracle Clusterware on docrac1 in a nonshared home, where CRS_home represents the successfully installed Oracle Clusterware home. Adding a new node to an Oracle RAC cluster is sometimes referred to as cloning.


To extend the Oracle Clusterware installation to include the new node:

1. Verify the ORACLE_HOME environment variable on docrac1 directs you to the successfully installed CRS home on that node.
在運行安裝程序的node 校驗ORACLE_HOME環境變數
2. Go to CRS_home/oui/bin and run the addNode.sh script.
在運行安裝程式的節點運行addNode.sh 腳本

cd /crs/oui/bin
./addNode.sh

OUI starts and first displays the Welcome window.
3. Click Next.

The Specify Cluster Nodes to Add to Installation window appears.
4. Select the node or nodes that you want to add, for example, docrac3. Make sure the public, private and VIP names are configured correctly for the node you are adding. Click Next.

5. Verify the entries that OUI displays on the Summary window and click Next.
The Cluster Node Addition Progress window appears. During the installation process, you will be prompted to run scripts to complete the configuration.
6. Run the rootaddNode.sh script from the CRS_home/install/ directory on docrac1 as the root user when prompted to do so. For example:

[docrac1:oracle]$ su root
[docrac1:root]# cd /crs/install
[docrac1:root]# ./rootaddNode.sh
在運行安裝程式的node 運行 rootaddNode.sh
This script adds the node applications of the new node to the Oracle Cluster Registry (OCR) configuration.
7. Run the orainstRoot.sh script on the node docrac3 if OUI prompts you to do so. When finished, click OK in the OUI window to continue with the installation.
在新增node運行orainstRoot.sh腳本

Another window appears, prompting you to run the root.sh script.
在新增node運行root.sh腳本

8. Run the CRS_home/root.sh script as the root user on the node docrac3 to start Oracle Clusterware on the new node.

[docrac3:oracle]$ su root
[docrac3:root]# cd /crs
[docrac3:root]# ./root.sh

9.

Return to the OUI window after the script runs successfully, then click OK.

OUI displays the End of Installation window.
10.

Exit the installer.
11. Obtain the Oracle Notification Services (ONS) port identifier used by the new node, which you need to know for the next step, by running the ons.config script in the CRS_home/opmn/conf directory on the docrac1 node, as shown in the following example:

[docrac1:oracle]$ cd /crs/opmn/conf
[docrac1:oracle]$ cat ons.config
--參考--

[oracle@croracle01 conf]$ cat ons.config
localport=6150
useocr=on
allowgroup=true
usesharedinstall=true

--------
After you locate the ONS port identifier for the new node, you must make sure that the ONS on docrac1 can communicate with the ONS on the new node, docrac3.

12. Add the new node's ONS configuration information to the shared OCR. From the CRS_home/bin directory on the node docrac1, run the ONS configuration utility as shown in the following example, where remote_port is the port identifier from Step 11, and docrac3 is the name of the node that you are adding:
在共享OCR信息中增加新增node's ONS

[docrac1:oracle]$ ./racgons add_config docrac3:remote_port
You should now have Oracle Clusterware running on the new node. To verify the installation of Oracle Clusterware on the new node, you can run the following command as the root user on the newly configured node, docrac3:

[docrac1:oracle]$ opt/oracle/crs/bin/cluvfy stage -post crsinst -n docrac3 -verbose
---參考--

[oracle@croracle01 ~]$ cluvfy stage -post crsinst -n croracle04 -verbose

Performing post-checks for cluster services setup

Checking node reachability...

Check: Node reachability from node "croracle01"
Destination Node Reachable?
------------------------------------ ------------------------
croracle04 yes
Result: Node reachability check passed from node "croracle01".


Checking user equivalence...

Check: User equivalence for user "oracle"
Node Name Comment
------------------------------------ ------------------------
croracle04 passed
Result: User equivalence check passed for user "oracle".

Checking Cluster manager integrity...


Checking CSS daemon...
Node Name Status
------------------------------------ ------------------------
croracle04 running
Result: Daemon status check passed for "CSS daemon".

Cluster manager integrity check passed.

Checking cluster integrity...

Node Name
------------------------------------
croracle01
croracle02
croracle03
croracle04

Cluster integrity check passed


Checking OCR integrity...

Checking the absence of a non-clustered configuration...
All nodes free of non-clustered, local-only configurations.

Uniqueness check for OCR device passed.

Checking the version of OCR...
OCR of correct Version "2" exists.

Checking data integrity of OCR...
Data integrity check for OCR passed.

OCR integrity check passed.

Checking CRS integrity...

Checking daemon liveness...

Check: Liveness for "CRS daemon"
Node Name Running
------------------------------------ ------------------------
croracle04 yes
Result: Liveness check passed for "CRS daemon".

Checking daemon liveness...

Check: Liveness for "CSS daemon"
Node Name Running
------------------------------------ ------------------------
croracle04 yes
Result: Liveness check passed for "CSS daemon".

Checking daemon liveness...

Check: Liveness for "EVM daemon"
Node Name Running
------------------------------------ ------------------------
croracle04 yes
Result: Liveness check passed for "EVM daemon".

Liveness of all the daemons
Node Name CRS daemon CSS daemon EVM daemon
------------ ------------------------ ------------------------ ----------
croracle04 yes yes yes

Checking CRS health...

Check: Health of CRS
Node Name CRS OK?
------------------------------------ ------------------------
croracle04 yes
Result: CRS health check passed.

CRS integrity check passed.

Checking node application existence...

Checking existence of VIP node application
Node Name Required Status Comment
------------ ------------------------ ------------------------ ----------
croracle04 yes exists passed
Result: Check passed.

Checking existence of ONS node application
Node Name Required Status Comment
------------ ------------------------ ------------------------ ----------
croracle04 no exists passed
Result: Check passed.

Checking existence of GSD node application
Node Name Required Status Comment
------------ ------------------------ ------------------------ ----------
croracle04 no exists passed
Result: Check passed.


Post-check for cluster services setup was successful.
[oracle@croracle01 ~]$

---------


3. Extending the Automatic Storage Management Home Directory
擴展ASM

To extend an existing Oracle RAC database to a new node, you must configure the shared storage for the new database instances that will be created on new node. You must configure access to the same shared storage that is already used by the existing database instances in the cluster. For example, the sales cluster database in this guide uses Automatic Storage Management (ASM) for the database shared storage, so you must configure ASM on the node being added to the cluster.

Because you installed ASM in its own home directory, you must configure an ASM home on the new node using OUI. The procedure for adding an ASM home to the new node is very similar to the procedure you just completed for extending Oracle Clusterware to the new node.
OUI方式(圖形)
Note:
If the ASM home directory is the same as the Oracle home directory in your installation, then you do not need to complete the steps in this section.
步驟:
To extend the ASM installation to include the new node:

1. Ensure that you have successfully installed the ASM software on at least one node in your cluster environment. In the following steps, ASM_home refers to the location of the successfully installed ASM software.
在安裝程序node的 ASM_HOME 目錄
2. Go to the ASM_home/oui/bin directory on docrac1 and run the addNode.sh script.
3. When OUI displays the Node Selection window, select the node to be added (docrac3), and then click Next.
4. Verify the entries that OUI displays on the Summary window, and then click Next.
5. Run the root.sh script on the new node, docrac3, from the ASM home directory on that node when OUI prompts you to do so.

You now have a copy of the ASM software on the new node.


4 Extending the Oracle RAC Home Directory
可以理解為安裝Oracle database software

Now that you have extended the CRS home and ASM home to the new node, you must extend the Oracle home on docrac1 to docrac3. The following steps assume that you have already completed the previous tasks described in this section, and that docrac3 is already a member node of the cluster to which docrac1 belongs.

The procedure for adding an Oracle home to the new node is very similar to the procedure you just completed for extending ASM to the new node.

To extend the Oracle RAC installation to include the new node:

1. Ensure that you have successfully installed the Oracle RAC software on at least one node in your cluster environment. To use these procedures as shown, replace Oracle_home with the location of your installed Oracle home directory.
2. Go to the Oracle_home/oui/bin directory on docrac1 and run the addNode.sh script.
從安裝程序node安裝 addNode.sh
3. When OUI displays the Specify Cluster Nodes to Add to Installation window, select the node to be added (docrac3), and then click Next.
4. Verify the entries that OUI displays in the Cluster Node Addition Summary window, and then click Next.
The Cluster Node Addition Progress window appears.
5. When prompted to do so, run the root.sh script s the root user on the new node, docrac3, from the Oracle home directory on that node.
6. Return to the OUI window and click OK. The End of Installation window appears.
7. Exit the installer.

After completing these steps, you should have an installed Oracle home on the new node.


5.Adding an Instance to the Cluster Database
這裡我使用的是dbca與資料不同.
You can use Enterprise Manager to add an instance to your cluster database. You must first configured the new node to be a part of the cluster and installed the software on the new node.

主要參考oracle 11g online document's.
Oracle® Database 2 Day + Real Application Clusters Guide
11g Release 1 (11.1)
9 Adding and Deleting Nodes and Instances

linux kernel page size

一般来说default page size 为4k
命令如下:
[hadoop@hadoop ~]$ getconf PAGESIZE
4096

or
[hadoop@hadoop ~]$ getconf PAGE_SIZE
4096


[oracle@croracle01 ~]$ getconf -a --全的
...
POSIX_REC_MAX_XFER_SIZE
POSIX_REC_MIN_XFER_SIZE 4096
POSIX_REC_XFER_ALIGN 4096
SYMLINK_MAX
GNU_LIBC_VERSION glibc 2.5
GNU_LIBPTHREAD_VERSION NPTL 2.5
POSIX2_SYMLINKS 1
LEVEL1_ICACHE_SIZE 32768
LEVEL1_ICACHE_ASSOC 8
LEVEL1_ICACHE_LINESIZE 64
LEVEL1_DCACHE_SIZE 32768
LEVEL1_DCACHE_ASSOC 8
LEVEL1_DCACHE_LINESIZE 64
LEVEL2_CACHE_SIZE 6291456
LEVEL2_CACHE_ASSOC 24
LEVEL2_CACHE_LINESIZE 64
LEVEL3_CACHE_SIZE 0
LEVEL3_CACHE_ASSOC 0
LEVEL3_CACHE_LINESIZE 0
LEVEL4_CACHE_SIZE 0
LEVEL4_CACHE_ASSOC 0
IPV6 200112
RAW_SOCKETS 200112

...


有调整的空间

c

#include
int main(){
int a = getpagesize();
printf ("%d\n",a);
}



[hadoop@hadoop test]$ vi getpagesize.c
[hadoop@hadoop test]$ make getpagesize.c
make: Nothing to be done for `getpagesize.c'.
[hadoop@hadoop test]$ make getpagesize
cc getpagesize.c -o getpagesize
getpagesize.c: In function ‘main’:
getpagesize.c:4: warning: incompatible implicit declaration of built-in function ‘printf’
[hadoop@hadoop test]$ ls
getpagesize getpagesize.c
[hadoop@hadoop test]$ ./getpagesize
4096

[hadoop@hadoop test]$ vi getpagesize2.c
[hadoop@hadoop test]$ make getpagesize2
cc getpagesize2.c -o getpagesize2
[hadoop@hadoop test]$ ./getpagesize2
Page size on your system = 4096 bytes
[hadoop@hadoop test]$ cat getpagesize2.c
#include
#include

int main()
{
int pageSize = getpagesize();

printf("Page size on your system = %i bytes\n", pageSize);

return 0;
}
[hadoop@hadoop test]$


怎么修改呢?搞大点,据说可以提高I/O性能。在查!

2009年6月3日星期三

raw device 實驗

[root@oracle03 rules.d]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1011, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1011, default 1011):
Using default value 1011

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@oracle03 rules.d]#


ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"

[root@oracle03 rules.d]# udevtest /block/sdb/sdb1
main: looking at device '/block/sdb/sdb1' from subsystem 'block'
run_program: '/bin/bash -c '/sbin/lsmod | /bin/grep ^dm_multipath''
run_program: '/bin/bash' (stdout) 'dm_multipath 52945 0 '
run_program: '/bin/bash' returned with status 0
udev_rules_get_name: add symlink 'disk/by-id/scsi-3600508b40006c47b00005000019d0000-part1'
udev_rules_get_name: add symlink 'disk/by-path/pci-0000:0a:00.0-scsi-0:0:0:1-part1'
run_program: '/lib/udev/vol_id --export /dev/.tmp-8-17'
run_program: '/lib/udev/vol_id' returned with status 4
udev_rules_get_name: no node name set, will use kernel name 'sdb1'
udev_device_event: device '/block/sdb/sdb1' already in database, validate currently present symlinks
udev_node_add: creating device node '/dev/sdb1', major = '8', minor = '17', mode = '0640', uid = '0', gid = '6'
udev_node_add: creating symlink '/dev/disk/by-id/scsi-3600508b40006c47b00005000019d0000-part1' to '../../sdb1'
udev_node_add: creating symlink '/dev/disk/by-path/pci-0000:0a:00.0-scsi-0:0:0:1-part1' to '../../sdb1'
main: run: '/sbin/multipath -v0 8:17'
main: run: 'socket:/org/kernel/udev/monitor'
main: run: '/lib/udev/udev_run_devd'
main: run: '/bin/raw /dev/raw/raw1 /dev/.tmp-8-17'
main: run: 'socket:/org/freedesktop/hal/udev_event'
main: run: '/sbin/pam_console_apply /dev/sdb1 /dev/disk/by-id/scsi-3600508b40006c47b00005000019d0000-part1 /dev/disk/by-path/pci-0000:0a:00.0-scsi-0:0:0:1-part1'


[root@oracle03 rules.d]# udevtest /block/sdb/sdb1 | grep raw
main: run: '/bin/raw /dev/raw/raw1 /dev/.tmp-8-17'



[root@oracle03 init.d]# start_udev
Starting udev: [ OK ]
[root@oracle03 init.d]#

[root@oracle03 init.d]# raw -qa
/dev/raw/raw1: bound to major 8, minor 17


[root@oracle03 init.d]# ls -l /dev/raw
total 0
crw------- 1 root root 162, 1 Jun 3 17:11 raw1
[root@oracle03 init.d]#

轉: about raw device

Q: 1. What is a raw device?

A:Raw device, also known as a rawpartition is a disk partition that is not mounted and written by Linuxfilesystem (ext2/ext3, reiserfs) or by Oracle Cluster File System(OCFS), but is accessed by a character device driver. It is theresponsibility of the application to organize how the data is writtento the disk partition.

[top]

Q: 2. How can a raw device be recognised?

A:Allhardware devices look like regular files; they can be opened, closed,read and written using the same, standard, system calls that are usedto manipulate files. Every device in the system is represented by adevice special file, for example the first IDE disk in the system isrepresented by /dev/hda. For block (disk) and character devices, thesedevice special files are created by the mknod command and they describethe device using major and minor device numbers.
All devices controlled by the same device driver have a common major device number.
Theminor device numbers are used to distinguish between different devicesand their controllers, for example each partition on the primary IDEdisk has a different minor device number. So, /dev/hda2, the secondpartition of the primary IDE disk has a major number of 3 and a minornumber of 2. Linux maps the device special file passed in system calls(say to mount a file system on a block device) to the device's devicedriver using the major device number and a number of system tables, forexample the character device table, chrdevs .

RedHat AS supports three types of hardware device: character, block and network.

1. Character devices are read and written directly without buffering.

2. Block devices can only be written to and read from in multiples ofthe block size, typically 512 or 1024 bytes. Block devices are accessedvia the buffer cache and may be randomly accessed, that is to say, anyblock can be read or written no matter where it is on the device. Blockdevices can be accessed via their device special file but more commonlythey are accessed via the file system. Only a block device can supporta mounted file system.

3. Network devices are accessed viathe BSD socket interface and the networking subsytems described in theNetworking chapter.

The Raw devices are character devices (major number 162).
The first minor number (i.e. 0) is reserved as a control interface and is usually found at /dev/rawctl.
A sequence of commands listing the raw devices:

# ls -lR /dev/rawctl
crw-rw---- 1 root disk 162, 0 Mar 19 2002 /dev/rawctl

# ls -lR /dev/raw[1-4]
crw-rw---- 1 root disk 162, 1 Mar 19 2002 /dev/raw1
crw-rw---- 1 root disk 162, 2 Mar 19 2002 /dev/raw2
crw-rw---- 1 root disk 162, 3 Mar 19 2002 /dev/raw3
crw-rw---- 1 root disk 162, 4 Mar 19 2002 /dev/raw4

[top]

Q: 3. What are the benefits of raw devices?

A:Araw device can be bound to an existing block device (e.g. a disk) andbe used to perform "raw" IO with that existing block device.
Such"raw" IO bypasses the caching (Linux buffer cache) that is normallyassociated with block devices and eliminates the file system overheadssuch as inodes or free lists. Hence a raw device offers a more "direct"route to the physical device and allows an application more controlover the timing of IO to that physical device. This makes raw devicessuitable for complex applications like Database Management Systems thattypically do their own caching.
If there is no I/O bottleneck, rawdevices will not help. Note that the overall amount of I/O is notreduced; it is just done more efficiently.

[top]

Q: 4. Are there circumstances when raw devices have to be used?

A:Ifyou are using the Oracle Parallel Server (OPS) or Oracle RealApplication Cluster (RAC) without Oracle Cluster File System (OCFS),all data files, control files, and redo log files must be placed on rawpartitions so they can be shared between nodes. Also if you use ListI/O or Asynchronous I/O, these facilities allow a program to issuemultiple write operations without having to wait for the return of theprevious write, to take advantage of this data files will need to be onraw devices.

[top]

Q: 5. Can I use the entire raw partition for Oracle?

A:No.You should specify a tablespace slightly smaller in size than the rawpartition size, specifically at least two Oracle block sizes smaller.

[top]

Q: 6. How many raw devices I have in RedHat AS by default and how many raw can I have?

A:RedHat AS operating system limits the number of raw devices that Linux can access to 255.
By default on RedHat Advanced Server there are 128 raw devices under /dev/raw:

# ls -l /dev/raw*
crw-rw---- 1 root disk 162, 1 Mar 19 2002 /dev/raw1
(...)
crw-rw---- 1 root disk 162, 3 Mar 19 2002 /dev/raw128

Linuxcannot handle more than a limited number of partitions per drive. So inLinux you have 4 primary partitions (3 of them useable, if you areusing logical partitions) and at most 15 partitions altogether on anSCSI disk (63 altogether on an IDE disk).

[top]

Q: 7. How can I create new raw devices?

A: If it's necessary create others raw devices the following command must be done as root user (see man mknod):

# mknod -m 660 /dev/raw/rawXXX c 162 XXX
# chown root:disk /dev/raw/rawXXX
(where XXX= 128< integer < 256)

i.e.:
# mknod -m 660 /dev/raw/raw130 c 162 130
# chown root:disk /dev/raw/raw130
# ls -l /dev/raw/raw130
crw-rw---- 1 root disk 162, 130 Dec 23 18:57 /dev/raw130

[top]

Q: 8. Who should own the raw device?

A:Youwill need to create the raw devices as root, but the ownership shouldbe changed to the 'oracle' account afterwards. The group must also bechanged to the 'dba' group (usually called dba).


[top]
Q: 9. How can I use a raw device for Oracle RDBMS?

A:We suppose to have a SCSI disk drivers - 9 Gbytes. The steps are:

a. Partition the disk driver (/dev/sdb)
b. Binding raw device with partition on new SCSI disk
c. Change the ownership to raw device
d. Create a new Oracle datafile on raw device

- Partion the disk driver, fdisk command (see man fdisk):
1. As user root, type

# fdisk /dev/sdb

2. Type 'p' to see the list of existing partitions on your disk drive:

command (m for help): p
Disk /dev/sdb: 255 heads, 63 sectors, 1174 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot Start End Block ID System

3.a. In order to create a partition, choose 'n' command and then choose an extended partition with the 'e' option.
You will need extended partition, because this disk will contains more than 4 partitions.
Create partition number 1 first, so choose number 1.

command (m for help): n
command action
e extended
p primary partition (1-4)
e
Partition Number (1-4): 1
First cylinder (1-1115, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1115, default 1115):
Using default value 1115

3.b. Now within the extended partition,
I will have to create 6 logical partition of equal sizes: each should be 257Mb large (256Mb+1Mb for the headers).
Press 'n' and 'l' and , and write the size of the partition (begin with a +) +257M.
Repeat these steps 6 times

command (m for help): n
command action
l logical (5 or over)
p primary partition (1-4)
l
Partition Number (1-4): 1
First cylinder (1-1115, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1115, default 1115): +257M
(...repeat 5 time...)

command (m for help): p
Disk /dev/sdb: 255 heads, 63 sectors, 1174 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot Start End Block ID System
/dev/sdb1 1 1115 8956206 5 Extended
/dev/sdb5 1 33 265009+ 83 Linux
/dev/sdb6 34 66 265041 83 Linux
(...)
/dev/sdb10 166 198 265041 83 Linux

3.c. Now press 'w' this will write the partition table to the disk and quit the fdisk programm

- Binding raw device with partition on new SCSI disk

A utility called raw (see man raw) can be used to bind a raw device to an existing block device:

# raw /dev/raw/raw1 /dev/sdb5
/dev/raw/raw1: bound to major 8, minor 3
(...)
# raw /dev/raw/raw6 /dev/sdb10
/dev/raw/raw6: bound to major 8, minor 3

The last details regarding this is that the assignement of rawdevice drivers to partitions should be done after each startup.
For this reason, as user root, edit the /etc/sysconfig/rawdevices and put the following raw command into it:

raw /dev/raw/raw1 /dev/sdb5
raw /dev/raw/raw2 /dev/sdb6
raw /dev/raw/raw3 /dev/sdb7
raw /dev/raw/raw4 /dev/sdb8
raw /dev/raw/raw5 /dev/sdb9
raw /dev/raw/raw6 /dev/sdb10

- Change the ownership to raw device

As root user type:

# cd /dev/raw
# chown oracle:dba raw[1-4]

- Create a new Oracle datafile on raw device

When using a raw device you need to specify the full pathname in single quotes, and use the REUSE parameter.
When creating the oracle tablespace on the raw partition aslightly smaller size than the actual partition size needs to bespecified.
This size can be calculated as follows:

Size of Redo Log = Raw Partition Size - 1*512 byte block
Size of Data File = Raw Partition Size - 2* Oracle Block Size

e.g. (db_block_size=8192):
create tablespace tablespace_on_raw datafile '/dev/raw/raw1' size 246784K REUSE,
& '/dev/raw/raw2' size 246784K REUSE,
& '/dev/raw/raw3' size 246784K REUSE,
& '/dev/raw/raw4' size 246784K REUSE,
& '/dev/raw/raw5' size 246784K REUSE,
& '/dev/raw/raw6' size 246784K REUSE;

[top]


Q: 10. Does the Oracle block size have any relevance on a raw device?

A:Itis of less importance than for a UNIX file; the size of the Oracleblock can be changed, but it must be a multiple of the physical block
size as it is only possible to seek to physical block boundaries andhence write only in multiples of the physical block size.

[top]

Q: 11. How can I back up my database files if they are on raw devices?

A:You cannot use utilities such as 'tar' or 'cpio', which expect a filesystem to be present.
Usuallypeople move Oracle datafiles from filesystem to raw devices using the'dd' command. Using dd is the fastest method to accomplish it. However,it is necessary to know how many blocks to skip in the raw device (e.g.on Tru64 Unix you have to skip 64K), so that you do not overwriteinformation necessary for the Operating System. The information on howmany blocks to skip is different on the different platforms. Using RMANthere's no necessity to know such platform specific information. Withthe RMAN copy command datafiles can be
copied from filesystem files to raw devices.

# dd if=/dev/raw/raw1 of=/u01/oradata/test_ts.dbf' bs=16K
(Keep the Block size to multiple of the Oracle Block Size)

See the UNIX man page on dd for further details.

You can use RMAN.
From filesystem to raw device:

RMAN> run {
2> allocate channel c1 type disk;
3> copy datafile '/u01/oradata/test_ts.dbf' to '/dev/raw/raw1';
4> }

From raw device to filesystem:

RMAN> run {
2> allocate channel c1 type disk;
3> copy datafile '/dev/raw/raw1' to '/u01/oradata/test_ts.dbf';
4> }

[top]

Q: 12. Providing I am not using Parallel Server or Real Application Cluster, can I use a mixture of raw?

A:Yes. The drawback is that this makes your backup strategy more complicated.

[top]

Q: 13. Should I store my redo log files on raw partitions?

A:Redologs are particularly suitable candidates for being located on rawpartitions, as they are write-intensive and in addition are written to
sequentially. If OPS or RAC is being used, redo logs must be stored on raw partitions.

[top]

Q: 14. Can I use raw partitions for archive logs?

A:No. Archive logs must be stored on a partition with a UNIX filesystem.

[top]

Q: 15. Can I have more than one data file on a raw partition?

A:No.This means you should be careful when setting up the raw partition. Toosmall a size will necessitate reorganisation when you
run out of space, whereas too large a size will waste any space the file does not use.

[top]

Q: 16. Should my raw partitions be on the same disk device?

A:Thisis inadvisable, as there is likely to be contention. You should placeraw devices on different disks, which should also be on different
controllers.


[top]
Q: 17. Do I need to make my raw partitions all the same size?
A:This is not essential, but it provides flexibility in the event of having to change the database configuration.
[top]
Q: 18. Do I need to change any UNIX kernel parameters if I decide to use raw devices?
A:No

[top]

Q: 19. What other UNIX-level changes could help to improve I/O performance?

A:RAIDand disk mirroring can be beneficial, depending on the applicationcharacteristics, especially whether it is read or write-intensive, ora
mixture.

[top]

Q: 20. How can I gain further performance benefits, after considering all of the above?

A:You will need to buy more disk drives and controllers for your system, to spread the I/O load between devices.

[top]

ref://http://airlgc.blog.51cto.com/161810/26441
http://bbs.chinaunix.net/viewthread.php?tid=1293379