Oracle RAC 엔진 설치 및 ASM 구성

  • Oracle 유저로 실행

       

   

  • 추가 서포터를 받지 않기 때문에 체크 해제

       

   

  • [Skip Software updates]

       

   

  • [Install database software only]

       

   

  • 2개의 노드 모두 선택

       

   

  • 언어 선택

       

   

   

  • Oracle SW 설치 위치 선택

       

   

  • Oracle 그룹선택

       

   

  • 11g의경우 설치시 필요사항에 대해서 Check해주기 때문에, 떨어지는 에러들만 잡아도 무난하게 설치가능합니다.

       

  • 설치완료

       

  • 각 노드별 확인(ORACLE_HOME)

    $ $ORACLE_HOME/bin/oifcfg getif

[root@rac1 ~]# oifcfg getif

eth0 192.168.22.0 global public

eth1 10.10.10.0 global cluster_interconnect

   

ASM DISK Group설정

  • Grid 유저로 실행

   

   

   

   

   

CRS 및 ASM 확인

[root@rac1 ~]# crs_stat -t

Name Type Target State Host

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

ora.DATA.dg ora....up.type ONLINE ONLINE rac1

ora....ER.lsnr ora....er.type ONLINE ONLINE rac1

ora....N1.lsnr ora....er.type ONLINE ONLINE rac1

ora.ORADATA.dg ora....up.type ONLINE ONLINE rac1

ora.asm ora.asm.type ONLINE ONLINE rac1

ora.cvu ora.cvu.type ONLINE ONLINE rac1

ora.gsd ora.gsd.type OFFLINE OFFLINE

ora....network ora....rk.type ONLINE ONLINE rac1

ora.oc4j ora.oc4j.type ONLINE ONLINE rac1

ora.ons ora.ons.type ONLINE ONLINE rac1

ora.rac.db ora....se.type ONLINE ONLINE rac1

ora....SM1.asm application ONLINE ONLINE rac1

ora....C1.lsnr application ONLINE ONLINE rac1

ora.rac1.gsd application OFFLINE OFFLINE

ora.rac1.ons application ONLINE ONLINE rac1

ora.rac1.vip ora....t1.type ONLINE ONLINE rac1

ora....SM2.asm application ONLINE ONLINE rac2

ora....C2.lsnr application ONLINE ONLINE rac2

ora.rac2.gsd application OFFLINE OFFLINE

ora.rac2.ons application ONLINE ONLINE rac2

ora.rac2.vip ora....t1.type ONLINE ONLINE rac2

ora....ry.acfs ora....fs.type ONLINE ONLINE rac1

ora.scan1.vip ora....ip.type ONLINE ONLINE rac1

[root@rac1 ~]#

   

[참고문헌]

   

http://www.allsoft.co.kr/bbs/board.php?bo_table=study91_2&wr_id=30

http://hook.tistory.com/275

http://blog.naver.com/jjuneye?Redirect=Log&logNo=110152112359

http://estenpark.tistory.com/284

http://www.oracle.com/pls/db112/homepage

http://pangsun.tistory.com/

http://www.oracleclub.com/

https://support.oracle.com

블로그 이미지

운명을바꾸는자

IT와 함께 살아가는 삶

,



Vmware 및 리눅스 설정 2

   

  • 디스크가 제대로 설정될 경우 아래와 같은 형태로 보여집니다.

       

[root@rac1 ~]# fdisk -l

   

Disk /dev/sda: 32.2 GB, 32212254720 bytes

255 heads, 63 sectors/track, 3916 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   

Device Boot Start End Blocks Id System

/dev/sda1 * 1 637 5116671 83 Linux

/dev/sda2 638 3059 19454715 83 Linux

/dev/sda3 3060 3824 6144862+ 82 Linux swap / Solaris

   

Disk /dev/sdb: 1073 MB, 1073741824 bytes

255 heads, 63 sectors/track, 130 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   

Device Boot Start End Blocks Id System

   

Disk /dev/sdc: 1073 MB, 1073741824 bytes

255 heads, 63 sectors/track, 130 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   

Device Boot Start End Blocks Id System

   

Disk /dev/sdd: 1073 MB, 1073741824 bytes

255 heads, 63 sectors/track, 130 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   

Device Boot Start End Blocks Id System

   

Disk /dev/sde: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   

Device Boot Start End Blocks Id System

   

Disk /dev/sdf: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   

Device Boot Start End Blocks Id System

   

Disk /dev/sdg: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   

Device Boot Start End Blocks Id System

[root@rac1 ~]#

   

Network 설정

   

   

   

   

[root@rac1 ~]# cat /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1 localhost.localdomain localhost

   

#public IP

192.168.22.101 rac1

192.168.22.102 rac2

   

#Private IP

10.10.10.1 rac1-priv

10.10.10.1 rac2-priv

   

#VIP

192.168.22.201 rac1-vip

192.168.22.202 rac2-vip

   

#ScanIP

192.168.22.100 rac-scanip

   

#service network restart --재설정

   

   

  • /etc/hosts 작성시 주의사항
    • 방화벽문제 + /etc/hosts 127.0.0.1 localhost.~ , hostname 문제(대문자X, -, _ X 사용금지)

       

    [인터넷 연결 확인]

[root@rac1 ~]# ping www.yahoo.com

PING ds-kr-fp3.wg1.b.yahoo.com (106.10.170.118) 56(84) bytes of data.

64 bytes from ir1.fp.vip.sg3.yahoo.com (106.10.170.118): icmp_seq=1 ttl=128 time=214 ms

64 bytes from ir1.fp.vip.sg3.yahoo.com (106.10.170.118): icmp_seq=2 ttl=128 time=240 ms

64 bytes from ir1.fp.vip.sg3.yahoo.com (106.10.170.118): icmp_seq=3 ttl=128 time=143 ms


[기타사항]

   

-vmware의 경우 IP 설정시, Vmware Network와 설치된 OS 서버의 Network 구성을 맞추어 주셔야합니다.

   

   

   

  • 사용 되는 IP 대역 및 Subnet mask확인 및 게이트웨이 설정

       

       

  • 설정된 게이트웨이 확인

       

    [설정]

       

Oracle 설치를 위한 OS 설정 변경

  1. 불필요한 서비스 제거

chkconfig --level 123456 xinetd off

chkconfig --level 123456 sendmail off

chkconfig --level 123456 cups off

chkconfig --level 123456 cups-config-daemon off

chkconfig --level 123456 smartd off

chkconfig --level 123456 isdn off

chkconfig --level 123456 iptables off

   

  • RAC 구동시 불필요한 서비스 제거(TEST DB를 구축하기 위함)

       

[주의]

  • 해당 내역은 실 운영적용시에는 절대 사용되어서는 안됩니다.

   

  1. OS 파라미터 세팅(Root 유저)

# vi /etc/sysctl.conf

   

kernel.shmmni= 4096

kernel.sem= 250 32000 100 128

net.ipv4.ip_local_port_range= 9000 65500

net.core.wmem_max= 1048576

net.core.rmem_default= 4194304

net.core.rmem_max= 4194304

net.core.wmem_default= 262144

fs.file-max= 6815744

fs.aio-max-nr= 1048576

   

#sysctl -p --적용

   

# vi /etc/security/limits.conf

   

gridsoft nproc 2047

gridhard nproc 16384

gridsoft nofile 1024

gridhard nofile 65536

oraclesoft nproc 2047

oraclehard nproc 16384

oraclesoft nofile 1024

oraclehard nofile 65536

   

# vi /etc/pam.d/login

   

session                   required                pam_limits.so

   

# vi /etc/modprobe.conf

optionshangcheck-timer hangcheck_tick=30 hangcheck_margin=180

   

# modprobe -v hangcheck-timer --적용

-> 커널 기반 타이머를 사용, 시스템 테스크 스케줄러에 발생하는 딜레이를 정기적으로 정검하는 방식으로 시스템 상태 확인기능

   

# vi /etc/rc.local

/sbin/modprobehangcheck-timer

rdate-s 203.248.240.140

   

[OS 설치시 System Tool 추가 설치]

   

[root@rac1 home]# rpm -qa|grep oracleasm*

oracleasm-support-2.1.3-1.el5

oracleasm-2.6.18-194.el5xen-2.0.5-1.el5

oracleasm-2.6.18-194.el5PAE-2.0.5-1.el5

oracleasmlib-2.0.4-1.el5

oracleasm-2.6.18-194.el5debug-2.0.5-1.el5

oracleasm-2.6.18-194.el5-2.0.5-1.el5

[root@rac1 home]#

   

[root@rac1 home]# rpm -qa|grep sysstat*

sysstat-7.0.2-3.el5

   

[root@rac1 rpm]# rpm -qa|grep libaio-devel*

libaio-devel-0.3.106-5

[root@rac1 rpm]# rpm -qa|grep unixODBC*

unixODBC-devel-2.2.11-7.1

unixODBC-2.2.11-7.1

unixODBC-kde-2.2.11-7.1

   

[출처: http://www.oracle.com/technetwork/server-storage/linux/downloads/rhel5-084877.html]

[root@rac1 home]# rpm -qa|grep oracleasmlib*

oracleasmlib-2.0.4-1.el5

   

[p10098816_112020_LINUX_3of7.zip 압축해제 이후 /rpm 폴더확인]

[root@rac1 rpm]# rpm -qa|grep cvuqdisk

cvuqdisk-1.0.9-1

   

# vi /etc/sysconfig/ntpd

" -x " 추가

   

OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"

   

# service ntpd restart --적용

   

   

#setup

   


setup -> system services-> ntpd 선택

   

  • OS 리부팅시 자동 재시작설정

   

유저, 그룹, 디렉토리 생성

   

  • 유저 및 그룹 생성

# groupadd -g 500 dba

# useradd -g dba oracle

# useradd -g dba grid

# passwd oracle

# passwd grid

   

  • ORACLE_HOME 및 GRID_HOME(해당 디렉토리 위치는 사용자지정)

Mkdir /home/ora_SW/grid/11.2.0.3

Mkdir /home/ora_SW/oracle/11.2.0.3

Chmod -R 755 /home/ora_SW

   

# vi ~/.bash_profile

   

exportGRID_HOME=/u01/app/11.2.0/grid

exportPATH=$PATH:$HOME/bin:$GRID_HOME/bin

   

  • Grid 유저(bash_profile)

export PATH

   

export PATH

export GRID_BASE=/home/grid

#export GRID_HOME=/home/ora_SW/oracle/11.2.0.3

export ORACLE_SID=+ASM1

export PATH=$GRID_HOME/bin:$GRID_HOME/OPatch:$PATH

export LD_LIBRARY_PATH=$GRID_HOME/lib:/lib:/usr/lib

export ORACLE_HOME=/home/ora_SW/grid/11.2.0.3

export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

#export DISPLAY=192.168.*.*:0.0

export LANG=C

   

export EDITOR=vi

export PS1='`hostname -s`@$ORACLE_SID : $PWD> '

   

[주의사항]

GRID_HOME의 경우, ORACLE_HOME에 명시해주어야 ASMCMD 수행시 문제 없이 정상작동가능

   

  • Oracle 유저(bash_profile)

export PATH

   

export PATH

export ORACLE_BASE=/home/ora_SW/oracle

export ORACLE_HOME=$ORACLE_BASE/11.2.0.3

export ORACLE_SID=RAC1

export ORACLE_UNQNAME=RAC

export ORACLE_TERM=xterm

export NLS_LANG=American_America.UTF8

export GRID_HOME=/home/grid/11.2.0.3

export PATH=/usr/sbin:$PATH

export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

#export DISPLAY=192.168.6.17:0.0

export LANG=C

   

umask 022

   

export EDITOR=vi

export PS1='`hostname -s`@$ORACLE_SID : $PWD> '

   

  • 2번 노드의 경우 ORACLE_SID만 변경해주면 됩니다.

       

ASMDISK 설정

  • 파티션 분할
  • 아래와 같은 방식으로 추가한 Disk 파티션 분할

# fdisk /dev/sdb

   

Command (m for help): help

h: unknown command

Command action

a toggle a bootable flag

b edit bsd disklabel

c toggle the dos compatibility flag

d delete a partition

l list known partition types

m print this menu

n add a new partition

o create a new empty DOS partition table

p print the partition table

q quit without saving changes

s create a new empty Sun disklabel

t change a partition's system id

u change display/entry units

v verify the partition table

w write table to disk and exit

x extra functionality (experts only)

   

Command(m for help): n

Commandaction

   e  extended

   p  primary partition (1-4)

p

Partitionnumber (1-4): 1

Firstcylinder (1-130, default 1):엔터

Usingdefault value 1

Lastcylinder or +size or +sizeM or +sizeK (1-130, default 130):엔터

Usingdefault value 130

Command(m for help): w

Thepartition table has been altered!

   

Callingioctl() to re-read partition table.

Syncingdisks.

   

[root@rac1 11.2.0.3]# fdisk -l

   

Disk /dev/sda: 32.2 GB, 32212254720 bytes

255 heads, 63 sectors/track, 3916 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   

Device Boot Start End Blocks Id System

/dev/sda1 * 1 637 5116671 83 Linux

/dev/sda2 638 3059 19454715 83 Linux

/dev/sda3 3060 3824 6144862+ 82 Linux swap / Solaris

   

Disk /dev/sdb: 1073 MB, 1073741824 bytes

255 heads, 63 sectors/track, 130 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   

Device Boot Start End Blocks Id System

/dev/sdb1 1 130 1044193+ 83 Linux

   

Disk /dev/sdc: 1073 MB, 1073741824 bytes

255 heads, 63 sectors/track, 130 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   

Device Boot Start End Blocks Id System

/dev/sdc1 1 130 1044193+ 83 Linux

   

Disk /dev/sdd: 1073 MB, 1073741824 bytes

255 heads, 63 sectors/track, 130 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   

Device Boot Start End Blocks Id System

/dev/sdd1 1 130 1044193+ 83 Linux

   

Disk /dev/sde: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   

Device Boot Start End Blocks Id System

/dev/sde1 1 652 5237158+ 83 Linux

   

Disk /dev/sdf: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   

Device Boot Start End Blocks Id System

/dev/sdf1 1 652 5237158+ 83 Linux

   

Disk /dev/sdg: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   

Device Boot Start End Blocks Id System

/dev/sdg1 1 652 5237158+ 83 Linux

[root@rac1 11.2.0.3]#

   

  • Oracle ASM 구성

# oracleasm configure -i

   

[root@rac1 ~]# oracleasm configure -i

Configuring the Oracle ASM library driver.

   

This will configure the on-boot properties of the Oracle ASM library

driver. The following questions will determine whether the driver is

loaded on boot and what permissions it will have. The current values

will be shown in brackets ('[]'). Hitting <ENTER> without typing an

answer will keep that current value. Ctrl-C will abort.

   

Default user to own the driver interface [grid]:

Default group to own the driver interface [dba]:

Start Oracle ASM library driver on boot (y/n) [y]:

Scan for Oracle ASM disks on boot (y/n) [y]:

Writing Oracle ASM library driver configuration: done

[root@rac1 ~]#

   

# oracleasm init

   

[주의사항]

유저를 2개로 나누어서 설치할 경우, ASM 구성시 관리하는 Grid 유저로 권한을 부여해야 합니다.

   

  • Oracleasm disk create

# oracleasm create disk OCR_VOTE01 /dev/sdb1

# oracleasm create disk OCR_VOTE02 /dev/sdc1

# oracleasm create disk OCR_VOTE01 /dev/sdd1

# oracleasm create disk ASMDISK01 /dev/sde1

# oracleasm create disk ASMDISK02 /dev/sdf1

# oracleasm create disk ASMDISK03 /dev/sdg1

   

-Disk 스캔

# oracleasm scandisks

-생성리스트 확인

# oracleasm listdisks

   

#chown -R gird.dba /dev/oracleasm

   

[주의사항]

설치 시 사용되는 유저가 2개일 경우, /dev/oracleasm의 경우 ASM에 대한 권한을 가지고 있는 Grid 유저 권한으로 적용해야 합니다.

   

  • 해당 서버를 종료시킨 이후에, 2번노드 설정을 해야되기 때문에 OS Shutdown을 실행합니다.

# init 0

   

  • 1번 노드 설정이 완료

       

   

노드 2번 세팅

   

   

   

  • 해당 2개의 파일을 노드2를 설정하기 위해 복사합니다.

       

       

  • 복사된 내용을 가지고 Vmware에 동작시킨 뒤, 기존의 Vmware 명을 변경해줍니다.

       

       

    [주의사항]

  • RAC 노드2 작업시에 기존의 RAC 노드1은 반드시 shutdown 상태이어야 합니다(Network 충돌로 인한 에러가 발생할 수 있음)
  • RAC 노드2를 동작시 반드시 "I copied it" 을 선택 후, 진행해야 합니다.

       

    5-1 network 재설정

       

       

       

       

[root@rac2 ~]# cat /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1 localhost.localdomain localhost

   

#public IP

192.168.22.101 rac1

192.168.22.102 rac2

   

#Private IP

10.10.10.1 rac1-priv

10.10.10.1 rac2-priv

   

#VIP

192.168.22.201 rac1-vip

192.168.22.202 rac2-vip

   

#ScanIP

192.168.22.100 rac-scanip

   

#service network restart --재설정

   

5-2

Grid 유저 및 Orcale 유저 ORACLE_SID 변경(.bash_profile)

   

  • 각 노드설정이 완료되고, 2개의 노드를 동작시켜서 Network TEST 및 정상동작여부 확인필요
  • public IP와 Private IP가 정상적으로 각 노드에 Ping이 들어가는지 확인이 필요합니다.

   

Ssh, user equivalence설정

  1. 수동설정

#Node1과 Node2 통신시 Passwd 묻지 않게..

   

각각의 node 에서 grid/oracle 유저로 접속을 하고..

(1,2번 노드에서 실행)

   

$ ssh-keygen -t rsa

$ ssh-keygen -t dsa

   

(1번노드에서만 실행)

$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

   

$ ssh rac2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

$ ssh rac2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

   

차례대로 실행해서 yes ? node2 password 를 입력하면 완료 된다.

작성된 인증키파일을 node2 에 복사해주면 완료 된다.

   

$ scp ~/.ssh/authorized_keys rac2:~/.ssh/authorized_keys

   

확인

 (1,2번 노드 모두)

   

아래 명령으로 테스를 해보면..

(최초 실행시에는 password를 묻는다..)

Password 를 물어보지 않으면 설정이 제대로 된거임

$ ssh rac1 date

$ ssh rac1-priv date

$ ssh rac2 date

$ ssh rac2-priv date

  1. 자동 스크립트 설정

-> grid 설치 media에 sshsetup 폴더에 있는 스크립트 사용

-> 유저가 2개일 경우(grid / oracle), 각 유저로 로그인하여 해당 스크립트를 동작

/sshsetup]# ./sshUserSetup.sh -user grid -hosts "rac1 rac2" -noPromptPassphrase -advanced -exverify

