ORACLE/RAC2008. 12. 23. 13:12
반응형
http://www.oracle.com/technology/global/kr/pub/articles/hunter_rac10gr2.html
반응형
Posted by [PineTree]
ORACLE/RAC2008. 12. 23. 11:10
반응형
 RAC Cluster/Database 구성의 검증

다음 RAC 검증 작업을 클러스터의 모든 노드에서 수행해야 합니다! 다만, 이 가이드에서는 linux1서버에서만 점검 작업을 수행하는 것으로 합니다.

이 섹션에서는 srvctl 커맨드와 SQL 쿼리를 사용하여 Oracle RAC 10g 구성을 검증하는 방법을 설명합니다.

SRVCTL을 위해 정의된 다섯 가지 노드-레벨 (node-level) 작업이 아래와 같습니다:

  • 노드-레벨 애플리케이션의 추가 및 삭제
  • 노드-레벨 애플리케이션 관련 환경변수의 설정 및 해제
  • 노드 애플리케이션의 관리
  • ASM 인스턴스의 관리
  • 프로그램 그룹의 시작 및 중단 (가상 IP 주소, 리스너, Oracle Notification Services, Oracle Enterprise Manager 에이전트 등).

모든 인스턴스 및 서비스의 상태 확인

$ srvctl status database -d orcl
Instance orcl1 is running on node linux1
Instance orcl2 is running on node linux2

단일 인스턴스의 상태 확인

$ srvctl status instance -d orcl -i orcl2
Instance orcl2 is running on node linux2

데이터베이스의 named service 글로벌 상태 확인

$ srvctl status service -d orcl -s orcltest
Service orcltest is running on instance(s) orcl2, orcl1

특정 노드의 노드 애플리케이션 상태 확인

$ srvctl status nodeapps -n linux1
VIP is running on node: linux1
GSD is running on node: linux1
Listener is running on node: linux1
ONS daemon is running on node: linux1

ASM 인스턴스의 상태 확인

$ srvctl status asm -n linux1
ASM instance +ASM1 is running on node linux1.

구성된 데이터베이스의 목록 확인

$ srvctl config database
orcl

RAC 데이터베이스의 구성 확인

$ srvctl config database -d orcl
linux1 orcl1 /u01/app/oracle/product/10.2.0/db_1
linux2 orcl2 /u01/app/oracle/product/10.2.0/db_1

특정 클러스터 데이터베이스에 관련된 모든 서비스를 확인

$ srvctl config service -d orcl
orcltest PREF: orcl2 orcl1 AVAIL:

노드 애플리케이션의 설정 확인 - (VIP, GSD, ONS, Listener 등)

$ srvctl config nodeapps -n linux1 -a -g -s -l
VIP exists.: /vip-linux1/192.168.1.200/255.255.255.0/eth0:eth1
GSD exists.
ONS daemon exists.
Listener exists.

ASM 인스턴스의 설정 확인

$ srvctl config asm -n linux1
+ASM1 /u01/app/oracle/product/10.2.0/db_1

클러스터에서 실행 중인 모든 인스턴스 확인

SELECT
inst_id
, instance_number inst_no
, instance_name inst_name
, parallel
, status
, database_status db_status
, active_state state
, host_name host
FROM gv$instance
ORDER BY inst_id;

INST_ID INST_NO INST_NAME PAR STATUS DB_STATUS STATE HOST
-------- -------- ---------- --- ------- ------------ --------- -------
1 1 orcl1 YES OPEN ACTIVE NORMAL linux1
2 2 orcl2 YES OPEN ACTIVE NORMAL linux2

디스크 그룹에 포함된 모든 데이터 파일 확인

select name from v$datafile
union
select member from v$logfile
union
select name from v$controlfile
union
select name from v$tempfile;

NAME
-------------------------------------------
+FLASH_RECOVERY_AREA/orcl/controlfile/current.258.570913191
+FLASH_RECOVERY_AREA/orcl/onlinelog/group_1.257.570913201
+FLASH_RECOVERY_AREA/orcl/onlinelog/group_2.256.570913211
+FLASH_RECOVERY_AREA/orcl/onlinelog/group_3.259.570918285
+FLASH_RECOVERY_AREA/orcl/onlinelog/group_4.260.570918295
+ORCL_DATA1/orcl/controlfile/current.259.570913189
+ORCL_DATA1/orcl/datafile/example.257.570913311
+ORCL_DATA1/orcl/datafile/indx.270.570920045
+ORCL_DATA1/orcl/datafile/sysaux.260.570913287
+ORCL_DATA1/orcl/datafile/system.262.570913215
+ORCL_DATA1/orcl/datafile/undotbs1.261.570913263
+ORCL_DATA1/orcl/datafile/undotbs1.271.570920865
+ORCL_DATA1/orcl/datafile/undotbs2.265.570913331
+ORCL_DATA1/orcl/datafile/undotbs2.272.570921065
+ORCL_DATA1/orcl/datafile/users.264.570913355
+ORCL_DATA1/orcl/datafile/users.269.570919829
+ORCL_DATA1/orcl/onlinelog/group_1.256.570913195
+ORCL_DATA1/orcl/onlinelog/group_2.263.570913205
+ORCL_DATA1/orcl/onlinelog/group_3.266.570918279
+ORCL_DATA1/orcl/onlinelog/group_4.267.570918289
+ORCL_DATA1/orcl/tempfile/temp.258.570913303

21 rows selected.

'ORCL_DATA1' 디스크 그룹에 포함된 모든 ASM 디스크 확인

SELECT path
FROM v$asm_disk
WHERE group_number IN (select group_number
from v$asm_diskgroup
where name = 'ORCL_DATA1');

PATH
----------------------------------
ORCL:VOL1
ORCL:VOL2
반응형
Posted by [PineTree]
ORACLE/RAC2008. 12. 23. 11:06
반응형
클러스터의 시작 및 종료

이것으로 Oracle RAC 10g의 설치 및 설정 작업을 모두 완료하였습니다.

이 시점에서 여러분은 이렇게 질문할 지도 모릅니다. “다 좋은데, 서비스를 어떻게 시작하고 종료하나요?” 이 가이드의 설명대로 작업을 완료하였다면 모든 서비스(Clusterware, 오라클 인스턴스, Enterprise Manager Database Console 등)는 Linux 노드가 리부트 될 때 자동으로 시작됩니다.

하지만 수동으로 노드를 셧다운하고 다시 시작해야 할 경우도 있습니다. 또는 Enterprise Manager가 실행되고 있지 않음을 확인하고, 이를 시작하려 할 수도 있습니다. 이 섹션에서는 SRVCTL 커맨드를 사용하여 클러스터 환경을 시작하고 종료하는 방법을 설명합니다.

먼저 oracle UNIX 계정으로 로그인하였는지 확인합니다. 여기에서는 모든 명령을 linux1서버에서 실행하는 것으로 가정합니다:

# su - oracle

$ hostname
linux1

Oracle RAC 10g 환경의 종료

먼저 오라클 인스턴스를 중단해야 합니다. 인스턴스와 관련 서비스가 종료된 다음에는, ASM 인스턴스를 종료합니다. 마지막으로 노드 애플리케이션(Virtual IP, GSD, TNS Listener, ONS)를 종료합니다.

$ export ORACLE_SID=orcl1
$ emctl stop dbconsole
$ srvctl stop instance -d orcl -i orcl1
$ srvctl stop asm -n linux1
$ srvctl stop nodeapps -n linux1

Oracle RAC 10g 환경의 시작

먼저 노드 애플리케이션(Virtual IP, GSD, TNS Listener, ONS)을 시작합니다. 노드 애플리케이션이 성공적으로 실행되었다면, ASM 인스턴스를 온라인 처리합니다. 마지막으로, 오라클 인스턴스와 관련 서비스, Enterprise Manager Database 콘솔을 실행합니다.

$ export ORACLE_SID=orcl1
$ srvctl start nodeapps -n linux1
$ srvctl start asm -n linux1
$ srvctl start instance -d orcl -i orcl1
$ emctl start dbconsole

SRVCTL을 이용한 전체 인스턴스의 시작/종료L

모든 인스턴스와 서비스를 동시에 시작/종료하는 방법이 아래와 같습니다!

$ srvctl start database -d orcl

$ srvctl stop database -d orcl
반응형
Posted by [PineTree]
ORACLE/RAC2008. 12. 12. 21:42
반응형
 
★ Check the Hardware Requirements
 /usr/sbin/dmesg | grep "Physical:"
 /usr/sbin/swapinfo -a
 bdf /tmp   
 bdf
 /bin/getconf KERNEL_BITS
 uname -a

★Async
To verify Async I/O is running, do the following procedure with gpm or glance.
     1. Select the dbwr process from the process menu.
     2. After selecting the process, select the "open files" option
 from the menu.
     3. Look for the /dev/async file.
Glance reports which files a given process opens. When async I/O is used,
it opens /dev/async as a file. Rememeber you also must set the
 disk_async_io = TRUE parameter in init.ora parameter file to use async I/O.
 
★ IP Address Requirements
 -------------------------------------------------------------------
 Host Name               Type       IP Address       Registered In 
 -------------------------------------------------------------------
 rac1.mydomain.com       Public      143.47.43.100    DNS 
 rac1-2.mydomain.com     Public      143.46.51.101    DNS 
 rac1-vip.mydomain.com   Virtual     143.46.43.104    DNS 
 rac1-priv1              Private     10.0.0.1         /etc/hosts 
 rac1-priv2              Private     10.0.0.2         /etc/hosts 

★ Checking the Network Requirements
 /usr/bin/netstat -in
 
★ Check for Required Software
/usr/sbin/swlist -l level | more
  *  -l level         levels of objects to view, one of: "depot",
                      "bundle", "product", "subproduct", "fileset",
                      "file", "root", "shroot", "prroot",
                      "category", "patch", "control_file"
 
★Check for Required Patches
 /usr/sbin/swlist -l bundle | grep GOLD
 /usr/sbin/swlist -l patch | grep PHSS_28880
 /usr/sbin/swlist -l patch | more
 
★ Creating the OSDBA Group
 /usr/sbin/groupadd dba
 
★ Create a New Oracle Software Owner User
 [node1]
   /usr/sbin/useradd -g dba oracle
   passwd oracle
   id oracle
     -> uid=440(oracle) gid=200(dba)
 [node2]
   /usr/sbin/groupadd -g 200 dba
   /usr/sbin/useradd -u 200 -g dba oracle
   passwd oracle

★ Grant Privileges to the OSDBA Group
  /etc/privgroup (<- dba MLOCK RTPRIO RTSCHED 추가)
  /usr/sbin/setprivgrp -f /etc/privgroup (Enter the following command to grant the privileges to the OSDBA group: )
  /usr/sbin/getprivgrp dba
 
