macOS Catalina에서 Oracle Instant Client를 사용하여 Perl DBD :: Oracle을 설치하는 방법

Dec 17 2020

macOS Catalina 10.15.7을 실행 중이며 DB에 연결하는 Perl 스크립트를 실행하려면 Oracle Instant Client를 설치해야합니다.

1. Oracle Instant Client 설치

필요한 패키지를 다운로드했습니다.

  • 기본 라이트 패키지 (DMG)
  • SDK 패키지 (DMG)
  • ODBC 패키지 (DMG)

Instant Client 19.8에서 문제없이 설치 지침 을 따랐습니다 (복사 및 붙여 넣기).

파일은 /Users/username/Downloads/instantclient_19_8

2. 설정 ORACLE_HOME

다음으로 ORACLE_HOME을 /Users/username/Downloads/instantclient_19_8

export ORACLE_HOME=/Users/username/Downloads/instantclient_19_8

3. 설치 DBD::Oracle

설치하려고 할 때 DBD::Oracle다음 오류가 발생했습니다.

$ cpanm DBD::Oracle
--> Working on DBD::Oracle
Fetching http://www.cpan.org/authors/id/M/MJ/MJEVANS/DBD-Oracle-1.80.tar.gz ... OK
Configuring DBD-Oracle-1.80 ... N/A
! Configure failed for DBD-Oracle-1.80. See /Users/username/.cpanm/work/1608142485.48272/build.log for details.

로그 파일의 내용 :

$ cat /Users/username/.cpanm/work/1608142485.48272/build.log
cpanm (App::cpanminus) 1.7044 on perl 5.032000 built for darwin-thread-multi-2level
Work directory is /Users/username/.cpanm/work/1608142485.48272
You have make /usr/bin/make
You have LWP 6.47
You have /usr/bin/tar: bsdtar 3.3.2 - libarchive 3.3.2 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.6
You have /usr/bin/unzip
Searching DBD::Oracle () on cpanmetadb ...
--> Working on DBD::Oracle
Fetching http://www.cpan.org/authors/id/M/MJ/MJEVANS/DBD-Oracle-1.80.tar.gz
-> OK
Unpacking DBD-Oracle-1.80.tar.gz
Entering DBD-Oracle-1.80
Checking configure dependencies from META.json
Checking if you have Config 0 ... Yes (5.032000)
Checking if you have Encode 0 ... Yes (3.06)
Checking if you have Math::BigInt 0 ... Yes (1.999818)
Checking if you have Devel::Peek 0 ... Yes (1.28)
Checking if you have Test::More 0 ... Yes (1.302177)
Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (7.44)
Checking if you have Data::Dumper 0 ... Yes (2.174)
Checking if you have DBI 1.623 ... Yes (1.643)
Checking if you have Test::NoWarnings 0 ... Yes (1.04)
Configuring DBD-Oracle-1.80
Running Makefile.PL
Using DBI 1.643 (for perl 5.032000 on darwin-thread-multi-2level) installed in /usr/local/Cellar/perl/5.32.0/lib/perl5/site_perl/5.32.0/darwin-thread-multi-2level/auto/DBI/
Configuring DBD::Oracle for perl 5.032000 on darwin (darwin-thread-multi-2level)

If you encounter any problem, a collection of troubleshooting
guides are available under lib/DBD/Oracle/Troubleshooting.
'DBD::Oracle::Troubleshooting' is the general troubleshooting
guide, while platform-specific troubleshooting hints
live in their labelled sub-document (e.g., Win32
hints are gathered in 'lib/DBD/Oracle/Troubleshooting/Win32.pod').

Trying to find an ORACLE_HOME
Your DYLD_LIBRARY_PATH env var is set to ''

      The ORACLE_HOME environment variable is not set and I couldn't guess it.
      It must be set to hold the path to an Oracle installation directory
      on this machine (or a machine with a compatible architecture).
      See the appropriate troubleshooting guide for your OS for more information.
      ABORTED!

-> N/A
-> FAIL Configure failed for DBD-Oracle-1.80. See /Users/username/.cpanm/work/1608142485.48272/build.log for details.

내가 읽은 여기에 그 ORACLE_HOME포함하는 디렉토리의 값으로 설정해야합니다 /bin디렉토리를하지만 난 하나를 찾을 수 없습니다 /bin.

답변

2 ChristopherJones Dec 17 2020 at 05:12

macOS는 항상 변경되지만 Mojave에서는 DMG에서 Instant Client를 설치 한 다음 다음을 수행했습니다.

brew install perl
ln -s $HOME/Downloads/instantclient_19_8 $HOME/instantclient
export DYLD_LIBRARY_PATH=$HOME/instantclient
cpan -i -T DBI
cpan -i -T DBD::Oracle

일반적으로 Instant Client에 대해 ORACLE_HOME을 설정하지 마십시오. (잘못된 구성 파일을 읽을 수 있습니다). ORACLE_HOME은 Instant Client가 아닌 '전체'데이터베이스 또는 전체 클라이언트 설치에 사용됩니다. 그러나 일부 설치 프로그램은 여전히 ​​변수를 참조하여 빌드 파일을 찾기 때문에 최소한 빌드 할 때 필요합니다. DBD :: Oracle은 내부적으로 Instant Client를 검색하고 $ ORACLE_HOME이 설정되지 않은 경우 $ HOME / instantclient를 사용합니다.

macOS는 하위 셸로 전파되지 않기 때문에 DYLD_LIBRARY_PATH의 유용성을 점차적으로 제거했습니다. 이것은 안정적으로 사용할 수 없음을 의미합니다. Mojave에서 인스턴트 클라이언트 라이브러리를 $ HOME / lib /에 복사 할 수 있으며 DYLD_LIBRARY_PATH를 설정할 필요가 없다는 것을 알았습니다.

참고 : DBD :: Oracle을 사용하는 경우 Instant Client ODBC 패키지가 필요하지 않습니다.