$sqlplus / as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on Tue May 31 10:33:11 2011
Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

/usr/lib/pa20_64/dld.sl: Unable to find library 'libskgxn2.sl'.
ERROR:
ORA-12547: TNS:lost contact


원본이 RAC인 DB를 copy해서 single로 띄울때 sqlplus를 실행하면 위의 오류가 발생할 수 있다.
이 경우 rac option을 빼주는 작업이 필요하다.

cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk rac_off
make -f ins_rdbms.mk ioracle
 

crs resource의 상태를 crs_stat 명령으로 확인해 보면 가끔 resource의 상태가 UNKNOW인 경우가 가끔 발생한다.
CRS resource가 정상적으로 가동 되지 않은 경우도 있고 또 정상적으로 가동된 것 같은데 UNKNOW인 경우도 가끔 있다.  

oracle CRS resource가 UNKNOWN 상태로 변경되는 이유는 일반적으로 CRS resource start/stop/check 시의 action script 수행이 실패할 때 status가 변경되게 된다. 다음은 CRS resource의 state가 UNKNOWN으로 변경되는 일반적인 원인이다.
    

1.  The permission of the resource trace file is incorrect.
2.  The permission of the action script and other racg script is incorrect.
3.  The server load is very heavy and the action script times out.
4.  The look up to NIS hangs or takes very long time and causes the action script to time out.


CRS resource의 action script는 다음의 명령으로 확인할 수 있다. 
crs_stat -p <resource name such as ora.node1.vip> | grep ACTION_SCRIPT

CRS resource 이름은 다음의 명령으로 확인할 수 있다.
crs_stat | grep -i name

다음은 위에 기술한 CRS resource의 UNKNOWN state의 일반적인 원인에 대해 점검해 볼 항목이다.

1.  The permission of the resource trace file if it is incorrect. 
The resource trace file in in the HOME/log/<node name>/racg directory where HOME is the the HOME directory of action script for the resource.

2.  The permission of racg scripts in the HOME/bin directory if it they are incorrect. 
HOME is the the HOME directory of action script for the resource. Please issue "ls -l HOME/bin/racg*" to get the permission of the racg script. Please issue "ls -l HOME/bin/racg*" as user oracle or a user who normally starts up failing resources.
If any of the racg script is a soft link to another file, then check the permission of the file to which the racg script is soft linked.

3.  Check crsd.log and see if the resource action script timed out. 
If it did, then check if the server load was heavy (95% used or higher) for a minute or longer at the time of the failure. Setting up OSWatcher or IPD/OS can help troubleshooting this if the timeout occurs intermittently. Also, check if the NIC was having a problem at the time of the failure. 


참고 : Common Causes for CRS Resources in UNKNOWN State (Doc ID 860441.1) 

oracle RAC(OPS도 마찬가지지만)를 사용할때, 각각의 instance는 자신의 SGA와 buffer cache를 갖는다.

RAC는 성능 향상과 노드간의 데이터 정합성을 위해 이들 각 instance내의 buffer내의 block의 변경을 자알 관리해야 한다. cache resource라 불리는 이들 buffer에 대한 각각의 copy 본은 cluster의 한 노드에는 반드시 master를 갖고 있어야 한다.

10g 이전 버전에서는 한 instance에서 해당 cache resource에 대해 master로 설정되면 instance startup이나 shutdown, node eviction 등으로 인한 reconfiguration 이전에는 그 설정이 지속되게 된다.  따라서 만약 노드 B가 cache resource에 대해 master로 설정되면 reconfiguration이 발생되기 전까지는 이 설정이 지속된다.

2009년 10월 12일 Update:


첨부된 문서는 RAC 간의 데이터 전송인 "cache fusion"에 대한 설명이다. 해당 설명의 그림을 보면 buffer access를 위해 계속 resource master에 해당 block에 대해 어떤 instance에서 master owner ship을 갖고 있는지 확인하고 있다.
이 문서는 2003년 봄 oracle magazine에 실린 "cache fusion"에 대한 설명이다.


10g에서 소개된 DRM은 자주 access 되는 node로의 buffer에 대한 master가 변경되는 re-mastering 개념이 소개되었다. 따라서 이전 버전처럼 reconfiguration 없이도 master의 재 설정이 가능해 졌다.