★ Configure Kernel Parameters 
  - Bourne, Bash, or Korn shell: 
    $ DISPLAY=local_host:0.0 ; export DISPLAY
  - C shell:
    $ setenv DISPLAY local_host:0.0
   
 /usr/sbin/sam

★ Identifying an Existing Oracle Base Directory
  - Identify an existing Oracle Inventory directory
    more /var/opt/oracle/oraInst.loc
   
  - Identify existing Oracle home directories
     more /etc/oratab
     
    
★ Creating a New Oracle Base Directory    
  mkdir -p /mount_point/app/oracle_sw_owner
  chown -R oracle:oinstall /mount_point/app
  chmod -R 775 /mount_point/app
  
 
★ Create the DBCA Raw Device Mapping File
  find /dev/vg_name -user oracle -name 'r*' -print  dbname_raw.conf
  Edit the dbname_raw.conf file in any text editor to create a file similar to the following:
  - Note:
     The following example shows a sample mapping file for a two-instance RAC cluster. 
 system=/dev/vg_name/rdbname_system_raw_500m
 sysaux=/dev/vg_name/rdbname_sysaux_raw_800m
 example=/dev/vg_name/rdbname_example_raw_160m
 users=/dev/vg_name/rdbname_users_raw_120m
 temp=/dev/vg_name/rdbname_temp_raw_250m
 undotbs1=/dev/vg_name/rdbname_undotbs1_raw_500m
 undotbs2=/dev/vg_name/rdbname_undotbs2_raw_500m
 redo1_1=/dev/vg_name/rdbname_redo1_1_raw_120m
 redo1_2=/dev/vg_name/rdbname_redo1_2_raw_120m
 redo2_1=/dev/vg_name/rdbname_redo2_1_raw_120m
 redo2_2=/dev/vg_name/rdbname_redo2_2_raw_120m
 control1=/dev/vg_name/rdbname_control1_raw_110m
 control2=/dev/vg_name/rdbname_control2_raw_110m
 spfile=/dev/vg_name/rdbname_spfile_raw_5m
 pwdfile=/dev/vg_name/rdbname_pwdfile_raw_5m
 
 
★ Verify the Cluster Software Configuration
 To verify that the HP Serviceguard software is running:
 
 If necessary, configure (or reconfigure) the cluster.
 
 Verify that HP Serviceguard is configured to start automatically at runlevel 3.
 
 To verify that HP Serviceguard is running correctly, enter the following command: 
 
 # /usr/sbin/cmviewcl -v
 
 Verify that the cluster status is up, and that all nodes are up and running.
 
 If the cluster is not running, enter the following command to start it:
 
 # /usr/sbin/cmruncl
 
 If any nodes are not running, enter a command similar to the following to start the cluster daemon on those nodes:
 
 # /usr/sbin/cmrunnode nodename1 nodename2...
 
 If you intend to use Hyper Messaging protocol as the cluster interconnect,
 enter the following command to verify that the HyperFabric software is configured properly:
 
 # /opt/clic/bin/clic_stat -d NET
 

★ Configure the oracle User's Environment
 $ xhost +  
 $ su - oracle  
 $ echo $SHELL 
   - Bourne shell (sh), Bash shell (bash), or Korn shell (ksh):  
     $ vi .profile 
     $ DISPLAY=local_host:0.0 ; export DISPLAY
    
   - C shell (csh or tcsh):  
     % vi .login
        $ setenv DISPLAY local_host:0.0

 su - root
 # mkdir /mount_point/tmp
 # chmod a+wr /mount_point/tmp
 # exit 
 Enter commands similar to the following to set the TEMP and TMPDIR environment variables:  
 -Bourne, Bash, or Korn shell:  
   $ TEMP=/mount_point/tmp
   $ TMPDIR=/mount_point/tmp
   $ export TEMP TMPDIR 
 - C shell:  
   $ setenv TEMP /mount_point/tmp
   $ setenv TMPDIR /mount_point/tmp
  
    $ unset ORACLE_HOME
    $ unset TNS_ADMIN
    $ umask
    $ env | more

반응형
Posted by [PineTree]
ORACLE/RAC2008. 8. 25. 20:30
반응형
Modifying the VIP or VIP Hostname of a 10g Oracle Clusterware Node
  문서 ID: 공지:276434.1 유형: BULLETIN
  마지막 갱신 날짜: 06-AUG-2007 상태: PUBLISHED
<LINK target="new" href="/images/metalink/generic/kmstyles.css" type=text/css rel=stylesheet>

In this Document
  Purpose
  Scope and Application
  Modifying the VIP or VIP Hostname of a 10g Oracle Clusterware Node
     Planning for VIP changes
     Verifying Current VIP configuration
     Stopping Resources
     Syntax for modifying nodeapps
     Starting Resources Back Up
  References


Applies to:

Oracle Server - Enterprise Edition - Version:
Information in this document applies to any platform.

Purpose

The purpose of this note is to illustrate the changing of a Virtual IP Address (VIP) or VIP hostname or other VIP parameters in an Oracle10g RAC/Oracle Clusterware environment.   Caution: This note can only be used to change the VIP IP address or Hostname or other parameters associated with the VIP. It is not meant to cover changing the public hostname or the public host IP address.

Scope and Application

Oracle 10g use a VIP (Virtual IP) for clients to connect to the database. This VIP is a static IP with a hostname defined and resolved thru DNS. During the installation of Oracle Clusterware users are prompted to enter a Virtual IP and Virtual hostname for each of the node in the cluster. These are stored within the OCR (Oracle Cluster Registry) and different components within 10g HA framework depend on these VIPs.   If for some reason the need arises  to change either the VIP or the VIP/hostname - perhpas due to a data center move, or changing IP subnets in a Data Center, this procedure should be followed.


Modifying the VIP or VIP Hostname of a 10g Oracle Clusterware Node

Planning for VIP changes



Changing the VIP involves modification of the nodeapps, which includes the Virtual IP address, the GSD, the Listener, and Oracle Notification Services (ONS).   The VIP can be modified while the nodeapps are running, however changes will not take effect until the VIP, and hence the nodeapps, are restarted.
Depending on the version of Oracle Clusterware that you are running, other resources on a node, such as database instances and ASM instances, are dependent on the VIP,  so stopping the nodeapps may cause other resources to be stopped - therefore, this change should be made during a scheduled outage.

In most cases, changing Data Centers or IP addresses within a Data Center will already incur an outage for other reasons, because changes need to be made at the operating system level, and servers may even need to be moved - so there is most likely a scheduled outage for this type of maintenence already.

However, in some cases - for example, if a VIP IP address was perhaps mistyped in DNS and needs to be corrected, you may be able to minimize the downtime by only modifying a single node.  Also, as of 10.2.0.3 and higher versions, the ASM instance and DB instances no longer depend on the VIP, so it is possible to stop the nodeapps without bringing down the ASM instance or DB instance - but client connectivity is limited while the VIP is offline.


Verifying Current VIP configuration

Below, we will provide examples on how to modify the nodeapps to change the VIP or VIP hostname.  


1. The first step that should be done is to confirm the current configuration of the VIP.  This is most easily accomplished by running the command:

 srvctl config nodeapps -n <nodename> -a

Using the '-a'  switch will give you the current VIP Hostname, VIP IP address and interface.   The following example is from a Windows System.   Note that the nodename is 'node1' as passed via the '-n'  argument.    

C:\>srvctl config nodeapps -n node1 -a 
VIP exists.: /node1-v/10.148.44.94/255.255.255.0/Public

These outputs show that:

The VIP Hostname is 'node1-v'
The VIP IP address is '10.148.44.94'
The VIP subnet mask is '255.255.255.0'
The Interface Name used by the VIP is called 'Public'

Any of the above configuration parameters associated with the VIP can be changed if they were originally input incorrectly, or perhaps they need to be changed due to external reasons (such as a data center move, or IP change as mentioned above).

 

Note:
In addition, you can also verify the IP address and interface of the VIP by running the 'ifconfig' command or 'ifconfig -a', and looking for the IP address associated with an interface ending in ':1'. The example below, on Linux, shows the interface as 'eth0:1'

=============================
eth0:1 Link encap:Ethernet HWaddr 00:01:03:2C:69:BB
inet addr:192.168.1.125 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
...
...
=============================

On the Windows platform, run the command 'ipconfig /all'. This will list all IP addresses bound to a given adapter, including the VIP, but it will not be obvious just from this output which one is the VIP address and which is the actual host IP address.   Therefore, using 'srvctl config nodeapps -n <nodename> -a'  is the surest bet.

2. Once you have determined what the current configuration of the nodeapps is, be sure to make note of what values will remain unchanged, and what the correct/new values that you need will be.   For example, if you are just changing the "Interface Name"   you will need to know what the correct interface name is, but you also need to note the VIP hostname, IP address and subnet mask to ensure that this information is re-entered correctly.

Stopping Resources

3.  Once you are ready to make the change, stop all resources that are dependent on the VIP on a given node. This includes all RAC database instances on that node, as well as the ASM instance on that node, if it exists and is being used   (Note that starting with 10.2.0.3, the dependency between the VIP and the database and ASM instances has been removed):

3a). Stop database instances:
$ srvctl stop instance -d grid -i grid1

Where the database name is specified via the '-d' option, and the instance on the appropriate node is specified with the '-i' option.

Alternatively, to stop the entire database, on all nodes, you can issue the stop database command:

$ srvctl stop database -d grid

3b). To stop the ASM instance on the node, issue the following command:

$ srvctl stop asm -n node1

This command should be issued for each ASM instance using the appropriate node name.  Alternatively, it is also possible to stop these resources via SQL*Plus and/or, on the Windows platform by stopping the associated services.

4. Next, stop the nodeapps using srvctl - i.e:

$ srvctl stop nodeapps -n node1

This will stop the VIP, GSD, Listener, and ONS daemon currently running on the nodes specified

If this is being done as part of a data center move, then you will most likely be stopping these resources prior to moving the equipment.   In that case, you may want to disable the resources after stopping them, to prevent them from re-starting once the machines are brought back up and the Oracle Clusterware stack is started.   You can do this via commands such as:

srvctl disable database -d grid
srvctl disable asm -n node1
srvctl disable nodeapps -n node1
etc.



5. Verify that the VIP is no longer running by executing the 'ifconfig -a' or 'ipconfig /all' command again, and confirm that the IP address is no longer listed as running in the output.

If the interface still shows as online, this may be an indication that a resource which is dependent on the VIP is still running. The crs_stat command can help to show resources that are still online.

6. Make any changes necessary to all nodes' /etc/hosts files (on Unix/Linux), or the
\WINDOWS\System32\drivers\etc\hosts file (on Windows) and/or make the necessary
DNS changes, to associate the new IP address with the old hostname.

Syntax for modifying nodeapps


6. To make the actual modification to the nodeapps, the Oracle Clusterware stack must be up on the node where you are running srvctl from.   To modify the nodeapps  use the 'srvctl modify nodeapps' command with the following syntax:

