在工作中学习_20101104

关于 zfs(1M) zpool(1M) 如何使用? 有什么作用?

参考 http://www.sun.com/bigadmin/hubs/multilingual/simp_chinese/content/zfs_overview.jsp

 

 

做一个Outline的练习.

 ------

关于cache buffer chains, 参考下面内容

http://www.itpub.net/thread-396687-1-1.html

http://blog.csdn.net/you_tube/archive/2010/07/07/5719502.aspx

 

-------

看来对于内存还有更细节的地方需要了解。

 

存储术语SAN - (Storage Area Network)

 

 

$ man iostat

Reformatting page.  Please Wait... done

 

System Administration Commands                         iostat(1M)

 

NAME

     iostat - report I/O statistics

 

SYNOPSIS

     /usr/bin/iostat  [-cCdDeEiImMnpPrstxXYz] [-l n] [-T u | d]

     [disk]... [interval [count]]

 

DESCRIPTION

     The iostat utility iteratively reports terminal,  disk,  and

     tape  I/O  activity,  as  well as CPU utilization. The first

     line of output is for all time since boot;  each  subsequent

     line is for the prior interval only.

 

     To compute this information, the kernel maintains  a  number

     of counters. For each disk, the kernel counts reads, writes,

     bytes read, and bytes written. The kernel also takes  hi-res

     time  stamps at queue entry and exit points, which allows it

     to  keep  track  of  the  residence  time   and   cumulative

     residence-length product for each queue. Using these values,

     iostat produces  highly  accurate  measures  of  throughput,

     utilization,  queue  lengths,  transaction rates and service

     time. For terminals collectively, the kernel  simply  counts

     the number of input and output characters.

 

     During execution of the kernel status command, the state  of

     the  system  can change. If relevant, a state change message

     is included in the iostat output, in one  of  the  following

     forms:

 

       <<device added: sd0>>

       <<device removed: sd0>>

       <<partition added: sd0,a>>

       <<partition removed: sd0,a>>

       <<NFS mounted: nfs1>>

       <<NFS unmounted: nfs1>>

       <<multi-path added: ssd4>>

       <<multi-path removed: ssd4>>

       <<controller added: c1>>

       <<controller removed: c1>>

       <<processors added: 1, 3>>

       <<processors removed: 1, 3>>

 

     Note that the names printed in these state  change  messages

     are affected by the -n and -m options as appropriate.

 

     For more general system statistics, use sar(1), sar(1M),  or

     vmstat(1M).

 

SunOS 5.10           Last change: 1 Nov 2006                    1

 

System Administration Commands                         iostat(1M)

 

  Output

     The output of the  iostat  utility  includes  the  following

     information.

 

     device    name of the disk

 

     r/s       reads per second

 

     w/s       writes per second

 

     kr/s      kilobytes read per second

 

               The average I/O size during the  interval  can  be

               computed from kr/s divided by r/s.

 

     kw/s      kilobytes written per second

 

               The average I/O size during the  interval  can  be

               computed from kw/s divided by w/s.

 

     wait      average number of transactions waiting for service

               (queue length)

 

               This is the number of I/O operations held  in  the

               device  driver queue waiting for acceptance by the

               device.

 

     actv      average number of transactions actively being ser-

               viced  (removed  from  the  queue but not yet com-

               pleted)

 

               This is the number of I/O operations accepted, but

               not yet serviced, by the device.

 

     svc_t     average response time  of  transactions,  in  mil-

               liseconds

 

               The svc_t  output  reports  the  overall  response

               time,  rather  than the service time, of a device.

               The overall time includes the time  that  transac-

               tions  are in queue and the time that transactions

               are being serviced. The time  spent  in  queue  is

               shown  with  the  -x  option  in the wsvc_t output

               column. The time spent servicing  transactions  is

               the  true service time. Service time is also shown

 

SunOS 5.10           Last change: 1 Nov 2006                    2

 

