Oracle密码有

九月课程 2024-04-23 22:03:13

Oracle密码有@等特殊字符,连接报ORA-12532: TNS:invalid argument

当oracle密码含有特殊字符时,在创建的时候,必须要用双引号把密码包起来才能创建成功

例子:

SQL> create user wj identified by oracle@123;

create user wj identified by oracle@123

*

ERROR at line 1:

ORA-00922: missing or invalid option

必须把密码包起来:

SQL> create user wj identified by "oracle@123";

User created.

SQL>

SQL> grant connect,resource to wj;

Grant succeeded.

连接报错:

SQL> conn wj/oracle@123;

ERROR:

ORA-12532: TNS:invalid argument

Warning: You are no longer connected to ORACLE.

也需要双引号

SQL> conn wj/"oracle@123";

Connected.

使用sqlplus切换到指定的数据库,报错

[oracle@strong admin]$ sqlplus wj/"oracle@123" @ORCL

SQL*Plus: Release 11.2.0.4.0 Production on Fri Dec 8 16:48:30 2023

Copyright (c) 1982, 2013, Oracle. All rights reserved.

ERROR:

ORA-12532: TNS:invalid argument

正确连接方式:

[oracle@strong admin]$ sqlplus 'wj/"oracle@123"' @ORCL

SQL*Plus: Release 11.2.0.4.0 Production on Fri Dec 8 16:48:44 2023

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SP2-0310: unable to open file "ORCL.sql"

SQL>

通过单引号将用户密码包起来,用双引号把密码包起来,就可以正常连接数据库啦。

推荐的特殊字符:_ $ #

其他特殊字符密码必须加双引号

0 阅读:0

九月课程

简介:感谢大家的关注