Oracle Database/Apex

2장. Oracle ORDS 설치 (Oracle 19c)

수상한 김토끼 2024. 7. 23. 20:36

안녕하세요.

‘수상한 김토끼’ 입니다.

 

이 포스팅은 Oracle Database 19c에 Apex와 ORDS를 설치하고 Apex 개발환경을 설정하는 과정을 정리 한 내용입니다.


설치과정은 크게 Apex 설치와 ORDS를 설치하고 구성하는 2개의 과정으로 진행됩니다.

 

1장. Oracle Apex 설치 (Oracle 19c)에서 apex 설치를 진행하였고 이번장에서는 ORDS를 설치 해 보도록 하겠습니다.

 

2024.07.23 - [Oracle Database/Apex] - 1장. Oracle Apex 설치 (Oracle 19c)

 

1장. Oracle Apex 설치 (Oracle 19c)

안녕하세요. ‘수상한 김토끼’ 입니다. 이 포스팅은 Oracle Database 19c에 Apex와 ORDS를 설치하고 Apex 개발환경을 설정하는 과정을 정리 한 내용입니다.설치과정은 크게 Apex 설치와 ORDS를 설치하고

with-kami.tistory.com

 

ORDS를 사용하기 위해서는 Java 11 이상의 JDK가 필요합니다.

우선 사용할 Java를 서버에 업로드 하고 .bash_profile을 수정하여 환경설정을 진행 해 줍니다.

더보기
[apex@apex jdk-11.0.23]$ cat ~/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs
. /home/apex/scripts/setEnv.sh
export JAVA_HOME=/home/apex/jdk-11.0.23
export PATH="$JAVA_HOME/bin"
[apex@apex jdk-11.0.23]$ pwd
/home/apex/jdk-11.0.23
[apex@apex jdk-11.0.23]$ ls
bin  conf  include  jmods  legal  lib  man  README.html  release
[apex@apex jdk-11.0.23]$

ORDS는 Oracle REST Data Services Download 페이지에서 다운로드 하여 서버에 업로드 후 설치하고자 하는 경로에 압축을 풀어줍니다.

 

https://www.oracle.com/database/sqldeveloper/technologies/db-actions/download/

 

Oracle REST Data Services Download

 

www.oracle.com

더보기
[apex@apex ords]$ pwd
/home/apex/ords
[apex@apex ords]$ ls -al
total 118380
drwxrwxr-x. 9 apex apex       190 Jul 15 08:48 .
drwx------. 9 apex apex      4096 Jul 15 08:48 ..
drwxr-xr-x. 2 apex apex        54 Jun 28 16:57 bin
drwxr-xr-x. 3 apex apex        21 Jun 28 16:57 docs
drwxr-xr-x. 8 apex apex       113 Jun 17 17:21 examples
drwxr-xr-x. 2 apex apex        28 Jun 17 17:21 icons
drwxr-xr-x. 3 apex apex      4096 Jun 17 17:21 lib
-rw-r--r--. 1 apex apex      5996 Jun 17 17:21 LICENSE.txt
drwxr-xr-x. 3 apex apex        86 Jun 28 16:57 linux-support
-rw-r--r--. 1 apex apex       210 Jun 17 17:21 NOTICE.txt
-rw-r--r--. 1 apex apex 121195337 Jun 28 16:52 ords.war
drwxr-xr-x. 4 apex apex        38 Jun 17 17:21 scripts
-rw-r--r--. 1 apex apex       365 Jun 17 17:21 THIRD-PARTY-LICENSES.txt
[apex@apex ords]$

ORDS 관련 명령어를 .bash_profile을 수정하여 PATH에 추가 해 줍니다.

더보기
[apex@apex ords]$ cat ~/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs
. /home/apex/scripts/setEnv.sh
export JAVA_HOME=/home/apex/jdk-11.0.23
export PATH="$JAVA_HOME/bin:$PATH:/home/apex/ords/bin"

제가 구성한 환경은 oracle유저와 apex유저가 다르기 때문에 apex 유저의 그룹을 oracle과 같은 dba 그룹으로 변경을 진행해야 설치를 정상적으로 진행할 수 있습니다.

 

다음 명령으로 apex의 그룹을 dba로 변경 후 아래 내용을 진행 해 주세요.

[root@apex /]# usermod -G dba apex
[root@apex /]# chown -R apex:dba /home/apex

 

다음 명령을 사용하여 ORDS config 디렉토리를 생성하고 설정을 진행합니다.

ords --config /home/apex/ords/config install
더보기
[apex@apex ords]$ ords --config /home/apex/ords/config install
2024-07-15T09:18:56.876Z WARNING     Your configuration folder /home/apex/ords/config is located in ORDS product folder.  Oracle recommends to use a different configuration folder.
Refer to Oracle REST Data Services Documentation on how to setup your configuration folder.

ORDS: Release 24.2 Production on Mon Jul 15 09:18:56 2024

Copyright (c) 2010, 2024, Oracle.

Configuration:
  /home/apex/ords/config

The configuration folder /home/apex/ords/config does not contain any configuration files.

Oracle REST Data Services - Interactive Install

Created folder /home/apex/ords/config
  Enter a number to select the TNS net service name to use from /oracle/app/oracle/product/19.3.0/network/admin/tnsnames.ora or specify the database connection
    [1] ORCL         SERVICE_NAME=orcl.subnet07151349.vcn07151349.oraclevcn.com
    [S] Specify the database connection
  Choose [1]: 1
  Provide database user name with administrator privileges.
    Enter the administrator username: sys
  Enter the database password for SYS AS SYSDBA:

Retrieving information.
ORDS is not installed in the database. ORDS installation is required.

  Enter a number to update the value or select option A to Accept and Continue
    [1] Connection Type: TNS
    [2] TNS Connection: TNS_NAME=ORCL TNS_FOLDER=/oracle/app/oracle/product/19.3.0/network/admin
           Administrator User: SYS AS SYSDBA
    [3] Database password for ORDS runtime user (ORDS_PUBLIC_USER): <generate>
    [4] ORDS runtime user and schema tablespaces:  Default: SYSAUX Temporary TEMP
    [5] Additional Feature: Database Actions
    [6] Configure and start ORDS in Standalone Mode: Yes
    [7]    Protocol: HTTP
    [8]       HTTP Port: 8080
    [9]   APEX static resources location:
    [A] Accept and Continue - Create configuration and Install ORDS in the database
    [Q] Quit - Do not proceed. No changes
  Choose [A]: A
The setting named: db.connectionType was set to: tns in configuration: default
The setting named: db.tnsAliasName was set to: ORCL in configuration: default
The setting named: db.tnsDirectory was set to: /oracle/app/oracle/product/19.3.0/network/admin in configuration: default
The setting named: plsql.gateway.mode was set to: proxied in configuration: default
The setting named: db.username was set to: ORDS_PUBLIC_USER in configuration: default
The setting named: db.password was set to: ****** in configuration: default
The setting named: feature.sdw was set to: true in configuration: default
The global setting named: database.api.enabled was set to: true
The setting named: restEnabledSql.active was set to: true in configuration: default
The global setting named: standalone.http.port was set to: 8080
The global setting named: standalone.static.context.path was set to: /ords
The global setting named: standalone.doc.root was set to: /home/apex/ords/config/global/doc_root
The setting named: security.requestValidationFunction was set to: ords_util.authorize_plsql_gateway in configuration: default
2024-07-15T09:19:31.299Z INFO        Created folder /home/apex/ords/logs
2024-07-15T09:19:31.299Z INFO        The log file is defaulted to the current working directory located at /home/apex/ords/logs
2024-07-15T09:19:31.391Z INFO        Installing Oracle REST Data Services version 24.2.1.r1801634 in NON_CDB
2024-07-15T09:19:33.890Z INFO        ... Verified database prerequisites
2024-07-15T09:19:34.791Z INFO        ... Created Oracle REST Data Services proxy user
2024-07-15T09:19:36.065Z INFO        ... Created Oracle REST Data Services schema
2024-07-15T09:19:36.835Z INFO        ... Granted privileges to Oracle REST Data Services
2024-07-15T09:19:40.190Z INFO        ... Created Oracle REST Data Services database objects
2024-07-15T09:19:54.561Z INFO        Completed installation for Oracle REST Data Services version 24.2.1.r1801634. Elapsed time: 00:00:23.133

2024-07-15T09:19:54.639Z INFO        Completed configuring PL/SQL gateway user for Oracle REST Data Services version 24.2.1.r1801634. Elapsed time: 00:00:00.71

2024-07-15T09:19:54.643Z INFO        Log file written to /home/apex/ords/logs/ords_install_2024-07-15_091931_30027.log
2024-07-15T09:19:54.966Z INFO        HTTP and HTTP/2 cleartext listening on host: 0.0.0.0 port: 8080
2024-07-15T09:19:55.006Z INFO        Disabling document root because the specified folder does not exist: /home/apex/ords/config/global/doc_root
2024-07-15T09:19:55.007Z INFO        Default forwarding from / to contextRoot configured.
2024-07-15T09:19:59.706Z INFO        Configuration properties for: |default|lo|
db.password=******
db.tnsAliasName=ORCL
conf.use.wallet=true
security.requestValidationFunction=ords_util.authorize_plsql_gateway
standalone.static.context.path=/ords
database.api.enabled=true
db.username=ORDS_PUBLIC_USER
standalone.http.port=8080
restEnabledSql.active=true
resource.templates.enabled=false
plsql.gateway.mode=proxied
feature.sdw=true
config.required=true
db.connectionType=tns
standalone.doc.root=/home/apex/ords/config/global/doc_root
db.tnsDirectory=/oracle/app/oracle/product/19.3.0/network/admin

