2022年11月22日火曜日

Oracle APEXの環境作成(4) - データベースのインストール

Oracle Linux 8で構成された仮想マシンに、Oracle Database 23c Freeをインストールします。

FAQを確認すると、使用できるリソースの制限は以下のようです。

What are the resource limits for Oracle Database Free

Oracle Database Free supports up to:

  • 2 CPUs for foreground processes
  • 2GB of RAM (SGA and PGA combined)
  • 12GB of user data on disk (irrespective of compression factor)

用途の制限も特に無いようです。

Can I use Oracle Database Free in production?

Oracle Database Free does not restrict the environment in which it can be deployed. However, Oracle Database Free is not supported and does not receive any patches, including security patches. Oracle recommends running production deployments on fully supported Oracle Database editions or cloud services.

今までOracle Database 21c Express Edition (XE)を使っていた用途であれば、Oracle Database 23c Freeを代わりに使用できます。

インストール手順はGet Startedのセクションに記載されています。

Oracle Database 23c Freeは、Oracle Linux 9にインストールできません


事前構成パッケージのインストール



仮想マシンにユーザーrootでログインします。

ssh -p 10022 root@localhost

% ssh -p 10022 root@localhost

root@localhost's password: 

Last login: Thu May 18 09:27:04 2023 from 10.0.2.2

[root@localhost ~]# 


Get Startedの手順ではOracle Linuxであればプリインストール・パッケージが不要に見えますが、実際は必要でした。直接RPMファイルを指定してインストールします。

dnf -y localinstall https://yum.oracle.com/repo/OracleLinux/OL8/developer/x86_64/getPackage/oracle-database-preinstall-23c-1.0-1.el8.x86_64.rpm

[root@localhost ~]# dnf -y localinstall https://yum.oracle.com/repo/OracleLinux/OL8/developer/x86_64/getPackage/oracle-database-preinstall-23c-1.0-1.el8.x86_64.rpm

Failed to set locale, defaulting to C.UTF-8

Last metadata expiration check: 0:08:33 ago on Tue Sep 26 11:08:55 2023.

oracle-database-preinstall-23c-1.0-1.el8.x86_64 142 kB/s |  30 kB     00:00    

Dependencies resolved.

================================================================================

 Package                 Arch   Version                 Repository         Size

================================================================================

Installing:

 oracle-database-preinstall-23c

                         x86_64 1.0-1.el8               @commandline       30 k

Installing dependencies:

 bc                      x86_64 1.07.1-5.el8            ol8_baseos_latest 129 k

 bind-libs               x86_64 32:9.11.36-8.el8_8.1    ol8_appstream     175 k

 bind-libs-lite          x86_64 32:9.11.36-8.el8_8.1    ol8_appstream     1.2 M

 bind-license            noarch 32:9.11.36-8.el8_8.1    ol8_appstream     104 k

 bind-utils              x86_64 32:9.11.36-8.el8_8.1    ol8_appstream     453 k

 binutils                x86_64 2.30-119.0.2.el8        ol8_baseos_latest 5.9 M

 checkpolicy             x86_64 2.9-1.el8               ol8_baseos_latest 346 k

 compat-openssl10        x86_64 1:1.0.2o-4.el8_6        ol8_appstream     1.1 M


[中略] 


  rpcbind-1.2.5-10.el8.x86_64                                                   

  smartmontools-1:7.1-1.el8.x86_64                                              

  sysstat-11.7.3-9.0.1.el8.x86_64                                               

  tar-2:1.30-9.el8.x86_64                                                       

  unzip-6.0-46.0.1.el8.x86_64                                                   

  xorg-x11-utils-7.5-28.el8.x86_64                                              

  xorg-x11-xauth-1:1.0.9-12.el8.x86_64                                          


Complete!

[root@localhost ~]# 


プリインストール・パッケージのインストールが完了しました。


データベースのインストールと構成



Oracle Database 23c FreeのRPMをダウンロードします。

curl -OL https://download.oracle.com/otn-pub/otn_software/db-free/oracle-database-free-23c-1.0-1.el8.x86_64.rpm

[root@localhost ~]# curl -OL https://download.oracle.com/otn-pub/otn_software/db-free/oracle-database-free-23c-1.0-1.el8.x86_64.rpm

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

100   509  100   509    0     0   1156      0 --:--:-- --:--:-- --:--:--  1156

100 1670M  100 1670M    0     0  8533k      0  0:03:20  0:03:20 --:--:-- 5939k

[root@localhost ~]# 


ダウンロードしたRPMをインストールします。

dnf -y localinstall oracle-database-free-23c-1.0-1.el8.x86_64.rpm

[root@localhost ~]# dnf -y localinstall oracle-database-free-23c-1.0-1.el8.x86_64.rpm

