我的 Oracle 21c PDB 连接有问题。我已经创建了一个操作系统用户,应该能够使用以下命令登录可插入数据库:
sqlplus /
...命令。但是它无法按照我的配置方式工作。
操作系统: Rocky Linux 版本 8.8(绿黑曜石)
Oracle版本:Oracle 21c
CDB:iqlink2c
PDB:iqlink2
您可以在下面找到步骤...
1.) 我已在 .cshrc 文件中使用以下参数创建了 orasync 操作系统 (Linux - Rocky 8) 用户...
setenv ORACLE_BASE /opt/oracle
setenv ORACLE_HOME $ORACLE_BASE/product/21c/dbhome_1
setenv ORACLE_SID iqlink2
setenv ORACLE_TERM xsun5
setenv NLS_LANG AMERICAN_AMERICA.WE8ISO8859P1
setenv PATH ${PATH}:${ORACLE_HOME}/bin
setenv EDITOR /bin/vi
2.) 我登录到 Pluggable Database (iqlink2),并使用以下语句创建了 orasync DB 用户...
create user orasync
identified externally
default tablespace COMPANY
temporary tablespace TEMP
quota unlimited on COMPANY
quota unlimited on COMPANY_INDX
/
...并授予 dba 权限...
GRANT dba TO orasync
/
3.) 我登录到 Container Database (iqlink2c) 并检查了 os_authent_prefix 和 remote_os 参数...
SQL> SHOW PARAMETERS os_authent_prefix;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
os_authent_prefix string ops$
SQL> SHOW PARAMETERS remote_os;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_os_roles boolean FALSE
SQL>
注意:我知道 remote_os_authent 参数应该是 TRUE,但它在 Oracle 21c 中不再可用。此时我想知道是否可以使用 Oracle 21c PDB 进行远程操作系统登录?!
4.)我删除了 os_authent_prefix 值,然后重新启动数据库...
[oracle@company02 ~]$ sqlplus sys@iqlink2c as sysdba
SQL*Plus: Release 21.0.0.0.0 - Production on Sat Nov 11 00:52:45 2023
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0
SQL> alter system set os_authent_prefix='' scope=SPFILE;
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area 4294967152 bytes
Fixed Size 9695088 bytes
Variable Size 3388997632 bytes
Database Buffers 872415232 bytes
Redo Buffers 23859200 bytes
Database mounted.
Database opened.
SQL> show parameter os_authent_prefix;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
os_authent_prefix string
5.) 我使用 orasync 用户登录并尝试登录可插入数据库...
[orasync@company02 ~]$ sqlplus /
SQL*Plus: Release 21.0.0.0.0 - Production on Sat Nov 11 01:04:49 2023
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Additional information: 4775
Additional information: 1962365431
Process ID: 0
Session ID: 0 Serial number: 0
Enter user-name:
...我也尝试过...
[orasync@company02 ~]$ sqlplus /@iqlink2
SQL*Plus: Release 21.0.0.0.0 - Production on Sat Nov 11 00:47:53 2023
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
**ERROR:
ORA-01017: invalid username/password; logon denied**
Enter user-name:
此时我真的不明白为什么不起作用,因为我得到了tnsping...
的答案[orasync@company02 ~]$ tnsping iqlink2
TNS Ping Utility for Linux: Version 21.0.0.0.0 - Production on 11-NOV-2023 01:08:00
Copyright (c) 1997, 2021, Oracle. All rights reserved.
Used parameter files:
/opt/oracle/product/21c/dbhome_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = iqlinkxg02)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = iqlink2)))
OK (0 msec)
[orasync@company02 ~]$
...我还可以使用同一操作系统用户的其他数据库用户登录...
[orasync@company02 ~]$ sqlplus sys1@iqlink2
SQL*Plus: Release 21.0.0.0.0 - Production on Sat Nov 11 01:09:18 2023
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Enter password:
Last Successful login time: Sat Nov 11 2023 01:03:42 +01:00
Connected to:
Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0
SQL>
我尝试解决此问题的第一件事是删除 os_authent_prefix 参数的 ops$ 值,但在这种情况下,我收到了
ORA-01017: invalid username/password; logon denied
错误。
我尝试的另一件事是,我在服务器上配置了一个 Oracle 19c 客户端,并相应地修改了 orasync 用户的 .cshrc 文件。配置没问题,因为我可以使用其他数据库用户登录数据库,但我仍然收到
ORA-01017: invalid username/password; logon denied
错误。
最重要的是,我尝试将
setenv TWO_TASK $ORACLE_SID
参数添加到 .cshrc 文件中,但这实际上只是一个正式的更改,没有帮助。
任何帮助将不胜感激!
remote_os_authentication
被删除是有充分理由的。这是一个重大的安全漏洞。与数据库用户共享相同名称的本地用户的任何客户端(甚至是黑客)都可以连接到数据库。这是一种永远、永远、永远都不应该使用的身份验证架构。
也就是说,PDB 无法按照您描述的方式直接连接。只有 CDB 可以通过 IPC 类型连接进行连接。对于 PDB,您必须指定 TNS 别名并通过网络侦听器进行连接。然后,您可以在客户端上使用 Oracle Wallet 来保存用户名/密码凭证并达到相同的效果。
请参阅此处的文档:chrome-extension://efaidnbmnnnibpcajpcglclefindmkaj/https://www.oracle.com/technetwork/database/security/twp-db-security-secure-ext-pwd-stor-133399.pdf
基本步骤是:
sqlplus /@pdb_tns_alias
另请注意:您的 Linux 发行版不支持 Oracle 服务器;为了获得正确的功能,您应该使用 Oracle Linux。