方法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'\`}: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好友(642808185),注明添加缘由

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

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

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

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

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

  

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

  1. Oracle用户密码过期和用户被锁解决方法【转】

    [原因/触发因素] 确定是由于Oracle11g中默认在default概要文件中设置了“PASSWORD_LIFE_TIME=180天”所导致. [影响和风险] 影响 密码过期后,业务进程连接数据库异 ...

  2. Oracle 用户密码中包括了“@”字符串的错误提示解决方法

    Oracle 用户密码设置了带有"@"符号,正常登陆总是无法登陆,提示无法解析的连接字符串错误 解决办法:1:修改密码:修改密码使密码中不包括@符号:2:增加转义即可,在密码前后增 ...

  3. Oracle用户密码过期问题解决

    一.用户密码即将过期,导致autotrace无法打开           如果用户密码即将过期,在登录数据库时会收到如下提示:           ERROR:            ORA-2800 ...

  4. 【密码】Oracle用户密码系列

    [密码]Oracle用户密码系列 1.1  BLOG文档结构图 1.2  前言部分 1.2.1  导读和注意事项 各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识, ...

  5. oracle用户密码过期!the password has expired

    Oracle提示错误消息ORA-28001: the password has expired,是由于Oracle11G的新特性所致, Oracle11G创建用户时缺省密码过期限制是180天(即6个月 ...

  6. 如何修改Oracle用户密码

    大家如果不知道oracle数据库的密码的话,我们可以通过简单的命令行把密码进行修改. 1.打开cmd 2 在弹出的命令提示窗口输入 set oracle_sid=数据库名称(实例),回车.例如数据库名 ...

  7. 技巧:如何提升Oracle用户密码的安全性

    环境:Oracle 11.2.0.4 客户需求:主要背景是数据库中有很多业务用户名,且由于部分用户缺乏安全意识,甚至直接将自己的密码设置为和用户名一样,目前客户期望密码设置不要过于简单,最起码别和用户 ...

  8. Oracle用户密码认证方式

    oracle用户有两种认证方式: 操作系统认证(要求该用户属于本地DBA组,然后通过操作系统认证登录oracle,从而启动数据库) 密码文件认证 oracle使用哪种认证方式决定在于两个参数: 1.r ...

  9. 修改oracle用户密码为永不过期

    错误提示:ORA-28001: the password has expired (DBD ERROR: OCISessionBegin) 解决方法:修改密码为永不过期 (1)查看用户的proifle ...

随机推荐

  1. jQuery查询性能考虑

    http://blog.163.com/neusoft_hao@yeah/blog/static/120544724201282810510215/

  2. 你真的懂ajax吗?

    前言 总括: 本文讲解了ajax的历史,工作原理以及优缺点,对XMLHttpRequest对象进行了详细的讲解,并使用原生js实现了一个ajax对象以方便日常开始使用. damonare的ajax库: ...

  3. CodeForces 429B

    Working out Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u   Desc ...

  4. python之FTP程序(支持多用户在线)

    转发注明出处:http://www.cnblogs.com/0zcl/p/6259128.html 一.需求 1. 用户加密认证 (完成)2. 允许同时多用户登录 (完成)3. 每个用户有自己的家目录 ...

  5. Ajax+存储过程真分页实例解析(10W数据毫秒级+项目解析)

    周末闲来无事,突然想写个分页的东西玩玩,说走就走 在文章最后我会把整个项目+数据库附上,下载下来直接运行就可以看效果了.整个项目采用的是简单三层模式,开发平开是VS2010+SQL2012 一.我要做 ...

  6. 路由器安装ubuntu-16.04.1-server-amd64出现“无法安装busybox-initramfs”错误。向目标系统中安装busybox-initramfs软件包时出现一个错误。请检查/var/log/syslog或查看第四虚拟控制台以获得详细

    公司的路由器要ubuntu服务器进行路由网络功能的管理,在安装的时候出现下面的错误提示: 安装ubuntu-16.04.1-server-amd64出现“无法安装busybox-initramfs”错 ...

  7. SourceTree 将本地已有的git项目推送到远程git仓库

    1.在远程git仓库创建对应的项目: 2.用命令行生成本地的ssh key; 3.把公钥粘贴远程仓库对应的位置: 4.SourceTree 设置远程仓库的地址: 5.把本地对应的分支推送到远程仓库: ...

  8. We Chall-Training: ASCII—Writeup

    MarkdownPad Document html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,ab ...

  9. css3 UI 修饰——回顾

    1.box-shadow 属性向框添加一个或者多个阴影. 语法: box-shadow: h-shadow v-shadow blur spread color inset h-shadow 必须,水 ...

  10. oracle_数据库访问问题

    1.通过JDBC连接数据库时报错“Caused by: oracle.net.ns.NetException: Got minus one from a read call” 网上百度得到: 1:数据 ...