리눅스 sqlplus 설치 - linugseu sqlplus seolchi

Oracle database is the popular database that is commonly used in transaction processing, data warehousing, and various other applications. SQLplus is an interface that is developed by Oracle itself. The main purpose of SQLplus is to interact with the Oracle DB and run various queries or code. We can say SQLplus is a powerful tool rather than an interface. It acts like an editor, writer and also executes the SQL queries and displays the output. In this article, we will be going through the installation steps of SQLplus in the Linux Operating System.

Installing SQLplus on Linux

Follow the below steps to install SQLPlus on Linux Operating System:

Step 1: Download theBasic Package (ZIP) by using the following command:

wget https://download.oracle.com/otn_software/linux/instantclient/214000/instantclient-basic-linux.x64-21.4.0.0.0dbru.zip

리눅스 sqlplus 설치 - linugseu sqlplus seolchi

Step 2: Download the SQL*Plus Package (ZIP) by using the following command:

wget https://download.oracle.com/otn_software/linux/instantclient/214000/instantclient-sqlplus-linux.x64-21.4.0.0.0dbru.zip 

리눅스 sqlplus 설치 - linugseu sqlplus seolchi

Step 3: Make a new directory for the instant client.

sudo mkdir -p /opt/oracle

리눅스 sqlplus 설치 - linugseu sqlplus seolchi

Step 4: Unzip the Basic Package in the newly-created directory.

sudo unzip -d /opt/oracle instantclient-basic-linux.x64-21.4.0.0.0dbru.zip

리눅스 sqlplus 설치 - linugseu sqlplus seolchi

Step 5: Unzip the SQL *Plus Package in the newly-created directory.

sudo unzip -d /opt/oracle instantclient-sqlplus-linux.x64-21.4.0.0.0dbru.zip

리눅스 sqlplus 설치 - linugseu sqlplus seolchi

Step 6: List out the file contents of the newly-created directory.

cd /opt/oracle/instantclient_21_4 && find . -type f | sort

리눅스 sqlplus 설치 - linugseu sqlplus seolchi

Step 7: Set the LD_LIBRARY_PATH  in your ~/.bashrc source file.

export LD_LIBRARY_PATH=/opt/oracle/instantclient_21_4:$LD_LIBRARY_PATH

리눅스 sqlplus 설치 - linugseu sqlplus seolchi

Step 8: Set the PATH env vars in your ~/.bashrc

export PATH=$LD_LIBRARY_PATH:$PATH

리눅스 sqlplus 설치 - linugseu sqlplus seolchi

Step 9: Source your ~/.bashrc file

source ~/.bashrc

리눅스 sqlplus 설치 - linugseu sqlplus seolchi

Step 10: Run sqlplus -V command to confirm it’s installed or not.

sqlplus -V

리눅스 sqlplus 설치 - linugseu sqlplus seolchi

-테스트베드 OS 정보.

$ hostnamectl
...
Operating System: CentOS Linux 8
Kernel: Linux 4.18.0-348.7.1.el8_5.x86_64
Architecture: x86-64
...

-하단의링크접속원하는오라클클라이언트버전에 맞춰서 Basic Package (RPM) & SQL*Plus Package (RPM) 파일다운로드.

  • https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html
리눅스 sqlplus 설치 - linugseu sqlplus seolchi

-root 계정으로접속다운로드한 *.rpm 파일설치.

# yum install -y oracle-instantclient19.15-basic-19.15.0.0.0-1.x86_64.rpm
마지막 메타자료 만료확인 0:24:45 이전인: 2022년 04월 29일 (금) 오후 03시 29분 50초.
종속성이 해결되었습니다.
==================================================================================================================================================
 꾸러미                                            구조                     버전                             레포지터리                      크기
==================================================================================================================================================
설치 중:
 oracle-instantclient19.15-basic                   x86_64                   19.15.0.0.0-1                    @commandline                    51 M

연결 요약
==================================================================================================================================================
설치  1 꾸러미

