DB2 HADR을 TSA 없이 설정할 경우, 프라이머리서버 상태를 모니터링하기 위해 필요한 스크립트

#!/bin/ksh

 

while true

do

  rsh 프라이머리서버명 /home/db2inst1/sqllib/bin/db2gcf -i db2inst1 -s | grep DB2 | awk '{ print $4 }' | read STATUS

  if [[ $STATUS != "Available" ]]

  then

    hadr_start.ksh

    exit 0

  fi

  sleep 60

Done

 

※ 위 스크립트는 스탠바이서버에서 nohup등을 사용하여 백그라운드로 실행시킴!

 

※ 위 스크립트를 그냥 실행시키면 잘 수행되지만, 만약 nohup으로 실행시킬 때 정지되는 경우가 발생하면 다음과 같이 스크립트의 수정이 필요!

 

) [1] + Stopped (SIGTTIN)        nohup ./hadr_monitor_loop.ksh &

 

해결책)

 

#!/bin/ksh

 

while true

do

  rsh 프라이머리서버명 -n /home/db2inst1/sqllib/bin/db2gcf -i db2inst1 -s | grep DB2 | awk '{ print $4 }' | read STATUS

  if [[ $STATUS != "Available" ]]

  then

    hadr_start.ksh

    exit 0

  fi

  sleep 60

Done

 

 오류 메세지
 

DB2 Embedded SQC 코드 작성 시, 동일한 호스트 변수를 서로 다른 Scope에서 각각 선언하면 프리컴파일 수행 시 다음의 오류가 발생하는 문제

SQL0307N The host variable "호스트변수명" is already defined.

 

 원인
 

다음 규칙은 호스트 변수 선언 섹션에 적용됩니다.

  • 모든 호스트 변수는 SQLDA 구조를 참조하는 호스트 변수를 제외하고, 참조되기 전에 소스 파일에서 올바른 형식의 선언 섹션 내에 선언되어야 합니다.
  • 소스 파일에서 복수의 선언 섹션을 사용할 있습니다.
  • 호스트 변수 이름은 소스 파일 내에서 고유해야 합니다. DB2 프리컴파일러는 호스트 언어별 변수 범위 지정 규칙을 고려하지 않기 때문입니다. 그러므로, 호스트 변수에 대해 하나의 범위가 존재합니다.

:

이는 DB2® 프리컴파일러가 호스트 변수의 범위를 전역으로 변경하여 호스트 변수를 정의된 범위 외부에서 액세스할 있음을 의미하지는 않습니다.

 

 조치
 

DB2 InfoCenter에 설명에 따르면,

하나의 SQC 파일 안에 호스트변수 선언문은 여러 번 사용될 수 있으나,

호스트 변수명은 유일해야 한다고 가이드 되고 있으므로

중복적으로 사용되는 호스트 변수를 Global로 선언하거나,

중복 사용되는 호스트 변수를 포함하는 함수들을 개별적인 SQC 파일로 분리하여 사용하는 것을 권장함.

( 같은 이름의 호스트 변수가 사용되는지를 체크하지 못하게 하는 프리컴파일 옵션은 존재하지 않음 )

 

 참고

http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.apdv.embed.doc/doc/c0005632.htm

 

 HACMP 기본 Cluster Process ( "/etc/inittab" 에 등록되어 있는 프로세스 ) 확인
 

[root@unix1:/]# ps -ef |grep cluster

    root 168102 196748   0 10:57:39      -  0:00 /usr/es/sbin/cluster/clstrmgr

    root 250032 196748   0 10:57:36      -  0:00 /usr/es/sbin/cluster/clcomd -d

 

[root@unix2:/]# ps -ef |grep cluster

    root 168102 196748   0 10:57:39      -  0:00 /usr/es/sbin/cluster/clstrmgr

    root 250032 196748   0 10:57:36      -  0:00 /usr/es/sbin/cluster/clcomd -d

 

 HACMP 서비스 프로세스 상태 확인
 

[root@unix1:/]# lssrc -g cluster

Subsystem         Group            PID          Status

 clstrmgrES       cluster          205034       활성

 clinfoES         cluster          491562       활성

 

[root@unix2:/]# lssrc -g cluster

Subsystem         Group            PID          Status

 clstrmgrES       cluster          205034       활성

 clinfoES         cluster          491562       활성

 

 HACMP 시작
 

[root@unix1:/]# smitty clstart

                                              Start Cluster Services

 

입력 필드에 값을 입력하거나 선택하십시오.

원하는 것을 모두 변경한 , Enter 키를 누르십시오.

 

                                                        [입력 필드]

* Start now, on system restart or both                now                                                      +

  Start Cluster Services on these nodes              [unix1,unix2]                                             +

* Manage Resource Groups                              Automatically                                            +

  BROADCAST message at startup?                       true                                                     +

  Startup Cluster Information Daemon?                 true                                                     +

  Ignore verification errors?                         false                                                    +

  Automatically correct errors found during           Yes                                                      +

  cluster start?

 

 HACMP 시작완료 확인
 

[root@unix1:/]# tail -f /tmp/hacmp.out

                        HACMP Event Summary

Event: /usr/es/sbin/cluster/events/check_for_site_up_complete unix2 

Start time: Mon Jul 13 17:27:32 2009

 

End time: Mon Jul 13 17:27:32 2009

 

Action:         Resource:                       Script Name:

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

No resources changed as a result of this event

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

 