/sshsetup]# ./sshUserSetup.sh -user oracle -hosts "rac1 rac2" -noPromptPassphrase -advanced -exverify

   

[참고문헌]

   

http://www.allsoft.co.kr/bbs/board.php?bo_table=study91_2&wr_id=30

http://hook.tistory.com/275

http://blog.naver.com/jjuneye?Redirect=Log&logNo=110152112359

http://estenpark.tistory.com/284

http://www.oracle.com/pls/db112/homepage

http://pangsun.tistory.com/

http://www.oracleclub.com/

https://support.oracle.com

   

블로그 이미지

운명을바꾸는자

IT와 함께 살아가는 삶

,



Vmware 및 리눅스 설정1

   

Vmware 설치 및 설정

   

   

   

   

  • 설치 이미지를 미리 넣지 않는 이유는, 생성과 동시에 추가 작업을 먼저 한 뒤에 설치를 진행해야 되기 때문입니다.

       

  • RHEL 5 리눅스 선택

       

       

  • 각 노드별, 스토리지별로 나누고 각각 분산시켜서 저장하는 방식으로 진행 하였습니다. 설치 완료 후, 관리 및 백업을 수월하게 받기 위하여 각 부분별로 나누어 저장했습니다.

       

       

       

       

       

  • 대략 3G~3.5GB를 잡고 TEST할 경우 수월하게 설치가 되었습니다. 그 이하의 memory로 설치할 경우 중간중간에 서버가 다운이 되어 처음부터 다시 설정해야 될 경우가 발생할 수 있습니다.
  • 정확한 측정기준은 Oracle 공식 문서를 참조해주세요
  • http://www.oracle.com/pls/db112/homepage

   

   

   

   

   

   

   

   

   

  • 설정 완료 이후 추가적으로 세팅이 필요합니다. 메모리 증설 및 네트워크 추가 및 Disk 추가작업시작

       

       

Memory

Node1,2

Vote&OCR

ASMDISK

Network

3.3GB

30GB

1GB-3개

5G-3개

NAT/HOST-Only

   

Network 추가

   

   

   

Disk 추가

   

   

   

   

   

   

  • 이전에 나누어 생성해 둔 스토리지 폴더에 파일 위치 지정합니다.

       

       

       

  • 해당 Disk 번호를 각각 지정하여 추가해 주면 되겠습니다.
  • 위와 같은 방식을 반복하면서 Disk를 추가해주세요

       

  • 아래 최종완료 내용을 참고해주세요

       

       

OCR_VOTE01    1GB    SCSI(1:0)

OCR_VOTE02    1GB    SCSI(1:1)

OCR_VOTE03    1GB    SCSI(1:2)

ASMDISK01          5GB    SCSI(1:3)

ASMDISK02          5GB    SCSI(1:4)

ASMDISK03          5GB    SCSI(1:5)

  • 최종적으로 위와 같은 형태가 되면 되겠습니다.

   

   

  • Vmware의 경우, 모든 세팅이 끝난 이후에 추가된 Disk에 대하여 수동으로 추가 작업이 필요합니다.

       

       

disk.locking = "FALSE"

diskLib.dataCacheMaxSize = "0"

scsi1.sharedBus = "virtual"

   

scsi1:0.deviceType = "disk"

scsi1:1.deviceType = "disk"

scsi1:2.deviceType = "disk"

scsi1:3.deviceType = "disk"

scsi1:4.deviceType = "disk"

scsi1:5.deviceType = "disk"

   

  • 추가적으로 Disk를 만드실 경우, 해당 내역에도 변경사항에 대하여 넣어 주세요

       

       

  • CD를 삽입한 뒤, OS를 부팅해주세요.

 

리눅스 설치 및 설정

   

   

  • Skip을 통하여 GUI형태로 설치 진행 선택

       

       

       

       

  • 추후 한글 패키지 설치를 진행할 예정이기 때문에 해당 순서에서는 영어 선택

       

       

       

  • 추가된 Disk를 모두포맷 후, 진행하여야 되게 때문에 [YES]를 선택해야 합니다.

       

       

  • RAC 구성의 경우, 파티션을 세부적으로 나누어야 되는 부분이 있어서 [Create custom layout]을 선택합니다.

       

       

  • 파티션 분할시에 주의해야 되는 점은 /dev/sda 파티션(30GB)에 대해서만

       

       

       

  • Public IP와 Pravate IP 설정

       

       

       

       

       

  • System Tools에서 Optional packages를 통하여 추가 패치키를 설치해줍니다.
  • 추후 필요 패키지만 설치할 수 있지만 번거로움을 줄이기 위해서 OS 설치시 패키지 설치

       

       

       

       

    • 추가 언어 패키지 설치

     

       

       

       

       

   

   

  • 방화벽의 경우 비활성화를 선택합니다.

       

       

       

       

       

       

   

   

  • 설치 완료
  • Network 설정 및 Disk 설정이 중요합니다.

   

[참고문헌]

   

http://www.allsoft.co.kr/bbs/board.php?bo_table=study91_2&wr_id=30

http://hook.tistory.com/275

http://blog.naver.com/jjuneye?Redirect=Log&logNo=110152112359

http://estenpark.tistory.com/284

http://www.oracle.com/pls/db112/homepage

http://pangsun.tistory.com/

http://www.oracleclub.com/

https://support.oracle.com

블로그 이미지

운명을바꾸는자

IT와 함께 살아가는 삶

,


Oracle RAC 사전 준비사항

  • 사전에 어떠한 방식 및 구조로 구축할지에 대한 생각.
  • 기본적인 설치 내역에 대해서 정리한 뒤, 설치를 진행.

   

RAC Architecture

   

Vmware Install(생략)

   

OS 설정 내역

Memory

Node1,2

Vote&OCR

ASMDISK

Network

3.3GB

30GB

1GB-3개

5G-3개

NAT/HOST-Only

  • Memory의 경우, 적어도 3G가 이상 적용되어 있어야 수월하게 설치가 가능합니다.
     

IP 설정 내역

[root@rac1 ~]# cat /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1 localhost.localdomain localhost

   

192.168.22.101 rac1

192.168.22.102 rac2

   

10.10.10.1 rac1-priv

10.10.10.1 rac2-priv

   

192.168.22.201 rac1-vip

192.168.22.202 rac2-vip

   

192.168.22.100 rac-scanip

RHEL5(Linux rac1 2.6.18-194.el5PAE) 32bit / Oracle 11.2.0.3 1~3

p10098816_112020_LINUX_1of7.zip

p10098816_112020_LINUX_2of7.zip

p10098816_112020_LINUX_3of7.zip

필수 RPM 설치

[OS 설치시 System Tool 추가 설치]

   

[root@rac1 home]# rpm -qa|grep oracleasm*

oracleasm-support-2.1.3-1.el5

oracleasm-2.6.18-194.el5xen-2.0.5-1.el5

oracleasm-2.6.18-194.el5PAE-2.0.5-1.el5

oracleasmlib-2.0.4-1.el5

oracleasm-2.6.18-194.el5debug-2.0.5-1.el5

oracleasm-2.6.18-194.el5-2.0.5-1.el5

[root@rac1 home]#

   

[root@rac1 home]# rpm -qa|grep sysstat*

sysstat-7.0.2-3.el5

   

[root@rac1 rpm]# rpm -qa|grep libaio-devel*

libaio-devel-0.3.106-5

[root@rac1 rpm]# rpm -qa|grep unixODBC*

unixODBC-devel-2.2.11-7.1

unixODBC-2.2.11-7.1

unixODBC-kde-2.2.11-7.1

   