System Administration Commands                         iostat(1M)

 

               with the -x option and appears in the asvc_t  out-

               put column of the same report.

 

     %w        percent of time there are transactions waiting for

               service (queue non-empty)

 

     %b        percent of time the disk is busy (transactions  in

               progress)

 

     wsvc_t    average  service  time  in  wait  queue,  in  mil-

               liseconds

 

     asvc_t    average service time of  active  transactions,  in

               milliseconds

 

     wt        the I/O wait time is no  longer  calculated  as  a

               percentage  of  CPU  time, and this statistic will

               always return zero.

 

OPTIONS

     The following options are supported:

 

     -c          Report the percentage of  time  the  system  has

                 spent  in user mode, in system mode, waiting for

                 I/O, and idling. See the NOTES section for  more

                 information.

 

     -C          When the -x  option  is  also  selected,  report

                 extended  disk  statistics  aggregated  by  con-

                 troller id.

 

     -d          For each disk, report the  number  of  kilobytes

                 transferred  per second, the number of transfers

                 per second, and the average service time in mil-

                 liseconds.

 

     -D          For each disk,  report  the  reads  per  second,

                 writes  per second, and percentage disk utiliza-

                 tion.

 

     -e          Display device  error  summary  statistics.  The

                 total  errors,  hard  errors,  soft  errors, and

 

SunOS 5.10           Last change: 1 Nov 2006                    3

 

System Administration Commands                         iostat(1M)

 

                 transport errors are displayed.

 

     -E          Display all device error statistics.

 

     -i          In -E output, display the Device ID  instead  of

                 the  Serial  No. The Device Id is a unique iden-

                 tifier   registered   by   a   driver    through

                 ddi_devid_register(9F).

 

     -I          Report the counts in each interval, rather  than

                 rates (where applicable).

 

     -l n        Limit the number of disks included in the report

                 to  n;  the  disk limit defaults to 4 for -d and

                 -D, and unlimited for -x. Note: disks explicitly

                 requested  (see  disk  below) are not subject to

                 this disk limit.

 

     -m          Report file system mount points. This option  is

                 most  useful  if  the  -P  or  -p option is also

                 specified or used in  conjunction  with  -Xn  or

                 -en.  The  -m option is useful only if the mount

                 point is actually listed  in  the  output.  This

                 option  can only be used in conjunction with the

                 -n option.

 

     -M          Display data throughput  in  MB/sec  instead  of

                 KB/sec.

 

     -n          Display names in descriptive format.  For  exam-

                 ple, cXtYdZ, rmt/N, server:/export/path.

 

                 By default, disks  are  identified  by  instance

                 names  such  as ssd23 or md301. Combining the -n

                 option with the -x option causes disk  names  to

                 display  in  the  cXtYdZsN  format which is more

                 easily associated with physical hardware charac-

                 teristics.  The  cXtYdZsN format is particularly

                 useful in FibreChannel (FC)  environments  where

                 the FC World Wide Name appears in the t field.

 

     -p          For each disk, report  per-partition  statistics

                 in addition to per-device statistics.

 

SunOS 5.10           Last change: 1 Nov 2006                    4

 

System Administration Commands                         iostat(1M)

 

     -P          For each disk, report  per-partition  statistics

                 only, no per-device statistics.

 

     -r          Display data in a comma-separated format.

 

     -s          Suppress messages related to state changes.

 

     -t          Report the number of characters read and written

                 to terminals per second.

 

     -T u | d    Display a time stamp.

 

                 Specify u for a printed  representation  of  the

                 internal  representation  of  time. See time(2).

                 Specify  d  for  standard   date   format.   See

                 ctime(3C).

 

     -x          Report extended  disk  statistics.  By  default,

                 disks  are  identified by instance names such as

                 ssd23 or md301. Combining the x option with  the

                 -n  option  causes  disk names to display in the

                 cXtYdZsN format,  more  easily  associated  with

                 physical  hardware  characteristics.  Using  the

                 cXtYdZsN format is particularly helpful  in  the

                 FibreChannel  environments  where  the  FC World

                 Wide Name appears in the t field.

 

                 If no output display is requested  (no  -x,  -e,

                 -E), -x is implied.

 

     -Y          For disks under scsi_vhci(7D) control, in  addi-

                 tion to disk lun statistics, also report statis-

                 tics        for        lun.targetport        and

                 lun.targetport.controller.

 

                 In -n (descriptive) mode the targetport is shown

                 in  using  the target-port property of the path.

                 Without -n the targetport  is  shown  using  the

                 shorter  port-id. All target ports with the same

                 target-port property value share the same  port-

                 id.  The target-port-to-port-id association does

                 not persist across reboot.

 

                 If no output display is requested  (no  -x,  -e,

                 -E), -x is implied.

 

