今日はRHEL7.3環境にOracleDBをインストールする作業の続きです。
![](https://libproc.com/wp-content/uploads/2018/07/oracle_top-1-300x300-1532570608.jpg)
今回はデータベースインスタンスを作成したいと思います!!!
これさえできれば 「○○さん、OracleDB作っておいて」、「最新の12.2.0.1でいいっすか?」 が
できるわけだ。
※今回も英語表記での手順になります。
リスナーの作成
まずはnetcaコマンドでOracle Net Configuration Assistantを起動しよう。
$ netca
まずはnetcaコマンドでOracle Net Configuration Assistantを起動しよう。
※環境変数が設定されてないとnetcaコマンドでは起動できないぞ。先にデータベース作成後作業をやってもよい。
「Listener configuration」を選択してNext。
![](https://shimi-dai.com/wp-content/uploads/2022/01/001-2.jpeg)
「Add」を選択してNext。
![](https://shimi-dai.com/wp-content/uploads/2022/01/002-1.jpeg)
「Linstener name」に「LISTENER」と入力してNext。
![](https://shimi-dai.com/wp-content/uploads/2022/01/003-2.jpeg)
「Selected Protocols」を「TCP」を選択してNext。
![](https://shimi-dai.com/wp-content/uploads/2022/01/004-2.jpeg)
「Use the standard port number 1521」を選択してNext。
のポート番号を入力しよう。
![](https://shimi-dai.com/wp-content/uploads/2022/01/005-2.jpeg)
「No」を選択してNext。
![](https://shimi-dai.com/wp-content/uploads/2022/01/006-2.jpeg)
「Linstener configuration complete!」が出力されたらNext。これでリスナーの作成は終了しました。
![](https://shimi-dai.com/wp-content/uploads/2022/01/007-2.jpeg)
ちゃんとリスナーが作成され、起動されているか確認しよう。
以下の内容が出力されればOKです。
Oracle Net Services Configuration:
Configuring Listener:LISTENER
Listener configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/u01/app/oracle/product/12.2.0.1/dbhome_1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Oracle Net Services configuration successful. The exit code is 0
データベースの作成
ここからはデータベースを作成していきます。
今回はシングルインスタンスのnon-PDB構成で作成します。
「create a database」を選択してNext。
![](https://shimi-dai.com/wp-content/uploads/2022/01/001-3.jpeg)
「Advanced configuration」を選択してNext。
![](https://shimi-dai.com/wp-content/uploads/2022/01/002-3.jpeg)
「Custom Database」を選択してNext。
※下の図ではGeneral Purpose or Trasaction procesingとなっているので注意。
![](https://shimi-dai.com/wp-content/uploads/2022/01/003-3.jpeg)
「Global database name」に「orcl」、「SID」に「orcl」を入力してNext。
![](https://shimi-dai.com/wp-content/uploads/2022/01/004-3.jpeg)
「Use following for the database storage attributes」を選択。
「Database files storage type」を「File System」、「Database files location」を任意の場所に設定してNext。
![](https://shimi-dai.com/wp-content/uploads/2022/01/005-3.jpeg)
「Specify Fast Recovery Area」と「Enable archive」のチェックを外してにNext。
ただし構成によっては必要なので注意が必要がです。
![](https://shimi-dai.com/wp-content/uploads/2022/01/006-3.jpeg)
先ほど作成した「LISTENER」を選択してNext。
![](https://shimi-dai.com/wp-content/uploads/2022/01/007-4.jpeg)
「Configure Oracle Label Security」と「Configure Oracle Database Vault」のチェックを外してにNext。
![](https://shimi-dai.com/wp-content/uploads/2022/01/008-2.jpeg)
「Use AutomaticAutomatic Shared Memory Managerment」で任意のSGAとPGAを設定。
DBを初めて作成する人は「Use Automatic Memory Management」を選択してもよいぞ!
![](https://shimi-dai.com/wp-content/uploads/2022/01/009-3.jpeg)
「processes」を「300」に設定。
![](https://shimi-dai.com/wp-content/uploads/2022/01/010-2.jpeg)
- 「Use Unicode」を選択。
- 「Natinal Character set」を「AL16UTF16」を選択。
- 「Default language」を「Japanese」を選択
- 「Default territory」を「Japan」を選択
![](https://shimi-dai.com/wp-content/uploads/2022/01/011-2.jpeg)
「Dedicated Sever mode(専用サーバモード)」を選択。
![](https://shimi-dai.com/wp-content/uploads/2022/01/012-1.jpeg)
「Add sample scehmas to the database」にチェックを入れずにNext。
![](https://shimi-dai.com/wp-content/uploads/2022/01/013-1.jpeg)
「Configure Enterprise Manager (EM) database express」と「Register with Enterprise with Enterprise Manager(EM) cloud control」にチェックを入れずにNext。
![](https://shimi-dai.com/wp-content/uploads/2022/01/014.jpeg)
「Use the sama administrative password for all accounts」に任意のパスワードを入力してNext。
![](https://shimi-dai.com/wp-content/uploads/2022/01/015-1.jpeg)
下の画面が出ても無視してYesを選択。
![](https://shimi-dai.com/wp-content/uploads/2022/01/016.jpeg)
「Create database」にのみチェックを入れてNext。
![](https://shimi-dai.com/wp-content/uploads/2022/01/017.jpeg)
作成するデータベースのサマリーを確認してFinish。
![](https://shimi-dai.com/wp-content/uploads/2022/01/018.jpeg)
![](https://shimi-dai.com/wp-content/uploads/2022/01/019.jpeg)
頑張ってインストールしているので待ちましょう。
![](https://shimi-dai.com/wp-content/uploads/2022/01/020-1.jpeg)
以下の画面が表示されたらインストール完了です。
![](https://shimi-dai.com/wp-content/uploads/2022/01/021-1.jpeg)
データベース作成後作業
OSのoracleユーザにログインしてsqlplus で直ぐに接続できるようにしておくと便利。
ということで.bash_profileに環境変数を設定しておく。
Oracle Net Services Configuration:
Configuring Listener:LISTENER
Listener configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/u01/app/oracle/product/12.2.0.1/dbhome_1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Oracle Net Services configuration successful. The exit code is 0
sqlplusでヘビーに使用するならばglogin.sqlに以下の設定を入れておくと便利
$ vi ${ORACLE_HOME}/sqlplus/admin/glogin.sql
内容は以下になります。
set time on
set timing on
set trimspool on
set serveroutput on size 1000000
set SQLPROMPT "_USER'@'_CONNECT_IDENTIFIER > "
ALTER SESSION SET nls_date_format = 'yyyy-mm-dd hh24:mi:ss';