Oracle

帶有空格字元的 Oracle 使用者密碼

  • July 30, 2019

我連接到一個 Oracle 19c 數據庫並執行以下 SQL:

alter user sys identified by "a b" container=all;

它執行成功。但是,之後我無法使用 SQLPlus 連接到 Oracle。以下是我的嘗試:

oracle:[~]$ sqlplus
Enter user-name: sys as sysdba
Enter password:
SP2-0306: Invalid option.
Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM|SYSBACKUP|SYSDG|SYSKM|SYSRAC}] [edition=value]]
where <logon> ::= <username>[/<password>][@<connect_identifier>]
     <proxy> ::= <proxyuser>[<username>][/<password>][@<connect_identifier>]
Enter user-name: oracle:[~]$
oracle:[~]$
oracle:[~]$
oracle:[~]$ sqlplus sys/"a b"@localhost:1521/ORCLCDB as sysdba
... (not work)
oracle:[~]$ sqlplus sys/\"a b\"@localhost:1521/ORCLCDB as sysdba
... (not work)
oracle:[~]$ sqlplus sys@localhost:1521/ORCLCDB as sysdba
... (type "a b" without quotes and not work)

如何連接到數據庫?

無法使用 sqlplus 實用程序登錄到 oracle,因為使用者名和密碼包含空格

[oracle@o71 ~]$ sqlplus sys/Oracle123@\'localhost/MIN19_O71\' as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Jul 30 23:12:19 2019
Version 19.4.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.4.0.0.0

SQL> alter user sys identified by "Oracle 123";

User altered.

SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.4.0.0.0

[oracle@o71 ~]$ sqlplus sys/\""Oracle 123\""@\'localhost/MIN19_O71\' as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Jul 30 23:19:25 2019
Version 19.4.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.4.0.0.0

SQL>

引用自:https://dba.stackexchange.com/questions/244161