[Oracle Cloud] DBCSにAPEXをインストールしてみた How to install APEX on DBCS

本記事の目的

OCI-ClassicのデータベースサービスであるDBCSの場合、デフォルトでAPEXがプリインストールされていてとても便利だったのですが、OCI DBaaSにはデフォルトでは設定されていません。

APEXを利用したいユーザは自分で(オンプレと同じ手順で)インストール&設定を行う必要があります。

本記事では、DBaaS(VM)環境にAPEXをインストールして、簡単な動作確認をするまでの手順を紹介します。

なお、本記事ではDBaaSでAPEXを動かしてみることを主眼においたため、マニュアルに記載の手順の一部をスキップしています。本記事とあわせてマニュアルも確認し、必要に応じて手順の見直しなどを行うことをお奨めします。

 

設定手順

項目名はマニュアル(英語)の記載にあわせてます。基本的に実行したコマンドは載せています。

※前提条件の確認ステップは除外

Downloading and Installing Oracle Application Express

APEXとREST Data Servicesの最新モジュールを以下サイトからそれぞれダウンロード。
https://www.oracle.com/technetwork/jp/developer-tools/apex/downloads/index.html
https://www.oracle.com/technetwork/developer-tools/rest-data-services/downloads/index.html

今回利用したバージョンは以下。
・Oracle APEX 18.2 – All languages
・Oracle REST Data Services 18.4

ORACLE_HOME配下に旧バージョンのAPEXが置いてあるフォルダがあったので、今回は同階層に新規フォルダを作成してアップロードしました。

[oracle@dbvmee02 dbhome_1]$ pwd
/u01/app/oracle/product/18.0.0.0/dbhome_1/apex18.2
[oracle@dbvmee02 apex18.2]$ unzip apex_18.2.zip
[oracle@dbvmee02 apex18.2]$ unzip ords-18.4.0.354.1002.zip

 

Installing Application Express

DBaaS上のデータベースはマルチテナント構成のため、PDBに対してインストール作業を実施。
(以降のステップも基本PDBで実行)

[oracle@dbvmee02 apex]$ sqlplus / as sysdba

SQL*Plus: Release 18.0.0.0.0 - Production on Sat Feb 9 02:28:59 2019
Version 18.3.0.0.0

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


Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0

SQL> alter session set container=pdb1;

Session altered.

SQL> @apexins.sql SYSAUX SYSAUX TEMP /i/

 

⇒約20分くらいで終了。ログでエラーを確認。

 

なお、指定している引数の意味は以下の通り。

tablespace_apex is the name of the tablespace for the Oracle Application Express application user. tablespace_files is the name of the tablespace for the Oracle Application Express files user. tablespace_temp is the name of the temporary tablespace or tablespace group. images is the virtual directory for Oracle Application Express images. To support future Oracle Application Express upgrades, define the virtual image directory as /i/.

 

 

Creating or Updating Your Instance Administration Account

SQL> @apxchpwd.sql
...set_appun.sql
================================================================================
This script can be used to change the password of an Application Express
instance administrator. If the user does not yet exist, a user record will be
created.
================================================================================
Enter the administrator's username [ADMIN]
User "ADMIN" does not yet exist and will be created.
Enter ADMIN's email [ADMIN]
Enter ADMIN's password []
Created instance administrator ADMIN.

⇒管理用スキーマの作成

 

Unlocking the APEX_PUBLIC_USER Account

SQL> ALTER USER APEX_PUBLIC_USER ACCOUNT UNLOCK;

 

Changing the Password for the APEX_PUBLIC_USER Account

SQL> ALTER USER APEX_PUBLIC_USER IDENTIFIED BY xxxxx;

 

 

Downloading and Installing Oracle REST Data Services

マニュアルに記載の通り、ここからORDSのマニュアルを参照しつつインストールを行う。

ODRSのインストールスクリプト実行時にはDBログイン情報の入力が必要となるが、失敗するとハマル可能性あり。事前にezconnect形式でログイン確認しておくのがオススメ。

