十三、数据库查询4

 


 

查看rac两个节点是否做了时间同步:

 

 

方式:

 

1>l***c -ls xntpd

 

2>查看同步的时间间隔(poll

# xntpdc -c peers

 

 

 

具体命令

 

主节点情况:

 

# l***c -ls xntpd

 

 Program name:    /usr/sbin/xntpd

 

 Version:         3

 

 Leap indicator:  00 (No leap second today.)

 

 Sys peer:        127.127.1.0

 

 Sys stratum:     4

 

 Sys precision:   -18

 

 Debug/Tracing:   DISABLED

 

 Root distance:   0.000000

 

 Root dispersion: 0.010010

 

 Reference ID:    127.127.1.0

 

 Reference time:  cfd147ba.95c06000  Sun, Jun 27 2010 11:44:58.584

 

 Broadcast delay: 0.003906 (sec)

 

 Auth delay:      0.000122 (sec)

 

 System flags:    pll monitor filegen 

 

 System uptime:   2980 (sec)

 

 Clock stability: 0.000000 (sec)

 

 Clock frequency: 0.000000 (sec)

 

 Peer: 127.127.1.0

 

      flags: (configured)(refclock)(sys peer)

 

      stratum:  3, version: 3

 

      our mode: client, his mode: server

 

Subsystem         Group            PID          Status

 

 xntpd            tcpip            127370       active

 

 

 

次节点的情况:

 

# l***c -ls xntpd

 

 Program name:    /usr/sbin/xntpd

 

 Version:         3

 

 Leap indicator:  00 (No leap second today.)

 

 Sys peer:        zzrac1

 

 Sys stratum:     5

 

 Sys precision:   -18

 

 Debug/Tracing:   DISABLED

 

 Root distance:   0.000305

 

 Root dispersion: 0.010757

 

 Reference ID:    10.220.97.51

 

 Reference time:  cfd147b0.aeda5000  Sun, Jun 27 2010 11:44:48.683

 

 Broadcast delay: 0.003906 (sec)

 

 Auth delay:      0.000122 (sec)

 

 System flags:    pll monitor filegen 

 

 System uptime:   2529 (sec)

 

 Clock stability: 0.000000 (sec)

 

 Clock frequency: 0.000000 (sec)

 

 Peer: zzrac1

 

      flags: (configured)(sys peer)

 

      stratum:  4, version: 3

 

      our mode: client, his mode: server

 

Subsystem         Group            PID          Status

 

 xntpd            tcpip            180636       active

 

解决方案:

 

如果问题无法解决,配置时间服务器的过程如下:

 

||||||||

 

AIX配置时间服务器及客户机实战笔记收藏

 xntpd是关于网络时间协议的守护进程,它遵循了因特网时间服务器的通用标准。在启动 xntpd , xntpd 会读取 /etc/ntp.conf 配置文件来确定网络中系统时钟服务器,以 ntp 服务器的系统时间为标准,来调整本机的系统时间。

 

 

可以用 ntpq 命令来显示 xntpd 进程的内部变量。使用 ntp 时应注意,xntpd 服务器和 xntpd 客户端的时钟不能相差超过1000秒。若有大于1000秒的偏移,在客户端启动 xntpd 守护进程前,用 data 命令或 ntpdate 命令调整本机的系统时间,使偏移量在1000秒之内。然后启动 xntpd.

 

 

1. 构造一个NTP环境的基本步骤:

 

 

1.1 设置NTP 服务器(192.168.5.2为例), 其它NTP客户服务器以此服务器的时间为准,与其进行时间同步.

 

1.1.1 编辑 /etc/ntp.conf 文件, 内容如下:

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

#broadcastclient

server 127.127.1.0

driftfile /etc/ntp.drift

tracefile /etc/ntp.trace

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

 

请注意文件中的 server 127.127.1.0 这一行, 此处的127.127.1.0 是一特殊的地址,表示NTP主服务器是与自身的系统时钟同步.

 

1.1.2 编辑好 /etc/ntp.conf, 启动xntpd守护进程

# startsrc -s xntpd

 

也可通过调用smitty , 使 xntpd 在以后重启服务器时能自动启动.

# smitty xntpd

 

 

1.1.3 xntpd 状态查询 , 使用 #l***c -ls xntpd

 

刚启动xntpd, sys peer 'insane', 表明xntpd还没有完成同步, .

#l***c -ls xntpd

Program name: --/usr/sbin/xntpd

Version: -------3

Leap indicator: 11 (Leap indicator is insane.) Sys peer: ------no peer, system is insane ...

 

 

等待 6 - 10 分钟后, sys peer 就不再是 'insane' .

#l***c -ls xntpd

Program name: --/usr/sbin/xntpd

Version: -------3

Leap indicator: 00 (No leap second today.) Sys peer: ------127.127.1.0 ...

 

1.2. NTP客户端的设置

 

1.2.1 编辑 NTP 客户端上的 /etc/ntp.conf文件, 内容如下:

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

#broadcastclient

server 192.168.5.2

 

driftfile /etc/ntp.drift

tracefile /etc/ntp.trace

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

 

其中的 server 192.168.5.2 表明, 此客户端与IP地址为 192.168.5.2 NTP服务器进行时间同步.

 

1.2.2 NTP客户端启动xntpd守护进程

# startsrc -s xntpd

 

也可通过调用smitty , 使 xntpd 在以后重启服务器时能自动启动.

# smitty xntpd

 

1.2.3 查询xntpd的状态

 

system peer 不为 'insane' , 表明客户端已与服务器端成功地进行了同步.

# l***c -ls xntpd

Program name: --/usr/sbin/xntpd

Version: -------3

Leap indicator: 00 (No leap second today.) Sys peer: ------192.168.5.2 ...

 

1.3. NTP客户端查询NTP服务器

ntp客户端使用 ntpdate 命令来确认是否可用指定的 ntp 服务器进行时间同步。

命令的结果会显示客户端与服务器的时间偏移。

#ntpdate -d 192.168.5.2

...

18 Jan 15:49:57 ntpdate[98462]: adjust time server 192.168.5.2 offset -0.000868

2 sec

 

若时间间隔大于1000秒,使用ntpdate 进行手工调整, 如:

#date

Thu Jan 18 15:52:00 BEIST 2007

 

#ntpdate 192.168.5.2

18 Jan 15:49:57 ntpdate[23832]: step time server 9.185.43.189 offset 23.40260

7 sec

 

#date

Thu Jan 18 15:52:00 BEIST 2007

完成上述操作后 ntp 客户端与 ntp 服务器系统时钟完成同步,ntp 客户端得到了新的系统时间。

 

查看同步的时间间隔(poll

# xntpdc -c peers

    remote           local    st poll reach   delay offset disp

=======================================================================

*192.168.5.2     192.168.7.1    4 64   377 0.00230 -0.000426 0.00026

 

 

 

||||||||||||||||

 

十四、数据库查询5

 

文件系统的RAC则要查询AIO设置:

 

原理:

 

异步IO的设置

 

操作系统中最常用的I/O模式是同步I/O。在同步中,当发出一个I/O请求之后,应用程序就会阻塞,知道I/O请求得到满足为止。

 

异步I/O(AIO)的基本思想是允许众多并发进程同时发起I/O操作,而不用阻塞或等待任何操作完成。在稍后接收到I/O

 

操作完成的通知时,进程就可以检索I/O操作的记结果。

 

显然,使用异步IO有助于构建在多用户运算模式下速度更快的I/O方式。在异步I/O的支持下,应用系统(如Oracle数据库),可以避免I/O的重叠操作,高效使用CPU资源。

 

Oracle数据库在AIX上运行时,完全支持AIO模型。如果能够正确和优化地使用AIO,则会对Oracle系统进行I/O写入操作带来非常正面的影响。它使Oracle在后台完成I/O操作的同时,继续进行计算和处理,大幅度提高性能。

 

 AIX 5L中,无论Oracle 数据文件采用的是JFS2文件系统方式存放,或者是采用裸设备方式存放,异步I/O都是支持的。如果Oracle采用裸设备形式存储数据库文件(数据文件、日志文件、控制文件),由于AIX对于AIO的支持已经完全集成在内核中,所以Oracle数据库的I/O操作本身即异步处理,无需做任何调整。

 

如果采用JFS2/JFS文件系统,则Oracle数据局库的I/O操作的异步化,必须由aioserver完成---aioserver控制读写任务从启动到结束的全过程。因此,aioserver的进程数量也就决定了Oracle可同时读写的任务多少。

所以,在文件系统数据库模式下,调整AIO的参数是非常必要的。调整该参数可以在SMITTY环境下执行。设定后需要重新启动系统。当然也可以通过下面的命令修改AIO逻辑设备的属性来达到同样的目的:

 

方法:

 

Smitty chaio

 

修改方式:

 

#chdev -l aio0  -a  maxservers='100'  -a minservers='50'

 

 

 

十五、数据库查询6

 

原理:

 

hard limitsAIX 4.1版本开始引入。hard limits 应由AIX系统治理员设置,只有security组的成员可以将此值增大,用户本身可以减小此限定值,但是其更改将随着该用户从系统退出而失效。使用下列命令可以查看hard limits的限定值:

 

  ulimit -Ha

 

  soft limits AIX核心使用的限制进程对系统资源的使用的上限值。此值可由任何人更改,但不能超出hard limits值。这里要注重的是只有security组的成员可使更改永久生效,普通用户的更改在其退出系统后将失效。使用以下命令可以查看soft limits的设置:

 

  ulimit -a

 

  下面为系统的soft limits的默认值:

 

  3.2 4.1-4.3

 

  =============== =================

 

  fsize = 2097151 fsize = 2097151

 

  core = 2048 core = 2048

 

  cpu = 3600 cpu = -1

 

  data = 131072 data = 262144

 

  rss = 65536 rss = 65536

 

  stack = 8192 stack = 65536

 

  nofiles = 2000* nofiles=2000 *   

 

  * 该值(nofiles)只能在AIX 4.3.1 或以后的版本中更改。

 

  上述定义作为默认值存放在文件 /etc/security/limits 中,在新用户被加进系统后生效。直接更改此文件中的定义值需要将系统重新启动以便使更改生效。将相应值该为"-1" 表示不受 soft limits的限制(unlimited)

 

  下面我们将就各字段逐一进行介绍:

 

  fsize 用户创建的文件大小限制。此定义值(512字节为单位)为该用户可以生成的最大文件的大小。

 

  core 生成的core文件大小的限制(512字节为单位)。

 

  cpu 用户进程可用cpu的限定值(以秒为单位)。普通用户只能将此值减小,root可以将此值增大。这里要注重的是进程使用CPU的时间取决于AIX Kernel(核心程序)进程调度算法,该值在此仅做参考。

 

  data 进程数据段大小的限定值(以字节为单位)。

 

  stack 进程堆栈段大小的限定值(以字节为单位)。

 

  rss 进程常驻内存段的限定值(以字节为单位)。AIX核心并不参考此限定。

 

  nofiles 进程中打开文件的最大数量。此限定在AIX 4.3.1之前的版本中固定为2000。在AIX 4.3.1及其之后的版本中可将此值增大至32767

 

 

 

方式:(ulimit –a)

cat /etc/security/limits

 

理想结果:

cat /etc/security/limits

# more /etc/security/limits

* Sizes are in multiples of 512 byte blocks, CPU time is in seconds

* fsize      - soft file size in blocks

* core       - soft core file size in blocks

* cpu        - soft per process CPU time limit in seconds

* data       - soft data segment size in blocks

* stack      - soft stack segment size in blocks

* rss        - soft real memory usage in blocks

* nofiles    - soft file descriptor limit

* fsize_hard - hard file size in blocks

* core_hard  - hard core file size in blocks

* cpu_hard   - hard per process CPU time limit in seconds

* data_hard  - hard data segment size in blocks

* stack_hard - hard stack segment size in blocks

* rss_hard   - hard real memory usage in blocks

* nofiles_hard - hard file descriptor limit

* The following table contains the default hard values if the

* hard values are not explicitly defined:

*

*   Attribute        Value

*   ==========    ============

*   fsize_hard    set to fsize

*   cpu_hard      set to cpu

*   core_hard         -1

*   data_hard         -1

*   stack_hard      8388608

*   rss_hard          -1

*   nofiles_hard      -1

*

* NOTE:  A value of -1 implies "unlimited"

*

 

default:

        fsize = -1

        core = -1

        cpu = -1

        data = -1

        rss = -1

        stack = -1

        nofiles = -1

 

root:

daemon:

bin:

sys:

adm:

uucp:

guest:

nobody:

lpd:

esaadmin:

        stack = 393216

        stack_hard = 393216

oracle:

 

        nofiles = -1 

        data = -1

        rss = -1

        stack = -1

        fsize = -1

注意,-1是无限制

 

解决办法:

要修改如上限制,可以采用命令如

chuser data='-1' rss='-1' stack='-1' fsize='-1' nofiles='-1' oracle

 

十六、数据库查询7

 

原理:

 

如何对操作系统进行调优,使操作系统支持最大连接数?

 

solaris下,在安装oracle前必须要调整系统参数,该参数文件位于/etc/下,名为system,里面有一个参数 semsys:seminfo_semmns=1024,这个值是processor的最终控制值,这个参数表示unix系统总共可以分配的进程。当oracle的进程数超过操作系统的限制时,就会出现这样的错误。maximum number of processes150 exceeded,现在,你可以检查根据你自己的操作系统检查一下看怎样找到该参数。

 

AIX操作系统下,smit chgsys 查看Maximum number of PROCESSES allowed per user

 

系统缺省128。如果连接数超过,也会有访问不了oracle的问题.

 

方式:

 

Smitty chgsys

 

 

 

结果类似下面:

 

Change / Show Characteristics of Operating System

 

 

 

Type or select values in entry fields.

 

Press Enter AFTER making all desired changes.

 

 

 

[TOP]                                                   [Entry Fields]

 

  System ID                                           0X80000EBC36D00000

 

  Partition ID                                        0X80000EBC36D00002

 

  Maximum number of PROCESSES allowed per user       [10000]                 +#

 

  Maximum number of pages in block I/O BUFFER CACHE  [20]                    +#

 

  Maximum Kbytes of real memory allowed for MBUFS    [0]                     +#

 

  Automatically REBOOT OS after a crash               true                   +

 

  Continuously maintain DISK I/O history              false                  +

 

  HIGH water mark for pending write I/Os per file    [33]                    +#

 

  LOW water mark for pending write I/Os per file     [24]                    +#

 

  Amount of usable physical memory in Kbytes          16252928

 

  State of system keylock at boot time                normal

 

  Enable full CORE dump                               false                  +

 

  Use pre-430 style CORE dump                         false 

 

 

 

解决方案

 

如果太小,可以修改

Smitty chgsys-> Maximum number of PROCESSES allowed per user    设置>1500