登陆的几种方式
关于登陆命令 sqlplus /nolog
The /NOLOG option starts SQLPlus without connecting to a database.
/NOLOG选项表示启动SQLPlus但不连接数据库
[oracle@localhost ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Tue May 28 10:41:10 2019
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> select user from dual;
SP2-0640: Not connected
SQL>
关于登陆命令 sqlplus / as sysdba
- 登陆的用户默认为SYS
- 登陆的实例默认为$ORACLE_SID
[oracle@localhost ~]$ echo $ORACLE_SID
orcl
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Tue May 28 10:39:08 2019
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> select user from dual;
USER
------------------------------------------------------------
SYS
SQL> select name from v$database;
NAME
------------------
ORCL
SQL>
Session
客户端与 Oracle 建立连接之后,会在v$session中留有相关的信息。
v$session 视图结构参考官方文档
- status 字段,个人理解,只有当这个session中有sql在执行时,状态为active,执行结束之后状态即会改为inactive,所以当在程序中有【数据库连接池】这种使用场景时,在比较空闲的情况下v$session中会有相当一部分的inactive状态的连接保持着。
- last_call_et 字段,inactive状态下,描述了该session的空闲时间,单位为秒。何时重置为0?还有待明确
网友评论