SunOS 5.10           Last change: 1 Nov 2006                    5

 

System Administration Commands                         iostat(1M)

 

     -z          Do not print lines whose underlying data  values

                 are all zeros.

 

     The option set -xcnCXTdz interval is particularly useful for

     determining  whether disk I/O problems exist and for identi-

     fying problems.

 

OPERANDS

     The following operands are supported:

 

     count       Display only count reports.

 

     disk        Explicitly specify the disks to be reported;  in

                 addition to any explicit disks, any active disks

                 up to the disk limit (see -l above) will also be

                 reported.

 

     interval    Report once each interval seconds.

 

EXAMPLES

     Example 1 Using iostat to Generate User and System Operation

     Statistics

 

     The following command displays two reports of extended  dev-

     ice  statistics,  aggregated by controller id, for user (us)

     and system (sy) operations. Because the -n  option  is  used

     with  the  -x  option,  devices are identified by controller

     names.

 

       example% iostat -xcnCXTdz 5

 

       Mon Nov 24 14:58:36 2003

          cpu

       us sy wt id

       14 31  0 20

                          extended device statistics

        r/s    w/s    kr/s      kw wait  actv wsvc_t asvc_t  %w  %b device

        3.8   29.9   145.8    44.0  0.0   0.2    0.1    6.4   0   5     c0

       666.3  814.8 12577.6 17591.1 91.3  82.3   61.6   55.6   0   2    c12

       180.0  234.6  4401.1  5712.6  0.0 147.7    0.0  356.3   0  98    d10

 

       Mon Nov 24 14:58:41 2003

          cpu

       us sy wt id

       11 31  0 22

                          extended device statistics

 

SunOS 5.10           Last change: 1 Nov 2006                    6

 

System Administration Commands                         iostat(1M)

 

        r/s    w/s    kr/s      kw wait  actv wsvc_t asvc_t  %w  %b device

        0.8   41.0     5.2    20.5 0.0    0.2    0.2    4.4   0   6     c0

       565.3  581.7  8573.2 10458.9 0.0   26.6    0.0   23.2   0   3    c12

       106.5   81.3  3393.2  1948.6 0.0    5.7    0.0   30.1   0  99    d10

 

     Example 2 Using iostat to Generate TTY Statistics

 

     The following command displays two reports on  the  activity

     of  five  disks in different modes of operation. Because the

     -x option is used, disks are identified by instance names.

 

       example% iostat -x tc 5 2

 

                        extended device statistics        tty         cpu

       device r/s  w/s kr/s  kw/s wait actv svc_t %w  %b  tin tout  us sy wt id

       sd0    0.4  0.3 10.4   8.0  0.0  0.0  36.9  0   1    0   10   0  0  0 99

       sd1    0.0  0.0  0.3   0.4  0.0  0.0  35.0  0   0

       sd6    0.0  0.0  0.0   0.0  0.0  0.0   0.0  0   0

       nfs1   0.0  0.0  0.0   0.0  0.0  0.0   0.0  0   0

       nfs2   0.0  0.0  0.0   0.1  0.0  0.0  35.6  0   0

                  extended device statistics              tty         cpu

       device r/s  w/s  kr/s  kw/s wait actv svc_t %w  %b tin tout  us sy wt id

       sd0    0.0  0.0  0.0   0.0  0.0  0.0  0.0   0   0   0  155   0  0  0 100

       sd1    0.0  0.0  0.0   0.0  0.0  0.0  0.0   0   0

       sd6    0.0  0.0  0.0   0.0  0.0  0.0  0.0   0   0

       nfs1   0.0  0.0  0.0   0.0  0.0  0.0  0.0   0   0

       nfs2   0.0  0.0  0.0   0.0  0.0  0.0  0.0   0   0

 

     Example 3 Using iostat  to  Generate  Partition  and  Device

     Statistics

 

     The following command generates partition and device statis-

     tics  for  each disk. Because the -n option is used with the

     -x option, disks are identified by controller names.

 

       example% iostat -xnp

 

                      extended device statistics

       r/s  w/s  kr/s kw/s wait actv wsvc_t asvc_t %w %b device

       0.4  0.3  10.4  7.9  0.0  0.0    0.0   36.9  0  1 c0t0d0

       0.3  0.3   9.0  7.3  0.0  0.0    0.0   37.2  0  1 c0t0d0s0

       0.0  0.0   0.1  0.5  0.0  0.0    0.0   34.0  0  0 c0t0d0s1

       0.0  0.0   0.0  0.1  0.0  0.0    0.6   35.0  0  0 fuji:/export/home/user3

 

