先日、RHEL8にRPMパッケージからOracle Database 19cをインストールしました。
今回は動作確認してみたいと思います。
環境
・Red Hat Enterprise Linux release 8.5 (Ootpa)
・Kernel 4.18.0-348.7.1.el8_5.x86_64
・oracle-database-preinstall-19c-1.0-3.el7.x86_64.rpm
・oracle-database-ee-19c-1.0-1.x86_64.rpm
・開発環境、GNOME環境、日本語入力インストール
・Subscription登録
configureで作成されたDatabaseはメッセージにあるように下記になります。
Database Information:
Global Database Name:ORCLCDB
System Identifier(SID):ORCLCDB
- oracleユーザでログイン
- 環境変数の設定 ORACLE
- 環境変数の設定 PATH
- リスナーの確認
- sqlplusで接続
- 日本語文字コードの環境変数設定
- sqlplusで接続
- ログイン時に環境変数の設定
1 |
[root@rhel8 ~]# su - oracle |
取り合えずoracle関連の環境変数を設定します。oraenvスクリプトを使用します。
1 2 3 4 5 6 7 8 9 |
[oracle@rhel8 ~]$ . oraenv ORACLE_SID = [oracle] ? ORCLCDB The Oracle base has been set to /opt/oracle [oracle@rhel8 ~]$ set | grep ORACLE OLD_ORACLE_BASE= ORACLE_BASE=/opt/oracle ORACLE_HOME=/opt/oracle/product/19c/dbhome_1 ORACLE_SID=ORCLCDB |
Oracle関連コマンドへのPATHを設定します。
1 |
[oracle@rhel8 ~]$ export PATH=$PATH:$ORACLE_HOME/bin |
リスナーが動作しているか確認します。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
[oracle@rhel8 ~]$ lsnrctl status Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rhel8)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production Start Date 14-JAN-2022 3:22:31 Uptime 0 days 0 hr. 36 min. 35 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora Listener Log File /opt/oracle/diag/tnslsnr/rhel8/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rhel8)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=rhel8)(PORT=5500))(Security=(my_wallet_directory=opt/oracle/admin/ORCLCDB/xdb_wallet))(Presentation=HTTP)(Session=RAW)) Services Summary... Service "ORCLCDB" has 1 instance(s). Instance "ORCLCDB", status READY, has 1 handler(s) for this service... Service "ORCLCDBXDB" has 1 instance(s). Instance "ORCLCDB", status READY, has 1 handler(s) for this service... Service "d5c0ad0287ff1c8fe0531a0aa8c0dc0f" has 1 instance(s). Instance "ORCLCDB", status READY, has 1 handler(s) for this service... Service "orclpdb1" has 1 instance(s). Instance "ORCLCDB", status READY, has 1 handler(s) for this service... The command completed successfully |
configure時のパラメーターファイルです。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
[oracle@rhel8 ~]$ cat /etc/sysconfig/oracledb_ORCLCDB-19c.conf #This is a configuration file to setup the Oracle Database. #It is used when running '/etc/init.d/oracledb_ORCLCDB configure'. #Please use this file to modify the default listener port and the #Oracle data location. # LISTENER_PORT: Database listener LISTENER_PORT=1521 # ORACLE_DATA_LOCATION: Database oradata location ORACLE_DATA_LOCATION=/opt/oracle/oradata # EM_EXPRESS_PORT: Oracle EM Express listener EM_EXPRESS_PORT=5500 |
このoracledb_ORCLCDB-19c.confを元にスクリプトが下記の関連ファイルを作成します。
1 2 3 4 5 6 7 8 9 10 11 |
[oracle@rhel8 ~]$ cat /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora # listener.ora Network Configuration File: /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora # Generated by Oracle configuration tools. LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = rhel8)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) ) |
1 2 3 4 5 |
[oracle@rhel8 ~]$ cat /opt/oracle/product/19c/dbhome_1/network/admin/sqlnet.ora # sqlnet.ora Network Configuration File: /opt/oracle/product/19c/dbhome_1/network/admin/sqlnet.ora # Generated by Oracle configuration tools. NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
[oracle@rhel8 ~]$ cat /opt/oracle/product/19c/dbhome_1/network/admin/tnsnames.ora # tnsnames.ora Network Configuration File: /opt/oracle/product/19c/dbhome_1/network/admin/tnsnames.ora # Generated by Oracle configuration tools. ORCLCDB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = rhel8)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORCLCDB) ) ) LISTENER_ORCLCDB = (ADDRESS = (PROTOCOL = TCP)(HOST = rhel8)(PORT = 1521)) |
接続できましたが日本語が文字化けしています。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
[oracle@rhel8 ~]$ sqlplus / as sysdba Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 ????????? SQL> show user; ?????"SYS"??? SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 ORCLPDB1 READ WRITE NO SQL> quit Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0????????????? |
1 |
[oracle@rhel8 ~]$ export NLS_LANG=Japanese_Japan.AL32UTF8 |
sqlplusのコマンド、いろいろなサイトからのコピペで実は殆ど分かりません(^^;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
[oracle@rhel8 ~]$ sqlplus / as sysdba Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 に接続されました。 SQL> select name, cdb, con_id from v$database; NAME CDB CON_ID --------- --- ---------- ORCLCDB YES 0 SQL> select instance_name, status, con_id from v$instance; INSTANCE_NAME STATUS CON_ID ---------------- ------------ ---------- ORCLCDB OPEN 0 SQL> select con_id, name, open_mode from v$pdbs; CON_ID ---------- NAME -------------------------------------------------------------------------------- OPEN_MODE ---------- 2 PDB$SEED READ ONLY 3 ORCLPDB1 READ WRITE CON_ID ---------- NAME -------------------------------------------------------------------------------- OPEN_MODE ---------- SQL> quit Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0との接続が切断されました。 |
最低限の動作確認ができたのでログイン時に環境変数を設定します。
oracleユーザはbashを設定してあるので~/.bash_profileに設定しました。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
[oracle@rhel8 ~]$ vi .bash_profile [oracle@rhel8 ~]$ cat .bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs export ORACLE_BASE=/opt/oracle export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1 export ORACLE_SID=ORCLCDB export NLS_LANG=Japanese_Japan.AL32UTF8 export PATH=$PATH:$ORACLE_HOME/bin |