ログイン情報確認後、以下のコマンドを実行。
接続情報やスキーマのパスワードを正しく入力していく。

[oracle@dbvmee02 apex18.2]$ pwd
/u01/app/oracle/product/18.0.0.0/dbhome_1/apex18.2
[oracle@dbvmee02 apex18.2]$ ls
apex apex_18.2.zip docs examples index.html ords-18.4.0.354.1002.zip ords.war params
[oracle@dbvmee02 apex18.2]$ java -jar ords.war install advanced
This Oracle REST Data Services instance has not yet been configured.
Please complete the following prompts

Enter the location to store configuration data:config
Enter the name of the database server [localhost]:dbvmee02
Enter the database listen port [1521]:
Enter 1 to specify the database service name, or 2 to specify the database SID [1]:1
Enter the database service name:pdb1.xxxx.yyyyy.oraclevcn.com
Enter 1 if you want to verify/install Oracle REST Data Services schema or 2 to skip this step [1]:
Enter the database password for ORDS_PUBLIC_USER:
Confirm password:
Requires SYS AS SYSDBA to verify Oracle REST Data Services schema.

Enter the database password for SYS AS SYSDBA:
Confirm password:

Retrieving information.
Enter the default tablespace for ORDS_METADATA [SYSAUX]:
Enter the temporary tablespace for ORDS_METADATA [TEMP]:
Enter the default tablespace for ORDS_PUBLIC_USER [USERS]:
Enter the temporary tablespace for ORDS_PUBLIC_USER [TEMP]:
Enter 1 if you want to use PL/SQL Gateway or 2 to skip this step.
If using Oracle Application Express or migrating from mod_plsql then you must enter 1 [1]:
Enter the PL/SQL Gateway database user name [APEX_PUBLIC_USER]:
Enter the database password for APEX_PUBLIC_USER:
Confirm password:
Enter 1 to specify passwords for Application Express RESTful Services database users (APEX_LISTENER, APEX_REST_PUBLIC_USER) or 2 to skip this step [1]:
Enter the database password for APEX_LISTENER:
Confirm password:
Enter the database password for APEX_REST_PUBLIC_USER:
Confirm password:
Feb 09, 2019 3:08:03 AM
INFO: reloaded pools: []
Installing Oracle REST Data Services version 18.4.0.r3541002

(省略)

Feb 09, 2019 3:14:36 AM
INFO: Oracle REST Data Services initialized
Oracle REST Data Services version : 18.4.0.r3541002
Oracle REST Data Services server info: jetty/9.4.z-SNAPSHOT

2019-02-09 03:14:36.621:INFO:oejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@1dde4cb2{/ords,null,AVAILABLE}
2019-02-09 03:14:36.622:INFO:oejsh.ContextHandler:main: Started o.e.j.s.h.ContextHandler@7714e963{/i,null,AVAILABLE}
2019-02-09 03:14:36.639:INFO:oejs.AbstractConnector:main: Started ServerConnector@65fb9ffc{HTTP/1.1,[http/1.1, h2c]}{0.0.0.0:8080}
2019-02-09 03:14:36.640:INFO:oejs.Server:main: Started @679798ms

ORDSプロセスが起動するが、インストール手順を継続するため、一旦CTRL + Cでストップ。

 

再びAPEXマニュアルの手順を再開。

About Configuring Oracle REST Data Services Behind a Reverse Proxy or Load Balancer

⇒スキップ

 

Web Server HTTP POST Request Limits

⇒スキップ

 

Disabling Oracle XML DB Protocol Server

SQL> SELECT DBMS_XDB_CONFIG.GETHTTPSPORT FROM DUAL;

GETHTTPSPORT
------------
0

⇒設定値を確認したところ既に上記の値になっていた。

 

Configuring Oracle REST Data Services
Copying the Images Directory

Whether you are loading a new installation or upgrading from a previous release, you must copy the images directory from the top level of the apex\images directory, for example C:\TEMP, to the location used by your Oracle REST Data Services installation.