[root@unix1:/]# ps -ef|grep cluster

    root 225520 163958   0  17:26:20      -  0:00 /usr/es/sbin/cluster/clinfo

    root 233650 163958   0  17:07:34      -  0:00 /usr/es/sbin/cluster/clcomd -d

    root 245932 163958   0  17:07:37      -  0:00 /usr/es/sbin/cluster/clstrmgr

    root 385094 221188   0  17:30:29  pts/0  0:00 grep cluster

    root 479476 163958   0  17:26:11      -  0:00 haemd HACMP 1 cluster1 SECNOSUPPORT

    root 483574 163958   0  17:26:15      -  0:00 harmad -t HACMP -n cluster1

 

 HACMP 정상 종료
 

[root@unix1:/]# smitty clstop

 

                                              Stop Cluster Services

 

입력 필드에 값을 입력하거나 선택하십시오.

원하는 것을 모두 변경한 , Enter 키를 누르십시오.

 

                                                        [입력 필드]

* Stop now, on system restart or both                 now                                                      +

  Stop Cluster Services on these nodes               [unix1,unix2]                                             +

  BROADCAST cluster shutdown?                         true                                                     +

* Select an Action on Resource Groups                 Bring Resource Groups Offline                            +

 

 HACMP 강제 종료 (unix1)
 

[root@unix1:/]# smitty clstop

                                              Stop Cluster Services

 

입력 필드에 값을 입력하거나 선택하십시오.

원하는 것을 모두 변경한 , Enter 키를 누르십시오.

 

                                                        [입력 필드]

* Stop now, on system restart or both                 now                                                      +

  Stop Cluster Services on these nodes               [unix1]                                                   +

  BROADCAST cluster shutdown?                         true                                                     +

* Select an Action on Resource Groups                 Unmanage Resource Groups                                 +

 

 HACMP 강제 종료 (unix2)
 

[root@unix1:/]# smitty clstop

                                              Stop Cluster Services

 

입력 필드에 값을 입력하거나 선택하십시오.

원하는 것을 모두 변경한 , Enter 키를 누르십시오.

 

                                                        [입력 필드]

* Stop now, on system restart or both                 now                                                      +

  Stop Cluster Services on these nodes               [unix2]                                                   +

  BROADCAST cluster shutdown?                         true                                                     +

* Select an Action on Resource Groups                 Unmanage Resource Groups                                 +

 

 HACMP Takeover (unix1 à unix2)
 

[root@unix1:/]# smitty clstop

 

                                              Stop Cluster Services

 

입력 필드에 값을 입력하거나 선택하십시오.

원하는 것을 모두 변경한 , Enter 키를 누르십시오.

 

                                                        [입력 필드]

* Stop now, on system restart or both                 now                                                      +

  Stop Cluster Services on these nodes               [unix1]                                                   +

  BROADCAST cluster shutdown?                         true                                                     +

* Select an Action on Resource Groups                 Move Resource Groups                                     +

 HACMP Takeover (unix2 à unix1)
 

[root@unix1:/]# smitty clstart

                                              Start Cluster Services

 

입력 필드에 값을 입력하거나 선택하십시오.

원하는 것을 모두 변경한 , Enter 키를 누르십시오.

 

                                                        [입력 필드]

* Start now, on system restart or both                now                                                      +

  Start Cluster Services on these nodes              [unix1]                                             +

* Manage Resource Groups                              Automatically                                            +

  BROADCAST message at startup?                       true                                                     +

  Startup Cluster Information Daemon?                 true                                                     +

  Ignore verification errors?                         false                                                    +

  Automatically correct errors found during           Yes                                                      +

  cluster start?  

 

[root@unix1:/]# smitty hacmp

                                                  HACMP for AIX

 

원하는 항목으로 커서를 이동시킨 , Enter 키를 누르십시오.

 

  Initialization and Standard Configuration

  Extended Configuration

  System Management (C-SPOC)

  Problem Determination Tools

 

[root@unix1:/]# smitty hacmp

                                              Extended Configuration

 

원하는 항목으로 커서를 이동시킨 , Enter 키를 누르십시오.

 

  Discover HACMP-related Information from Configured Nodes

  Extended Topology Configuration

  Extended Resource Configuration

  Extended Cluster Service Settings

  Extended Event Configuration

  Extended Performance Tuning Parameters Configuration

  Security and Users Configuration

  Snapshot Configuration

  Export Definition File for Online Planning Worksheets

 

  Extended Verification and Synchronization

  HACMP Cluster Test Tool

 

> Resource 정의 <

 

                                         Extended Resource Configuration

 

원하는 항목으로 커서를 이동시킨 , Enter 키를 누르십시오.

 

  HACMP Extended Resources Configuration

  Configure Resource Group Run-Time Policies

  HACMP Extended Resource Group Configuration

 

                                      HACMP Extended Resources Configuration

 

원하는 항목으로 커서를 이동시킨 , Enter 키를 누르십시오.

 

  Configure HACMP Applications Servers

  Configure HACMP Service IP Labels/Addresses

  Configure HACMP Tape Resources

  Configure HACMP Communication Adapters and Links

  Configure Custom Disk Methods

  Configure Custom Volume Methods

  Configure Custom Filesystem Methods

  Customize Resource Group and Resource Recovery

  Configure Resource Distribution Preferences

  

> Resource Group 정의 <

 

                                         Extended Resource Configuration

 

원하는 항목으로 커서를 이동시킨 , Enter 키를 누르십시오.

 

  HACMP Extended Resources Configuration

  Configure Resource Group Run-Time Policies

  HACMP Extended Resource Group Configuration

 

+ Recent posts