๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

Back-end/DB

[Oracle] Rocky Linux์— Oracle Instant Client ์„ค์น˜ํ•˜๊ธฐ *์˜ค๋ผํด ์—ฐ๋™ 1ํƒ„*

728x90
๋ฐ˜์‘ํ˜•

๐ŸŸก ๋ฆฌ๋ˆ…์Šค์— Oracle Instant Client ์„ค์น˜ํ•˜๋Š” ๋ฐฉ๋ฒ•

โค๏ธ OS : Rocky Linux

โค๏ธ Tools : Xshell 7, Xftp 7, VirtualBox

 

 

 

 

Step 1. ์˜ค๋ผํด ์ธ์Šคํ„ดํŠธ ํด๋ผ์ด์–ธํŠธ ๋‹ค์šด๋กœ๋“œ ์‚ฌ์ดํŠธ์— ์ ‘์†ํ•˜๊ธฐ

 

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

=> Instant Client Package ์—์„œ Basic๊ณผ SQL*Plus ๋‹ค์šด๋กœ๋“œ!

๋‚˜๋Š” basic, jdbc, sdk, sqlplus๋ฅผ ๋‹ค์šด๋ฐ›์•˜๋‹ค. basic์€ ํ•„์ˆ˜๋กœ ๋‹ค์šด ๋ฐ›์•„์•ผ ํ•œ๋‹ค๋Š” ์  ์œ ์˜ํ•˜๊ธฐ

 

 

Step 2. ๋‹ค์šด๋ฐ›์€ ํŒŒ์ผ ์••์ถ• ํ•ด์ œํ•˜๊ธฐ
for i in instantclient*zip; do unzip $i;done

=> ๋ฏธ๋ฆฌ zip ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•œ ํ›„ ์••์ถ• ํ•ด์ œํ•ด์•ผ ํ•œ๋‹ค.

 

์••์ถ• ํ•ด์ œ ํ›„, instantclient_11_2 ๋ผ๋Š” ๋””๋ ‰ํ„ฐ๋ฆฌ๊ฐ€ ์ƒ์„ฑ๋œ ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

 

 

Step 3. instantclient_11_2 ๋””๋ ‰ํ„ฐ๋ฆฌ๋กœ ์ด๋™ํ•˜๊ธฐ
cd instantclient_11_2/

ํ•ด๋‹น ๋””๋ ‰ํ„ฐ๋ฆฌ์— ๋“ค์–ด์žˆ๋Š” ํŒŒ์ผ๋“ค์˜ ๋ชฉ๋ก

 

 

Step 4. ์„ค์น˜ ๊ฒฝ๋กœ์™€ library Path๋ฅผ ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ํŒŒ์ผ์— ์„ค์ •ํ•˜๊ธฐ
export ORACLE_HOME=/usr/local/instantclient_11_2
export PATH=/usr/local/instantclient_11_2:$PATH
export LD_LIBRARY_PATH=/usr/local/instantclient_11_2:$LD_LIBRARY_PATH

=> ๊ฐ์ž ์ž์‹ ์˜ instantclient_11_2 ํŒŒ์ผ์ด ์œ„์น˜ํ•œ ๊ฒฝ๋กœ๋ฅผ ์ ์–ด์ฃผ๋ฉด ๋œ๋‹ค.

 

 

Step 5. SQLPATH ๋ณ€์ˆ˜๋ฅผ glogin.sql์ด ์žˆ๋Š” ๊ฒฝ๋กœ๋กœ ์„ค์ •ํ•˜๊ธฐ (์„ ํƒ)
export SQLPATH=${INSTANT_CLIENT_PATH}:${SQLPATH}

 

 

 

Step 6. NLS_LANG ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ์„ค์ • (์„ ํƒ)
export NLS_LANG=KOREAN_KOREA.AL32UTF8

=> ํ•œ๊ธ€ ์‚ฌ์šฉ์„ ์œ„ํ•œ ์ž‘์—…

 

 

Step 7. ์—ฐ๊ฒฐ ์ •๋ณด๋ฅผ ์„ค์ •ํ•˜๋Š” tnsnames.ora ๋ฅผ ์ฐพ๋Š” ๊ฒฝ๋กœ์ธ TNS_ADMIN ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ์„ค์ •
export TNS_ADMIN=/usr/local/instantclient_11_2

=> ์œ„์™€ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ๋‚ด ํŒŒ์ผ์ด ๋“ค์–ด์žˆ๋Š” ๊ฒฝ๋กœ๋ฅผ ์ ์–ด์ฃผ๊ธฐ

 

 

Step 8. TNS_ADMIN ํด๋”(Instant Client ์„ค์น˜ ํด๋”)๋‚ด์— tnsnames.ora ๋ฅผ ๋งŒ๋“ค๊ณ  ์—ฐ๊ฒฐ ์ •๋ณด ์„ค์ •
mydb=
"(DESCRIPTION= 
    (ADDRESS= 
        (PROTOCOL=TCP)
        (HOST=mydb.example.com)
        (PORT=1621)
    ) 
    (CONNECT_DATA= 
        (SID=MYSID) 
    )
)"

=> mydb์—๋Š” ์ž์‹ ์˜DB ๋ช…์„ ์ ์–ด์ฃผ๊ณ  HOST์˜ ์ฃผ์†Œ๋Š” ์ž์‹ ์˜ ์„œ๋ฒ„ ์ฃผ์†Œ๋ฅผ ์ ์–ด์ฃผ๋ฉด ๋œ๋‹ค. PORT ์—ญ์‹œ ์ด์— ๋งž๊ฒŒ ์„ค์ •ํ•ด์ฃผ๋ฉด ๋œ๋‹ค. (SID=MYSID) ๊ฐ™์€ ๊ฒฝ์šฐ์—๋Š” (SERVICE_NAME = one2ye)์™€ ๊ฐ™์€ ํ˜•์‹์œผ๋กœ ์ง์ ‘ ์„ค์ •ํ•ด์ฃผ๋ฉด ์™„๋ฃŒ!

 

 

Step 9. SQLPlus๋ฅผ ์‹คํ–‰ํ•˜์—ฌ DB์— ์ •์ƒ์ ์œผ๋กœ ์—ฐ๊ฒฐ๋˜๋Š”์ง€ ํ™•์ธ
sqlplus ์‚ฌ์šฉ์ž๋ช…@๋น„๋ฐ€๋ฒˆํ˜ธ

์ž˜ ์—ฐ๊ฒฐ์ด ๋˜์—ˆ๋‹ค๋ฉด ์ž์‹ ์ด ์„ค์ •ํ•œ pwd๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ์„ฑ๊ณต!

 

 

 

 

 

 

๐Ÿ“– Oracle ์—ฐ๋™ ์‹œ๋ฆฌ์ฆˆ ๐Ÿ“–

1. https://ye5ni.tistory.com/154
2. https://ye5ni.tistory.com/164
3. https://ye5ni.tistory.com/165
4. https://ye5ni.tistory.com/174

 

 

 

 

 

 

728x90
๋ฐ˜์‘ํ˜•