SunOS 5.10           Last change: 1 Nov 2006                    7

 

System Administration Commands                         iostat(1M)

 

     Example 4 Show Translation from Instance Name to Descriptive

     Name

 

     The following example  illustrates  the  use  of  iostat  to

     translate a specific instance name to a descriptive name.

 

       example% iostat -xn sd1

                              extended device statistics

       r/s    w/s   kr/s   kw/s wait actv wsvc_t asvc_t  %w  %b device

       0.0    0.0    0.0    0.0  0.0  0.0    0.0    0.0   0   0 c8t1d0

 

     Example 5 Show Target Port and  Controller  Activity  for  a

     Specific Disk

 

     In the following example, there are  four  controllers,  all

     connected to the same target port.

 

       # iostat -Y ssd22

                          extended device statistics

       device          r/s    w/s   kr/s   kw/s wait actv  svc_t  %w  %b

       ssd22           0.2    0.0    1.5    0.0  0.0  0.0    0.7   0   0

       ssd22.t2        0.2    0.0    1.5    0.0  0.0  0.0    0.0   0   0

       ssd22.t2.fp0    0.0    0.0    0.4    0.0  0.0  0.0    0.0   0   0

       ssd22.t2.fp1    0.0    0.0    0.4    0.0  0.0  0.0    0.0   0   0

       ssd22.t2.fp2    0.0    0.0    0.4    0.0  0.0  0.0    0.0   0   0

       ssd22.t2.fp3    0.0    0.0    0.4    0.0  0.0  0.0    0.0   0   0

 

ATTRIBUTES

     See attributes(5) for descriptions of the  following  attri-

     butes:

 

     ____________________________________________________________

    |       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |

    |_____________________________|_____________________________|

    | Availability                | SUNWcsu                     |

    |_____________________________|_____________________________|

    | Interface Stability         | See below.                  |

    |_____________________________|_____________________________|

 

     Invocation is evolving. Human readable output is unstable.

 

SEE ALSO

 

SunOS 5.10           Last change: 1 Nov 2006                    8

 

System Administration Commands                         iostat(1M)

 

     sar(1), sar(1M), mpstat(1M), vmstat(1M), time(2), ctime(3C),

     attributes(5), scsi_vhci(7D)

 

NOTES

     The sum of CPU utilization  might  vary  slightly  from  100

     because of rounding errors in the production of a percentage

     figure.

 

     The svc_t response time is not particularly significant when

     the  I/0  (r/s+w/s) rates are under 0.5 per second. Harmless

     spikes are fairly normal in such cases.

 

     The mpstat utility reports the same wt, usr, and sys statis-

     tics. See mpstat(1M) for more information.

 

     When executed in a zone and if the pools facility is active,

     iostat(1M)  will  only provide information for those proces-

     sors in the processor set of the pool to which the  zone  is

     bound.

 

SunOS 5.10           Last change: 1 Nov 2006                    9

 

 

一个同事写的批量停启数据库的脚本, 可了解

 

 

