温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

sqlplus '!@#/!!! as sysdba' 竟然看不懂?

发布时间:2020-07-11 14:45:05 来源:网络 阅读:866 作者:roidba 栏目:关系型数据库

今日分享,今天在银行待了一天,明天可以休息一下了,祝大家周末愉快!

如果大家看到以下几种写法,大家会有什么想法?有什么区别?
告诉大家,这几种写法默认都可以登录到数据库的。

<rac01:orcl1:/home/oracle>$sqlplus xxx/xxx as sysdba
<rac01:orcl1:/home/oracle>$sqlplus roidba/roidba as sysdba
<rac01:orcl1:/home/oracle>$sqlplus / as sysdba
<rac01:orcl1:/home/oracle>$sqlplus '!@#/!!! as sysdba'

这里有几个小知识点值得注意。
1、Oracle 默认使用系统认证,登录数据库
2、单引号在这里强调忽略所有特殊字符,这就是为什么有时候我们需要单引号,而有的时候不需要。

我们在做数据库备份的时候,有的时候用sys,有的时候用system,有的时候有业务用户来做逻辑备份,而我又不想把密码暴露出来的话,怎么办呢?
有不少朋友就是使用了expdp \'/ as sysdba\'
例如

<rac01:orcl1:/home/oracle>$expdp \'/ as sysdba\' 

Export: Release 12.1.0.2.0 - Production on Fri Dec 15 22:42:17 2017

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

Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
Starting "SYS"."SYS_EXPORT_SCHEMA_01":  "/******** AS SYSDBA" 
Estimate in progress using BLOCKS method...
Total estimation using BLOCKS method: 0 KB
Processing object type SCHEMA_EXPORT/STATISTICS/MARKER
ORA-31655: no data or metadata objects selected for job
Job "SYS"."SYS_EXPORT_SCHEMA_01" completed with 1 error(s) at Fri Dec 15 22:42:43 2017 elapsed 0 00:00:24

哪里来的xxx用户,别被忽悠了哈

<rac01:orcl1:/home/oracle>$sqlplus xxx/xxx as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Fri Dec 15 22:44:20 2017

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

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SYS@orcl1> select user from dual;

USER
------------------------------
SYS

哪里来的!@#用户哈,这下大家应该理解了吧,眼见不一定为实,自己动手测试验证了,才能得出最终的结论。

<rac01:orcl1:/home/oracle>$sqlplus '!@#/!!! as sysdba'

SQL*Plus: Release 12.1.0.2.0 Production on Fri Dec 15 22:45:35 2017

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

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SYS@orcl1> select user from dual;

USER
------------------------------
SYS

SYS@orcl1> 
向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI