[Oracle - 리눅스 서버에서 RDS 접속 방법] use. oracle client

■ Oracle버전에 맞는 client 다운로드

basic & sqlplus

https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html

 

Instant Client for Linux x86-64 (64-bit)

Base - one of these packages is required Tools - optional packages Development and Runtime - optional packages

www.oracle.com

 

 

[root@ip-172-31-38-100 ~]# wget https://download.oracle.com/otn_software/linux/instantclient/1919000/oracle-instantclient19.19-basic-19.19.0.0.0-1.x86_64.rpm
--2023-04-27 03:41:02--  https://download.oracle.com/otn_software/linux/instantclient/1919000/oracle-instantclient19.19-basic-19.19.0.0.0-1.x86_64.rpm
Resolving download.oracle.com (download.oracle.com)... 23.45.56.109
Connecting to download.oracle.com (download.oracle.com)|23.45.56.109|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 53553372 (51M) [application/x-redhat-package-manager]
Saving to: ‘oracle-instantclient19.19-basic-19.19.0.0.0-1.x86_64.rpm’

oracle-instantclient19.19-bas 100%[==============================================>]  51.07M  37.0MB/s    in 1.4s    

2023-04-27 03:41:04 (37.0 MB/s) - ‘oracle-instantclient19.19-basic-19.19.0.0.0-1.x86_64.rpm’ saved [53553372/53553372]





[root@ip-172-31-38-100 ~]# wget https://download.oracle.com/otn_software/linux/instantclient/1919000/oracle-instantclient19.19-sqlplus-19.19.0.0.0-1.x86_64.rpm
--2023-04-27 03:41:11--  https://download.oracle.com/otn_software/linux/instantclient/1919000/oracle-instantclient19.19-sqlplus-19.19.0.0.0-1.x86_64.rpm
Resolving download.oracle.com (download.oracle.com)... 23.45.56.109
Connecting to download.oracle.com (download.oracle.com)|23.45.56.109|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 703388 (687K) [application/x-redhat-package-manager]
Saving to: ‘oracle-instantclient19.19-sqlplus-19.19.0.0.0-1.x86_64.rpm’

oracle-instantclient19.19-sql 100%[==============================================>] 686.90K  3.33MB/s    in 0.2s    

2023-04-27 03:41:11 (3.33 MB/s) - ‘oracle-instantclient19.19-sqlplus-19.19.0.0.0-1.x86_64.rpm’ saved [703388/703388]





[root@ip-172-31-38-100 ~]# yum -y install oracle-instantclient19.19-basic-19.19.0.0.0-1.x86_64.rpm
[root@ip-172-31-38-100 ~]# yum -y install oracle-instantclient19.19-sqlplus-19.19.0.0.0-1.x86_64.rpm

 

 

■ $ORACLE_HOME , $TNS_ADMIN 추가

[root@ip-~]# vi /etc/profile.d/oracle.sh

export ORACLE_HOME=/usr/lib/oracle/19.19/client64
export TNS_ADMIN=/usr/lib/oracle/19.19/client64/bin

 

 

■ tnsnames.ora 설정 & 접속

[root@ip-172-31-47-148 ~]# vi /usr/lib/oracle/19.19/client64/bin/tnsnames.ora

ORCL =                                                                    
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = kimjeonghyun.clb8vfq4410k.ap-northeast-2.rds.amazonaws.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )





[root@ip-172-31-47-148 ~]# sqlplus admin/<비밀번호>@ORCL
SQL*Plus: Release 19.0.0.0.0 - Production on Thu May 25 01:18:18 2023
Version 19.19.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.

Last Successful login time: Thu May 25 2023 00:55:55 +00:00

Connected to:
Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production
Version 19.19.0.0.0

SQL>

 

 

■ client 접속 2

[root@ip-172-31-38-100 bin]# sqlplus 'admin@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=kjh-db.clb8vfq4410k.ap-northeastCT_DATA=(SID=DATABASE)))'
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Apr 27 03:49:40 2023

Version 19.19.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.

Enter password: <비밀번호 입력>

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.18.0.0.0

SQL>