【方法】Oracle用户密码含特殊字符时的登陆问题

方法Oracle用户密码含特殊字符时的登陆问题

 

1.1  BLOG文档结构图

 

1.2  前言部分

1.2.1  导读和注意事项

各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~:

① 用户密码含有特殊字符,如@、%、&、¥、#等字符,如何修改密码及登录数据库(重点)

② exp或expdp的时候使用sys用户导出

 

Tips:

① 本文在itpub(http://blog.itpub.net/26736162)、博客园(http://www.cnblogs.com/lhrbest)和微信公众号(xiaomaimiaolhr)上有同步更新。

② 文章中用到的所有代码、相关软件、相关资料及本文的pdf版本都请前往小麦苗的云盘下载,小麦苗的云盘地址见:http://blog.itpub.net/26736162/viewspace-1624453/

③ 若网页文章代码格式有错乱,请下载pdf格式的文档来阅读。

④ 在本篇BLOG中,代码输出部分一般放在一行一列的表格中。

本文有错误或不完善的地方请大家多多指正,您的批评指正是我写作的最大动力。

 

1.2.2  相关文章链接

 【密码】Oracle用户密码系列:http://blog.itpub.net/26736162/viewspace-2129595/

-------------------------------------------------------------------------

第二章 实验部分

2.1  实验环境介绍


项目


source db


db 类型


RAC


db version


11.2.0.3.0


db 存储


ASM


OS版本及kernel版本


RHEL 6.5

2.2  实验目标

当用户密码含有特殊字符的时候,测试sqlplus和exp、imp及expdp、impdp的登陆及修改密码问题。

2.3  实验过程

2.3.1  sqlplus连接

普通用户连接:


[oracle@orcltest admin]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.3.0 Production on Fri Feb 24 09:25:35 2017

 

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

 

 

Connected to:

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

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

 

SYS@lhrdb> alter user lhr identified by "l@hr";

 

User altered.

 

SYS@lhrdb> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

[oracle@orcltest ~]$ sqlplus 'lhr/"l@hr"'@LHRDB

 

SQL*Plus: Release 11.2.0.3.0 Production on Fri Feb 24 09:27:05 2017

 

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

 

 

Connected to:

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

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

 

LHR@LHRDB> EXIT

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

[oracle@orcltest ~]$

 

 

sys用户连接:


[oracle@orcltest admin]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.3.0 Production on Fri Feb 24 09:29:09 2017

 

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

 

 

Connected to:

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

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

 

SYS@lhrdb>  alter user sys identified by "l@hr";

 

User altered.

 

SYS@lhrdb> exit

[oracle@orcltest ~]$ sqlplus 'sys/"l@hr"'@LHRDB as sysdba

 

SQL*Plus: Release 11.2.0.3.0 Production on Fri Feb 24 09:29:35 2017

 

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

 

 

Connected to:

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

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

 

SYS@LHRDB> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

[oracle@orcltest ~]$

 

 

2.3.2  expdp连接

密码用双引号,用户名和密码用单引号括起来,然后【用户名】+【密码】+【tn】+【as sysdba】用单引号括起来,最后的这个单引号用\进行转义


expdp \''sys/"l@hr"'@LHRDB as sysdba\' DIRECTORY=DATA_PUMP_DIR DUMPFILE=SCOTT%U.dmp SCHEMAS=SCOTT COMPRESSION=all metrics=y

 


[oracle@orcltest admin]$  expdp \''sys/"l@hr"'@LHRDB as sysdba\' DIRECTORY=DATA_PUMP_DIR DUMPFILE=SCOTT%U.dmp SCHEMAS=SCOTT COMPRESSION=all metrics=y

 

Export: Release 11.2.0.3.0 - Production on Fri Feb 24 09:32:22 2017

 

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

 

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

FLASHBACK automatically enabled to preserve database integrity.

Starting "SYS"."SYS_EXPORT_SCHEMA_01":  "sys/********@LHRDB AS SYSDBA" DIRECTORY=DATA_PUMP_DIR DUMPFILE=SCOTT%U.dmp SCHEMAS=SCOTT COMPRESSION=all metrics=y

Estimate in progress using BLOCKS method...

Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA

Total estimation using BLOCKS method: 192 KB

Processing object type SCHEMA_EXPORT/USER

     Completed 1 USER objects in 0 seconds

Processing object type SCHEMA_EXPORT/SYSTEM_GRANT

     Completed 1 SYSTEM_GRANT objects in 0 seconds

Processing object type SCHEMA_EXPORT/ROLE_GRANT

     Completed 2 ROLE_GRANT objects in 1 seconds

Processing object type SCHEMA_EXPORT/DEFAULT_ROLE

     Completed 1 DEFAULT_ROLE objects in 1 seconds

Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA

     Completed 1 PROCACT_SCHEMA objects in 10 seconds

Processing object type SCHEMA_EXPORT/TABLE/TABLE

     Completed 4 TABLE objects in 2 seconds

Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT

     Completed 3 OBJECT_GRANT objects in 3 seconds

Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX

     Completed 2 INDEX objects in 1 seconds

Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT

     Completed 2 CONSTRAINT objects in 0 seconds

Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS

     Completed 2 INDEX_STATISTICS objects in 1 seconds

Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT

     Completed 1 REF_CONSTRAINT objects in 2 seconds

Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

     Completed 4 TABLE_STATISTICS objects in 14 seconds

. . exported "SCOTT"."DEPT"                              4.976 KB       4 rows

. . exported "SCOTT"."EMP"                               5.617 KB      14 rows

. . exported "SCOTT"."SALGRADE"                          4.890 KB       5 rows

. . exported "SCOTT"."BONUS"                                 0 KB       0 rows

Master table "SYS"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded

******************************************************************************

Dump file set for SYS.SYS_EXPORT_SCHEMA_01 is:

  /u02/app/oracle/admin/lhrdb/dpdump/SCOTT01.dmp

Job "SYS"."SYS_EXPORT_SCHEMA_01" successfully completed at 09:33:19

 

2.3.3  修改密码中含有“@”符号


[oracle@orcltest ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.3.0 Production on Thu Mar 16 17:10:26 2017

 

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

 

 

Connected to:

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

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

 

SYS@lhrdb> alter user scott identified by "tiger&123";

Enter value for 123:

old   1: alter user scott identified by "tiger&123"

new   1: alter user scott identified by "tiger"

 

User altered.

 

SYS@lhrdb>

SYS@lhrdb> set define off

SYS@lhrdb> alter user scott identified by "tiger&123";

 

User altered.

 

SYS@lhrdb> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

[oracle@orcltest ~]$  sqlplus 'scott/"tiger&123"'@LHRDB

 

SQL*Plus: Release 11.2.0.3.0 Production on Thu Mar 16 17:14:00 2017

 

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

 

 

Connected to:

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

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

 

SCOTT@LHRDB>

SCOTT@LHRDB> set define off

SCOTT@LHRDB> alter user scott identified by "$tiger&123l@h\r/0%s,d$";

 

User altered.

 

SCOTT@LHRDB> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

[oracle@orcltest ~]$  sqlplus 'scott/"$tiger&123l@h\r/0%s,d$"'@LHRDB

 

SQL*Plus: Release 11.2.0.3.0 Production on Thu Mar 16 17:20:12 2017

 

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

 

 

Connected to:

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

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

 

SCOTT@LHRDB>

 

 

2.3.4  修改密码中含有双引号符号

修改scott用户的密码为:a"b


[oracle@orcltest ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.3.0 Production on Thu Mar 16 17:39:18 2017

 

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

 

 

Connected to:

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

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

 

SYS@lhrdb> password scott

Changing password for scott

New password:

Retype new password:

Password changed

SYS@lhrdb> conn scott/a"b

Connected.

SCOTT@lhrdb>

[oracle@orcltest ~]$ sqlplus scott/a\"b   

 

SQL*Plus: Release 11.2.0.3.0 Production on Thu Mar 16 17:42:34 2017

 

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

 

 

Connected to:

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

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

 

SCOTT@lhrdb>

 

注:因为一般特殊字符可以使用双引号处理,但是如果密码中含有双引号,就不能用双引号处理,可以直接使用password修改密码。

2.4  本文结论

参考下表:

 


Linux平台


sqlplus工具


数据泵工具(expexpdp


普通用户


无tns


sqlplus 'lhr/"l@h\r/0"'


expdp 'lhr/"l@h\r/0"'


有tns


sqlplus 'lhr/"l@h\r/0"'@LHRDB


expdp 'lhr/"l@h\r/0"'@LHRDB 


sys用户


无tns


sqlplus / as sysdba


expdp \'/ AS SYSDBA\'


有tns


sqlplus 'sys/"l@h\r/0"'@LHRDB as sysdba


expdp \''sys/"l@h\r/0"'@LHRDB as sysdba\'


正常密码


sqlplus sys/lhr@lhrdb as sysdba


expdp \'sys/lhr@LHRDB as sysdba\'


备注:含特殊字符密码为:l@h\r/0,正常密码为:lhr,tns为:LHRDB,总的原则为:密码用双引号括起来,用户名和密码用单引号括起来,然后【用户名】+【密码】+【tns】+【as sysdba】用单引号括起来,最后的这个单引号用\进行转义

alter user lhr identified by "l@h\r/0";

alter user sys identified by "l@h\r/0";

set define off

alter user scott identified by "$tiger&123l@h\r/0%s,d$";

alter user scott identified by "$?`$%*H\@f'\<a-q $-@#`}:H$";

password scott


 


 


 


 


 


 


 


 


Windows平台


sqlplus工具


数据泵工具(expexpdp


普通用户


无tns


sqlplus lhr/"""l@h\r/0"""

sqlplus lhr/\"l@h\r/0\"


expdp lhr/"""l@h\r/0"""

expdp lhr/\"l@h\r/0\"


有tns


sqlplus lhr/"""l@h\r/0"""@LHRDB

sqlplus lhr/\"l@h\r/0\"@LHRDB


expdp lhr/"""l@h\r/0"""@LHRDB

expdp lhr/\"l@h\r/0\"@LHRDB


sys用户


无tns


sqlplus / as sysdba


expdp \"/ as sysdba\"


有tns


sqlplus sys/"""l@h\r/0"""@LHRDB as sysdba

sqlplus sys/\"l@h\r/0\"@LHRDB as sysdba


 


正常密码


sqlplus sys/lhr@lhrdb as sysdba


expdp \"sys/lhr@LHRDB as sysdba\"


备注:含特殊字符密码为:l@h\r/0,正常密码为:lhr,tns为:LHRDB,总的原则为:密码用3个双引号括起来,或者用一个双引号括起来,然后用\将双引号进行转义   DIRECTORY=DATA_PUMP_DIR DUMPFILE=dmp_SCOTT.dmp SCHEMAS=SCOTT  reuse_dumpfiles=y

 

 



About Me


...............................................................................................................................

● 本文作者:小麦苗,只专注于数据库的技术,更注重技术的运用

● 本文在itpub(http://blog.itpub.net/26736162)、博客园(http://www.cnblogs.com/lhrbest)和个人微信公众号(xiaomaimiaolhr)上有同步更新

● 本文itpub地址:http://blog.itpub.net/26736162/viewspace-2135493/

● 本文博客园地址:http://www.cnblogs.com/lhrbest/p/6560906.html

● 本文pdf版及小麦苗云盘地址:http://blog.itpub.net/26736162/viewspace-1624453/

● QQ群:230161599     微信群:私聊

● 联系我请加QQ好友(642808185),注明添加缘由

● 于 2017-03-16 10:00 ~ 2017-03-16 22:00 在泰兴公寓完成

● 文章内容来源于小麦苗的学习笔记,部分整理自网络,若有侵权或不当之处还请谅解

● 版权所有,欢迎分享本文,转载请保留出处

...............................................................................................................................

拿起手机使用微信客户端扫描下边的左边图片来关注小麦苗的微信公众号:xiaomaimiaolhr,扫描右边的二维码加入小麦苗的QQ群,学习最实用的数据库技术。

   

时间: 2024-09-01 01:22:02

【方法】Oracle用户密码含特殊字符时的登陆问题的相关文章

Oracle用户密码含特殊字符时登陆失败问题_oracle

当Oracle数据库用户的密码含特殊字符如 @ 时,直接使用正常的密码输入,由于oracle将@后的字符解析为网络服务名而导致登陆失败 如下演示 用户名为:wang密码为:oracle@1网络服务名为:sun 的情况: Linux平台:'wang/"oracle@1"'@sun --1个双引号扩密码,1个单引号扩 用户名+密码,即: '用户名/"密码"'@服务名 [11:41:14oracle@dvd adump]$sqlplus wang/oracle@1@sun

Oracle用户密码含有特殊字符导致无法登陆解决方法_oracle

今天碰到一个比较奇怪的问题: 在客户端上使用sqlplus用普通用户可以登录,但是system以及sys用户均无法登录,提示ORA-12154: TNS: 无法解析指定的连接标识符 SQL> conn system@webdata 输入口令: ERROR: ORA-12154: TNS: 无法解析指定的连接标识符 SQL> conn xgplat@webdata 输入口令: 已连接. 本来以为客户端是32位的缘故,就在oracle服务器上用sqlplus登录,也还是一样 SQL> con

【密码】Oracle用户密码系列

[ 密码 ] Oracle 用户密码系列 1.1   BLOG 文档结构图   1.2   前言部分 1.2.1   导读和注意事项 各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识, ~O(∩_∩)O~ : ① 用户的 9 种状态含义 (重点) ② 如何解锁账户 ③ 如何修改密码无效状态 ④ 如何获取密码的密文,如何利用密文修改用户的密码 (重点) ⑤ 如何查询失败的登陆次数 ⑥ 11g 密码大小写问题 ⑦ 11g 密码延迟验证 ⑧ 密码复杂性校验   Ti

一个修改Oracle用户密码的小诀窍

oracle 一个修改Oracle用户密码的小诀窍 数据库版本:9.2.0.5   有时候我们可能不知道一个用户的密码,但是又需要以这个用户做一些操作,又不能去修改掉这个用户的密码,这个时候,就可以利用一些小窍门,来完成操作. 具体操作过程如下: SQL*Plus: Release 9.2.0.5.0 - Production on 星期日 11月 21 13:32:34 2004 Copyright (c) 1982, 2002, Oracle Corporation.  All rights

Oracle 用户密码有效期的sql语句_oracle

废话不多说了,直接给大家写sql语句了,当然写法还有很多种,我也只是给大家分享其中的一种解决办法,有不同见解的可以留言哦. oracle的密码是存在有效期的,有时候会遇到密码到期需要重设的情况,查看当前密码有效期的语句: SELECT * FROM dba_profiles s WHERE s.profile='DEFAULT' AND resource_name='PASSWORD_LIFE_TIME'; 将密码的时间限制改为无限制: ALTER PROFILE DEFAULT LIMIT P

oracle用户密码设置的特殊字符问题

当oracle用户的密码里带有如@.$.!等特殊字符时,会出现一些问题. 以hr用户为例: 当oracle用户的密码里带有@时: SYS@ORCL> alter user hr identified by qwet@2017; alter user hr identified by qwet@2017 * ERROR at line 1: ORA-00922: missing or invalid option SYS@ORCL> alter user hr identified by 'qw

windows-在Windows下更改用户密码时,有什么方法可以获取到旧密码、新密码、确认密码吗?求各位大神指教

问题描述 在Windows下更改用户密码时,有什么方法可以获取到旧密码.新密码.确认密码吗?求各位大神指教 在Windows下更改用户密码时,有什么方法可以获取到旧密码.新密码.确认密码吗?求各位大神指教. 有什么DLL用来处理用户修改密码的事件吗? 有的话是不是可以hook这个DLL的函数来截获新密码? 解决方案 不知道你是准备做什么,用hook是可以截取键盘和鼠标的所有信息的,但是各种杀毒软件都会提醒用户键盘鼠标正被监听.hook函数慎重使用,不然你的电脑会经常死机的 解决方案二: 不是要截

Oracle 11G密码180天过期后的修改方法_oracle

由于Oracle11G的新特性所致,经常会遇到使用sqlplus登陆oracle数据库时提示"ORA-28002: 7 天之后口令将过期"等情况. 在Oracle 11G 创建用户时缺省密码过期限制是180天, 如果超过180天用户密码未做修改则该用户无法登录,提示"ORA-28001: the password has expired" 密码过期后,业务进程连接数据库异常,必然会影响使用与登录. 解放方法: ****************************

Win8.1系统网页无法保存用户密码的解决方法

Win8.1系统网页无法保存用户密码的解决方法: 1.首先我们先检查一下IE是否设置了退出时删除浏览器历史记录的选项,点击工具,打开Internet 选项,然后查看常规页面是否勾选了"退出时删除浏览器历史记录",如果勾选请取消,并点击"设置"按钮,然后将"检查储存的页面的较新版本"设置为[自动],然后确定. 2. 在缓存和数据库选项卡中勾选允许使用网站缓存和数据库. 3.然后退出之前的设置 回到Internet选项界面,点击内容标签,在内容标签里