AS SYSDBA, AS SYSOPER 和 AS SYSASM 选项是数据库管理权限。
[oracle@safeserver admin]$sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Fri Nov 14 15:45:42 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
命令详解:以conn / as sysdba方式登录时,采用的是操作系统验证的方式,所以用户名/密码输与不输入是一样的。
[oracle@safeserver admin]$sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Fri Nov 14 15:48:53 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> conn safe1
Enter password:
Connected.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
例(1):
[oracle@safeserver admin]$ sqlplus safe1/SAFE123456789
SQL*Plus: Release 11.2.0.1.0 Production on Fri Nov 14 16:05:40 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
例(2):
[oracle@safeserver ~]$ sqlplus safe1/SAFE123456789@orcl
SQL*Plus: Release 11.2.0.1.0 Production on Fri Nov 14 16:23:28 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
@
通过sqlnet.ora这个文件来决定怎么样找一个连接中出现的连接字符串(
如果sqlnet.ora配置如下:
# sqlnet.ora Network Configuration File: /u01/oracle/product/OraHome/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
ADR_BASE = /u01/oracle
当客户端输入sqlplus safe1/SAFE123456789@orcl时, 就会首先在 tnsnames.ora文件中找orcl的记录.如果没有相应的记录,则尝试把orcl当作一个主机名来解析(括号中还有其他选项,如LDAP等,但EZCONNECT,LDAP通常并不常用,通常只设TNSNAME即可.)
LINUX默认是怎样解析一个主机名(hostname)的?
一般而言, Linux 的预设 hostname 搜寻都是先使用 /etc/hosts 来的,如果没有相应的记录,则尝试使用DNS来解析hostname
为什么呢?你可以查看一下/etc/nsswitch.conf ,并找到 hosts 的项目:
[root@linux ~]# vi /etc/nsswitch.conf
hosts: files dns
上面那个 files 就是先使用 /etc/hosts 而最后的 dns 则是使用 /etc/resolv.conf 的 DNS 主机 IP搜寻啦!因此,你可以先以 /etc/hosts 来设定 IP 对应的hostname!当然啦,你也可以将他调换过来,不过,总是/etc/hosts 比较简单,所以将他摆在前面比较好啦!
/etc/hosts :这个是最早的 hostname 对应 IP 的档案;
/etc/resolv.conf :这个就是设定你 Client 端连上 DNS 主机的 IP 设定文件;
/etc/nsswitch.conf:这个档案则是在决定先要使用 /etc/hosts 还是 /etc/resolv.conf的设定!
[oracle@safeserver ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Fri Nov 14 16:29:40 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options