이러한 re-mastering operation은 LMD trace에서 확인할 수 있다.
Begin DRM(202) - transfer pkey 4294951314 to 0 oscan 1.1
*** 2006-08-01 17:34:54.645
Begin DRM(202) - transfer pkey 4294951315 to 0 oscan 1.1
*** 2006-08-01 17:34:54.646
Begin DRM(202) - transfer pkey 4294951316 to 0 oscan 1.1
*** 2006-08-01 17:34:54.646
Begin DRM(202) - transfer pkey 4294951317 to 0 oscan 1.1
RAC에서는 buffer내의 block에 대한 access시 반드시 해당 block의 master와 통신을 하게 되어 있다. 따라서 특정 노드에서 자주 참조되는 block은 해당 노드에서 master를 갖는것이 성능상의 잇점을 얻을 수 있을 것이다.

하지만 oracle10g RAC에 대해서 이전 버전처럼 업무를 노드 별로 나누는 것을 강조하고 있지 않다. 더구나 sql*net의 load balance 기능을 사용하고 있다면, remastering에 의한 부담이 더 크지 않을까나..

참고 : Note 390483.1 DRM - Dynamic Resource management

2010/03/25 Updated: 
Oracle database internals by Riyaj라는 유명한 오라클 블로그에서 DRM에 대해 post 하나를 올렸군요. 
오 ..역쉬, force가 다르군요. ㅜㅡ

내용을 좀 읽어보니 아예 DRM을 disable 시키지 말고 값을 크게 해서 remastering을 최소화하는 것을 권하는 군요. 
DRM 기능은 _gc_affinity_time을 0으로 설정해 disable 시킬 수 있습니다. 그러나 _gc_affinity_limit와 _gc_affinity_minimum의 값 조정으로 DRM 기능을 최소화 할 수 도 있군요. 이렇게 최소화 시켜놓으면 사용자게 manual 하게 rematering 하는 게 여전히 가능하답니다. 
manual 하게 수정은 "oradebug lkdebug -m pkey" 명령으로 가능합니다. 

자세한 내용은 아래 링크에서...

http://orainternals.wordpress.com/2010/03/25/rac-object-remastering-dynamic-remastering/






* CRS process 확인
1. ps -ef | grep d.bin

* Resource Status 확인
crs_stat -t
crs_stat -p ==> CRS PROFILE을 확인

* Node_name 확인
as oracle> $ORA_CRS_HOME/crs/bin/olsnodes -n

* CRS 실행
1. as root> $ORA_CRS_HOME/crs/bin/crsctl start crs

* ASM 사용시 Start/Stop 방법
as oracle> srvctl start/stop asm -n node_name

* Listener Start/Stop 방법
as oracle> srvctl start/stop listener -n node_name [-l listenername]

* Instance Startup/Stop

srvctl start instance -d oraDB -i oraDB1
srvctl stop instance -d oraDB -i oraDB1
srvctl status database -d oraDB
Instance oraDB1 is not running on node ds04e
Instance oraDB2 is not running on node ds05e

* Database Down 방법

1. sqlplus "/as sysdba"
   SQL> shutdown immediate
   또는
   srvctl stop database -d db_name

2. srvctl stop nodeapps -n <node#1_name>
3. srvctl stop nodeapps -n <node#2_name>
4. as root> /fsoracle/app/oracle/crs/bin/crsctl stop crs
5. OS Cluster Down                     -- 꼭 내릴 필요는 없음

* Database startup 방법

1. OS Cluster startup
2. as root> /fsoracle/app/oracle/crs/bin/crsctl start crs
3. srvctl start nodeapps -n <node#1_name>        -- Resource Start (Optional)
4. srvctl start nodeapps -n <node#2_name>        -- Resource Start (Optional)
5. sqlplus "/as sysdba"
   SQL> startup
   또는 srvctl start database -d db_name

* CRS setup 방법

1. Database Auto Restart Disable 방법
   crs_stat -p ora.DSCTMA.db > /tmp/ora.DSCTMA.db.cap
   crs_profile -update ora.DSCTMA.db -dir /tmp -o as=2,ra=0
   crs_register ora.DSCTMA.db -dir /tmp -u
   crs_stat -p  ora.DSCTMA.db | grep -E "REQUIRED_RESOURCES|RESTART_ATTEMPTS|AUTO_START"


2.Instance Auto Restart  Disable 방법
  crs_stat -p ora.DSCTMA.DSCTMA01.inst > /tmp/ora.DSCTMA.DSCTMA01.inst.cap
  crs_profile -update ora.DSCTMA.DSCTMA01.inst -dir /tmp -o as=2,ra=0        -- Resource Option 수정
  crs_register ora.DSCTMA.DSCTMA01.inst -dir /tmp -u
  crs_stat -p  ora.DSCTMA.DSCTMA01.inst | grep -E "REQUIRED_RESOURCES|RESTART_ATTEMPTS|AUTO_START"

  crs_stat -p ora.DSCTMA.DSCTMA02.inst > /tmp/ora.DSCTMA.DSCTMA02.inst.cap
  crs_profile -update ora.DSCTMA.DSCTMA02.inst -dir /tmp -o as=2,ra=0        -- Resource Option 수정
  crs_register ora.DSCTMA.DSCTMA02.inst -dir /tmp -u
  crs_stat -p  ora.DSCTMA.DSCTMA02.inst | grep -E "REQUIRED_RESOURCES|RESTART_ATTEMPTS|AUTO_START"

