2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Oracle Database 19c のインストール

Last updated at Posted at 2022-11-11

皆さんこんにちは!

今回は Oracle Linux 8.6 に Oracle Database 19c EnterpriseEdition をインストールしていきます。
参考にするサイトは ORACLE 社公式のインストール手順です。
本記事は、簡単かつ大雑把に最小限のインストール手順を紹介しますので、
細かい部分を確認されたい場合は以下をご参照ください。
参考サイトはこちら

インストール前準備

1.yum パッケージのアップデートを実行

既にインストール済みのパッケージ達を一斉にアップデートしていきます。

[root@TARGET ~]# yum update
・
・*/省略/*
・
インストール済み:
  grub2-tools-efi-1:2.02-123.0.10.el8_6.8.x86_64
  kernel-4.18.0-372.32.1.0.1.el8_6.x86_64
  kernel-core-4.18.0-372.32.1.0.1.el8_6.x86_64
  kernel-modules-4.18.0-372.32.1.0.1.el8_6.x86_64
  kernel-uek-5.4.17-2136.312.3.4.el8uek.x86_64
  libatomic-8.5.0-10.1.0.1.el8_6.x86_64

完了しました!

2.再起動

色々とアップデートし終わったので、一旦OS再起動をかけます。

[root@TARGET oracle]# systemctl reboot

3.Preinstallation RPM を実行

Oracle Database のインストール前には必要なパッケージ等めんどくさい作業がありますが、こちらを行うことでその手順をスキップすることができます。
Preinstallation RPMについて詳細はこちら

[root@TARGET oracle]# yum install -y oracle-database-preinstall-19c
・
・*/省略/*
・
インストール済み:
  glibc-devel-2.28-189.5.0.1.el8_6.x86_64
  ksh-20120801-255.0.1.el8_6.x86_64
  libaio-devel-0.3.112-1.el8.x86_64
  libnsl-2.28-189.5.0.1.el8_6.x86_64
  libstdc++-devel-8.5.0-10.1.0.1.el8_6.x86_64
  libxcrypt-devel-4.1.1-6.el8.x86_64
  lm_sensors-libs-3.4.0-23.20180522git70f7e08.el8.x86_64
  make-1:4.2.1-11.el8.x86_64
  oracle-database-preinstall-19c-1.0-2.el8.x86_64
  sysstat-11.7.3-7.el8.x86_64

完了しました!

4.透過的Hugepagesを無効化

透過的Hugepages が有効だとメモリー割当ての遅延が生じてパフォーマンスの低下が起きるようなので、無効にすることが推奨されています。
詳細はこちら
ざっくり言うと、スケールがでかい考え方をしてしまうので、インストールでは必要ない機能ってことですね。

また、現在の設定状況は cat /sys/kernel/mm/transparent_hugepage/enabled で確認できます。

  • 有効な場合 : [always] madvise never
  • 無効な場合 : always madvise [never]

私の環境では無効になっているので特に対処は必要ないようです。

[root@TARGET oracle]# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]

変更する場合は、root ユーザーで/etc/default/grub ファイルに
transparent_hugepage=never パラメータを追加もしくは変更した後、
grub.cfg ファイルを再作成する必要があります。

詳しくはこちらの11ページを参照

5.ソフトウェア要件

Oracle Database のインストールに必要なパッケージがあるので、それらがインストールされているのかを確認します。
詳しくはこちらの12ページを参照

6./etc/sysctl.conf の設定要件

以下を満たす必要があります。

  • shmmax : 物理メモリー・サイズの半分(バイト)
  • semmsl : 250
  • semmns : 32000
  • semopm : 100
  • semmni : 128
  • shmall : shmmax の値以上(ページ単位)
  • shmmni : 4096
  • panic_on_oops : 1
  • file-max : 6815744
  • aio-max-nr : 1048576
  • ip-local-port_range 最小:9000 最大:65500
  • rmem_default : 262144
  • rmem_max : 4194304
  • wmem_default : 262144
  • wmem_max : 1048576

設定が完了したら以下のコマンドで即時反映が可能です。こちら rootユーザーで実行してください。

# /sbin/sysctl --system

7.OSグループの作成

以下のコマンドでOSグループを作成します。

# groupadd -g 54321 oinstall
# groupadd -g 54322 dba
# groupadd -g 54323 oper
# groupadd -g 54324 backupdba
# groupadd -g 54325 dgdba
# groupadd -g 54326 kmdba
# groupadd -g 54327 racdba

8.Oracleユーザーの作成

自分はOSインストール時に作成してしまったので、手順7で作成したOSグループに追加するコマンドのみ実行します。
次回ログイン時から反映されます。

[root@TARGET oracle]# id oracle
uid=1000(oracle) gid=1000(oracle) groups=1000(oracle),10(wheel)
[root@TARGET oracle]# usermod -aG dba,oper,backupdba,dgdba,kmdba,racdba oracle
[root@TARGET oracle]# id oracle
uid=1000(oracle) gid=1000(oracle) groups=1000(oracle),10(wheel),54330(racdba),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba)

9.リソース制限の設定

以下の設定を /etc/security/limits.conf に追記します。

[root@ISO oracle]# vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
oracle soft memlock 5274299
oracle hard memlock 5274299

10.OUIの設定準備

[root@TARGET oracle]# xhost + **.**.**.**
[root@TARGET oracle]# su - oracle
[oracle@TARGET ~]$ export DISPLAY=**.**.**.**:0.0

11.インストールディレクトリの準備

ORACLE_HOME、ORACLE_BASE となるディレクトリを準備します。

[root@TARGET oracle]# mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1
[root@TARGET oracle]# mkdir -p /u01/app/oraInventory
[root@TARGET oracle]# chown -R oracle:oinstall /u01/app/oracle
[root@TARGET oracle]# chown -R oracle:oinstall /u01/app/oraInventory
[root@TARGET oracle]# chmod -R 775 /u01/app

12.インストール媒体展開

[oracle@TARGET dbhome_1]$ unzip V982063-01.zip -d /u01/app/oracle/product/19.0.0/dbhome_1
・
・*/省略/*
・
[oracle@TARGET dbhome_1]$ export LANG=ja_JP.utf8

インストール

1.コマンド実行

[oracle@TARGET dbhome_1]$ ./runInstaller
ERROR: Unable to verify the graphical display setup. This application requires X display. Make sure that xdpyinfo exist under PATH variable.

No X11 DISPLAY variable was set, but this program performed an operation which requires it.

うまく実行されませんね。
クライアント端末との OUI の接続設定がうまくいっていないようですが、
めんどくさいので OL 側で再度実行します。

[oracle@TARGET dbhome_1]$ ./runInstaller

通りましたがまたエラー。
image.png
「INS-08101」を頼りに検索すると以下のサイトがヒット。
どうやら 19C には OL8 に対する前提チェックの仕組みが無いとのこと。
解決法参考サイト

そのため、以下のコマンドをあらかじめ実行してから再度./runInstaller を実行します。

[oracle@TARGET dbhome_1]$ export CV_ASSUME_DISTID='OL7'

また、文字セットを日本語にした影響で"□□□"等文字化けが発生する場合があるため、
英語にすることで解消することができます。
日本語にする方法もあるようですが、今回は英語で行きます。

[oracle@TARGET ~]$ export LANG=c

2.インストール画面

すると以下の通り、正常に開始しました。
image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png
ここは「Yes」を選択します。
image.png

image.png

image.png
「Ignore ALL」を選択し次へ
image.png
ここも「Yes」を選択します。
image.png

image.png

image.png

該当のスクリプトを root ユーザーで実行してほしいそうです。
image.png
以下の通り実行しました。

[root@TARGET oraInventory]# ./orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oracle.
The execution of the script is complete.

[root@TARGET dbhome_1]# ./root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/19.0.0/dbhome_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...


Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Oracle Trace File Analyzer (TFA - Standalone Mode) is available at :
    /u01/app/oracle/product/19.0.0/dbhome_1/bin/tfactl

Note :
1. tfactl will use TFA Service if that service is running and user has been granted access
2. tfactl will configure TFA Standalone Mode only if user has no access to TFA Service or TFA is not installed

無事インストール完了
image.png

Oracle Database に接続

1.環境変数を設定

新入社員にどこで何をすればよいのかを教えてあげることと同じように、Oracle ユーザーに Oracle Database の場所(環境変数)を教えてあげます。

[root@TARGET dbhome_1]# su - oracle
[oracle@TARGET ~]$ export ORACLE_BASE=/u01/app/oracle
[oracle@TARGET ~]$ export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1
[oracle@TARGET ~]$ export PATH=$PATH:$ORACLE_HOME/bin
[oracle@TARGET ~]$ export ORACLE_SID=orcl19ta

2.SQL を実行

教えてあげたので無事接続することができました。
起動状態も正常です。

[oracle@TARGET ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Nov 10 21:21:32 2022
Version 19.3.0.0.0

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


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

SQL> startup
ORA-01081: cannot start already-running ORACLE - shut it down first
SQL> select status from v$instance;

STATUS
------------
OPEN

以上です!

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?