srvctl modify nodeapps -n <node_name> [-o <oracle_home>] [-A <new_vip_address>]

Options Description:
-n <node_name> Node name.
-o <oracle_home> Oracle home for the cluster database.
-A <new_vip_address> The node level VIP address (<name|ip>/netmask[/if1[|if2|...]]).

As noted previously, any of the above parameters can be changed from their original values  (though it is unlikely that the ORACLE_HOME would change), provided that the match the expected characteristics. 

So - for example, be sure that the interface name specified is the correct name as seen from the OS (refer to Note 283684.1 ), be sure that the subnet mask used for the VIP matches the subnet mask used for the actual public IP addresses, and that the VIP hostname is correctly registered in DNS and/or the hosts file.   An example of the 'modify nodeapps' command is as follows:

$ srvctl modify nodeapps -n node1 -A 192.168.2.125/255.255.255.0/eth0

It should be noted that for the first parameter, you can specify either the hostname associated with the VIP, or the IP address associated with the VIP.    Either way, the srvctl command will actually attempt to resolve the IP to a hostname, or the hostname to an IP, and it will store both entries in the OCR.  So, assuming that the virtual hostname of 'node1-v'  resolves to an IP address 192.168.2.125, the below command would have the same effect as the command using the IP address:

$ srvctl modify nodeapps -n node1 -A  node1-v/255.255.255.0/eth0
Note that the interface names are case senstive on all platforms.  On some platforms, such as Windows, the Interface Name may have spaces in it - i.e. "Local Area Connection 1".   If that is the case, you must enclose the interface name in double quotes - i.e.

srvctl modify nodeapps -n node1 -A 192.168.2.125/255.255.255.0/"Local Area Connection 1"

On Unix and Linux systems, this command should be run as root. Attempting to run this command
as the 'oracle' user or software owner will result in the following error:

PRKO-2117 : This command should be executed as the system privilege user.

On Windows systems, this command should be run as the user who did the original installation.   This account should be an account with Local Administrator privileges on each node.

7.  After making the change, you should verify that it is correct by re-running

'srvctl config nodeapps -n <nodename> -a'

Double-check the output to confirm that all parameters are correct. 

Starting Resources Back Up


7. Once the modify nodeapps has been executed, you can re-start node-level applications via srvctl with the following syntax:

srvctl start nodeapps -n <node_name>
i.e.:

$ srvctl start nodeapps -n rnode1


If any resources (such as database or ASM) were previously disabled, then they should now be re-enabled and re-started as well.



Repeat the same steps for all the nodes in the cluster.  Since SRVCTL is a cluster wide management tool, you can accomplish these tasks for any specific nodes from one node, without the need to login individually to each of the cluster nodes.

Note: If only the IP address is changed, it should not be necessary to make changes to the LISTENER.ORA and TNSNAMES.ORA, provided they are using the vip hostnames for
the 'HOST=' entries.

If changing both the hostname and the VIP for a node, it will be necessary to modify the LISTENER.ORA and change the 'HOST=' entries to the new VIP hostname. This can be done manually, or by using the NETCA to reconfigure the listener. In addition, changes may need to be made to the TNSNAMES.ORA of any clients connecting to the old HOSTNAME.


In addition to modifying the nodeapps after an IP address or network change of some type, it may also be necessary to modify the networks that are stored in the OCR.   If that is the case, please refer to the following note:

Note 283684.1 How to Change Interconnect/Public Interface IP Subnet in a 10g Cluster

For complete srvctl syntax on 10gR1, Refer to Appendix B of the RAC Admin Guide:
http://download-west.oracle.com/docs/cd/B13789_01/rac.101/b10765/toc.htm

For complete srvctl syntax on 10gR2, Refer to Appendix E of the RAC Admin Guide:
http://download-west.oracle.com/docs/cd/B19306_01/rac.102/b14197/toc.htm

반응형

'ORACLE > RAC' 카테고리의 다른 글

클러스터의 시작 및 종료  (0) 2008.12.23
10gR2 RAC Oracle 설치관련 명령어 모음  (0) 2008.12.12
OCR, Voting disk 다른 스토리지로 이관  (0) 2008.08.12
RAC Option Remove  (0) 2008.07.30
CRS 와 10G REAL APPLICATION CLUSTERS  (0) 2008.06.05
Posted by [PineTree]
ORACLE/RAC2008. 8. 12. 18:57
반응형

지지난 주에 제가 작업 했던 내용 기술합니다.

 

사용하던 스토리지 교체로 ocr 과 voting disk 를 새로운 스토리지로 이관하는 내용입니다.

 

작업 하기 전에 준비되어야 하는 것은 기존 스토리지와 새로운 스토리지 모두 서버에서 바라 볼수 있어야 합니다.

 

이 작업은 하드웨어 엔지니어분께 얘기하면 알아서 해주실 겁니다.

 

기존 스토리지의 볼륨 그룹은 rac1 이고 새로운 스토리지의 볼륨 그룹은 rac2 입니다.

 

ocr은 replace 하고, voting 은 add 하고 delete 합니다.

 

작업 하시기 전 불의의 사고(?) 에 대비해 ocr 과 voting disk 모두 백업 하시고요,

 

저는 이런식으로 했는데 상황에 따라 다른 여러가지 방법이 존재할 수 있을 겁니다.

 

note 428681.1 를 참고 했으며, 꼭 읽어 본 후 작업 하세요.

 

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

모든 작업은 root 계정으로 한다.

OCR 은 crs 가 start 상태에서 작업하며, voting disk 는 crs 가 down 상태에서 한다.

 

1. OCR 현재 상태 확인

[db1:/oramedia/patch/6455161] su - root
Password:
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
cdSourcing //.profile-EIS.....
root@db1 # cd $ORA_CRS_HOME
root@db1 # cd bin
root@db1 # ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     524044
         Used space (kbytes)      :       4100
         Available space (kbytes) :     519944
         ID                       : 1967014107
         Device/File Name         : /dev/md/rac1/rdsk/d201
                                    Device/File integrity check succeeded
         Device/File Name         : /dev/md/rac1/rdsk/d202
                                    Device/File integrity check succeeded

         Cluster registry integrity check succeeded

 

2. OCR 다른 스토리지로 이관
root@db1 # ocrconfig -replace ocr /dev/md/rac2/rdsk/d201
root@db1 # ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     524044
         Used space (kbytes)      :       4100
         Available space (kbytes) :     519944
         ID                       : 1967014107
         Device/File Name         : /dev/md/rac2/rdsk/d201
                                    Device/File integrity check succeeded
         Device/File Name         : /dev/md/rac1/rdsk/d202
                                    Device/File integrity check succeeded

         Cluster registry integrity check succeeded

root@db1 # ocrconfig -replace ocrmirror /dev/md/rac2/rdsk/d202
root@db1 # ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          2
         Total space (kbytes)     :     524044
         Used space (kbytes)      :       4100
         Available space (kbytes) :     519944
         ID                       : 1967014107
         Device/File Name         : /dev/md/rac2/rdsk/d201
                                    Device/File integrity check succeeded
         Device/File Name         : /dev/md/rac2/rdsk/d202
                                    Device/File integrity check succeeded

         Cluster registry integrity check succeeded

 

3. voting disk 현재 상태 확인

root@db1 # crsctl query css votedisk
 0.     0    /dev/md/rac1/rdsk/d203
 1.     0    /dev/md/rac1/rdsk/d204
 2.     0    /dev/md/rac1/rdsk/d205

located 3 votedisk(s).
root@db1 # crsctl add css votedisk /dev/md/rac2/rdsk/d203
Cluster is not in a ready state for online disk addition <= 온라인 상태라 등록이 안된다.

 

4. crs 중지 (모든 노드)

root@db1 # crsctl stop crs
Stopping resources. This could take several minutes.
Successfully stopped CRS resources.
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.

 

5. voting disk 추가 및 기존 디스크 제거

root@db1 # crsctl add css votedisk /dev/md/rac2/rdsk/d203 -force
Now formatting voting disk: /dev/md/rac2/rdsk/d203
successful addition of votedisk /dev/md/rac2/rdsk/d203.
root@db1 # crsctl delete css votedisk /dev/md/rac1/rdsk/d203 -force
successful deletion of votedisk /dev/md/rac1/rdsk/d203.
root@db1 # crsctl add css votedisk /dev/md/rac2/rdsk/d204 -force
Now formatting voting disk: /dev/md/rac2/rdsk/d204
successful addition of votedisk /dev/md/rac2/rdsk/d204.
root@db1 # crsctl delete css votedisk /dev/md/rac1/rdsk/d204 -force
successful deletion of votedisk /dev/md/rac1/rdsk/d204.
root@db1 # crsctl add css votedisk /dev/md/rac2/rdsk/d205 -force
Now formatting voting disk: /dev/md/rac2/rdsk/d205
successful addition of votedisk /dev/md/rac2/rdsk/d205.
root@db1 # crsctl delete css votedisk /dev/md/rac1/rdsk/d205 -force
successful deletion of votedisk /dev/md/rac1/rdsk/d205.

 

6. crs 스타트 (모든 노드)
root@db1 # crsctl start crs
Attempting to start CRS stack
The CRS stack will be started shortly

 

7. voting disk 확인

root@db2 # crsctl query css votedisk
 0.     0    /dev/md/rac2/rdsk/d204
 1.     0    /dev/md/rac2/rdsk/d205
 2.     0    /dev/md/rac2/rdsk/d203

located 3 votedisk(s).

 

8. ocr.loc 파일에서 ocr 경로 확인

root@db2 # cat /var/opt/oracle/ocr.loc
#Device/file /dev/md/rac1/rdsk/d202 getting replaced by device /dev/md/rac2/rdsk/d202
ocrconfig_loc=/dev/md/rac2/rdsk/d201
ocrmirrorconfig_loc=/dev/md/rac2/rdsk/d202

반응형
Posted by [PineTree]
ORACLE/RAC2008. 7. 30. 19:47
반응형

297. RAC Option Remove
     1. Login as the Oracle software owner and shutdown all database instances on all nodes in the cluster.
     2. cd $ORACLE_HOME/rdbms/lib
     3. make -f ins_rdbms.mk rac_off
        If this step did not fail with fatal errors, proceed to step 4.
     4. make -f ins_rdbms.mk ioracle

 

     RAC to Single DB 과정으로는
     1. hot backup 을 restore 하신 다음
     2. 양쪽 node 의 archive log file 을 위치하신 다음.
     3. init file 에서 rac 관련 parameter 를 제거
     4. incomplete recovery (using backup controlfile)
     5. alter database open resetlogs
     6. alter database disable thread 2
     7. drop redo of thread 2.


반응형
Posted by [PineTree]
ORACLE/RAC2008. 6. 5. 19:41
반응형
CRS 와 10G REAL APPLICATION CLUSTERS
===================================



PURPOSE
-------
이 문서는, 10g Real Application Cluster의 CRS (Cluster Ready Services)에 대한 추가적인
정보를 제공하는 것을 목적으로 한다.


