환경)
- vmware 15.5 pro
- centos7
- jdk 11.0.2
이전 단계) 오라클 설치 진행할 리눅스 계정 생성 (선택사항. 이미 생성된 계정에서 오라클을 설치해도 된다)
[centos7] 리눅스 계정 생성 (tistory.com)
오라클을 설치할 계정으로 접속한 후 다음 단계들로 설치를 진행한다.
1. zip 및 unzip 패키지와 함께 RDBMS에 필요한 모든 종속성을 설치
$ sudo yum install -y binutils.x86_64 compat-libcap1.x86_64 gcc.x86_64 gcc-c++.x86_64 glibc.i686 glibc.x86_64 glibc-devel.i686 glibc-devel.x86_64 ksh compat-libstdc++-33 libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64 libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 libXi.i686 libXi.x86_64 libXtst.i686 libXtst.x86_64 make.x86_64 sysstat.x86_64 zip unzip
2. 임계값 수정
# vi /etc/sysctl.conf
kernel.shmmax = 68719476736
kernel.shmall = 10523004
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.aio-max-nr = 1048576
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
2-1. 적용
# sysctl -p
# sysctl -a
3. 제한설정
# vi /etc/security/limits.conf
sd soft nproc 65536
sd hard nproc 65536
sd soft nofile 65536
sd hard nofile 65536
(값은 사용자 지정. 여기에선 65536으로 통일해주었다.
맨 앞에는 사용자 계정명을 적어주면 된다.
가령 사용자 계정명이 sd일 경우 위와 같이 내용을 추가해준다)
4. SELinux 설정 해제
$ setenforce 0
$ vi /etc/selinux/config
SELINUX=disabled
5. 방화벽 정지
# systemctl stop firewalld
# systemctl disable firewalld
6. 오라클 설치
https://edelivery.oracle.com/osdc/faces/SoftwareDelivery
-oracle12c 검색
-DLP: Oracle Database 12c Enterprise Edition 12.2.0.1.0 ( Oracle Database Enterprise Edition )
선택
-우측 상단의 continue 선택
-Oracle Database 12.2.0.1.0 선택
- platforms/languse ->설치하고자하는 os 에 맞게 선택 (여기에서는 linux86-64)
V839960-01.zip 이라는 이름으로 다운로드 된다. (3.3기가 정도)
해당 zip 파일을 centos 서버에 업로드.
$ unzip 파일명
으로 압축을 푼다.
압축 푼 경로 하위에
'database' 라는 이름으로 디렉터리 생성됨
여기에서 runInstaller 라는 파일을 실행해줘야하는데
여기서부터는 xwindow가 마련되어있는 centos 터미널에서
$ ./runInstaller
를 실행시켜줘야 오라클 설치 화면을 보며 설치를 진행할 수 있다.
xwindow가 있는 centos 화면 상에서 자체 터미널 실행시키고 database 디렉터리로 이동 후 runInstaller 실행.
이후 설치 참고)
Oracle 12c CentOS 7에 설치 - CURVC DevOps - Confluence
설치 중 이부분의 값은 기본 설정값으로 진행해도 되지만 이후 db 연결 시 알아둬야할 정보니 기억해둔다.
7. 설치중 필요조건 검사에서 조건 불충족시.
1) 교체크기 - 시스템에서 충분한 총 교체공간을 사용할 수 있는지 여부를 테스트하는 필요조건
예상값: ~~ GB
실제값: ~~ GB
~~노드에 사용가능한 교체 크기가 부족합니다.
최소교체공간요구사항을 충족하도록 교체 크기를 늘리십시오,
-->swap공간(크기)이 부족해서 발생되는 문제다. swap 크기 늘리는 방법으로 해결한다
swap 메모리 늘리는 방법중 swap파일을 생성해주는 방법으로 진행한다.
현재 스왑 공간의 크기 확인
$ free
swap메모리확인
$ free -h
swap 상세사이즈확인
$ swapon -s, free
swap크기확장 (4기가정도 늘려줘야하는상황이라 4097152로 입력함)
(home/sd 하위에 swapfile이라는 파일이 생성되게함)
$ dd if=/dev/zero of=/home/sd/swapfile bs=1024 count=4097152
$ mkswap /home/sdi/swapfile
->실제 스왑파일을 바로 사용하는 것이 아니라 커널이 이 파일을 가상 메모리로 사용할 수 있도록 하기 위한 명령어.
$ sudo swapon /home/sd/swapfile
->생성한 스왑파일로 스왑공간을 활성화하는 명령어.
$ free
$ free -mt
->늘어난 스왑공간을 확인.
여기서 멈추고 나중에 reboot 하면 스왑공간이 다시 원래대로 돌아온다
swapon~ 이 활성화 명령을 시스템 리부트시 동작할수있게 해주기 위해 /etc/fstab 에 등록시켜준다.
(영구등록을 진행)
루트에서
# vi /etc/fstab
맨 하단에
/home/sd/swapfile swap swap defaults 0 0
다음과 같은 내용을 추가.
(/home/sd/swapfile: swapfile 스왑파일 생성해준 경로를 앞에 써주는 것)
2) 최대스텍크기 문제.
$ ulimit -s 로 스택크기확인
스택크기늘리기::
10240가 필요하다하면
$ ulimit -s 10240
명령어로 늘려주면된다.
---환경변수 설정vi /home/sd/.bash_profile
(홈디렉터리 위치에서 vi ~/.bash_profile 로 들어가도 된다)
오라클 설치 경로(오라클 홈): /home/sd/app/sdi/product/12.2.0/dbhome_1/
export ORACLE_BASE=/home/sd/app/sd
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1/
export ORACLE_SID=orcl
export NLS_LANG=KOREAN_KOREA.AL32UTF8
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export PATH=$PATH:$ORACLE_HOME/bin
위와 같은 내용 추가.
--> 수정 후 전체 환경 변수 내용
export JAVA_HOME=/home/sd/jdk-11.0.2
export ORACLE_BASE=/home/sd/app/sd
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1/
export ORACLE_SID=orcl
export NLS_LANG=KOREAN_KOREA.AL32UTF8
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
PATH=$JAVA_HOME/bin:$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin
export PATH
[오라클 접속]
1. 최초 접속 (띄어쓰기에 주의)
$ sqlplus / as sysdba
2. User. 생성
2-1. 세션변경
SQL> alter session set "_ORACLE_SCRIPT"=true;
2-2. 유저 생성
SQL> create user 유저명 identified by 비번 default tablespace USERS temporary tablespace TEMP;
2-3. 생성된 유저에 권한 부여
SQL> grant create session to 유저명;
SQL> grant connect, resource to 유저명;
2-4. 생성한 유저로 사용자 변경
SQL> alter user 유저명 default tablespace users quota unlimited on users;
dbeaver로 오라클 연결
host: 오라클 설치를 진행한 리눅스 서버의 ip 를 입력
database: 오라클 설치 진행시 database identifiers 부분을 기본 설정으로 하고 넘어갔다면 sid가 orcl로 설정되어있을 것이다. 우측 드롭다운에서 sid말고 service name을 선택할수도있는데 이는 오라클 설치의 해당 단계에서 global database name값에 해당한다.
username,password: 오라클 접속 후 생성한 유저의 이름과 비번을 넣어준다.
이후 test connection 진행. 다운로드를 필요로하는 것들이 나오면 확인버튼(다운로드버튼)눌러 다운 진행한다.
참조)
'Server, OS > 리눅스' 카테고리의 다른 글
.bashrc 와 .bash_profile 의 차이 (0) | 2022.11.18 |
---|---|
파일 시스템의 사용 가능 공간 표시 (df -k) (0) | 2022.11.15 |
[centos7] jdk 파일로 설치 (0) | 2022.09.15 |
[centos7] 리눅스 계정 생성 (0) | 2022.09.15 |
[linux] 하위 디렉터리 포함 디렉터리 삭제 (0) | 2022.07.20 |