先に実行したInstalling Oracle REST Data Servicesの手順で「Enter the APEX static resources location」に指定したフォルダにコピーする。

[oracle@dbvmee02 apex18.2]$ pwd
/u01/app/oracle/product/18.0.0.0/dbhome_1/apex18.2
[oracle@dbvmee02 apex18.2]$ ls
apex apex_18.2.zip config docs examples index.html ords-18.4.0.354.1002.zip ords.war params
[oracle@dbvmee02 apex18.2]$ cp -rp apex/images .

 

Configuring RESTful Services

スキーマパスワードなどを設定

SQL> alter session set container=pdb1;

Session altered.

SQL> @apex_rest_config.sql

PL/SQL procedure successfully completed.

(結果、省略)

 

Securing Oracle REST Data Service

⇒スキップ

 

 

Enabling Network Services in Oracle Database 11g or Later

Enabling network services enables support for sending outbound mail in Oracle Application Express, use of Web services in Oracle Application Express, and PDF report printing.

⇒スキップ

 

ここまで実行すればAPEXのインストール&設定としては、ほぼ完了。

あとは、DBaaSへの接続用の設定を行っていく。

 

 

DBaaS環境用の設定1:セキュリティリスト

セキュリティリストに以下のルールを追加して、8080ポートへの接続を許可

Ingress Rules
TCP traffic for ports: 8080

 

DBaaS環境用の設定2:iptables

デフォルトでは8080番ポートへのアクセスは許可されていないので、追加

[root@dbvmee02 ~]# iptables -I INPUT 8 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT -m comment --comment "Required for APEX"
[root@dbvmee02 ~]# service iptables status | grep 8080
8 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:8080 /* Required for APEX */

[root@dbvmee02 ~]# /sbin/service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]

 

スタンドアローンモードで起動

[oracle@dbvmee02 apex18.2]$ java -jar ords.war standalone

 

 

 

動作確認

APEXログイン

以下のURLにアクセス

http://hostname:port/apex/apex_admin

インストール&設定がきちんと出来ていれば、以下のような見慣れたログイン画面が表示されるはず!

 

APEX動作確認

ハンズオンラボにある「初心者ラボ」を参考に、以下のような基本操作ができることを確認。

・ワークスペース作成
・アプリ作成
・サンプルデータロード
・アプリ実行してデータ表示

⇒グラフ表示を確認して、動作確認終了!

 

 

参考情報

・Application Express Installation Guide
https://docs.oracle.com/database/apex-18.2/HTMIG/toc.htm

・Oracle Application Expressインストレーション・ガイド リリース18.1 (日本語)
https://docs.oracle.com/cd/E99982_01/HTMIG/toc.htm

・Oracle REST Data Services 18.4
https://docs.oracle.com/en/database/oracle/oracle-rest-data-services/18.4/index.html

・APEXポータル
https://apex.oracle.com/ja/

・Application Express (APEX) で使用するデータベースと Web サーバの certify 情報リファレンス (Doc ID 1662582.1)
https://support.oracle.com/knowledge/Oracle%20Cloud/1662582_1.html

 

スポンサードリンク

2 Comments

  1. It is perfect time to make some plans for the future and it’s time to be happy.
    I’ve read this post and if I could I wish to suggest
    you few interesting things or tips. Maybe you can write next articles referring to this article.
    I desire to read more things about it! Hi there just wanted to give you
    a quick heads up. The words in your post seem to be running off the screen in Opera.
    I’m not sure if this is a format issue or something to do with internet browser compatibility but I figured I’d post to let you know.
    The design look great though! Hope you get the issue solved
    soon. Thanks There’s definately a great deal to learn about this subject.

    I love all the points you made. http://foxnews.net/

1 Trackback / Pingback

  1. [Oracle Cloud] OCI DBaaS 関連情報まとめ(リンク集) – IT Edge Blog

John へ返信する コメントをキャンセル

Your email address will not be published.


*