Explanation
-----------
1. CRS 와 10g REAL APPLICATION CLUSTERS

CRS (Cluster Ready Services)는 10g Real Application Cluster의 새로운 기능으로,
모든 플랫폼에 대해 표준화된 클러스터 인터페이스를 제공 해 주고, 이전 버전에서는 없었던
새로운 고가용 서비스를 제공해 준다.


2. CRS 핵심 기능

CRS와 10g RAC를 설치하기 전에, CRS및 10g RAC에 대해 사전에 알아 두어야 할 사항이 있다 :

- 10g RAC를 설치를 위해서는 CRS는 사전에 설치 되고 실행되어야 한다.

- CRS는 하드웨어 공급 업체에서 제공하는 클러스터 제품 (예 : Sun Cluster,
HP Serviceguard, IBM HACMP, TruCluster, Veritas Cluster, Fujitsu Primecluster,
기타 ...) 위에서 실행 될 수도 있고, 하드웨어 공급 업체에서 제공하는 클러스터 제품
없이도 실행될 수 있다. 하드웨어 업체에서 공급하는 클러스터 제품은 9i RAC까지는 반드시
필요했지만, 10g RAC에서는 선택 사항이다.

- CRS HOME 과 ORACLE_HOME 은 반드시 다른 디렉토리에 설치 되어야 한다.

- CRS를 설치하기 전에, voting 파일 또는 OCR (Oracle Configuration Repository) 파일을
설치 할 수 있는 공유된 디렉토리 또는 디바이스가 셋업되어야 한다. voting file은 최소 20MB 정도
크기이며, OCR 파일은, 최소 100MB 크기가 되어야 한다.

- CRS 및 RAC를 설치하기 위해서는 다음과 같은 네트워크 인터페이스가 구성되어야 한다 :
- Public Interface
- Private Interface
- Virtual (Public) Interface
관련된 추가적인 정보는 <Bulletin No: 22345> 참조.

- CRS 설치 후 root.sh를 실행시키면 CRS 서비스를 구동시킨다. 만약 CRS가 정상적으로
구동되지 않는다면, Note 240001.1 참조.

- RAC 노드당 1개의 CRS 데모만 실행 가능.

- 유닉스 시스템의 경우, CRS 서비스는 /etc/inittab 상의 ‘respawn’ entry로 등록되어 있다.

- 네트워크 split이 있을 경우 (노드간 통신 두절) data corruption을 방지 하기 위해 하나
또는 그 이상의 노드에서 리부팅이 발생할 수 있다.

- CRS 서비스를 구동시키는 올바른 방법은 장비를 부팅시키는 것이다.

- 서비스를 중단시키는 올바른 방법은, 장비를 shutdown 시키거나, "init.crs stop" 명령을
실행시키는 것이다.

- CRS 데몬을 kill 시키는 것은 올바른 방법이 아니며, 오직 설치된 CRS를 제거한 경우에만
적용해도 되는 방법이다. (Bulletin No: 22343 참조) 이것은 , 플래그 파일에 불일치가 발생 할
수 있기 때문이다.

- 시스템 유지 보수를 위해서는, OS를 단일 사용자 모드 (single user mode)로 전환한다.

서비스 스택이 구동되면, ps -ef 명령으로 관련된 데몬 프로세스를 확인 할 수 있다 :

[rac1]/u01/home/beta> ps -ef | grep crs

oracle 1363 999 0 11:23:21 ? 0:00 /u01/crs_home/bin/evmlogger.bin -o /u01
oracle 999 1 0 11:21:39 ? 0:01 /u01/crs_home/bin/evmd.bin
root 1003 1 0 11:21:39 ? 0:01 /u01/crs_home/bin/crsd.bin
oracle 1002 1 0 11:21:39 ? 0:01 /u01/crs_home/bin/ocssd.bin


3. CRS DAEMON 기능

다음은 각각의 CRS 데몬 프로세스에 대한 간략한 설명이다 :

CRSD:
- HA 작업을 위한 엔진
- '애플리케이션 자원'관리
- '애플리케이션 자원'을 구동, 정지, fail over 처리
- 애플리케이션 자원 구동/정지/점검 하기 위한 별도의 'actions'을 spawn
- OCR(Oracle Configuration Repository)의 구성 프로파일 관리
- OCR의 현재 알려진 상태를 저장
- root 권한으로 실행
- 장애 발생시 자동으로 재 구동됨

OCSSD:
- OCSSD는 RAC의 일부로, ASM과 함께 단일 인스턴스를 구성함
- 노드 멤버쉽에 대한 액세스를 제공
- 그룹 서비스 제공
- 기본적인 클러스터 lock 기능 제공
- 하드웨어 공급 업체에서 제공하는 클러스터 소프트웨어가 설치되어 있을 경우, 통합을 실시
- 하드웨어 공급 업체에서 제공하는 클러스터 소프트웨어 없이도 실행 가능
- 오라클 계정으로 실행
- 장애로 인한 종료시 시스템 리부팅됨
--- 리부팅은 split brain 현상 발생시, 데이터 corruption 방지를 목적으로 함.

EVMD:
- 특정한 사건 발생 시 이벤트 생성
- 자식 프로세스로 evmlogger를 spawn 시킴
- Evmlogger는 필요시 자식 프로세스를 spawn 시킴
- callout directory를 스캔하고 callout을 호출
- 오라클 계정으로 실행.
- 장애로 인한 종료시 자동으로 재 구동됨


4. CRS 로그 디렉토리

CRS 문제의 원인을 추적할 때는, CRS 홈 디렉토리 아래 디렉토리를 살펴보는 것이
중요하다.

$ORA_CRS_HOME/crs/log - 이 디렉토리는, CRS 자원들에 대한 트레이스를 포함하며,
CRS에 의해 식별된 가입(joining), 탈퇴(leaving), 재구동(restarting), 재배치(relocating)와
관련된 정보들이 기록된다.

$ORA_CRS_HOME/crs/init - crsd.bin 데몬과 관련된 모든 core dump가 기록된다.

$ORA_CRS_HOME/css/log - css 로그는, 재구성(reconfiguration)이나, 성공하지
못한 체크인 (missed checkin), 클라이언트의 css listener로 부터 발생한 연결(connect) 및
연결해제(disconnect)와 관련된 모든 액션을 기록한다. 때에 따라서는 로거에서는 (auth.crit)
유형의 메시지를 남기는데 이것은 오라클에 의해 리부팅이 발생할 때 남는다. 이 정보는
리부팅이 정확히 언제 발생했는지를 확인하는데 사용될 수 있다.

$ORA_CRS_HOME/css/init - 기본적으로는 ocssd로 부터의 core dump 파일을 저장하며, 프로세스의
종료가 심각한 문제로 간주되는 css 데몬의 pid 정보 또한 기록된다. css의 비정상 재 구동이 발생할
경우, core 파일은, core.<pid> 형태로 기록된다.

$ORA_CRS_HOME/evm/log - evn과 evmlogger 데몬의 로그 파일이 기록된다. CRS 또는 CSS 관련 디렉토리
처럼 디버깅 용도로 자주 사용되지는 않는다.

$ORA_CRS_HOME/evm/init - EVM의 pid와 lock 파일이 저장된다. EVM으로 부터 발생한 core 파일 또한
이 디렉토리에 저장된다. 디버깅을 위해서는 Note 1812.1 참조.

$ORA_CRS_HOME/srvm/log - OCR을 위한 로그 파일.


5. CRS 자원의 상태

RAC를 설치하고, RAC root.sh을 실행시키면 VIPCA (Virtual IP Configuration Assistant)가
구동된다. crs_stat 명령을 이용하여 모든 CRS 자원을 확인할 수 있다. 예 :

cd $ORA_CRS_HOME/bin
./crs_stat

NAME=ora.rac1.gsd
TYPE=application
TARGET=ONLINE
STATE=ONLINE

NAME=ora.rac1.oem
TYPE=application
TARGET=ONLINE
STATE=ONLINE

NAME=ora.rac1.ons
TYPE=application
TARGET=ONLINE
STATE=ONLINE

NAME=ora.rac1.vip
TYPE=application
TARGET=ONLINE
STATE=ONLINE

NAME=ora.rac2.gsd
TYPE=application
TARGET=ONLINE
STATE=ONLINE

NAME=ora.rac2.oem
TYPE=application
TARGET=ONLINE
STATE=ONLINE

NAME=ora.rac2.ons
TYPE=application
TARGET=ONLINE
STATE=ONLINE

NAME=ora.rac2.vip
TYPE=application
TARGET=ONLINE
STATE=ONLINE

CRS 자원을 읽기 쉬운 형태로 확인하기 위한 스크립트 또한 사용할 수 있다.
다음은 shell script의 예이다 :

--------------------------- Begin Shell Script -------------------------------

#!/usr/bin/ksh
#
# Sample 10g CRS resource status query script
#
# Description:
# - Returns formatted version of crs_stat -t, in tabular
# format, with the complete rsc names and filtering keywords
# - The argument, $RSC_KEY, is optional and if passed to the script, will
# limit the output to HA resources whose names match $RSC_KEY.
# Requirements:
# - $ORA_CRS_HOME should be set in your environment

RSC_KEY=$1
QSTAT=-u
AWK=/usr/xpg4/bin/awk # if not available use /usr/bin/awk

# Table header:echo ""
$AWK \
'BEGIN {printf "%-45s %-10s %-18s\n", "HA Resource", "Target", "State";
printf "%-45s %-10s %-18s\n", "-----------", "------", "-----";}'

# Table body:
$ORA_CRS_HOME/bin/crs_stat $QSTAT | $AWK \
'BEGIN { FS="="; state = 0; }
$1~/NAME/ && $2~/'$RSC_KEY'/ {appname = $2; state=1};
state == 0 {next;}
$1~/TARGET/ && state == 1 {apptarget = $2; state=2;}
$1~/STATE/ && state == 2 {appstate = $2; state=3;}
state == 3 {printf "%-45s %-10s %-18s\n", appname, apptarget, appstate; state=0;}'

--------------------------- End Shell Script -------------------------------

실행 결과 예시 :

[opcbsol1]/u01/home/usupport> ./crsstat
HA Resource Target State
----------- ------ -----
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



6. CRS 자원 관리

자원을 관리하기 위해서는, srvctl 명령을 사용한다. 다음은 명령어 문법 예제이다.


1) CRS 자원 상태

srvctl status database -d <database-name> [-f] [-v] [-S <level>]
srvctl status instance -d <database-name> -i <instance-name> >[,<instance-name-list>]
[-f] [-v] [-S <level>]
srvctl status service -d <database-name> -s <service-name>[,<service-name-list>]
[-f] [-v] [-S <level>]
srvctl status nodeapps [-n <node-name>]
srvctl status asm -n <node_name>

예제:

데이터베이스의 상태, 모든 인스턴스와 모든 서비스
srvctl status database -d ORACLE -v
이름이 부여된 인스턴스의 상태와 현재 서비스
srvctl status instance -d ORACLE -i RAC01, RAC02 -v
이름이 부여된 서비스의 상태.
srvctl status service -d ORACLE -s ERP -v
데이터베이스 애플리케이션을 지원하는 모든 노드의 상태.
srvctl status node


2) CRS 자원의 구동

srvctl start database -d <database-name> [-o < start-options>]
[-c <connect-string> | -q]
srvctl start instance -d <database-name> -i <instance-name>
[,<instance-name-list>] [-o <start-options>] [-c <connect-string> | -q]
srvctl start service -d <database-name> [-s <service-name>[,<service-name-list>]]
[-i <instance-name>] [-o <start-options>] [-c <connect-string> | -q]
srvctl start nodeapps -n <node-name>
srvctl start asm -n <node_name> [-i <asm_inst_name>] [-o <start_options>]

예제:

데이터베이스를 모든 활성화된 인스턴스와 함께 구동.
srvctl start database -d ORACLE
이름이 부여된 인스턴스의 구동.
srvctl start instance -d ORACLE -i RAC03, RAC04
이름이 부여된 서비스의 구동. 연관된 인스턴스는 필요시 구동됨.
srvctl start service -d ORACLE -s CRM
이름이 부여된 인스턴스의 서비스의 구동.
srvctl start service -d ORACLE -s CRM -i RAC04
노드 애플리케이션의 구동.
srvctl start nodeapps -n myclust-4



3) CRS 자원의 정지

srvctl stop database -d <database-name> [-o <stop-options>]
[-c <connect-string> | -q]
srvctl stop instance -d <database-name> -i <instance-name> [,<instance-name-list>]
[-o <stop-options>][-c <connect-string> | -q]
srvctl stop service -d <database-name> [-s <service-name>[,<service-name-list>]]
[-i <instance-name>][-c <connect-string> | -q] [-f]
srvctl stop nodeapps -n <node-name>
srvctl stop asm -n <node_name> [-i <asm_inst_name>] [-o <start_options>]

예제:

데이터베이스, 모든 인스턴스, 모든 서비스를 정지 시킴.
srvctl stop database -d ORACLE
이름이 부여된 인스턴스를 정지 시킴. 그 전에 우선 존재하는 모든 서비스를 재배치 함.
srvctl stop instance -d ORACLE -i RAC03,RAC04
서비스를 정지시킴.
srvctl stop service -d ORACLE -s CRM
이름이 부여된 인스턴스의 서비스를 정지 시킴.
srvctl stop service -d ORACLE -s CRM -i RAC04
노드 애플리케이션을 정지 시킴. 인스턴스와 서비스 역시 정지됨.
srvctl stop nodeapps -n myclust-4


4) CRS 자원의 추가

srvctl add database -d <name> -o <oracle_home> [-m <domain_name>] [-p <spfile>]
[-A <name|ip>/netmask] [-r {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY}]
[-s <start_options>] [-n <db_name>]
srvctl add instance -d <name> -i <inst_name> -n <node_name>
srvctl add service -d <name> -s <service_name> -r <preferred_list>
[-a <available_list>] [-P <TAF_policy>] [-u]
srvctl add nodeapps -n <node_name> -o <oracle_home>
[-A <name|ip>/netmask[/if1[|if2|...]]]
srvctl add asm -n <node_name> -i <asm_inst_name> -o <oracle_home>

OPTIONS:

-A vip range, node, and database, address specification. The format of
address string is:
[<logical host name>]/<VIP address>/<net mask>[/<host interface1[ |
host interface2 |..]>] [,] [<logical host name>]/<VIP address>/<net mask>
[/<host interface1[ | host interface2 |..]>]
-a for services, list of available instances, this list cannot include
preferred instances
-m domain name with the format “us.mydomain.com”
-n node name that will support one or more instances
-o $ORACLE_HOME to locate Oracle binaries
-P for services, TAF preconnect policy - NONE, PRECONNECT
-r for services, list of preferred instances, this list cannot include
available instances.
-s spfile name
-u updates the preferred or available list for the service to support the
specified instance. Only one instance may be specified with the -u
switch. Instances that already support the service should not be
included.

예제:

새로운 노드의 추가.
srvctl add nodeapps -n myclust-1 -o $ORACLE_HOME ?A
139.184.201.1/255.255.255.0/hme0
새로운 데이터 베이스의 추가.
srvctl add database -d ORACLE -o $ORACLE_HOME
이미 존제하는 데이터베이스에 이름이 부여된 인스턴스 추가.
srvctl add instance -d ORACLE -i RAC01 -n myclust-1
srvctl add instance -d ORACLE -i RAC02 -n myclust-2
srvctl add instance -d ORACLE -i RAC03 -n myclust-3
서비스를 이미 존재하는 데이터베이스에 추가하며, 선호되는 인스턴스를 지정 (-r)하고,
가용한 인스턴스를 지정함(-a). 가용 인스턴스에 대해서는 기본 failover를 사용함.
srvctl add service -d ORACLE -s STD_BATCH -r RAC01,RAC02 -a RAC03,RAC04
이미 존재하는 데이터베이스에 선호되는 인스턴스를 list 1, 가용한 인스턴스를 list 2에
추가함. 가용 인스턴스에 대해서는 사전연결 (preconnect) 방식을 사용함.
srvctl add service -d ORACLE -s STD_BATCH -r RAC01,RAC02 -a RAC03,RAC04 -P PRECONNECT


5) CRS RE자원의 제거

srvctl remove database -d <database-name>
srvctl remove instance -d <database-name> [-i <instance-name>]
srvctl remove service -d <database-name> -s <service-name> [-i <instance-name>]
srvctl remove nodeapps -n <node-name>

예제:

데이터베이스에 대한 애플리케이션의 제거.
srvctl remove database -d ORACLE
이미 존재하는 데이터베이스의 이름이 부여된 인스턴스에 대한 애플리케이션 제거.
srvctl remove instance -d ORACLE -i RAC03
srvctl remove instance -d ORACLE -i RAC04
서비스 제거.
srvctl remove service -d ORACLE -s STD_BATCH
인스턴스로부터 서비스 제거.
srvctl remove service -d ORACLE -s STD_BATCH -i RAC03,RAC04
노드로 부터 모든 노드 애플리케이션 제거.
srvctl remove nodeapps -n myclust-4


6) CRS 자원의 변경

srvctl modify database -d <name> [-n <db_name] [-o ><ohome>] [-m <domain>]
[-p <spfile>] [-r {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY}]
[-s <start_options>]
srvctl modify instance -d <database-name> -i <instance-name> -n <node-name>
srvctl modify instance -d <name> -i <inst_name> {-s <asm_inst_name> | -r}
srvctl modify service -d <database-name> -s <service_name> -i <instance-name>
-t <instance-name> [-f]
srvctl modify service -d <database-name> -s <service_name> -i <instance-name>
-r [-f]
srvctl modify nodeapps -n <node-name> [-A <address-description> ] [-x]

OPTIONS:

-i <instance-name> -t <instance-name> the instance name (-i) is replaced by the
instance name (-t)
-i <instance-name> -r the named instance is modified to be a preferred instance
-A address-list for VIP application, at node level
-s <asm_inst_name> add or remove ASM dependency

예제:

인스턴스가 다른 노드에서 실행되도록 변경.
srvctl moinstance -d ORACLE -n myclust-4
서비스가 다른 노드에서 실행되도록 변경.
srvctl modify service -d ORACLE -s HOT_BATCH -i RAC01 -t RAC02
인스턴스가 서비스의 선호되는 인스턴스가 되도록 변경.
srvctl modify service -d ORACLE -s HOT_BATCH -i RAC02 ?r


7) SERVICE의 재 배치

srvctl relocate service -d <database-name> -s <service-name> [-i <instance-name >]-t<instance-name > [-f]

예제:

서비스를 한 인스턴스에서 다른 인스턴스로 재 배치
srvctl relocate service -d ORACLE -s CRM -i RAC04 -t RAC01



8) CRS 자원을 활성화 (자원은 이 기능을 사용할 당시 실행중이거나, 정지된 상태일 수 있음)

srvctl enable database -d <database-name>
srvctl enable instance -d <database-name> -i <instance-name> [,<instance-name-list>]
srvctl enable service -d <database-name> -s <service-name>] [, <service-name-list>] [-i <instance-name>]

예제:

데이터베이스를 활성화.
srvctl enable database -d ORACLE
이름이 부여된 인스턴스의 활성화.
srvctl enable instance -d ORACLE -i RAC01, RAC02
서비스의 활성화.
srvctl enable service -d ORACLE -s ERP,CRM
이름이 부여된 인스턴스에서 서비스의 활성화.
srvctl enable service -d ORACLE -s CRM -i RAC03


9) CRS 자원의 비활성화 (자원은 이 기능을 사용할 당시 정지된 상태 이어야만 함)

srvctl disable database -d <database-name>
srvctl disable instance -d <database-name> -i <instance-name> [,<instance-name-list>]
srvctl disable service -d <database-name> -s <service-name>] [,<service-name-list>] [-i <instance-name>]

예제:

데이터베이스를 전역(global) 비활성화 시킴.
srvctl disable database -d ORACLE
이름이 부여된 인스턴스의 비활성화.
srvctl disable instance -d ORACLE -i RAC01, RAC02
서비스를 전역(global) 비활성화.
srvctl disable service -d ORACLE -s ERP,CRM
이름이 부여된 인스턴스상의 서비스를 비 활성화.
srvctl disable service -d ORACLE -s CRM -i RAC03,RAC04



추가 정보는 Oracle10g Real Application Clusters Administrator's Guide - Appendix B 참조


Example
-------


Reference Documents
-------------------
<Note:259301.1> CRS and 10g Real Application Clusters
반응형
Posted by [PineTree]
ORACLE/RAC2007. 6. 25. 03:59
반응형

[RAC] 100% 무정지를 향한 아름다운 도전

김형일

Real Application Cluster, 그 어렵다던 RAC을 정복하기 위해 여행을 떠나 보자. 사실 어렵지 않다. 단지 100% 무정지를 구현하기가 어려울 뿐이다. 연금술사들이 금을 만들기 위해 부단한 노력을 했던 것처럼 100% 무정지를 위해 필수불가결한 RAC에 대한 여행을 시작해 보겠다.