2024-07-15T09:19:59.710Z WARNING     *** jdbc.MaxLimit in configuration |default|lo| is using a value of 10, this setting may not be sized adequately for a production environment ***
2024-07-15T09:19:59.710Z WARNING     *** jdbc.InitialLimit in configuration |default|lo| is using a value of 10, this setting may not be sized adequately for a production environment ***
2024-07-15T09:20:09.884Z INFO

Mapped local pools from /home/apex/ords/config/databases:
  /ords/                              => default                        => VALID


2024-07-15T09:20:10.037Z INFO        Oracle REST Data Services initialized
Oracle REST Data Services version : 24.2.1.r1801634
Oracle REST Data Services server info: jetty/10.0.21
Oracle REST Data Services java info: Java HotSpot(TM) 64-Bit Server VM 11.0.23+7-LTS-222

중간에 1과 A를 입력하고 여기가지 진행이 완료되면 ORDS 설치는 마무리가 되었고 해당 서버의 8080포트로 접근하여 ORDS를 사용할 수 있습니다.

http://localhost:8080/ords

 

다만 ords config를 구성하며 ords.war가 동작하는 jetty 웹서버가 포어그라운드로 실행되었기에 해당 창을 닫거나 접속을 종료하면 프로세스도 함께 죽어버리는 문제가 있어 기동과 종료를 스크립트로 만들어 줄 필요가 있습니다.

 

저는 /home/apex/scirpts 경로에 아래 2개 파일을 작성하여 기동, 종료시 사용하도록 하겠습니다.

 

start.sh

더보기

 

[apex@apex scripts]$ cat start.sh
#!/bin/bash
. /home/apex/scripts/setEnv.sh
nohup ords --config /home/apex/ords/config serve > /dev/null &

stop.sh

더보기

 

[apex@apex scripts]$ cat stop.sh
#!/bin/bash
. /home/apex/scripts/setEnv.sh
ps -ef | grep java | grep "/home/apex/ords/config" | awk '{print $2}' | xargs kill -9

start.sh 스크립트로 jetty 웹서버 실행 후 Oracle APEX 실행을 눌러 접속하면 다음과 같은 메세지와 함께 이미지가 출력되지 않는 것을 확인할 수 있습니다.

apex의 이미지는 cdn을 통해서 불러오도록 설정되어 있어 cdn정보가 입력되지 않은 경우 발생하는 오류로 alert창에 나온대로 reset_image_prefix.sql 파일을 수행하여 cdn 주소를 등록해 주면 해결할 수 있습니다.

더보기
[apex@apex utilities]$ pwd
/home/apex/apex_24.1/utilities
[apex@apex utilities]$ ls
apxpart.sql                debug                              reset_image_prefix_con.sql   support
apxrekey.sql               enable_sso.sql                     reset_image_prefix_core.sql
check_lovs_for_errors.sql  report_instance_configuration.sql  reset_image_prefix.sql
[apex@apex utilities]$ sqlplus

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 15 09:40:01 2024
Version 19.3.0.0.0

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

Enter user-name: sys as sysdba
Enter password:

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

SQL> @reset_image_prefix.sql


Enter the Oracle APEX image prefix [/i/] https://static.oracle.com/cdn/apex/24.1.0/
...Changing Oracle APEX image prefix

NEW_IMAGE_PREFIX
------------------------------------------
https://static.oracle.com/cdn/apex/24.1.0/


PL/SQL procedure successfully completed.


...Recreate APEX global


PL/SQL procedure successfully completed.


Commit complete.


Image Prefix update complete

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[apex@apex utilities]$

작성일 기준 주요 apex 버전별 cdn 주소는 아래와 같습니다.

 

 https://www.oracle.com/tools/downloads/apex-downloads/apex-241-known-issues/

 

Oracle APEX 24.1 Known Issues

Patch Set Bundle for Oracle APEX 24.1 (36695709) The Patch Set Bundle for Oracle APEX 24.1 is available for download from My Oracle Support, via the following path: https://support.oracle.com/epmos/faces/PatchDetail?patchId=36695709. Navigate to Patches &

www.oracle.com

 

24.1.0 https://static.oracle.com/cdn/apex/24.1.0/
24.1.1 https://static.oracle.com/cdn/apex/24.1.1/
24.1.2 https://static.oracle.com/cdn/apex/24.1.2/

 

수정 후 재접속을 해 보면 아래와 같이 정상적으로 화면이 로드 되는 것을 확인 할 수 있습니다.

최초로 apex에 로그인한 경우 Workspace나 사용자등을 설정하기 위해서 apex_admin 페이지에 접근하여 설치시 입력했던 계정정보로 로그인 후 Workspace, 사용자등을 수정 후 사용하시면 됩니다.

http://localhost:8080/ords/apex_admin

 

여기까지 ords를 구성하고 apex에 접근하는 과정을 마무리 하였습니다.

'Oracle Database > Apex' 카테고리의 다른 글

1장. Oracle Apex 설치 (Oracle 19c)  (3) 2024.07.23