3.crsctl disable crs ( Automatic Startup Disable )

4. Network Down 시 Database shutdown 방지 방법
crs_stat -p ora.DSCTMA.DSCTMA01.lsnr > /tmp/ora.DSCTMA.DSCTMA01.lsnr.cap
crs_profile -update ora.DSCTMA.DSCTMA01.lsnr -dir /tmp -o as=0,ra=0
crs_register ora.DSCTMA.DSCTMA01.lsnr -dir /tmp -u
crs_stat -p  ora.DSCTMA.DSCTMA01.lsnr | grep -E "REQUIRED_RESOURCES|RESTART_ATTEMPTS|AUTO_START"


5. VIP auto restart 기능 OFF
crs_stat -p ora.<node#1_name>.vip > /tmp/ora.<node#1_name>.vip.cap
crs_profile -update ora.<node#1_name>.vip -dir /tmp -o as=0  # auto_start=0
crs_register ora.<node#1_name>.vip -dir /tmp -u
crs_stat -p  ora.<node#1_name>.vip | grep -E "REQUIRED_RESOURCES|RESTART_ATTEMPTS|AUTO_START"





1. crs 버전

# ./crsctl query crs softwareversion
CRS software version on node [mars] is [10.2.0.2.0]

# ./crsctl query crs activeversion
CRS active version on the cluster is [10.2.0.2.0]

2. crs 설치 정보

각 노드에서 olsnodes -n,   oicfg getif 를 수행한다.

예:
# olsnodes -n

결과
pvl31  1
pvl41  2

# oifcfg getif

결과
en0  192.1.10.0 global public
en1  192.1.11.0 global cluster_interconnect

3. crs 상태 확인

as oracle user

# crs_stat -t

ora.V10SN.V10SN1.inst                         ONLINE     ONLINE on opcbsol1
ora.V10SN.V10SN2.inst                         ONLINE     ONLINE on opcbsol2
ora.V10SN.db                                  ONLINE     ONLINE on opcbsol2
ora.opcbsol1.ASM1.asm                         ONLINE     ONLINE on opcbsol1
ora.opcbsol1.LISTENER_OPCBSOL1.lsnr           ONLINE     ONLINE on opcbsol1
ora.opcbsol1.gsd                              ONLINE     ONLINE on opcbsol1
ora.opcbsol1.ons                              ONLINE     ONLINE on opcbsol1
ora.opcbsol1.vip                              ONLINE     ONLINE on opcbsol1
ora.opcbsol2.ASM2.asm                         ONLINE     ONLINE on opcbsol2
ora.opcbsol2.LISTENER_OPCBSOL2.lsnr           ONLINE     ONLINE on opcbsol2
ora.opcbsol2.gsd                              ONLINE     ONLINE on opcbsol2
ora.opcbsol2.ons                              ONLINE     ONLINE on opcbsol2
ora.opcbsol2.vip                              ONLINE     ONLINE on opcbsol2

프로세스(process) 확인
ps -ef | grep oprocd     | grep -v grep
ps -ef | grep evmd     | grep -v grep
ps -ef | grep ocssd     | grep -v grep
ps -ef | grep crsd     | grep -v grep

4. network 구성

기본 구성
node        : pvl31, pvl41
interconnect: pvl31_int,pvl41_int
vip         : pvl31_vip(192.1.10.131),pvl41_vip(192.1.10.141)

en0 : public  (192.1.10.31/41)
en1 : private (192.1.11.31/41)

# netstat -l

Name  Mtu    Network   Address
En0   1500   link#2    0.2.55……..
En0   1500   192.1.10  pvl31
En0   1500   192.1.10  pvl31_vip
En1   1500   link#3    0.2.55…….
En1   1500   192.1.11  pvl31_int

5. voting , ocr 위치

[voting disk]
# crsctl query css votedisk

[ocr]
/var/opt/oracle/srvConfig.loc 에 지정되어 있거나 환경 변수인 SRV_CONFIG에 지정 되어 이다.

# ocrcheck