전체 크기: 51 M
설치된 크기 : 226 M
꾸러미 내려받기중:
연결 확인 실행 중
연결 확인에 성공했습니다.
연결 시험 실행 중
연결 시험에 성공했습니다.
연결 실행 중
  준비 중           :                                                                                                                         1/1 
  설치 중           : oracle-instantclient19.15-basic-19.15.0.0.0-1.x86_64                                                                    1/1 
  스크립트릿 실행 중: oracle-instantclient19.15-basic-19.15.0.0.0-1.x86_64                                                                    1/1 
  확인 중           : oracle-instantclient19.15-basic-19.15.0.0.0-1.x86_64                                                                    1/1 

설치되었습니다:
  oracle-instantclient19.15-basic-19.15.0.0.0-1.x86_64                                                                                            

완료되었습니다!

# yum install -y oracle-instantclient19.15-sqlplus-19.15.0.0.0-1.x86_64.rpm
마지막 메타자료 만료확인 0:25:34 이전인: 2022년 04월 29일 (금) 오후 03시 29분 50초.
종속성이 해결되었습니다.
==================================================================================================================================================
 꾸러미                                             구조                    버전                              레포지터리                     크기
==================================================================================================================================================
설치 중:
 oracle-instantclient19.15-sqlplus                  x86_64                  19.15.0.0.0-1                     @commandline                  687 k

연결 요약
==================================================================================================================================================
설치  1 꾸러미

전체 크기: 687 k
설치된 크기 : 3.1 M
꾸러미 내려받기중:
연결 확인 실행 중
연결 확인에 성공했습니다.
연결 시험 실행 중
연결 시험에 성공했습니다.
연결 실행 중
  준비 중           :                                                                                                                         1/1 
  설치 중           : oracle-instantclient19.15-sqlplus-19.15.0.0.0-1.x86_64                                                                  1/1 
  스크립트릿 실행 중: oracle-instantclient19.15-sqlplus-19.15.0.0.0-1.x86_64                                                                  1/1 
  확인 중           : oracle-instantclient19.15-sqlplus-19.15.0.0.0-1.x86_64                                                                  1/1 

설치되었습니다:
  oracle-instantclient19.15-sqlplus-19.15.0.0.0-1.x86_64                                                                                          

완료되었습니다!

-다운로드한 *.rpm 파일설치간하단의에러발생할경우, libaio 라이브러리설치해야.

Failed dependencies:libaio is needed by oracle-instantclient19.15-basiclite-19.15.0.0.0-1.x86_64

-libaio 라이브러리 설치 방법.

$ yum install -y libaio

-"/etc/profile.d/oracle.sh" 생성하단과같이 $ORACLE_HOME, $TNS_ADMIN 설정추가.

 # vi /etc/profile.d/oracle.sh
export ORACLE_HOME=/usr/lib/oracle/19.15/client64
export TNS_ADMIN=/usr/lib/oracle/19.15/client64/bin

-oracle instant client 사용하려는계정의 .bash_profile하단과같이 $ORACLE_HOME, $TNS_ADMIN, $PATH 설정추가 .bash_profile 적용.

$ vi ~/.bash_profile
export NLS_LANG=KOREAN_KOREA.AL32UTF8
export ORACLE_HOME=/usr/lib/oracle/19.15/client64
export TNS_ADMIN=/usr/lib/oracle/19.15/client64/bin
export PATH=${PATH}:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/lib

-oracle instant client에서 oracle server접속(sqlplus)위해서 tnsnames.ora 설정.

$ vi $TNS_ADMIN/tnsnames.ora
serviceName =
  (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = xxx.xxx.xxx.xxx)(PORT = xxxx))
        (CONNECT_DATA =
                (SERVER = DEDICATED)
                (SID = sid)
        )
 )

-oracle instant client에서 oracle server접속(sqlplus) 확인.

$ sqlplus id/passwd@serviceName

SQL*Plus: Release 19.0.0.0.0 - Production on 금 4월 29 16:15:19 2022
Version 19.15.0.0.0
Copyright (c) 1982, 2022, Oracle.  All rights reserved.
마지막 성공한 로그인 시간: 금 4월  29 2022 16:14:30 +09:00
다음에 접속됨:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL>