VirutalBoxの仮想マシンを作成して、その仮想マシン上でOracle Database 19c EEのインスタンスを実行します。作業にはAppleのMacbook Proを使用します。
TLSの有効化
sh setup_oracle_wallet.sh パスワード
[oracle@localhost tls]$ sh setup_selfsigned_cert.sh orcl19c
Generating self-signed certificate for: orcl19c
1. Generating Root CA...
Generating a RSA private key
......................++++
......................................................++++
writing new private key to 'rootCA.key'
-----
2. Generating server key...
Generating RSA private key, 2048 bit long modulus (2 primes)
.............................................................................................................+++++
...........+++++
e is 65537 (0x010001)
3. Generating CSR...
4. Signing certificate...
Signature ok
subject=CN = orcl19c
Getting CA Private Key
5. Verifying certificate...
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
1e:f2:8e:2e:95:24:20:6e:7b:6e:08:ec:f3:2c:78:68:b1:3b:b9:14
Signature Algorithm: sha256WithRSAEncryption
Issuer: C = JP, O = Development, CN = My Root CA
Validity
Not Before: Feb 17 05:32:08 2026 GMT
Not After : Mar 21 05:32:08 2027 GMT
Subject: CN = orcl19c
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public-Key: (2048 bit)
Modulus:
00:e4:78:ae:8d:36:d1:19:12:7c:1d:91:2b:9c:cd:
72:31:91:6f:41:d9:b4:38:36:3d:b1:e5:e4:6f:97:
82:ab:94:84:7c:64:8c:26:3b:86:28:f8:2d:b4:db:
65:2d:16:af:fc:87:ab:79:b7:9e:a2:04:84:9c:f9:
8d:29:7c:02:b6:22:0c:7e:4a:41:a4:41:8c:3c:51:
90:60:6a:a2:05:0b:6c:8f:9f:f4:b4:12:38:ea:68:
8b:be:77:1f:83:6b:0f:37:21:ad:43:ba:4f:d2:0f:
47:c7:2e:d6:3d:ea:45:e1:3e:d4:4e:f4:11:01:50:
fe:e1:9b:ef:6e:4a:ce:d4:9f:03:08:e2:14:54:0e:
34:08:e7:3e:74:80:bd:a0:7d:13:17:a3:18:c7:61:
9c:af:36:58:e3:0e:13:fc:1a:91:c9:d8:04:94:de:
1d:6a:fa:8e:54:89:78:dc:3b:d4:6c:a3:6f:d5:24:
6a:0c:e7:2a:da:85:01:52:e8:e9:b3:0a:06:0b:e9:
63:87:05:d0:c4:32:55:8e:ab:6f:8a:90:17:69:58:
8d:e0:87:15:cb:4a:cf:c5:4b:4c:00:a0:32:de:00:
61:bc:45:cf:cc:dc:70:37:0f:cf:9e:22:4f:58:15:
19:7d:0d:a3:9b:e5:e3:e2:28:7f:ed:df:5a:18:7f:
8b:13
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
X509v3 Key Usage:
Digital Signature, Key Encipherment
X509v3 Extended Key Usage:
TLS Web Server Authentication
X509v3 Subject Alternative Name:
DNS:orcl19c, DNS:localhost, IP Address:127.0.0.1
Signature Algorithm: sha256WithRSAEncryption
97:37:69:1f:5a:8a:3f:23:72:db:0e:bf:52:f9:97:7c:b8:92:
9a:01:7f:2d:83:8f:90:a6:26:5f:92:fa:81:84:3f:03:9f:ee:
8d:78:ac:c3:82:6d:9d:ac:dd:7c:9c:ae:02:08:59:ef:fd:12:
cd:b1:57:a7:4c:4a:e6:ba:71:d2:c2:78:18:7a:cf:5f:88:91:
01:eb:b8:f3:9e:60:25:d9:14:d5:3b:48:ad:ca:03:ec:d4:e4:
c1:6c:61:0d:3d:48:6f:b7:42:1c:75:6e:b7:bb:63:0d:e5:db:
bf:3a:97:9e:00:cd:e3:b5:42:e6:91:72:43:c1:65:90:a9:41:
38:69:82:20:05:f0:8d:58:49:e5:f3:fb:94:80:61:82:a5:96:
4a:eb:f8:95:53:cf:bd:c9:24:f5:6b:0c:6d:f9:b8:90:a3:18:
35:62:f7:31:f9:17:d9:e3:a8:45:af:43:29:22:75:cc:f4:38:
48:61:8a:3e:04:16:99:f5:5e:77:8b:47:1f:22:48:c9:9a:33:
ca:37:e3:50:00:b8:ad:4a:44:e2:e3:3a:4c:0d:83:64:a1:34:
d0:5f:8f:59:2a:14:ad:a3:30:bb:2a:a5:8d:d1:47:47:a7:df:
6c:97:67:04:da:bf:0b:f8:03:ee:64:aa:c6:38:37:a1:77:e1:
fe:f9:68:98:86:63:ab:45:9e:d5:26:3b:5c:db:3f:91:a1:84:
d0:eb:74:9a:06:95:32:bb:b0:58:0e:3a:aa:c6:26:a6:30:32:
4b:34:24:50:18:e0:0f:b6:2f:ae:6a:6b:f8:25:5b:46:84:78:
7b:ab:de:12:4d:1f:31:51:da:98:7f:2f:0f:9f:82:db:5b:90:
5b:d8:07:22:e5:4a:85:77:33:49:19:15:1c:b3:03:46:0a:18:
77:45:2e:94:e9:35:8f:a8:f0:bc:ed:a5:bc:d5:ba:6c:a7:c3:
4c:cd:5d:7e:8f:ad:95:af:72:65:c5:11:b6:87:9a:8f:83:ed:
52:e8:b5:fb:0e:95:64:b4:7a:7d:a5:2e:f0:78:4d:59:6e:84:
b1:fb:af:6e:5b:04:68:13:8c:01:b7:bd:f3:94:13:90:4b:c3:
d8:ba:8f:bc:2d:92:60:7e:0f:ac:1b:0c:09:1d:9c:d9:c3:8e:
d9:32:9c:77:dd:a2:08:15:97:85:96:ef:be:1c:3c:94:6b:53:
50:f2:0a:f3:8d:57:a0:20:56:3e:3a:12:61:82:9b:3c:28:21:
c2:6d:30:65:62:8a:69:9a:9b:ce:c7:5d:88:fd:4c:91:32:0a:
08:8a:9b:41:5e:2e:1f:1d:a6:f5:ce:f7:9e:bb:07:aa:3d:56:
39:8c:fb:b5:30:23:d4:af
6. Creating PKCS12 bundle...
Done! Generated files:
- rootCA.crt / rootCA.key (Root CA - import rootCA.crt to your browser/system)
- server.p12 (PKCS12 bundle)
[oracle@localhost tls]$ sh setup_oracle_wallet.sh *********
Oracle PKI Tool Release 19.0.0.0.0 - Production
19.4.0.0.0: バージョン{1}
Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved.
操作は正常に完了しました。
Oracle PKI Tool Release 19.0.0.0.0 - Production
19.4.0.0.0: バージョン{1}
Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved.
操作は正常に完了しました。
Oracle PKI Tool Release 19.0.0.0.0 - Production
19.4.0.0.0: バージョン{1}
Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved.
orapki command import_pkcs12 executed successfully.
Oracle PKI Tool Release 19.0.0.0.0 - Production
19.4.0.0.0: バージョン{1}
Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved.
Requested Certificates:
User Certificates:
Subject: CN=orcl19c
Trusted Certificates:
Subject: CN=My Root CA,O=Development,C=JP
[oracle@localhost tls]$
cd $ORACLE_HOME/network/admin
[oracle@localhost ~]$ cd $ORACLE_HOME/network/admin
[oracle@localhost admin]$
listener.oraの内容を以下に変更します。
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCPS)(HOST = localhost)(PORT = 1522))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
SSL_CLIENT_AUTHENTICATION = FALSE
WALLET_LOCATION =
(SOURCE =
(METHOD = FILE)
(METHOD_DATA =
(DIRECTORY = /opt/oracle/admin/ORCL/wallet)
)
)
sqlnet.oraにWALLET_LOCATIONを追記します。NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
WALLET_LOCATION =
(SOURCE =
(METHOD = FILE)
(METHOD_DATA =
(DIRECTORY = /opt/oracle/admin/ORCL/wallet)
)
)TNSリスナーを再起動します。lsnrctl start
[oracle@localhost admin]$ lsnrctl stop
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 17-FEB-2026 14:35:49
Copyright (c) 1991, 2023, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
The command completed successfully
[oracle@localhost admin]$ lsnrctl start
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 17-FEB-2026 14:35:51
Copyright (c) 1991, 2023, Oracle. All rights reserved.
Starting /opt/oracle/product/19c/dbhome/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 19.0.0.0.0 - Production
System parameter file is /opt/oracle/product/19c/dbhome/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=localhost)(PORT=1522)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date 17-FEB-2026 14:35:51
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/19c/dbhome/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=localhost)(PORT=1522)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
[oracle@localhost admin]$
sqlplus / as sysdba
alter system register;
exit
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Feb 17 14:36:38 2026
Version 19.19.0.0.0
Copyright (c) 1982, 2023, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.19.0.0.0
SQL> alter system register;
System altered.
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.19.0.0.0
[oracle@localhost ~]$
firewall-cmd --add-port=1522/tcp
firewall-cmd --runtime-to-permanent
firewall-cmd --list-all
[root@localhost ~]# firewall-cmd --add-port=1522/tcp
success
[root@localhost ~]# firewall-cmd --runtime-to-permanent
success
[root@localhost ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: enp0s8
sources:
services: cockpit dhcpv6-client http https ssh
ports: 1521/tcp 1522/tcp
protocols:
forward: no
masquerade: no
forward-ports:
port=443:proto=tcp:toport=8443:toaddr=
port=80:proto=tcp:toport=8080:toaddr=
source-ports:
icmp-blocks:
rich rules:
[root@localhost ~]#
mkdir tlsdb
cd tlsdb
% mkdir tlsdb
% cd tlsdb
tlsdb %
scp -r -P 2223 root@localhost:/opt/oracle/admin/ORCL/wallet .
tlsdb % scp -r -P 2223 root@localhost:/opt/oracle/admin/ORCL/wallet .
** WARNING: connection is not using a post-quantum key exchange algorithm.
** This session may be vulnerable to "store now, decrypt later" attacks.
** The server may need to be upgraded. See https://openssh.com/pq.html
root@localhost's password: *********
ewallet.p12 100% 4128 6.6MB/s 00:00
cwallet.sso 100% 4173 5.5MB/s 00:00
tlsdb %
sqlnet.oraを以下の内容で作成します。DIRECTORYには、先ほど作成したディレクトリtlsdb/walletをフルパスで指定します。
SSL_CLIENT_AUTHENTICATION = FALSE
WALLET_LOCATION =
(SOURCE =
(METHOD = FILE)
(METHOD_DATA =
(DIRECTORY = /Users/**********/Documents/tlsdb/wallet)
)
)
tnsnames.oraを作成し、TNS名としてORCLPDB1_TLSを設定します。ORCLPDB1_TLS =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCPS)(HOST = 0.0.0.0)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCLPDB1)
)
(SECURITY =
(SSL_SERVER_DN_MATCH=TRUE)
(SSL_SERVER_CERT_DN="CN=orcl19c")
)
)
SQLclで接続することを考慮し、ojdbc.propertiesを作成して以下を記述します。oracle.net.wallet_location=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=${TNS_ADMIN}/wallet)))
tlsdb % export TNS_ADMIN=$PWD
tlsdb %
sql system@orclpdb1_tls
select sys_context('userenv','network_protocol') from dual;
exit
tlsdb % sql system@orclpdb1_tls
SQLcl: 火 2月 17 14:54:27 2026のリリース25.4 Production
Copyright (c) 1982, 2026, Oracle. All rights reserved.
パスワード (**********?) ******
Last Successful login time: 火 2月 17 2026 14:54:28 +09:00
接続先:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.19.0.0.0
SQL> select sys_context('userenv','network_protocol') from dual;
SYS_CONTEXT('USERENV','NETWORK_PROTOCOL')
____________________________________________
tcps
SQL> exit
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.19.0.0.0から切断されました
ynakakoshi@Ns-Macbook tlsdb %
以上でオンプレミスのOracle Database 19c Enterprise EditionのSQL*Net通信をTLSで暗号化することができました。
Entra IDによるユーザー認証
ORCLPDB1(3):Token Auth: AZURE_AD application_id_uri check failed! application_id_uri in not beginning with https://
アプリケーションIDのURIがhttps://で始まることが必須のようです。
データベースの構成
select name, value from v$parameter where name = 'identity_provider_type';
identity_provider_typeは、未設定であればNONEになります。
tlsdb % sql sys@localhost/orclpdb1 as sysdba
SQLcl: 火 2月 17 15:14:06 2026のリリース25.4 Production
Copyright (c) 1982, 2026, Oracle. All rights reserved.
パスワード (**********?) ******
接続先:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.19.0.0.0
SQL> select name, value from v$parameter where name = 'identity_provider_type';
NAME VALUE
_________________________ ________
identity_provider_type NONE
SQL>
alter system set identity_provider_type=AZURE_AD scope=both;
select name, value from v$parameter where name = 'identity_provider_type';
SQL> alter system set identity_provider_type=AZURE_AD scope=both;
Systemが変更されました。
SQL> select name, value from v$parameter where name = 'identity_provider_type';
NAME VALUE
_________________________ ___________
identity_provider_type AZURE_AD
SQL>
以下のコマンドのアプリケーションIDのURI、ディレクトリ(テナントID)、アプリケーション(クライアント)IDを、作成したアプリケーション(今回の例ではORCL19C)の値で置き換えて実行します。
alter system set identity_provider_config =
'{
"application_id_uri": "アプリケーション ID の URI" ,
"tenant_id": "ディレクトリ (テナント) ID",
"app_id": "アプリケーション (クライアント) ID"
}' scope=both;
SQL> alter system set identity_provider_config =
2 '{
3 "application_id_uri": "https://__________.onmicrosoft.com/20f65749-****-****-****-1cfd84ff3e01",
4 "tenant_id": "3940511e-****-****-****-01b080952758",
5 "app_id": "20f65749-****-****-****-1cfd84ff3e01"
6* }' scope=both;
Systemが変更されました。
SQL>
ORCLPDB1(3):Token Auth: AZURE_AD Get groups failed! Only shared mapping is supported, but roles array does not exist or its size is 0
どうも、アプリロールに割り当てて認証されるのはグループのみで、ユーザーには対応していないようです。今回の作業では無償利用できる範囲でEntra IDを使用しているため、アプリロールにグループを割り当てることはできません。
alter user mcpuser quota 25m on users;
grant create table, create view, create sequence, create synonym to mcpuser;
grant create session to mcpuser;
SQL> create user mcpuser identified globally as 'AZURE_USER=yuji______.com_EXT_@________.onmicrosoft.com';
User MCPUSERは作成されました。
SQL> alter user mcpuser quota 25m on users;
User MCPUSERが変更されました。
SQL> grant create table, create view, create sequence, create synonym to mcpuser;
Grantが正常に実行されました。
SQL> grant create session to mcpuser;
Grantが正常に実行されました。
SQL>
データベース・ユーザーMCPUSERがネットワーク接続できるように、ACLを追加します。
begin
dbms_network_acl_admin.append_host_ace(
host => '*',
ace => xs$ace_type(
privilege_list => xs$name_list('connect'),
principal_name => 'MCPUSER',
principal_type => xs_acl.ptype_db
)
);
end;
/
SQL> begin
2 dbms_network_acl_admin.append_host_ace(
3 host => '*',
4 ace => xs$ace_type(
5 privilege_list => xs$name_list('connect'),
6 principal_name => 'MCPUSER',
7 principal_type => xs_acl.ptype_db
8 )
9 );
10 end;
11* /
PL/SQLプロシージャが正常に完了しました。
SQL> exit
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.19.0.0.0から切断されました
tlsdb %
TOKEN_AUTH=AZURE_DEVICE_CODEでの接続
ORCLPDB1_TLS_CODE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCPS)(HOST = 0.0.0.0)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCLPDB1)
)
(SECURITY =
(SSL_SERVER_DN_MATCH=TRUE)
(SSL_SERVER_CERT_DN="CN=orcl19c")
(TOKEN_AUTH=AZURE_DEVICE_CODE)
(TENANT_ID=3940511e-****-****-****-01b080952758)
(CLIENT_ID=763f0b0e-****-****-****-8d506d4ba989)
(AZURE_DB_APP_ID_URI=https://_____________.onmicrosoft.com/20f65749-****-****-****-1cfd84ff3e01)
)
)
orcl19c % sql /@orclpdb1_tls_code
SQLcl: 金 8月 29 18:16:41 2025のリリース25.2 Production
Copyright (c) 1982, 2025, Oracle. All rights reserved.
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code NEVQFUJBH to authenticate.
ブラウザでhttps://microsoft.com/deviceloginを開き、表示されているコードを入力します。
次へ進みます。
Entra IDに登録されたユーザーでサインインします。以下のスクリーンショットは、すでにサインインしているため、サインイン済みのユーザーを選択しています。
アプリケーションORCL19C-CLIにサインインします。
続行をクリックします。
SCLclでは、データベースへの接続が完了しています。
tlsdb % sql /@orclpdb1_tls_code
SQLcl: 火 2月 17 15:39:04 2026のリリース25.4 Production
Copyright (c) 1982, 2026, Oracle. All rights reserved.
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code NMNQX5ZZH to authenticate.
接続先:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.19.0.0.0
SQL>
select
sys_context('userenv','session_user') as session_user,
sys_context('userenv','current_user') as current_user,
sys_context('userenv','authentication_method') as method,
sys_context('userenv','authenticated_identity') as azure_user
from dual;
SQL> select
2 sys_context('userenv','session_user') as session_user,
3 sys_context('userenv','current_user') as current_user,
4 sys_context('userenv','authentication_method') as method,
5 sys_context('userenv','authenticated_identity') as azure_user
6* from dual;
SESSION_USER CURRENT_USER METHOD AZURE_USER
_______________ _______________ _______________ _____________________________________________________________
MCPUSER MCPUSER TOKEN_GLOBAL ************_outlook.com_EXT_@*****************.onmicrosoft.com
SQL> exit
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.19.0.0.0から切断されました
tlsdb %
以上で、TOKEN_AUTH=AZURE_DEVICE_CODEでの認証を確認できました。