리눅스     : /var/oracle
기타 유닉스: /var/opt/oracle

내용:
ocrconfig_loc=<shared device>
local_only=FALSE

6. callout 디렉토리

$ORA_CRS_HOME/racg/usrco
$ORA_CRS_HOME/racg/usrco






사례 1) Database를 매뉴얼하게 생성 후 netca, srvctl add 명령으로 서비스 등록 후, srvctl start 명령 시 node 2번에서만 listener, instance가 시작되지 않고 crs_satat-t로 보았을 때 target =online, status UNKNOWN으로 나타난다.

사례 2) srvctl로 instnace startup시 다음과 같은 에러가 발생한다. Sqlplus로 메뉴얼하게 startup하면 정상적으로 startup된다.
srvctl start database -d BDB
PRKP-1001 : Error starting instance BDB1 on node bdb1
CRS-0215: Could not start resource 'ora.BDB.BDB1.inst'.
PRKP-1001 : Error starting instance BDB2 on node bdb2
CRS-0215: Could not start resource 'ora.BDB.BDB2.inst'.

사례 3) Veritas clusterware에 10gR2 CRS 설치 후 ons와 gsd가 구동되지 않는다.







가끔 RAC나 CRS 관련해 문서를 보다보면 I/O fencing이라는 말이 나오는데, 이게 무슨 말일까요?

다음은 Cluster I/O fencing에 대한 설명입니다.

There will be some situations where the leftover write operations from failed database instances reach the storage system after the recovery process starts, such as when the cluster function failed on the nodes, but the nodes are still running at OS level.

Since these write operations are no longer in the proper serial order, they can damage the consistency of the stored data. Therefore, when a cluster node fails, the failed node needs to be fenced off from all the shared disk devices or disk groups.

This methodology is called I/O Fencing, sometimes called Disk Fencing or failure fencing.

정리해 보자면, cluster 구성에서 떨어져 나간 노드의 I/O를 방지하는 방법?




'Oracle Database' 카테고리의 다른 글

sequence cache & pining  (0) 2009.06.30
오라클의 에러  (0) 2009.06.25
Sample code - sqlplus : demobld.sql  (0) 2009.06.09
Oracle Korea Magazine - Summer 2009  (0) 2009.06.09
Oracle Magazine - July/August 2009  (0) 2009.06.09

Linux, iSCSI 환경에서 Oracle RAC 10g Release 2 클러스터 설치하기


저자 - Jeffrey Hunter

(2,500달러 이하의) 저렴한비용으로 Oracle RAC 10g Release 2 클러스터 개발환경을 셋업하고 설정하는 방법을 배워 보십시오.


이 정도 가격이면 테스트 장비 용으로 구축해 볼만할 거 같긴하네요...




oracle은 9i로 version이 올라오면서 이전 버전의 OPS(oracle parallel server)를 RAC(real application cluster)로 명칭을 바꾸고 새로운 기능들을 대폭 추가했다. 양 노드간의 데이터의 cache level에서의 이전을 지원하는 cache fusion, 일부 노드의 장애에 대해 자동으로 client 의 접속을 다른 노드로 넘겨주는 TAF, CTF 등의 추가로 HA 기능을 강조하던 이전의 버전에서 cluster 기능을 대폭 강화 했다.


oracle 10g rac에서의 가장 눈에 띄는 변화는 CRS의 등장이다. CRS는 서로 다른 platform에서도 동일한 interface를 구현하기 위해 설계되었다. 동일한 interface의 구현이라면 platform과는 상관없이 데이터베이스에서의 동일한 기능 구현을 말하는 듯 하다.

(혹시 다른 CRS(crystal red shrimp) 찾아 오신분들을 위해 사진 올립니다... ㅋ)

CRS(crystal red shrimp)



CRS는 여러 application을 가지고 있다. 이 application들은 발생하는 event를 모니터링해서 미리 설정된 action을 취하게 된다. public network의 단절이나, private network의 단절, disk controller와의 통신 문제, system 장애에 대해 이러한 action을 지정할 수 있다.
이러한 미리 정의된 action으로 사용자는 시스템 레벨에서의 장애 상황에 따른 application level의 조치 없이 운영이 가능하다.

물론 각 장애를 인지하기 위한 timeout까지의 시간, 강제 종료된 instance에 대한 recovery 시간등이 필요하므로 이에 대한 업무의 영향은 있을 것이다.

자세한 내용은 요기서..
Oracle 10g RAC의 CRS (Cluster Ready Services)
http://blog.naver.com/PostView.nhn?blogId=hmsong95&logNo=130004625118#






+ Recent posts