사실 ‘전문가와 떠나는 30일간의 여행’의 진행을 요청받았을 때 가볍게 생각한 것은 사실이다. 일반적인 Q&A를 하는 것처럼 글을 쓰면 되겠구나 했는데 그것이 아니었다. 처음 송정훈씨를 만나며 느낀 것은 걱정스러움이었다. 현재 송정훈씨는 OPS 및 RAC을 운영하고 있으니 최전방에서 전투를 벌이고 있는 예봉을 겸비한 군인처럼 늠름했다. 그래도 주변의 권고로 용기를 내어 그동안 경험을 바탕으로 여행을 함께 떠나기로 했다.
송정훈씨가 주로 알고 싶어하는 것은 운영시의 RAC에 대한 진단과 튜닝 그리고 구축 방법과 TAF, CTF 등이었다. 업무 자체가 OPS와 RAC을 운영하고 있으므로 시스템의 헬스 체크, 그리고 문제 발생시의 해결 방안에 대해 궁금해 했다. 이에 다음과 같은 코스로 여행을 했다.

1. RAC의 개념과 구축 방법, 업무 분산 설계
2. RAC 운영
3. RAC의 진단 및 개선 활동
4. TAF, CTF 그리고 로드밸런스

자! 그럼 여행을 떠나보도록 하자. 우선 본격적인 RAC 진단과 개선을 시작하기에 앞서 RAC의 개념, 구축 방법, 그리고 업무 분산 설계에 대해 알아보겠다.

RAC이란 무엇인가?

오라클에서는 100% 무정지를 구축하고자 하는 고객의 요구에 따라 오라클7부터 OPS (Oracle Parallel Server)를 지원했으며 오라클8, 오라클8i로 발전하여 오라클9i에서는 각 노드간 캐시의 일치성을 보장하기 위한 서버간의 통신 방식을 디스크를 이용한 방식에서 초고속 인터커넥트를 이용한 캐시 퓨전(Cache Fusion)으로 변경하면서 획기적인 발전을 가져왔다. 결국 현재 오라클10g에서 그리드 컴퓨팅을 지원하는 더욱 발전된 RAC이 출시되어 100% 가용성을 위한 도전에 좋은 솔루션이 되고 있다. 간단하게 RAC을 설명하면 물리적인 하나의 데이터베이스를 여러 대의 서버가 공유하여 사용하는 것으로, 모든 서버들은 같은 데이터를 사용하게 되어 논리적으로는 하나의 시스템을 이용하는 것이다.

<그림 1> 기본적인 RAC 구조




<그림 2> 4번째 노드를 추가하는 경우




<그림 3> RAC의 캐시 퓨젼

확장이 손쉬운 RAC

RAC의 주요한 특징으로는 확장성을 제공한다는 것이다. 많은 고객들이 용량을 고려하여 시스템을 구축하지만 시간의 흐름에 따라 데이터는 증가하고, 또한 사용자의 새로운 요구사항으로 신규 애플리케이션이 추가되어 시스템의 부하는 점점 커지게 된다. 따라서 하나의 하드웨어에서 최대의 용량으로 증설하더라도 용량 부족 문제가 해결되지 않는 경우가 종종 생긴다. 이렇게 되면 시스템 운영 중에 많은 돈을 투자하여 더욱 큰 시스템을 도입하고, 기존의 운영 중이던 시스템을 신규 시스템으로 이관하는 작업을 하게 된다. 실로 엄청난 비용이 추가된다.
과거 OPS를 사용하는 경우에는 노드간 데이터를 주고받는 핑에 의한 성능의 저하로, OPS의 설계를 잘못했을 경우 1+1=0.7로 되어버리는, 즉 2대의 서버로 구축한 OPS 시스템이 하나의 시스템으로 운영하는 시스템보다 성능이 떨어지는 경우가 있었다. 그래서 어떤 경우에는 한 쪽 노드만을 사용하고, 다른 쪽 노드는 장애 발생시에 Fail-over하기 위한 용도로 사용하는 Hot Standby 시스템으로 운영하기도 했다. 그러나 현재의 RAC(오라클9i, 10g)에서는 이러한 제약사항이 개선되어 일반적으로 하나의 노드로 운영하는 데이터베이스와 마찬가지로 구성해도 별다른 성능 문제가 발생하지 않는다. 과거의 OPS가 1+1=0.7이 되었다면 현재의 RAC은 1+1=1.8 정도의 확장성을 제공한다.

가용성에서 으뜸인 RAC

RAC의 또 다른 특징은 고가용성이다. 하나의 서버로 구성된 데이터베이스인 경우 서버에 돌발 장애가 발생하게 되면 장애에 대한 복구가 완료될 때까지 모든 서비스는 정지해야만 한다. 그러나 RAC의 경우에는 하나의 서버에 장애가 발생하더라도 나머지 서버에서 지속적인 서비스를 제공할 수 있으므로 서비스의 중지는 없다. 또한 RAC의 경우에는 HW의 유지 보수, 패치 적용, 업그레이드를 하는 경우에도 정지 없이 서비스를 제공할 수 있다. 특히 오라클10g에서 개선된 Rolling patch, Rolling upgrade 기능은 서비스의 정지를 최소화시켜 준다.

RAC 구축 방법

다음 여행지는 실제 RAC으로 시스템을 구축할 경우 어떠한 부분에 중점을 두어야 하는지에 대한 것이다. RAC 구축 시에 기술적으로 고려해야 하는 점은 다음과 같다.

RAC 내 공유 오브젝트의 관리

RAC의 특성상 서로 다른 노드에서 동일한 데이터를 동시에 액세스하게 되면 핑이 발생하는데 핑이 과도하게 발생하면 RAC의 특수 구조인 노드간 인터커넥트 부분에 부하가 발생하여 전반적인 시스템의 성능의 저하를 발생한다. 이러한 핑의 발생이 최소화되도록 애플리케이션의 배치와 테이블의 물리적인 구조, 파티셔닝에 신경을 써야 한다. 과거 OPS에서는 이러한 핑 현상을 최소화시키는 것이 성능을 극대화시키는 첫 번째 방법이었다. 예를 들어 다음과 같은 것을 고려해 구축했다.

1. 인스턴스별로 사용하는 오브젝트에 대한 파티션을 나누기
- 공유 테이블 생성시 경합을 최소화하기 위해 extent를 인스턴스별로 할당한다.
- 시퀀스 같이 공유하는 오브젝트의 캐시 값을 증대시킨다.
2. 락의 배분을 조절(init.ora의 gc_files_to_lock, gc_rollback_segments 등)
- 공유 오브젝트를 중점 관리 테이블 스페이스에 집중화하고, 이 테이블 스페이스에 많은 락을 할당한다.
- 조회 위주의 데이터와 전혀 공유하지 않는 데이터(한 노드에서만 사용하는 데이터)에는 락을 최소로 할당한다.
3. 동시에 같은 데이터를 액세스하는 애플리케이션은 한 노드에서 수행하도록 하는 애플리케이션 파티셔닝
- 동일한 애플리케이션은 같은 노드에서 수행하도록 배치한다.
- 업무별로 그룹핑하여 노드간에 경합이 없도록 배치한다.

물론 오라클9i, 10g로 올수록 RAC의 기능이 개선되어 수작업 튜닝이 필요 없어지고 있지만, 만약 애플리케이션의 특성상 많은 핑이 발생하면 이와 같이 업무와 오브젝트를 분산해야 할 것이다.

인스턴스 장애시 복구 요구 시간

가용성을 지원하는 RAC은 돌발 장애시의 복구 요구 시간에 따라 인스턴스의 복구 시간을 만족할 수 있도록 해야 한다. 즉 하나의 노드에 장애가 발생했을 때 얼마나 빠른 시간 내에 서비스를 할 수 있는가에 대한 것이다. 이러한 요구사항을 기반으로 인스턴스 복구 시간을 고려해 구성하게 된다.

애플리케이션 서비스의 자동 복구 요구

돌발 장애시에 만약 사용자가 모르는 사이 복구되기를 원한다면 TAF (Transportation Application Failover)와 CTF(Connection Time Failover) 기능을 사용해야 한다. 그러나 현재의 버전에서 조회를 하는 애플리케이션인 경우에만 TAF의 기능을 이용하여 애플리케이션의 수정 없이 Failover를 구현할 수 있다.
CTF는 장애 발생시 새로 접속하는 사용자가 가용한 노드로 자동으로 접속할 수 있도록 구성하는 것이다. 이와 같이 TAF와 CTF를 통해 돌발 장애시 서비스의 정지 없이 혹은 수초 내에 가용한 노드로 접속을 넘김으로써 시스템의 가용성을 극대화시킬 수 있다.

자원의 효율적인 사용 요구

많은 사용자가 시스템 사용시 모든 노드가 균일하게 사용하도록 하려면 SQL*NET의 로드밸런스 기능을 사용해서 구현해야 한다. 보통의 경우 로드밸런서라는 네트워크 장비를 사용하여 사용자의 부하를 분산시키게 되는데, RAC을 사용하는 경우에는 SQL*NET의 구성만으로 사용자의 접속 수나 CPU의 부하를 계산하여 균일하게 분산시켜 줄 수 있다.

RAC의 진단

질문 : 캐시 퓨전 환경이나 업무 분산이 적절한지를 진단하려면 어떤 것을 살펴보면 되나?

이 부분은 송정훈씨가 가장 알고 싶어하는 것이었다. RAC을 운영하면서 어떤 부분을 점검해야 하는지, 또한 각각의 진단 결과에 따라 조치 사항이 무엇인지에 대해 많은 궁금증을 가지고 있었다. 필자 역시 이번 여행 중에서 가장 중요하게 여긴 부분이 바로 RAC 진단 부분이다.
RAC의 진단은 RAC의 특수 구조에 대한 진단이다. 즉 노드간 연결을 해주는 인터커넥트와 관련된 진단이 주가 된다. 결국 이 인터커넥트의 사용량과 부하를 진단하여 문제점을 해결하는 것이 RAC 진단의 시작과 끝이 된다. 그럼 인터커넥트와 관련된 진단을 어떤 방식으로 해야 하는가를 설명하겠다. 보통의 경우(필자의 경우)에는 다음의 3가지 방식으로 접근한다.

1. 통계치를 이용한 분석
2. RAC에 관련된 대기 정보를 이용한 분석
3. 오브젝트의 핑 정보

우선 통계치를 이용한 분석 방법을 살펴보겠다. 통계치란 데이터베이스가 운영되는 동안에 여러 가지 중요한 값을 저장·기록한 것으로, 이중에는 인터커넥트에 대한 정보들도 포함되어 있다. 이러한 통계치를 이용하여 의미있는 메트릭(Metric)을 만들게 된다. 트랜잭션 수를 통계치라 하면 메트릭은 초당 트랜잭션 수처럼 의미와 기준이 되는 것이다. 이러한 여러 가지 메트릭에는 적절한 기준 값이 있어서 진단 중인 시스템의 메트릭 값에 따라 기준에 적합한지 확인하여 시스템의 안정성을 점검하게 된다.
RAC의 진단에 대표적으로 확인하는 것은 AVG CR BLOCK RECEIVE TIME이다. 이 메트릭의 의미는 한 노드에서 다른 노드로부터 무결성 읽기를 하기 위해 블럭을 받기까지의 응답 시간을 의미하는 것으로 보통의 경우 15ms 이하의 값이 나와야 한다.

