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

本文涉及的产品
云原生数据仓库AnalyticDB MySQL版,基础版 8ACU 100GB 1个月
简介: 【方法】Oracle用户密码含特殊字符时的登陆问题   1.1  BLOG文档结构图   1.

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

 

1.1  BLOG文档结构图

wps493D.tmp 

1.2  前言部分

1.2.1  导读和注意事项

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

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

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

 

Tips

本文在itpubhttp://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和expimpexpdpimpdp的登陆及修改密码问题。

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  本文结论

参考下表:


wps494E.tmp

 

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,正常密码为:lhrtns为: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,正常密码为: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群,学习最实用的数据库技术。

   DBA笔试面试讲解

相关实践学习
AnalyticDB MySQL海量数据秒级分析体验
快速上手AnalyticDB MySQL,玩转SQL开发等功能!本教程介绍如何在AnalyticDB MySQL中,一键加载内置数据集,并基于自动生成的查询脚本,运行复杂查询语句,秒级生成查询结果。
阿里云云原生数据仓库AnalyticDB MySQL版 使用教程
云原生数据仓库AnalyticDB MySQL版是一种支持高并发低延时查询的新一代云原生数据仓库,高度兼容MySQL协议以及SQL:92、SQL:99、SQL:2003标准,可以对海量数据进行即时的多维分析透视和业务探索,快速构建企业云上数据仓库。 了解产品 https://www.aliyun.com/product/ApsaraDB/ads
目录
相关文章
|
7月前
|
SQL Oracle 关系型数据库
Oracle查询优化-将字符和数字分离
【2月更文挑战第4天】【2月更文挑战第9篇】将字符和数字分离
68 2
|
7月前
|
SQL Oracle 关系型数据库
Oracle查询优化-计算字符在字符串中出现的次数
【2月更文挑战第3天】【2月更文挑战第7篇】只接上SQL
148 0
|
7月前
|
SQL Oracle 关系型数据库
java往oracle存clob类型的值时,字符长度过长怎么办?
java往oracle存clob类型的值时,字符长度过长怎么办?
467 1
|
7月前
|
Oracle 关系型数据库
Oracle查询优化-union all 与空字符
【1月更文挑战第4天】【1月更文挑战第10篇】两个表中有重复数据时,空值与空字符串在UNION ALL中的使用中的注意点。
142 0
|
1月前
|
SQL Oracle 关系型数据库
Oracle数据库优化方法
【10月更文挑战第25天】Oracle数据库优化方法
54 7
|
3月前
|
Oracle 安全 关系型数据库
Oracle数据恢复—Oracle数据库误删除的数据恢复方法探讨
删除Oracle数据库数据一般有以下2种方式:delete、drop或truncate。下面针对这2种删除oracle数据库数据的方式探讨一下oracle数据库数据恢复方法(不考虑全库备份和利用归档日志)。
|
5月前
|
Oracle 关系型数据库 数据库
Oracle数据恢复—Oracle数据库误删除的数据恢复方法
相信有很多oracle数据库用户都遇到过在操作Oracle数据库时误删除某些重要数据的情况,这个时候如果数据库没有备份且数据十分重要的,怎么才能恢复误删除的数据呢?北亚企安数据恢复工程师下面简单介绍几个误删除Oracle数据库数据的恢复方法。
|
5月前
|
SQL 存储 Oracle
Oracle数据库中游标的工作原理与优化方法
Oracle数据库中游标的工作原理与优化方法
|
6月前
|
Oracle 关系型数据库 数据库
oracle误删除数据的恢复方法
oracle误删除数据的恢复方法
57 0
|
7月前
|
运维 Oracle 安全
Oracle的三重奏:密码文件、警告文件与跟踪文件
【4月更文挑战第19天】Oracle数据库的三大守护者:密码文件保护系统免受未经授权访问,如同宝藏的“密码锁”;警告文件似“哨兵”,记录错误信息,助于及时解决问题;跟踪文件扮演“侦探”角色,详尽记录操作,便于性能优化和故障排查。这三份文件共同确保数据王国的安全与稳定。作为管理员,重视并善用它们是关键。