所有脚本都放在一个目录,以root用户权限执行。

可以将shutdown immediate 改为shutdown abort ,以免某些库一直停不下来。

ASM的实例要自己停。

{pwd_to_inf} 是停库时保存的数据库信息文件的路径

{pwd_to_stop_shell} 是脚本db_stop.ksh的路径

{pwd_to_start_shell} 是脚本db_start.ksh的路径

二,批量停db

1.db_stop.ksh

------------------------------------------

#!/usr/bin/ksh

typeset prof_name

ps -ef|grep 'pmon'|grep ${LOGNAME} | grep -v grep |awk '{print($1,$9)}'|while read ORA_USR ORA_PMON

do

 prof_name=`ls prof*${ORA_PMON##*_}`

 if [[ -a ${prof_name} ]]

 then

    . ./prof*${ORA_PMON##*_}

 fi

sqlplus '/as sysdba' <<!

shutdown immediate

exit

!

lsnrctl stop ${ORACLE_SID}

done

 

2.db_stop_mian.ksh ${pwd_to_inf}  ${pwd_to_stop_shell}

------------------------------------------

#!/usr/bin/ksh

typeset file_inf=`pwd`//$1

typeset file_run=`pwd`//$2

ps -ef|grep 'pmon'|grep -v 'grep'|sort > ${file_inf}

awk '{printf("%s %s/n",$1,$9)}' ${file_inf} |while read ORA_USR ORA_PMON

do

  su - ${ORA_USR} -c "ksh ${file_run}"  # add path to file

done

 

 

三,批量启db

1.db_start.ksh

------------------------------------------

#!/usr/bin/ksh

typeset file_inf=$1

typeset prof_name

for ORA_PMON in `grep ${LOGNAME} ${file_inf} | awk '{print $9 }'`

do

prof_name=`ls prof*${ORA_PMON##*_}`

if [[ -a ${prof_name} ]]

then

    . ./prof*${ORA_PMON##*_}

fi

sqlplus '/ as sysdba'<<!

startup

exit

!

lsnrctl start ${ORACLE_SID}

done

 

2.db_start_main.ksh ${pwd_to_inf}  ${pwd_to_start_shell}

------------------------------------------

#!/usr/bin/ksh

typeset file_inf=`pwd`//$1

typeset file_run=`pwd`//$2

awk '{printf("%s/n",$1)}' ${file_inf} |while read ORA_USR

do

  su - ${ORA_USR} -c "ksh  ${file_run} ${file_inf}"

done

 

 

linux中如何确定 当前使用的什么SHELL

 

To determine the default shell for the oracle user, enter the following command:

$ echo $SHELL

 

注意在solaris 中环境变量的设置命令用法有些不一样, 如下:

Bourne, Bash, or Korn shell:

$ ORACLE_HOME=oracle_home1

$ export ORACLE_HOME

C or tcsh shell:

% setenv ORACLE_HOME oracle_home1

 

 

而直接使用export ORACLE_HOME=oracle_home1 的方法好像不行。

 

使用ps –ef 来查看那进程的信息, 很有用, 比如今天用它来查看oracle 安装在哪个目录,通过查看lsnrctlcommand路径

 

 

理解一点 listener 的动态注册,只会注册到端口号为1521的默认listener

 

-----------------------

 

 

关于在PL/SQL developer工具中直接使用数据库连接串登录,而不用去修改tnsnames.ora的问题

 

 

今天遇到了一个很郁闷的问题,大概花了1小时的时间来处理, 由于终端机上没有修改tnsnames.ora文件的权限(我也不想取改)。我想可以直接输入PL/SQL 的登录数据库中填入连接串就可以了,但试了好久都不行, 最后的原因是必须 使用 括号 把连接串括起来, 例如:

 

(description =(address = (PROTOCOL=tcp)(HOST=10.25.18.33)(PORT=1541))(connect_data = (sid = opmsdev)) )

 

最外面必须要有一个括号,要注意这个连接串用tnsping 可能试ping 不同的,但是使用PL/SQL developer 登录是没有问题的.

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值