select b1.inst_id,
b2.value “CR BLOCKS RECEIVED”, -- 통계치
b1.value “CR BLOCK RECEIVE TIME”, -- 통계치
((b1.value / b2.value) * 10) “AVG CR BLOCK RECEIVE TIME (ms)” -- 메트릭
from gv$sysstat b1, gv$sysstat b2
where b1.name = ‘global cache cr block receive time’
and b2.name = ‘global cache cr blocks received’
and b1.inst_id = b2.inst_id ;

INST_ID CR BLOCKS RECEIVED CR BLOCK RECEIVE TIME AVG CR BLOCK RECEIVE TIME (ms)
------- ------------------ --------------------- ------------------------------
    2        958091        67770        .707344083
    1        1116902        82760        .74097817

만약 15ms보다 높은 값이 나온다면 CPU의 용량이 부족하거나 Long-running SQL이 수행되고 있음을 알 수 있다. Long-running SQL은 많은 데이터 블럭들을 노드 간에 주고받게 되므로 인터커넥트에 부하를 가중하여 시간이 길어지게 된다. 또한 인터커넥트의 대역폭이나 네트워크 관련 파라미터가 정상적으로 구성되어 있는지 확인해 보아야 할 것이다.
다음으로 확인해 보는 것이 글로벌 캐시 락 퍼포먼스(global cache lock performance)이다. 이는 RAC의 캐시에 대한 락을 획득할 때의 응답 시간으로 20~30ms 이하의 값을 가져야 한다. 이 시간은 기존의 락을 획득하는 시간과 더불어 새로운 락을 생성하는 시간도 포함된다.

select b1.inst_id,
(b1.value + b2.value) “GLOBAL LOCK GETS”, -- 통계치
b3.value “GLOBAL LOCK GET TIME”, -- 통계치
(b3.value /(b1.value + b2.value)*10) “AVG GLOBAL LOCK GET TIME (ms)” - 메트릭
from gv$sysstat b1, gv$sysstat b2, gv$sysstat b3
where b1.name = ‘global lock sync gets’
and b2.name = ‘global lock async gets’
and b3.name = ‘global lock get time’
and b1.inst_id = b2.inst_id
and b2.inst_id = b3.inst_id;

INST_ID GLOBAL LOCK GETS GLOBAL LOCK GET TIME AVG GLOBAL LOCK GET TIME (ms)
------- ---------------- -------------------- -----------------------------
    1        185162646        1089892        .058861332
    2        2455830        323333        1.31659358

만약 이 값이 20~30ms보다 크다면 시스템 전체의 대기 이벤트 중 상위 10위에는 ‘WAITING SESSIONS’, ‘PCM LOCK BLOCKERS’, ‘PCM LOCK WAITERS’이 있을 것이다. 이러한 경우는 서로 다른 노드의 애플리케이션에서 동일한 오브젝트의 변경과 조회를 동시에 하게 되는 경우가 많이 발생한다. 물론 양 노드의 시스템에 부하가 많거나 인터커넥트의 네트워크 속도가 느린 경우도 발생하지만 Global Lock Get Time이 지나치게 큰 값이면 애플리케이션 락이 발생하는지 확인하여 해결해야 하며, 또한 노드간의 애플리케이션에서 동일한 오브젝트를 변경하는 애플리케이션끼리 그룹 핑하여 한쪽 노드에서 수행할 수 있도록 한다. 이를 애플리케이션 파티션닝이라고 하는데 각각의 애플리케이션의 크루드 메트릭스(CRUD: Create, Read, Update, Delete) 형태를 파악하여 동일 데이터를 접근하는 애플리케이션은 같은 노드에서 운영되도록 배치해야 한다. 과거의 OPS에서는 OPS 튜닝의 99%가 이러한 오브젝트의 배치와 업무 분산이 가장 중요한 포인트였다.
시스템의 상태와 Waiting을 이용한 분석으로는 v$session_wait이나 v$system_wait의 대기 이벤트를 이용하여 문제되는 부분을 중점적으로 찾아 진단하는 방법이다. 특히 RAC에 관련되는 대기 이벤트로는 ‘global cache cr requests’, ‘buffer busy global CR’, ‘ges inquiry response’ 등이 있다. 대부분 RAC에 관련된 대기 이벤트는 각각의 이벤트에 따른 조치 방법이 매우 다양하므로 오라클 Metalink에서 찾아보기 바란다. 찾는 방식은 http:://metalink. oracle.com의 검색 창에서 표를 붙여서 ‘global cache cr requests’로 찾으면 해결법을 쉽게 찾을 수 있다. 다음은 시스템 내에 현재 어떤 대기 이벤트가 있는가를 확인하는 방법이다.

select sw.inst_id, sw.sid,sw.state,sw.event,sw.seconds_in_wait seconds,sw.p1,
sw.p2,sw.p3,sa.sql_text last_sql
from gv$session_wait sw,gv$session s,gv$sqlarea sa
where sw.event not in (‘rdbms ipc message’, ‘smon timer’, ‘pmon timer’,
‘SQL*Net message from client’, ‘lock manager wait for remote message’,
‘ges remote message’, ‘gcs remote message’,
‘gcs for action’, ‘client message’,’pipe get’,’Null event’, ‘PX Idle Wait’,
‘single-task message’, ‘PX Deq: Execution Msg’,
‘KXFQ: kxfqdeq - normal deqeue’,’listen endpoint status’,
‘slave wait’, ‘wakeup time manager’)
and seconds_in_wait > 0 and (sw.inst_id = s.inst_id and sw.sid = s.sid)
and (s.inst_id = sa.inst_id and s.sql_address = sa.address)
order by seconds desc;

마지막으로 오브젝트의 핑 정보를 이용한 방법이 있다. RAC 환경에서는 핑 오퍼레이션이 많을수록 시스템의 부하는 가중되어 성능이 점차 느려질 수 있다. 그러므로 이러한 핑 현상이 많이 발생하는지 확인하는 진단이 필요하고 만약 많이 발생한다면 적절한 조치를 취해 이를 해소해서 RAC의 성능이 최적화될 수 있도록 해야 한다.
핑의 양이 얼마나 많이 발생하는지 확인하려면 v$lock_activity를 1분의 시간차를 두어 조회한 후 그 값들의 차이가 5000 이상이면 핑이 많이 발생한다고 볼 수 있다. 이러한 경우에 오브젝트에 대한 핑을 조사하여 애플리케이션 파티셔닝을 하면 효과가 있다.

select * from gv$lock_activity;

INST_ID    FROM TO_V ACTION_VAL    COUNTER
------- ---- ---- -------------------------------------------- -------------------
    1 NULL S    Lock buffers for read    27977258
    1 NULL X    Lock buffers for write    2330669
    1 S    NULL Make buffers CR (no write)    27724129
    1 S    X    Upgrade read lock to write    402467
    1 X    NULL Make buffers CR (write dirty buffers)    2448830
    1 X    S    Downgrade write lock to read (write dirty buffers)    249608
    2 NULL S    Lock buffers for read    10765390
    2 NULL X    Lock buffers for write    2259510
    2 S    NULL Make buffers CR (no write)    10684894
    2 S    X Upgrade read lock to write    272618
    2 X    NULL Make buffers CR (write dirty buffers)    2212990
    2 X    S Downgrade write lock to read (write dirty buffers)    275689

시스템 전체에 핑이 많이 발생한다면 어떤 오브젝트에서 많이 발생하는가를 확인한다. 다음은 핑이 발생하는 오브젝트들을 파악하기 위한 SQL이다.

select inst_id, name, kind, file#, status,BLOCKS, READ_PINGS, WRITE_PINGS
from ( select
/*+ rule use_merge(df) */
p.inst_id, p.name, p.kind, p.file#, p.status, count(p.block#) BLOCKS,
sum(p.forced_reads) READ_PINGS, sum(p.forced_writes) WRITE_PINGS
from gv$ping p, gv$datafile df
where p.file# = df.file# (+)
group by p.inst_id, p.name, p.kind, p.file#, p.status
order by sum(p.forced_writes) desc, sum(p.forced_reads) desc)
where rownum < 50
order by WRITE_PINGS desc, READ_PINGS desc;

INST_ID    NAME    KIND    FILE#    STATU    BLOCKS READ_PINGS WRITE_PINGS
--- ---------------------- ------------- ----------- ----- ----------- -----------
1 STATS$SQL_PLAN_USAGE_HV INDEX 73 cr 510 988 0
1 IX_PTTA_N1         INDEX PARTITION 29 xcur 344 880 0
1 STATS$SQL_PLAN_USAGE_HV INDEX 62 cr 460 832 0
2 TB_PTRT         TABLE 14 scur 60 394 0
1 _SYSSMU16$     UNDO 5 cr 8 332 0
1 TB_PTRT         TABLE 14 scur 80 316 0
......

이 결과를 보면 IX_PTTA_N1 인덱스와 TB_PTRT 테이블에 Read 핑이 많이 발생하는 것을 알 수 있다. 그러므로 이 IX_PTTA_N1 인덱스와 TB_PTRT 테이블이 모든 노드에서 동시에 변경과 조회를 하므로 이 오브젝트를 사용하는 애플리케이션을 확인하여 가능하면 한쪽 노드에서 수행할 수 있도록 조정하면 효과를 볼 수 있다. 하지만 만약 인터커넥트에 별다른 부하가 없고 핑의 발생이 앞과 같이 그다지 많이 발생하지 않을 경우에는 특별한 조치를 하지 않아도 된다.
참고로 다음은 False 핑을 조회하는 방법이다. False 핑은 반드시 핑이 발생하지 않아도 되는데, RAC의 락 분배 방식에 따라 하나의 락에서 여러 개의 블럭을 관할하게 되어 실제로 필요한 블럭은 변경이 없는데도 불구하고 다른 블럭의 변경에 의해 락의 오너십을 넘겨주는 것을 False 핑이라 한다.

select inst_id, name, kind, file#, status, BLOCKS, READ_PINGS, WRITE_PINGS
from (
select /*+ rule use_merge(df) */
p.inst_id, p.name, p.kind, p.file#, p.status, count(p.block#) BLOCKS,
sum(p.forced_reads) READ_PINGS, sum(p.forced_writes) WRITE_PINGS
from gv$false_ping p, gv$datafile df
where p.file# = df.file# (+)
group by p.inst_id, p.name, p.kind, p.file#, p.status
order by sum(p.forced_writes) desc, sum(p.forced_reads) desc)
where rownum < 51
order by WRITE_PINGS desc, READ_PINGS desc;

INST_ID NAME KIND FILE# STATU BLOCKS READ_PINGS WRITE_PINGS
---- -------------------- ---------- -------- ----- -------- ---------- -----------
1 _SYSSMU16$ UNDO 5 cr 8 332 0
1 _SYSSMU20$ UNDO 5 cr 6 264 0
1 _SYSSMU13$ UNDO 5 cr 4 114 0
2 TB_PTRT TABLE 14 pi 4 102 0
......