Failed to set locale, defaulting to C.UTF-8

Last metadata expiration check: 0:20:07 ago on Tue Sep 26 11:08:55 2023.

Dependencies resolved.

================================================================================

 Package                       Arch        Version      Repository         Size

================================================================================

Installing:

 oracle-database-free-23c      x86_64      1.0-1        @commandline      1.6 G


Transaction Summary

================================================================================

Install  1 Package


Total size: 1.6 G

Installed size: 4.0 G

Downloading Packages:

Running transaction check

Transaction check succeeded.

Running transaction test

Transaction test succeeded.

Running transaction

  Preparing        :                                                        1/1 

  Running scriptlet: oracle-database-free-23c-1.0-1.x86_64                  1/1 

  Installing       : oracle-database-free-23c-1.0-1.x86_64                  1/1 

  Running scriptlet: oracle-database-free-23c-1.0-1.x86_64                  1/1 

[INFO] Executing post installation scripts...

[INFO] Oracle home installed successfully and ready to be configured.

To configure Oracle Database Free, optionally modify the parameters in '/etc/sysconfig/oracle-free-23c.conf' and then run '/etc/init.d/oracle-free-23c configure' as root.


  Verifying        : oracle-database-free-23c-1.0-1.x86_64                  1/1 


Installed:

  oracle-database-free-23c-1.0-1.x86_64                                         


Complete!

[root@localhost ~]# 


oracle-free-23c configureを実行して、SYSSYSTEMおよびPDBADMINのパスワードとなる文字列を2回入力します。

/etc/init.d/oracle-free-23c configure

マルチテナント構成のデータベース・インスタンスが作成されます。SIDFREE、作成されるPDBFREEPDB1です。SIDやPDBの名前を変更する場合は、/etc/init.d/oracle-free-23cに記述されている定義を、あらかじめ変更しておきます。

[root@localhost ~]# /etc/init.d/oracle-free-23c configure

Specify a password to be used for database accounts. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. Note that the same password will be used for SYS, SYSTEM and PDBADMIN accounts: ********

Confirm the password: ********

Configuring Oracle Listener.

Listener configuration succeeded.

Configuring Oracle Database FREE.

Enter SYS user password: 

*******

Enter SYSTEM user password: 

***** 

Enter PDBADMIN User Password: 

********

Prepare for db operation

7% complete

Copying database files

29% complete

Creating and starting Oracle instance

30% complete

33% complete

36% complete

39% complete

43% complete

Completing Database Creation

47% complete

49% complete

50% complete

Creating Pluggable Databases

54% complete

71% complete

Executing Post Configuration Actions

93% complete

Running Custom Scripts

100% complete

Database creation complete. For details check the logfiles at:

 /opt/oracle/cfgtoollogs/dbca/FREE.

Database Information:

Global Database Name:FREE

System Identifier(SID):FREE

Look at the log file "/opt/oracle/cfgtoollogs/dbca/FREE/FREE.log" for further details.


Connect to Oracle Database using one of the connect strings:

     Pluggable database: localhost.localdomain/FREEPDB1

     Multitenant container database: localhost.localdomain

[root@localhost ~]# 


構成が完了したら、データベースへの接続を確認します。接続先としてlocalhost/FREEPDB1を指定します。

. oraenv
ORACLE_SID = [root] ? FREE
sqlplus system/パスワード@localhost/freepdb1
select banner_full from v$version;
exit

[root@localhost ~]# . oraenv

ORACLE_SID = [root] ? FREE

The Oracle base has been set to /opt/oracle

[root@localhost ~]# sqlplus system/******@localhost/freepdb1

SQL*Plus: Release 23.0.0.0.0 - Production on Tue Sep 26 11:41:19 2023

Version 23.3.0.23.09


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


Last Successful login time: Tue Sep 26 2023 11:38:48 +09:00


Connected to:

Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free

Version 23.3.0.23.09


SQL> select banner_full from v$version;


BANNER_FULL

--------------------------------------------------------------------------------

Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free

Version 23.3.0.23.09



SQL> exit

Disconnected from Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free

Version 23.3.0.23.09

[root@localhost ~]# 


2023年9月にOracle Database 23c FreeのRPMが、同じ名前で更新されています。バージョンが23.3(以前は23.2)になっていることを確認します。

最後にデータベースの自動起動を有効にします。

systemctl enable oracle-free-23c

[root@localhost ~]# systemctl enable oracle-free-23c

oracle-free-23c.service is not a native service, redirecting to systemd-sysv-install.

Executing: /usr/lib/systemd/systemd-sysv-install enable oracle-free-23c

[root@localhost ~]# 


以上でOracle Database 23c Free - Developer Releaseのインストールは完了です。

続く