[출처: http://www.oracle.com/technetwork/server-storage/linux/downloads/rhel5-084877.html]

[root@rac1 home]# rpm -qa|grep oracleasmlib*

oracleasmlib-2.0.4-1.el5

   

[p10098816_112020_LINUX_3of7.zip 압축해제 이후 /rpm 폴더확인]

[root@rac1 rpm]# export CVUQDISK_GRP=dba

[root@rac1 rpm]# rpm -qa|grep cvuqdisk

cvuqdisk-1.0.9-1

   

[기타 설정내역 확인]

   

./runcluvfy.sh stage -pre crsinst -n rac1, rac2 -verbose

  • Rac1, rac2 의 경우 해당 서버에 따라서 변경될 수 있습니다.
  • 해당 스크립트의 경우, 1,2번 노드 구성이후 확인하는 부분으로써, 한번 더 설명될 예정입니다.
  • p10098816_112020_LINUX_3of7.zip 압축해제 시 스크립트가 있습니다.

       

   

Performing pre-checks for cluster services setup

   

Checking node reachability...

   

Check: Node reachability from node "rac1"

Destination Node Reachable?

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

rac2 yes

rac1 yes

Result: Node reachability check passed from node "rac1"

   

   

Checking user equivalence...

   

Check: User equivalence for user "grid"

Node Name Status

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

rac2 passed

rac1 passed

Result: User equivalence check passed for user "grid"

   

Checking node connectivity...

   

Checking hosts config file...

Node Name Status

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

rac2 passed

rac1 passed

   

Verification of the hosts config file successful

   

   

Interface information for node "rac2"

Name IP Address Subnet Gateway Def. Gateway HW Address MTU

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

eth0 192.168.22.102 192.168.22.0 0.0.0.0 192.168.22.2 00:0C:29:C7:63:A4 1500

eth0 192.168.22.202 192.168.22.0 0.0.0.0 192.168.22.2 00:0C:29:C7:63:A4 1500

eth1 10.10.10.2 10.10.10.0 0.0.0.0 192.168.22.2 00:0C:29:C7:63:AE 1500

eth1 169.254.97.84 169.254.0.0 0.0.0.0 192.168.22.2 00:0C:29:C7:63:AE 1500

   

   

Interface information for node "rac1"

Name IP Address Subnet Gateway Def. Gateway HW Address MTU

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

eth0 192.168.22.101 192.168.22.0 0.0.0.0 192.168.22.2 00:0C:29:40:65:E4 1500

eth0 192.168.22.100 192.168.22.0 0.0.0.0 192.168.22.2 00:0C:29:40:65:E4 1500

eth0 192.168.22.201 192.168.22.0 0.0.0.0 192.168.22.2 00:0C:29:40:65:E4 1500

eth1 10.10.10.1 10.10.10.0 0.0.0.0 192.168.22.2 00:0C:29:40:65:EE 1500

eth1 169.254.206.234 169.254.0.0 0.0.0.0 192.168.22.2 00:0C:29:40:65:EE 1500

   

   

Check: Node connectivity of subnet "192.168.22.0"

Source Destination Connected?

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

rac2[192.168.22.102] rac2[192.168.22.202] yes

rac2[192.168.22.102] rac1[192.168.22.101] yes

rac2[192.168.22.102] rac1[192.168.22.100] yes

rac2[192.168.22.102] rac1[192.168.22.201] yes

rac2[192.168.22.202] rac1[192.168.22.101] yes

rac2[192.168.22.202] rac1[192.168.22.100] yes

rac2[192.168.22.202] rac1[192.168.22.201] yes

rac1[192.168.22.101] rac1[192.168.22.100] yes

rac1[192.168.22.101] rac1[192.168.22.201] yes

rac1[192.168.22.100] rac1[192.168.22.201] yes

Result: Node connectivity passed for subnet "192.168.22.0" with node(s) rac2,rac1

   

   

Check: TCP connectivity of subnet "192.168.22.0"

Source Destination Connected?

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

rac1:192.168.22.101 rac2:192.168.22.102 passed

rac1:192.168.22.101 rac2:192.168.22.202 passed

rac1:192.168.22.101 rac1:192.168.22.100 passed

rac1:192.168.22.101 rac1:192.168.22.201 passed

Result: TCP connectivity check passed for subnet "192.168.22.0"

   

   

Check: Node connectivity of subnet "10.10.10.0"

Source Destination Connected?

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

rac2[10.10.10.2] rac1[10.10.10.1] yes

Result: Node connectivity passed for subnet "10.10.10.0" with node(s) rac2,rac1

   

   

Check: TCP connectivity of subnet "10.10.10.0"

Source Destination Connected?

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

rac1:10.10.10.1 rac2:10.10.10.2 passed

Result: TCP connectivity check passed for subnet "10.10.10.0"

   

   

Check: Node connectivity of subnet "169.254.0.0"

Source Destination Connected?

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

rac2[169.254.97.84] rac1[169.254.206.234] yes

Result: Node connectivity passed for subnet "169.254.0.0" with node(s) rac2,rac1

   

   

Check: TCP connectivity of subnet "169.254.0.0"

Source Destination Connected?

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

rac1:169.254.206.234 rac2:169.254.97.84 passed

Result: TCP connectivity check passed for subnet "169.254.0.0"

   

   

Interfaces found on subnet "192.168.22.0" that are likely candidates for VIP are:

rac2 eth0:192.168.22.102 eth0:192.168.22.202

rac1 eth0:192.168.22.101 eth0:192.168.22.100 eth0:192.168.22.201

   

Interfaces found on subnet "169.254.0.0" that are likely candidates for VIP are:

rac2 eth1:169.254.97.84

rac1 eth1:169.254.206.234

   

Interfaces found on subnet "10.10.10.0" that are likely candidates for a private interconnect are:

rac2 eth1:10.10.10.2

rac1 eth1:10.10.10.1

Checking subnet mask consistency...

Subnet mask consistency check passed for subnet "192.168.22.0".

Subnet mask consistency check passed for subnet "10.10.10.0".

Subnet mask consistency check passed for subnet "169.254.0.0".

Subnet mask consistency check passed.

   

Result: Node connectivity check passed

   

Checking multicast communication...

   

Checking subnet "192.168.22.0" for multicast communication with multicast group "230.0.1.0"...

Check of subnet "192.168.22.0" for multicast communication with multicast group "230.0.1.0" passed.

   

Checking subnet "10.10.10.0" for multicast communication with multicast group "230.0.1.0"...

Check of subnet "10.10.10.0" for multicast communication with multicast group "230.0.1.0" passed.

   

Checking subnet "169.254.0.0" for multicast communication with multicast group "230.0.1.0"...

Check of subnet "169.254.0.0" for multicast communication with multicast group "230.0.1.0" passed.

   

Check of multicast communication passed.

   

Checking ASMLib configuration.

Node Name Status

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

rac2 passed

rac1 passed

Result: Check for ASMLib configuration passed.

   

Check: Total memory

Node Name Available Required Status

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

rac2 3.2544GB (3412456.0KB) 1.5GB (1572864.0KB) passed

rac1 3.2544GB (3412456.0KB) 1.5GB (1572864.0KB) passed

Result: Total memory check passed

   

Check: Available memory

Node Name Available Required Status

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

rac2 2.4833GB (2603944.0KB) 50MB (51200.0KB) passed

rac1 2.3028GB (2414676.0KB) 50MB (51200.0KB) passed

Result: Available memory check passed

   

Check: Swap space

Node Name Available Required Status

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

rac2 5.8602GB (6144852.0KB) 3.2544GB (3412456.0KB) passed

rac1 5.8602GB (6144852.0KB) 3.2544GB (3412456.0KB) passed

Result: Swap space check passed

   

Check: Free disk space for "rac2:/home/ora_SW/grid/11.2.0.3"

Path Node Name Mount point Available Required Status

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

/home/ora_SW/grid/11.2.0.3 rac2 /home 10.2373GB 5.5GB passed

Result: Free disk space check passed for "rac2:/home/ora_SW/grid/11.2.0.3"

   

Check: Free disk space for "rac1:/home/ora_SW/grid/11.2.0.3"

Path Node Name Mount point Available Required Status

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

/home/ora_SW/grid/11.2.0.3 rac1 /home 4.4033GB 5.5GB passed

Result: Free disk space check passed for "rac1:/home/ora_SW/grid/11.2.0.3"

   

Check: Free disk space for "rac2:/tmp"

Path Node Name Mount point Available Required Status

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

/tmp rac2 / 793MB 1GB passed

Result: Free disk space check passed for "rac2:/tmp"

   

Check: Free disk space for "rac1:/tmp"

Path Node Name Mount point Available Required Status

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

/tmp rac1 / 1.2109GB 1GB passed

Result: Free disk space check passed for "rac1:/tmp"

   

Check: User existence for "grid"

Node Name Status Comment

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

rac2 passed exists(501)

rac1 passed exists(501)

   

Checking for multiple users with UID value 501

Result: Check for multiple users with UID value 501 passed

Result: User existence check passed for "grid"

   

Check: Group existence for "oinstall"

Node Name Status Comment

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

rac2 failed does not exist

rac1 failed does not exist

Result: Group existence check failed for "oinstall"

   

--OS 유저 그룹을 DBA로 통일하여 진행하였기 때문에 해당 부분에 대한 Failed은 생략가능

   

Check: Group existence for "dba"

Node Name Status Comment

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

rac2 passed exists

rac1 passed exists

Result: Group existence check passed for "dba"

   

Check: Membership of user "grid" in group "oinstall" [as Primary]

Node Name User Exists Group Exists User in Group Primary Status

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

rac2 yes yes no N/A failed

rac1 yes yes no N/A failed

Result: Membership check for user "grid" in group "oinstall" [as Primary] failed

   

--OS 유저 그룹을 DBA로 통일하여 진행하였기 때문에 해당 부분에 대한 Failed은 생략가능

   

Check: Membership of user "grid" in group "dba"

Node Name User Exists Group Exists User in Group Status

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

rac2 yes yes yes passed

rac1 yes yes yes passed

Result: Membership check for user "grid" in group "dba" passed

   

Check: Run level

Node Name run level Required Status

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

rac2 5 3,5 passed

rac1 5 3,5 passed

Result: Run level check passed

   

Check: Hard limits for "maximum open file descriptors"

Node Name Type Available Required Status

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

rac2 hard 65536 65536 passed

rac1 hard 65536 65536 passed

Result: Hard limits check passed for "maximum open file descriptors"

   

Check: Soft limits for "maximum open file descriptors"

Node Name Type Available Required Status

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

rac2 soft 1024 1024 passed

rac1 soft 1024 1024 passed

Result: Soft limits check passed for "maximum open file descriptors"

   

Check: Hard limits for "maximum user processes"

Node Name Type Available Required Status

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

rac2 hard 16384 16384 passed

rac1 hard 16384 16384 passed

Result: Hard limits check passed for "maximum user processes"

   

Check: Soft limits for "maximum user processes"

Node Name Type Available Required Status

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

rac2 soft 2047 2047 passed

rac1 soft 2047 2047 passed

Result: Soft limits check passed for "maximum user processes"

   

Check: System architecture

Node Name Available Required Status

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

rac2 i686 x86 passed

rac1 i686 x86 passed

Result: System architecture check passed

   

Check: Kernel version

Node Name Available Required Status

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

rac2 2.6.18-194.el5PAE 2.6.18 passed

rac1 2.6.18-194.el5PAE 2.6.18 passed

Result: Kernel version check passed

   

Check: Kernel parameter for "semmsl"

Node Name Current Configured Required Status Comment

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

rac2 250 250 250 passed

rac1 250 250 250 passed

Result: Kernel parameter check passed for "semmsl"

   

Check: Kernel parameter for "semmns"

Node Name Current Configured Required Status Comment

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

rac2 32000 32000 32000 passed

rac1 32000 32000 32000 passed

Result: Kernel parameter check passed for "semmns"

   

Check: Kernel parameter for "semopm"

Node Name Current Configured Required Status Comment

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

rac2 100 100 100 passed

rac1 100 100 100 passed

Result: Kernel parameter check passed for "semopm"

   

Check: Kernel parameter for "semmni"

Node Name Current Configured Required Status Comment

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

rac2 128 128 128 passed

rac1 128 128 128 passed

Result: Kernel parameter check passed for "semmni"

   

Check: Kernel parameter for "shmmax"

Node Name Current Configured Required Status Comment

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

rac2 4294967295 4294967295 1747177472 passed

rac1 4294967295 4294967295 1747177472 passed

Result: Kernel parameter check passed for "shmmax"

   

Check: Kernel parameter for "shmmni"

Node Name Current Configured Required Status Comment

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

rac2 4096 4096 4096 passed

rac1 4096 4096 4096 passed

Result: Kernel parameter check passed for "shmmni"

   

Check: Kernel parameter for "shmall"

Node Name Current Configured Required Status Comment

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

rac2 268435456 268435456 2097152 passed

rac1 268435456 268435456 2097152 passed

Result: Kernel parameter check passed for "shmall"

   

Check: Kernel parameter for "file-max"

Node Name Current Configured Required Status Comment

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

rac2 6815744 6815744 6815744 passed

rac1 6815744 6815744 6815744 passed

Result: Kernel parameter check passed for "file-max"

   

Check: Kernel parameter for "ip_local_port_range"

Node Name Current Configured Required Status Comment

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

rac2 between 9000.0 & 65500.0 between 9000.0 & 65500.0 between 9000.0 & 65500.0 passed

rac1 between 9000.0 & 65500.0 between 9000.0 & 65500.0 between 9000.0 & 65500.0 passed

Result: Kernel parameter check passed for "ip_local_port_range"

   

Check: Kernel parameter for "rmem_default"

Node Name Current Configured Required Status Comment

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

rac2 4194304 4194304 262144 passed

rac1 4194304 4194304 262144 passed

Result: Kernel parameter check passed for "rmem_default"

   

Check: Kernel parameter for "rmem_max"

Node Name Current Configured Required Status Comment

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

rac2 4194304 4194304 4194304 passed

rac1 4194304 4194304 4194304 passed

Result: Kernel parameter check passed for "rmem_max"

   

Check: Kernel parameter for "wmem_default"

Node Name Current Configured Required Status Comment

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

rac2 262144 262144 262144 passed

rac1 262144 262144 262144 passed

Result: Kernel parameter check passed for "wmem_default"

   

Check: Kernel parameter for "wmem_max"

Node Name Current Configured Required Status Comment

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

rac2 1048576 1048576 1048576 passed

rac1 1048576 1048576 1048576 passed

Result: Kernel parameter check passed for "wmem_max"

   

Check: Kernel parameter for "aio-max-nr"

Node Name Current Configured Required Status Comment

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

rac2 1048576 1048576 1048576 passed

rac1 1048576 1048576 1048576 passed

Result: Kernel parameter check passed for "aio-max-nr"

   

Check: Package existence for "make"

Node Name Available Required Status

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

rac2 make-3.81-3.el5 make-3.81 passed

rac1 make-3.81-3.el5 make-3.81 passed

Result: Package existence check passed for "make"

   

Check: Package existence for "binutils"

Node Name Available Required Status

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

rac2 binutils-2.17.50.0.6-14.el5 binutils-2.17.50.0.6 passed

rac1 binutils-2.17.50.0.6-14.el5 binutils-2.17.50.0.6 passed

Result: Package existence check passed for "binutils"

   

Check: Package existence for "gcc"

Node Name Available Required Status

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

rac2 gcc-4.1.2-48.el5 gcc-4.1.2 passed

rac1 gcc-4.1.2-48.el5 gcc-4.1.2 passed

Result: Package existence check passed for "gcc"

   

Check: Package existence for "gcc-c++"

Node Name Available Required Status

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

rac2 gcc-c++-4.1.2-48.el5 gcc-c++-4.1.2 passed

rac1 gcc-c++-4.1.2-48.el5 gcc-c++-4.1.2 passed

Result: Package existence check passed for "gcc-c++"

   

Check: Package existence for "libgomp"

Node Name Available Required Status

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

rac2 libgomp-4.4.0-6.el5 libgomp-4.1.2 passed

rac1 libgomp-4.4.0-6.el5 libgomp-4.1.2 passed

Result: Package existence check passed for "libgomp"

   

Check: Package existence for "libaio"

Node Name Available Required Status

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

rac2 libaio-0.3.106-5 libaio-0.3.106 passed

rac1 libaio-0.3.106-5 libaio-0.3.106 passed

Result: Package existence check passed for "libaio"

   

Check: Package existence for "glibc"

Node Name Available Required Status

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

rac2 glibc-2.5-49 glibc-2.5-24 passed

rac1 glibc-2.5-49 glibc-2.5-24 passed

Result: Package existence check passed for "glibc"

   

Check: Package existence for "compat-libstdc++-33"

Node Name Available Required Status

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

rac2 compat-libstdc++-33-3.2.3-61 compat-libstdc++-33-3.2.3 passed

rac1 compat-libstdc++-33-3.2.3-61 compat-libstdc++-33-3.2.3 passed

Result: Package existence check passed for "compat-libstdc++-33"

   

Check: Package existence for "elfutils-libelf"

Node Name Available Required Status

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

rac2 elfutils-libelf-0.137-3.el5 elfutils-libelf-0.125 passed

rac1 elfutils-libelf-0.137-3.el5 elfutils-libelf-0.125 passed

Result: Package existence check passed for "elfutils-libelf"

   

Check: Package existence for "elfutils-libelf-devel"

Node Name Available Required Status

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

rac2 elfutils-libelf-devel-0.137-3.el5 elfutils-libelf-devel-0.125 passed

rac1 elfutils-libelf-devel-0.137-3.el5 elfutils-libelf-devel-0.125 passed

Result: Package existence check passed for "elfutils-libelf-devel"

   

Check: Package existence for "glibc-common"

Node Name Available Required Status

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

rac2 glibc-common-2.5-49 glibc-common-2.5 passed

rac1 glibc-common-2.5-49 glibc-common-2.5 passed

Result: Package existence check passed for "glibc-common"

   

Check: Package existence for "glibc-devel"

Node Name Available Required Status

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

rac2 glibc-devel-2.5-49 glibc-devel-2.5 passed

rac1 glibc-devel-2.5-49 glibc-devel-2.5 passed

Result: Package existence check passed for "glibc-devel"

   

Check: Package existence for "glibc-headers"

Node Name Available Required Status

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

rac2 glibc-headers-2.5-49 glibc-headers-2.5 passed

rac1 glibc-headers-2.5-49 glibc-headers-2.5 passed

Result: Package existence check passed for "glibc-headers"

   

Check: Package existence for "libaio-devel"

Node Name Available Required Status

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

rac2 libaio-devel-0.3.106-5 libaio-devel-0.3.106 passed

rac1 libaio-devel-0.3.106-5 libaio-devel-0.3.106 passed

Result: Package existence check passed for "libaio-devel"

   

Check: Package existence for "libgcc"

Node Name Available Required Status

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

rac2 libgcc-4.1.2-48.el5 libgcc-4.1.2 passed

rac1 libgcc-4.1.2-48.el5 libgcc-4.1.2 passed

Result: Package existence check passed for "libgcc"

   

Check: Package existence for "libstdc++"

Node Name Available Required Status

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

rac2 libstdc++-4.1.2-48.el5 libstdc++-4.1.2 passed

rac1 libstdc++-4.1.2-48.el5 libstdc++-4.1.2 passed

Result: Package existence check passed for "libstdc++"

   

Check: Package existence for "libstdc++-devel"

Node Name Available Required Status

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

rac2 libstdc++-devel-4.1.2-48.el5 libstdc++-devel-4.1.2 passed

rac1 libstdc++-devel-4.1.2-48.el5 libstdc++-devel-4.1.2 passed

Result: Package existence check passed for "libstdc++-devel"

   

Check: Package existence for "sysstat"

Node Name Available Required Status

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

rac2 sysstat-7.0.2-3.el5 sysstat-7.0.2 passed

rac1 sysstat-7.0.2-3.el5 sysstat-7.0.2 passed

Result: Package existence check passed for "sysstat"

   

Check: Package existence for "ksh"

Node Name Available Required Status

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

rac2 ksh-20100202-1.el5 ksh-20060214 passed

rac1 ksh-20100202-1.el5 ksh-20060214 passed

Result: Package existence check passed for "ksh"

   

Checking for multiple users with UID value 0

Result: Check for multiple users with UID value 0 passed

   

Check: Current group ID

Result: Current group ID check passed

   

Starting check for consistency of primary group of root user

Node Name Status

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

rac2 passed

rac1 passed

   

Check for consistency of root user's primary group passed

   

Starting Clock synchronization checks using Network Time Protocol(NTP)...

   

NTP Configuration file check started...

The NTP configuration file "/etc/ntp.conf" is available on all nodes

NTP Configuration file check passed

   

Checking daemon liveness...

   

Check: Liveness for "ntpd"

Node Name Running?

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

rac2 yes

rac1 yes

Result: Liveness check passed for "ntpd"

Check for NTP daemon or service alive passed on all nodes

   

Checking NTP daemon command line for slewing option "-x"

PRVF-5436 : The NTP daemon running on one or more nodes lacks the slewing option "-x"

Result: Clock synchronization check using Network Time Protocol(NTP) passed

   

Checking Core file name pattern consistency...

Core file name pattern consistency check passed.

   

Checking to make sure user "grid" is not in "root" group

Node Name Status Comment

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

rac2 passed does not exist

rac1 passed does not exist

Result: User "grid" is not part of "root" group. Check passed

   

Check default user file creation mask

Node Name Available Required Comment

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

rac2 0022 0022 passed

rac1 0022 0022 passed

Result: Default user file creation mask check passed

Checking consistency of file "/etc/resolv.conf" across nodes

   

Checking the file "/etc/resolv.conf" to make sure only one of domain and search entries is defined

File "/etc/resolv.conf" does not have both domain and search entries defined

Checking if domain entry in file "/etc/resolv.conf" is consistent across the nodes...

domain entry in file "/etc/resolv.conf" is consistent across nodes

Checking if search entry in file "/etc/resolv.conf" is consistent across the nodes...

search entry in file "/etc/resolv.conf" is consistent across nodes

Checking file "/etc/resolv.conf" to make sure that only one search entry is defined

All nodes have one search entry defined in file "/etc/resolv.conf"

Checking all nodes to make sure that search entry is "localdomain" as found on node "rac2"

All nodes of the cluster have same value for 'search'

Checking DNS response time for an unreachable node

Node Name Status

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

rac2 passed

rac1 passed

The DNS response time for an unreachable node is within acceptable limit on all nodes

   

File "/etc/resolv.conf" is consistent across nodes

   

Check: Time zone consistency

Result: Time zone consistency check passed

   

Pre-check for cluster services setup was unsuccessful on all the nodes.

rac1@+ASM1 : /home/grid/setup/grid> runInstaller

   

[참고문헌]

   

http://www.allsoft.co.kr/bbs/board.php?bo_table=study91_2&wr_id=30

http://hook.tistory.com/275

http://blog.naver.com/jjuneye?Redirect=Log&logNo=110152112359

http://estenpark.tistory.com/284

http://www.oracle.com/pls/db112/homepage

http://pangsun.tistory.com/

http://www.oracleclub.com/

https://support.oracle.com

   

블로그 이미지

운명을바꾸는자

IT와 함께 살아가는 삶

,



0.TEST환경

  • 1개의 vmwere 에서 TEST함
  • 이전에 보낸 문서는 2개의 vmwere를 이용하여 TEST함.

       

1.TSET서버는 Archive 설정

  • Test서버는 Archive 설정이 않 되어 있어서 우선 alter system switch logfile; 을 3번정도 먼저 실행함.

       

SYS> Alter system switch logfile ;

System altered.

   

SYS> Alter system switch logfile ;

System altered.

   

SYS> Alter system switch logfile ;

System altered.

  

   

   

2.Hot backup 받기

   

  • 현재 backup 상태확인!!

    SYS>

    SYS> SELECT * FROM V$BACKUP;

       

    FILE# STATUS CHANGE# TIME

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

    1 NOT ACTIVE 550922 2012-05-27 14:14:30

    2 NOT ACTIVE 550943 2012-05-27 14:14:49

    3 NOT ACTIVE 550928 2012-05-27 14:14:33

    4 NOT ACTIVE 550937 2012-05-27 14:14:46

    5 NOT ACTIVE 550948 2012-05-27 14:14:52

    6 NOT ACTIVE 0

       

    6 rows selected.

       

  • Tablespace 이름 별로 begin~end 를 걸어주어야 함!!

       

    SYS> alter tablespace system begin backup;

       

    Tablespace altered.

       

    SYS> alter tablespace sysaux begin backup;

       

    Tablespace altered.

       

    SYS> alter tablespace users begin backup;

       

    Tablespace altered.

       

    SYS> alter tablespace undotbs1 begin backup;

       

    Tablespace altered.

       

    SYS> alter tablespace example begin backup;

       

    Tablespace altered.

       

    SYS> alter tablespace TS_AFS begin backup;

       

    Tablespace altered.

       

  • 컨트롤 파일과 HOT backup(데이터파일 리두로그 파일 이동) -> 현재 ACTIVE 상태확인! -> 파일 이동이 끝니면 모두 end 해주어야함.

       

    SYS>

    SYS> alter database backup controlfile to '/home/oracle/control01.ctl';

       

    Database altered.

       

    SYS>

       

       

    SYS> SELECT * FROM V$BACKUP;

       

    FILE# STATUS CHANGE# TIME

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

    1 ACTIVE 551993 2012-05-27 14:29:55

    2 ACTIVE 552010 2012-05-27 14:30:04

    3 ACTIVE 551999 2012-05-27 14:29:58

    4 ACTIVE 552004 2012-05-27 14:30:01

    5 ACTIVE 552016 2012-05-27 14:30:08

    6 ACTIVE 552022 2012-05-27 14:30:11

       

    6 rows selected.

       

  • 파일 이동 /u01/oradata/test

       

    ocp@orcl : /u01/oradata/orcl> ls

    arch1 control03.ctl redo02.log system01.dbf undotbs01.dbf

    control01.ctl example01.dbf redo03.log temp01.dbf users01.dbf

    control02.ctl redo01.log sysaux01.dbf ts_afs.dbf

    ocp@orcl : /u01/oradata/orcl>

    ocp@orcl : /u01/oradata/orcl>

    ocp@orcl : /u01/oradata/orcl> cp *.log /u01/oradata/test

    ocp@orcl : /u01/oradata/orcl>

    ocp@orcl : /u01/oradata/orcl> cp *.dbf /u01/oradata/test

       

    backup creuser.sql orcl_start.sh

    ocp@orcl : /home/oracle>

    ocp@orcl : /home/oracle> mv control* /u01/oradata/test

    ocp@orcl : /home/oracle>

       

    ocp@orcl : /home/oracle> cd /u01/oradata/test

    ocp@orcl : /u01/oradata/test> ls

    control01.ctl redo02.log system01.dbf undotbs01.dbf

    example01.dbf redo03.log temp01.dbf users01.dbf

    redo01.log sysaux01.dbf ts_afs.dbf

    ocp@orcl : /u01/oradata/test>

    ocp@orcl : /u01/oradata/test>

       

  • Hot backup을 완료.

       

    SYS> SELECT * FROM V$BACKUP;

       

    FILE# STATUS CHANGE# TIME

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

    1 ACTIVE 551993 2012-05-27 14:29:55

    2 ACTIVE 552010 2012-05-27 14:30:04

    3 ACTIVE 551999 2012-05-27 14:29:58

    4 ACTIVE 552004 2012-05-27 14:30:01

    5 ACTIVE 552016 2012-05-27 14:30:08

    6 ACTIVE 552022 2012-05-27 14:30:11

       

    6 rows selected.

       

    SYS> alter tablespace system end backup;

       

    Tablespace altered.

       

    SYS> SELECT * FROM V$BACKUP;

       

    FILE# STATUS CHANGE# TIME

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

    1 NOT ACTIVE 551993 2012-05-27 14:29:55

    2 ACTIVE 552010 2012-05-27 14:30:04

    3 ACTIVE 551999 2012-05-27 14:29:58

    4 ACTIVE 552004 2012-05-27 14:30:01

    5 ACTIVE 552016 2012-05-27 14:30:08

    6 ACTIVE 552022 2012-05-27 14:30:11

       

    6 rows selected.

       

    SYS>

       

    SYS> alter tablespace sysaux end backup;

       

    Tablespace altered.

       

    SYS> alter tablespace users end backup;

       

    Tablespace altered.

       

    SYS> alter tablespace undotbs1 end backup;

       

    Tablespace altered.

       

    SYS> alter tablespace example end backup;

       

    Tablespace altered.

       

    SYS> alter tablespace TS_AFS end backup;

       

    Tablespace altered.

       

    SYS> SELECT * FROM V$BACKUP;

       

    FILE# STATUS CHANGE# TIME

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

    1 NOT ACTIVE 551993 2012-05-27 14:29:55

    2 NOT ACTIVE 552010 2012-05-27 14:30:04

    3 NOT ACTIVE 551999 2012-05-27 14:29:58

    4 NOT ACTIVE 552004 2012-05-27 14:30:01

    5 NOT ACTIVE 552016 2012-05-27 14:30:08

    6 NOT ACTIVE 552022 2012-05-27 14:30:11

       

    6 rows selected.

       

  • 로그파일 및 컨트롤 파일, 데이터파일 위치 확인

       

    SYS>

    SYS> select * from v$logfile;

       

    GROUP# STATUS TYPE

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

    MEMBER

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

    IS_

    ---

    3 ONLINE

    /u01/oradata/orcl/redo03.log

    NO

       

    2 ONLINE

    /u01/oradata/orcl/redo02.log

    NO

       

    1 ONLINE

    /u01/oradata/orcl/redo01.log

    NO

       

       

    SYS> select member from v$logfile;

       

    MEMBER

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

    /u01/oradata/orcl/redo03.log

    /u01/oradata/orcl/redo02.log

    /u01/oradata/orcl/redo01.log

       

    SYS> select * from v$controlfile;

       

    STATUS

    -------

    NAME

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

    IS_ BLOCK_SIZE FILE_SIZE_BLKS

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

       

    /u01/oradata/orcl/control01.ctl

    NO 16384 430

       

       

    /u01/oradata/orcl/control02.ctl

    NO 16384 430

       

       

    /u01/oradata/orcl/control03.ctl

    NO 16384 430

       

       

    SYS>

    SYS> select name from v$datafile;

       

    NAME

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

    /u01/oradata/orcl/system01.dbf

    /u01/oradata/orcl/undotbs01.dbf

    /u01/oradata/orcl/sysaux01.dbf

    /u01/oradata/orcl/users01.dbf

    /u01/oradata/orcl/example01.dbf

    /u01/oradata/orcl/ts_afs.dbf

       

    6 rows selected.

     

  • Scott 유저의 현재 데이터 상태확인

       

    SYS> conn scott/tiger

       

    Connected.

    SCOTT> SCOTT>

    SCOTT> select table_name from user_tables;

       

    TABLE_NAME

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

    DEPT

    EMP

    BONUS

    SALGRADE

       

    HOT backup 완료

       

       

3.Scott 유저에 데이터 추가

  • HOT backup recovery 전/후를 보기 위해서!!

       

    SCOTT>

    SCOTT> select table_name from user_tables;

       

    TABLE_NAME

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

    DEPT

    EMP

    BONUS

    SALGRADE

    REGIONS

    LOCATIONS

    DEPARTMENTS

    JOBS

    EMPLOYEES

    JOB_HISTORY

    JOB_GRADES

    COUNTRIES

       

    12 rows selected.

       

    SCOTT>

       

4.Alter system switch logfile

   

SYS>

SYS> Alter system switch logfile ;

   

System altered.

   

SYS> Alter system switch logfile ;

   

System altered.

   

SYS>

   

   

  • 해당 아카이브도 backup 후 같은 위치에 옮기기.(initSID.ora 설정 확인)

       

5.기존의 datafile들 삭제

   

ocp@orcl : /u01/oradata>

ocp@orcl : /u01/oradata> mv orcl orcl.bak

ocp@orcl : /u01/oradata> ls

badcmdfile.rcv flash_recovery_area goodcmdfile.rcv orcl.bak test

ocp@orcl : /u01/oradata>

ocp@orcl : /u01/oradata>

ocp@orcl : /u01/oradata> cd test

ocp@orcl : /u01/oradata/test> ls

control01.ctl example01.dbf redo03.log temp01.dbf users01.dbf

control02.ctl redo01.log sysaux01.dbf ts_afs.dbf

control03.ctl redo02.log system01.dbf undotbs01.dbf

ocp@orcl : /u01/oradata/test>

   

   

6./u01/oradata/orcl->/u01/oradata/test로 복구

   

  • InitSID.ora 컨트롤 파일 및 아카이브 위치 변경

       

    <변경 후>

    *.control_files='/u01/oradata/orcl/control01.ctl','/u01/oradata/orcl/control02.ctl','/u01/oradata/orcl/control03.ctl'

    <변경 전>

    *.control_files='/u01/oradata/test/control01.ctl','/u01/oradata/test/control02.ctl','/u01/oradata/test/control03.ctl'

    <아카이브 위치도 맞쳐주기>

    *.log_archive_format='orcl_%t_%s_%r.arc'

    *.log_archive_dest_1='location=/home/oracle/backup/archive'

       

  • Startup -> 에러 해결

       

    SYS> startup

    ORACLE instance started.

       

    Total System Global Area 167772160 bytes

    Fixed Size 1218316 bytes

    Variable Size 75499764 bytes

    Database Buffers 88080384 bytes

    Redo Buffers bytes

    Database mounted.

    ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

       

    SYS> alter database open resetlogs;

    alter database open resetlogs

    *

    ERROR at line 1:

    ORA-01157: cannot identify/lock data file 1 - see DBWR trace file

    ORA-01110: data file 1: '/u01/oradata/orcl/system01.dbf'

       

  • 각 데이터파일의 위치를 재지정해줌.

       

    SYS> ALTER DATABASE RENAME FILE '/u01/oradata/orcl/system01.dbf' to '/u01/oradataSYS> ALTER DATABASE RENAME FILE '/u01/oradata/orcl/system01.dbf' to '/u01/oradataALTER DATABASE RENAME FILE '/u01/oradata/orcl/system01.dbf' to '/u01/oradata/test/system01.dbf';

       

    ALTER DATABASE RENAME FILE '/u01/oradata/orcl/sysaux01.dbf' to '/u01/oradata/testALTER DATABASE RENAME FILE '/u01/oradata/orcl/sysaux01.dbf' to '/u01/oradata/test/sysaux01.dbf';

       

    ALTER DATABASE RENAME FILE '/u01/oradata/orcl/example01.dbf' to '/u01/oradata/tesALTER DATABASE RENAME FILE '/u01/oradata/orcl/example01.dbf' to '/u01/oradata/test/example01.dbf';

       

    ALTER DATABASE RENAME FILE '/u01/oradata/orcl/temp01.dbf' to '/u01/oradata/test/tALTER DATABASE RENAME FILE '/u01/oradata/orcl/temp01.dbf' to '/u01/oradata/test/temp01.dbf';

       

    ALTER DATABASE RENAME FILE '/u01/oradata/orcl/users01.dbf' to '/u01/oradata/test/ALTER DATABASE RENAME FILE '/u01/oradata/orcl/users01.dbf' to '/u01/oradata/test/users01.dbf';

       

    ALTER DATABASE RENAME FILE '/u01/oradata/orcl/undotbs01.dbf' to '/u01/oradata/tesALTER DATABASE RENAME FILE '/u01/oradata/orcl/undotbs01.dbf' to '/u01/oradata/test/undotbs01.dbf';

       

    ALTER DATABASE RENAME FILE '/u01/oradata/orcl/ts_afs.dbf' to '/u01/oradata/test/tALTER DATABASE RENAME FILE '/u01/oradata/orcl/ts_afs.dbf' to '/u01/oradata/test/ts_afs.dbf';

       

    Database altered.

       

    SYS> SYS>

       

    ALTER DATABASE RENAME FILE '/u01/oradata/orcl/redo01.log' to '/u01/oradata/test/rALTER DATABASE RENAME FILE '/u01/oradata/orcl/redo01.log' to '/u01/oradata/test/redo01.log';

       

    ALTER DATABASE RENAME FILE '/u01/oradata/orcl/redo02.log' to '/u01/oradata/test/rALTER DATABASE RENAME FILE '/u01/oradata/orcl/redo02.log' to '/u01/oradata/test/redo02.log';

       

    ALTER DATABASE RENAME FILE '/u01/oradata/orcl/redo03.log' to '/u01/oradata/test/rALTER DATABASE RENAME FILE '/u01/oradata/orcl/redo03.log' to '/u01/oradata/test/redo03.log';

       

    Database altered.

       

    SYS> SYS>

    Database altered.

       

    SYS> SYS>

    Database altered.

       

    SYS> SYS>

    Database altered.

       

    SYS> SYS>

    Database altered.

       

    SYS> SYS>

    Database altered.

       

    SYS> SYS> SYS>

    Database altered.

       

    SYS> SYS>

    Database altered.

       

    SYS> SYS>

    Database altered.

       

  • 현재 상태확인 -> current 상태의 redolog 확인.

       

       

    SYS> select * from v$backup;

       

    FILE# STATUS CHANGE# TIME

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

    1 ACTIVE 551993 2012-05-27 14:29:55

    2 ACTIVE 552010 2012-05-27 14:30:04

    3 ACTIVE 551999 2012-05-27 14:29:58

    4 ACTIVE 552004 2012-05-27 14:30:01

    5 ACTIVE 552016 2012-05-27 14:30:08

    6 ACTIVE 552022 2012-05-27 14:30:11

       

    6 rows selected.

       

    SYS> select * from v$log;

       

    GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE#

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

    FIRST_TIME

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

    1 1 17 10485760 1 YES INACTIVE 551980

    2012-05-27 14:29:19

       

    3 1 16 10485760 1 YES INACTIVE 551978

    2012-05-27 14:29:18

       

    2 1 18 10485760 1 NO CURRENT 551983

    2012-05-27 14:29:25

       

       

    SYS> select * from v$logfile;

       

    GROUP# STATUS TYPE

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

    MEMBER

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

    IS_

    ---

    3 ONLINE

    /u01/oradata/test/redo03.log

    NO

       

    2 ONLINE

    /u01/oradata/test/redo02.log

    NO

       

    1 ONLINE

    /u01/oradata/test/redo01.log

    NO

       

  • Recover database;

       

    SYS> recover database using backup controlfile;

    ORA-00279: change 551993 generated at 05/27/2012 14:29:55 needed for thread 1

    ORA-00289: suggestion : /home/oracle/backup/archive/orcl_1_18_643126719.arc

    ORA-00280: change 551993 for thread 1 is in sequence #18

       

       

    Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

    /u01/oradata/test/redo02.log

    Log applied.

    Media recovery complete.

    SYS> alter database open resetlogs;

       

    Database altered.

       

    SYS>

    SYS>

    SYS> shutdown immediate

    Database closed.

    Database dismounted.

    ORACLE instance shut down.

    SYS> startup

    ORACLE instance started.

       

    Total System Global Area 167772160 bytes

    Fixed Size 1218316 bytes

    Variable Size 75499764 bytes

    Database Buffers 88080384 bytes

    Redo Buffers 2973696 bytes

    Database mounted.

    Database opened.

    SYS>

       

  • Scott 유저 상태확인

       

    SCOTT>

    SCOTT> select table_name from user_tables;

       

    TABLE_NAME

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

    DEPT

    EMP

    BONUS

    SALGRADE

       

    SCOTT>

    SCOTT>

    SCOTT>

       

  • 결론 : HOT backup 상태의 데이터가 들어가 있음.

       

  • 발생된 에러들..
  • 해당 에러는 TEST 서버에서 아카이브를 먼저 생성해 놓지 않고 Hot backup을 받은 뒤에 recovery를 하려고 했더니 해당 에러가 발생됨.
  • HOT backup을 하기전에 아카이브를 생성한 뒤(alter system switch logfile;) 백업을 받고 -> 데이터 변경 이후에 아카이브를 생성(alter system switch logfile;) 후 리커버리 -> hot backup 된 데이터 상태로 돌아감.

       

블로그 이미지

운명을바꾸는자

IT와 함께 살아가는 삶

,

heapSort

1. IT Story/Development 2012. 4. 4. 15:51



heapSort

#include<iostream>
#include<iomanip>
#include "maxHeap.h"
using namespace std;

#define MAX_ARY 15


void heapSort(int list[], int last);

int main()
{

 int ary[MAX_ARY]={12,12,23,54,67,43,67,87,56,4,3,2,54,67,9};


 cout << "before sort"<<endl;

 for(int i=0; i<MAX_ARY; i++)
 {
  cout<<setw(3)<<ary[i];
 }

 cout<<endl;

 cout<<"after heap sort"<<endl;

 heapSort(ary, MAX_ARY-1);

 for(int i=0; i<MAX_ARY; i++)
 {
  cout<<setw(3)<<ary[i];
 }
 cout<<endl;

}

void heapSort(int list[], int last)
{
 int sorted;//index
 int hold;
 int walker;
 //heap building 하기

 for(walker=1; walker <= last; walker++)
 {
  reheapUp(list, walker);
 }
 //sort

 int pass=1;


 sorted = last;
 while(sorted >0)
 {
  hold=list[0];
  list[0] = list[sorted];
  list[sorted]=hold;
  sorted--;
  reheapDown(list, 0, sorted);

  cout<<"PASS"<<pass++<<":";
  for(int i=0; i<MAX_ARY; i++)
  {
  cout<<setw(3)<<list[i];
  }
  cout<<endl;
 }
}

 

 

#define HEAP_SIZE 15

void reheapUp(int heap[], int newNode);
void reheapDown(int heap[], int root, int last);
void buildHeap(int heap[], int size);

bool insertHeap(int heap[], int& last, int data);
bool deleteHeap(int heap[], int& heapLast, int& dataOut);
void swap(int heap[],int root,int largeChildIndex);

void reheapUp(int heap[], int newNode)
{
 int parent;
 //int hold;


 if (newNode !=0) // if(newNode)
 {
  parent=(newNode-1)/2;

  if(heap[newNode] > heap[parent])
  {
   swap(heap, newNode, parent);

   /*hold = heap[parent];
   heap[parent]=heap[newNode];
   heap[newNode] = hold;*/

   reheapUp(heap, parent);
  }
 }
 return;
}

 

void reheapDown(int heap[], int root, int last)
{
 //int hold;
 int rightKey;
 int leftKey;
 int largeChildKey, largeChildIndex;

 if((root * 2 + 1) <= last)
 {
  leftKey=heap[root * 2 + 1];

  if(root * 2 + 2<=last)
  {
   rightKey = heap[root * 2 + 2];
  }
  else
  {
   rightKey = -1; // 아주작은값!
  }
  // 자식들중에 큰 키 찾기
  
  if(leftKey>rightKey)
  {
   
   largeChildKey = leftKey;
   largeChildIndex = root * 2 + 1;
  }
  else
  {
   largeChildKey = rightKey;
   largeChildIndex = root * 2 + 2;
  }

  if(heap[root]< largeChildKey)
  {
   swap(heap, root, largeChildIndex);

   /*int hold = heap[root];
   heap[root]=heap[largeChildIndex];
   heap[largeChildIndex] = hold;*/
   
   reheapDown(heap, largeChildIndex, last);
  }
 }
 return;
}

void swap(int heap[],int newNodeRoot,int parentLargeChildIndex)
{
 int hold = heap[newNodeRoot];
 heap[newNodeRoot]=heap[parentLargeChildIndex];
 heap[parentLargeChildIndex] = hold;
}

bool insertHeap(int heap[], int& last, int data)
{
 

 if(last == HEAP_SIZE -1)
 {return false;}

 ++last;
 heap[last]=data;
 reheapUp(heap, last);

 return true;
}
bool deleteHeap(int heap[], int& last, int& dataOut)
{
 
 if(last<0)
 {
  return false;
 }
 
 dataOut = heap[0];
 heap[0]=heap[last];
 last--;
 reheapDown(heap, 0, last);
 return true;
}

'1. IT Story > Development' 카테고리의 다른 글

무료 IT 개발 언어공부, 코딩공부 유튜브 TOP5  (0) 2021.01.26
selectionSort  (0) 2012.04.04
shellSort  (0) 2012.04.04
오픈 API를 이용한 간단한 번역프로그램  (0) 2012.03.29
ChatClient  (0) 2012.03.29
MultiChatServer  (0) 2012.03.29
MultiChatClient  (0) 2012.03.29
큐를 이용한 간단한 구직Pro  (0) 2012.03.29
블로그 이미지

운명을바꾸는자

IT와 함께 살아가는 삶

,



selectionSort

#include<iostream>
#include<iomanip>
using namespace std;

#define MAX_ARY 15


void selectionSort(int list[], int last);

int main()
{

 int ary[MAX_ARY]={12,12,23,54,67,43,67,87,56,4,3,2,54,67,9};


 cout << "before sort"<<endl;

 for(int i=0; i<MAX_ARY; i++)
 {
  cout<<setw(3)<<ary[i];
 }

 cout<<endl;

 cout<<"after selection sort"<<endl;

 selectionSort(ary, MAX_ARY-1);

 for(int i=0; i<MAX_ARY; i++)
 {
  cout<<setw(3)<<ary[i];
 }
 cout<<endl;

}

void selectionSort(int list[], int last)
{
 int current;
 int smallest; 
 int hold;
 int walker;

 for(current = 0; current < last; current++)
 {
  smallest=current;
  
  for(walker = current +1; walker<=last; walker++)
  {
   if(list[walker]< list[smallest])
   {
    smallest = walker;
   }
  }//for
  //최소값이 선택됨. 현재요소와 교환
  hold = list[current];
  list[current] = list[smallest];
  list[smallest] = hold;
  cout<<"PASS"<< current+1<<":";
  for(int i=0; i<MAX_ARY; i++)
  {
  cout<<setw(3)<<list[i];
  }
  cout<<endl;
 }
}

'1. IT Story > Development' 카테고리의 다른 글

무료 IT 개발 언어공부, 코딩공부 유튜브 TOP5  (0) 2021.01.26
heapSort  (0) 2012.04.04
shellSort  (0) 2012.04.04
오픈 API를 이용한 간단한 번역프로그램  (0) 2012.03.29
ChatClient  (0) 2012.03.29
MultiChatServer  (0) 2012.03.29
MultiChatClient  (0) 2012.03.29
큐를 이용한 간단한 구직Pro  (0) 2012.03.29
블로그 이미지

운명을바꾸는자

IT와 함께 살아가는 삶

,


shellSort

#include<iostream>
#include<iomanip>
using namespace std;



#define MAX_ARY 15

void shellSort(int list[], int last);

int main()
{

 int ary[MAX_ARY]={12,12,23,54,67,43,67,87,56,4,3,2,54,67,9};


 cout << "before sort"<<endl;

 for(int i=0; i<MAX_ARY; i++)
 {
  cout<<setw(3)<<ary[i];
 }

 cout<<endl;

 cout<<"after sort"<<endl;

 shellSort(ary, MAX_ARY-1);

 for(int i=0; i<MAX_ARY; i++)
 {
  cout<<setw(3)<<ary[i];
 }
 cout<<endl;

}

void shellSort(int list[], int last)
{
 int hold;
 int incre;
 int curr;
 int walker;
 incre = last /2;
 int pass =1;

 while(incre != 0)
 {
  for(curr=incre; curr<=last; curr++)
  {
   hold = list[curr];
   walker = curr - incre;

   while(walker>=0 && hold < list[walker])
   {
    list[walker + incre] = list[walker];
    walker = walker - incre;
   }//while(walker>=0 && hold < list[walker])
   list[walker + incre] = hold;
  }//for
  //pass출력하기
  
  cout<<"PASS"<<pass++<<"("<<incre<<")"<<":";

  for(int i=0; i<MAX_ARY; i++)
  {
   cout<<setw(3)<<list[i];
  }
  cout<<endl;

  incre=incre/2;

 }//while(incre!=0)
 
}

 

 

'1. IT Story > Development' 카테고리의 다른 글

무료 IT 개발 언어공부, 코딩공부 유튜브 TOP5  (0) 2021.01.26
heapSort  (0) 2012.04.04
selectionSort  (0) 2012.04.04
오픈 API를 이용한 간단한 번역프로그램  (0) 2012.03.29
ChatClient  (0) 2012.03.29
MultiChatServer  (0) 2012.03.29
MultiChatClient  (0) 2012.03.29
큐를 이용한 간단한 구직Pro  (0) 2012.03.29
블로그 이미지

운명을바꾸는자

IT와 함께 살아가는 삶

,