만약 False 핑이 과도하게 발생하는 경우, 오라클9i 이전의 OPS에서 해결한 방식과 동일하게 읽기전용 테이블 스페이스에는 락의 할당을 적게 주고, 모든 노드에서 빈번하게 변경/수정이 발생하는 테이블 스페이스에는 락을 아주 많이 지정하여 해결할 수 있다. 그러나 이를 지정하는 것은 아주 조심해서 사용해야 하며 오라클9i 이상에서는 기본 값(Default)으로 사용해도 잘 운영된다.
추가적으로 statspack을 이용하여 RAC을 진단할 수 있다. 원하는 시간대의 statspack의 스냅샷을 이용하여 Statspack의 리포트를 생성해 보면 ‘Global Cache Service - Workload Characteristics’ 부분에 여러 가지 다양한 RAC 관련 메트릭를 보여준다. 다음은 statspack 리포트의 샘플이다. Statspack report 생성은 $ORACLE_HOME/rdbms/admin/ 디렉토리의 spreport.sql을 수행하면 만들 수 있다.

Global Cache Service - Workload Characteristics
-----------------------------------------------
Ave global cache get time (ms): 0.3
Ave global cache convert time (ms): 0.9
Ave build time for CR block (ms): 0.0
Ave flush time for CR block (ms): 0.2
Ave send time for CR block (ms): 0.1
Ave time to process CR block request (ms): 0.3
Ave receive time for CR block (ms): 0.6
Ave pin time for current block (ms): 0.1#
Ave flush time for current block (ms): 0.1
Ave send time for current block (ms): 0.1
Ave time to process current block request (ms): 0.2
Ave receive time for current block (ms): 0.7

다음은 RAC의 진단 중에 중요한 응답 속도에 대한 일반적인 기준 값이다. 이 statspack의 결과를 이용해 점검해 보면 RAC 관련된 메트릭을 검증할 수 있다.

간략하게나마 RAC 진단에 대해 알아보았다. 오라클9i, 10g의 RAC은 과거 OPS와는 달리 캐시 퓨전으로 기능과 성능이 아주 많이 개선되어 파라미터 튜닝이나 애플리케이션 파티셔닝의 부담이 현격히 줄어 데이터베이스 관리자가 쉽게 구축하여 사용할 수 있게 되었다. 심지어 오라클 RAC 매뉴얼에는 싱글 데이터베이스를 RAC으로 이관할 때 고려할 사항이 전혀 없다고 할 정도이다.

TAF와 CTF 그리고 로드밸런스

질문 : SQL*Net 및 관련 init.ora의 설정이 잘 되었는지 알고 싶다. 관련해서 예전에 설명해 주기로 한 부분(Failover & Load balancing)도 궁금하다. 그리고 순수하게 JDBC 연결을 사용할 경우 TAF를 지원할 수 없다고 알고 있는데 맞는지.

마지막 여행지로 다녀온 것은 TAF와 CTF 그리고 로드밸런스이다. 사실 이 부분은 RAC 데이터베이스와 클라이언트나 미들티어 애플리케이션과의 통신 구조에 대한 것이다. 결국 RAC의 아키텍처에서 빠질 수 없는 부분이다. 게다가 TAF, CTF, 로드밸런스의 사용 여부는 사용자의 가용성 요구사항과 응용 애플리케이션의 성격 등에 따라 그 구성이 달라지게 된다.

TAF와 CTF의 정의

◆ CTF : Connection Time Failover의 기능은 클라이언트가 데이터베이스로 접속을 시도할 때 접속하고자 하는 서버에 장애가 발생하여 접속하지 못할 경우 다른 서버로 접속할 수 있도록 하는 기능.
◆ TAF : Transparent Application Failover의 기능은 클라이언트가 RAC의 한쪽 노드에 접속하여 사용하는 중에 접속한 노드에 장애가 발생한 경우 가용한 다른 노드로 접속하여 작업을 계속할 수 있도록 하는 기능.

CTF는 접속할 수 있는 노드들을 tnsnames.ora에 명시해 놓고, 그 중에 접속할 수 있는 노드로 접속하는 것을 말한다. 결국 CTF는 접속시의 정지된 서버가 있을 경우 이 서버를 피해 가용한 서버로 접속하는 Failover 기능을 말한다.
TAF의 경우 오라클에서 조회(select)를 하고 있는 경우에만 자동 Failover를 지원한다. 만약 입력(insert), 삭제(delete)의 경우에는 해당 처리에 대한 롤백 처리를 반드시 구현해 주어야 Failover가 가능하다. 이러한 제약사항으로 DML이 있는 응용 프로그램에 대한 TAF는 현실적으로 구현이 어렵다. 사실 이러한 점이 송정훈씨의 고민 중 하나였는데, 다만 향후의 버전에서 조회뿐만이 아닌 모든 DML에 대한 TAR가 구현되어 진정한 Failover를 구현할 수 있기를 바란다.
결국 대부분의 경우에는 CTF나 조회만 하는 응용 프로그램에 TAF를 구현한다. 게다가 만약 응용 프로그램이 웹으로 구현되어 있을 경우에는 CTF만을 사용하더라도 어느 정도의 가용성은 보장할 수 있다. 예를 들어 CTF만 구현했다고 가정할 때, 페이지 이동 중 장애가 발생했다면 사용자 화면에 에러가 표시된다. 이때 사용자가 다시 시도하는 경우에 장애나 노드가 아닌 정상적인 노드로 다시 접속하게 되므로 사용자는 장애를 느끼지 않을 것이다.

TAF의 구현 구조

<그림 4> TAF의 구현 구조


다음은 TAF를 구현하는 모드와 방식을 나타낸 표이다. 방식에는 BASIC, PRECONNECT 방식이 있고, 접속 모드에는 SESSION, SELECT가 있다. 이러한 TAF 기능은 이미 언급한 바와 같이 OCI를 사용하는 프로그램 언어를 사용했을 때만 가능하다. <리스트 1>은 TAF 예제 프로그램으로 JDBC Thick 드라이버를 사용하여 Callback을 구현한 예제로써 TAF와 CTF를 동시에 사용한 것이다.

로드밸런스 알기

로드밸런스란 클라이언트의 요청들을 여러 개의 서버로 분산시켜서 다중 서버들의 자원을 골고루 사용할 수 있도록 하는 것이다. 오라클에서 지원하는 로드밸런스의 기능에는 클라이언트 사이드 로드밸런스와 서버 사이드 로드밸런스 2가지가 있다. 클라이언트 사이드 로드밸런스인 경우에는 tnsnames.ora에 LOAD_BALANCE=ON을 지정하고 ADDRESS_LIST에 여러 개의 노드로 접속하는 주소를 지정하면 임의적(random) 방식을 이용하여 접속하게 된다. 이와 같은 방식은 접속의 수를 1:1로 나뉘는 방식으로 고정 방식(static)이라 할 수 있다.
서버 사이드 로드밸런스인 경우에는 init.ora의 remote_listener들을 지정하여 로드밸런스를 할 모든 리스너를 지정한다. 이렇게 지정하면 오라클 프로세스 중의 하나인 PMON이 30초마다 서버의 부하를 측정하여 변화가 많이 있는 경우에 모든 리스너에 정보를 배포한다. 변화가 없을 경우에는 10분마다 다시 부하 정보가 갱신된다. 여기서 측정되는 부하는 접속 수와 서버 CPU의 부하를 계산한다. 이렇게 계산된 부하를 바탕으로 각각의 리스너가 클라이언트의 접속 요청에 대해 최소의 부하를 가진 서버로 보내주게 된다. 이와 같은 방식은 접속요청에 대해 부하에 따라 접속하는 서버를 결정하게 되므로 동적(dynamic) 방식이라 할 수 있다. 다음은 클라이언트 로드밸런스를 사용하는 방식이다.

TEST =
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = hikim1)(PORT = 1526))
(ADDRESS = (PROTOCOL = TCP)(HOST = hikim2)(PORT = 1526))
)
(CONNECT_DATA =
(SERVICE_NAME = 10g2)
)
)

다음은 서버 사이드 로드밸런스를 사용하는 방식이다.

Init.ora(node1)
remote_listener=ERP02

Init.ora(node2)
Remote_listener=ERP01

로드밸런스의 기능은 RAC 환경에서 추가적인 로드밸런스 장비의 도입없이도 전체 자원을 균등하게 사용할 수 있도록 해주며 대용량 처리를 요하는 시스템이나 많은 사용자가 있는 시스템에서는 자원을 효과적으로 사용할 수 있게 해주는 것이다.
그럼 로드밸런스에 대해 좀 더 깊이 고민해 보자. 일반적으로 정상 운영 중에 로드밸런스를 많이 고민하게 된다. 이는 앞에서 설명한 기능으로 어느 정도 해결이 가능하다. 그런데 장애 후의 로드밸런스에 문제점이 있다. 만약 한 개의 노드에 장애가 발생했다고 가정하면 모든 접속은 정상적인 노드로 새로 접속하여 서비스를 받게 된다. 이후 장애가 발생한 노드가 정상 복귀되어 서비스를 재개하면 어떻게 될까? 이미 모든 클라이언트가 정상 노드에 접속하여 서비스를 받고 있으므로 계속적으로 정상 노드에서만 운영하게 되어 있다.
이렇듯 장애 후의 부하 분산에 대한 적당한 답은 아직까지 없었다. 보통의 경우는 어쩔 수 없이 응용 애플리케이션이나 WAS를 재가동하여 접속을 새로 하는 방법 밖에 없었다. 그러나 오라클10g에서는 이러한 장애 후 재부하 분산을 위해 dbms_service라는 PL/SQL 패키지를 이용하여 인액티브한 세션을 정리하여 다시 접속을 시키는 방식으로 장애 후 부하 분산 기능을 제공한다. 조금은 미약한 방식인 듯하지만 WAS의 커넥션 풀(connection pool)을 사용하는 경우라면 잘 활용할 수 있다.

캐시 퓨전의 발전

이번 여행을 마치면서 오라클 RAC에 대해 개념, 진단 방법, 구축 방법, 그리고 TAF, CTF, 로드밸런스에 대해 이야기했다. 9i RAC부터는 캐시 퓨전의 발전으로 과거의 OPS에서 항상 치러왔던 핑과의 전쟁에서 벗어날 수 있었으며, 애플리케이션의 파티셔닝이 없더라도 큰 문제 없이 시스템을 구축할 수 있다. 이러한 것들이 100% 무정지 시스템을 위해 어디선가 노력하는 분들에게 1%라도 도움이 되었으면 하는 마음으로 마무리한다. 100%의 무정지를 향한 아름다운 도전에 성공의 외침을 바라며 글을 마친다.

출처 : 마이크로소프트웨어[2004년도 7월호]

반응형
Posted by [PineTree]