重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 854|回复: 0
打印 上一主题 下一主题

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

[复制链接]
跳转到指定楼层
楼主
发表于 2023-12-8 16:37:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 jiawang 于 2023-12-8 17:21 编辑

当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>      

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

推荐的特殊字符:_ $ #

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




分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-5-2 16:47 , Processed in 0.103393 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表