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

简介:

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

<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> 









本文转自 roidba 51CTO博客,原文链接:http://blog.51cto.com/roidba/2051199,如需转载请自行联系原作者

目录
相关文章
|
SQL 存储 Oracle
SQLPlus命令使用大全
SQLPlus命令使用大全
570 0
|
SQL Oracle 关系型数据库
|
存储 SQL Oracle
|
存储 Oracle Java
|
存储 SQL Oracle
Oracle总结【PLSQL学习】
PLSQL介绍 PLSQL是Oracle对SQL99的一种扩展,基本每一种数据库都会对SQL进行扩展,Oracle对SQL的扩展就叫做PLSQL... SQL99是什么 (1)是操作所有关系型数据库的规则 (2)是第四代语言 (3)是一种结构化查询语言 (4)只需发出合法合理的命令,就有对应的...
1303 0
|
SQL Oracle 关系型数据库
|
SQL Oracle 关系型数据库