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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了方法Oracle用户密码含特殊字符时的登陆问题相关的知识,希望对你有一定的参考价值。

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

 

1.1  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和expimpexpdpimpdp的登陆及修改密码问题。

2.3  实验过程

2.3.1  sqlplus连接

普通用户连接:

[[email protected] 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

 

[email protected]> alter user lhr identified by "[email protected]";

 

User altered.

 

[email protected]> 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

[[email protected] ~]$ sqlplus ‘lhr/"[email protected]"‘@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

 

[email protected]> 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

[[email protected] ~]$

 

 

sys用户连接:

[[email protected] 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

 

[email protected]>  alter user sys identified by "[email protected]";

 

User altered.

 

[email protected]> exit

[[email protected] ~]$ sqlplus ‘sys/"[email protected]"‘@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

 

[email protected]> 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

[[email protected] ~]$

 

 

2.3.2  expdp连接

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

expdp \‘‘sys/"[email protected]"‘@LHRDB as sysdba\‘ DIRECTORY=DATA_PUMP_DIR DUMPFILE=SCOTT%U.dmp SCHEMAS=SCOTT COMPRESSION=all metrics=y

 

[[email protected] admin]$  expdp \‘‘sys/"[email protected]"‘@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 DUMPFIL

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  修改密码中含有“@”符号

[[email protected] ~]$ 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

 

[email protected]> 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.

 

[email protected]>

[email protected]> set define off

[email protected]> alter user scott identified by "tiger&123";

 

User altered.

 

[email protected]> 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

[or[email protected] ~]$  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

 

[email protected]>

[email protected]> set define off

[email protected]> alter user scott identified by "$tiger&[email protected]\r/0%s,d$";

 

User altered.

 

[email protected]> 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

[[email protected] ~]$  sqlplus ‘scott/"$tiger&[email protected]\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

 

[email protected]>

 

 

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

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

[[email protected] ~]$ 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

 

[email protected]> password scott

Changing password for scott

New password:

Retype new password:

Password changed

[email protected]> conn scott/a"b

Connected.

[email protected]>

[[email protected] ~]$ 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

 

[email protected]>

 

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

2.4  本文结论

参考下表:


技术分享

 

Linux平台

sqlplus工具

数据泵工具(expexpdp

普通用户

tns

sqlplus ‘lhr/"[email protected]\r/0"‘

expdp ‘lhr/"[email protected]\r/0"‘

tns

sqlplus ‘lhr/"[email protected]\r/0"‘@LHRDB

expdp ‘lhr/"[email protected]\r/0"‘@LHRDB 

sys用户

tns

sqlplus / as sysdba

expdp \‘/ AS SYSDBA\‘

tns

sqlplus ‘sys/"[email protected]\r/0"‘@LHRDB as sysdba

expdp \‘‘sys/"[email protected]\r/0"‘@LHRDB as sysdba\‘

正常密码

sqlplus sys/[email protected] as sysdba

expdp \‘sys/[email protected] as sysdba\‘

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

alter user lhr identified by "[email protected]\r/0";

alter user sys identified by "[email protected]\r/0";

set define off

alter user scott identified by "$tiger&[email protected]\r/0%s,d$";

alter user scott identified by "$?`$%*H\@f‘\<a-q [email protected]#<="">`}:H$";

password scott

 

 

 

 

 

 

 

 

Windows平台

sqlplus工具

数据泵工具(expexpdp

普通用户

tns

sqlplus lhr/"""[email protected]\r/0"""

sqlplus lhr/\"[email protected]\r/0\"

expdp lhr/"""[email protected]\r/0"""

expdp lhr/\"[email protected]\r/0\"

tns

sqlplus lhr/"""[email protected]\r/0"""@LHRDB

sqlplus lhr/\"[email protected]\r/0\"@LHRDB

expdp lhr/"""[email protected]\r/0"""@LHRDB

expdp lhr/\"[email protected]\r/0\"@LHRDB

sys用户

tns

sqlplus / as sysdba

expdp \"/ as sysdba\"

tns

sqlplus sys/"""[email protected]\r/0"""@LHRDB as sysdba

sqlplus sys/\"[email protected]\r/0\"@LHRDB as sysdba

 

正常密码

sqlplus sys/[email protected] as sysdba

expdp \"sys/l[email protected] as sysdba\"

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

 




About Me

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

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

本文在itpubhttp://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群,学习最实用的数据库技术。

技术分享技术分享

 技术分享  技术分享

本文出自 “小麦苗的博客” 博客,请务必保留此出处http://lhrbest.blog.51cto.com/2318295/1907373

以上是关于方法Oracle用户密码含特殊字符时的登陆问题的主要内容,如果未能解决你的问题,请参考以下文章

sqlplus连接oracle数据库--密码含特殊字符

ORACLE 用户的 密码 支持哪些特殊字符,不支持哪些字符?

Oracle用户密码含有特殊字符应当如何处理

oracle之用户名密码包含特殊字符时候怎么使用sqlplus登录

oracle字段中含特殊字符

oracle 用户名中带下划线,pl/sql登陆不了