2017060312C sqlplus顯示使用者上次登入時間
[20170603]12C sqlplus 顯示使用者上次登入時間.txt
--//12c sqlplus使用sqlplus登陸會顯示上次登陸的時間.實際上其他管理工具toad也一樣.
D:\tools\rlwrap>sqlplus scott/btbtms@test01p
SQL*Plus: Release 12.1.0.1.0 Production on Sat Jun 3 18:11:08 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Last Successful login time: Sat Jun 03 2017 18:10:15 +08:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
--//不顯示執行如下:
D:\tools\rlwrap>sqlplus -nologintime scott/btbtms@test01p
SQL*Plus: Release 12.1.0.1.0 Production on Sat Jun 3 18:11:30 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SCOTT@test01p> select sysdate from dual ;
SYSDATE
-------------------
2017-06-03 18:12:28
--//退出再進入.
D:\tools\rlwrap>sqlplus scott/btbtms@test01p
SQL*Plus: Release 12.1.0.1.0 Production on Sat Jun 3 18:13:01 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Last Successful login time: Sat Jun 03 2017 18:11:30 +08:00
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
--//你可以發現-nologintime僅僅是不顯示,而實際上記錄在資料庫的 sys.user$中的.(spare6欄位)
--//你可以想象如果應用頻繁這樣登入登出也修改sys.user$,就會存在爭用問題.
--//參考我寫的http://blog.itpub.net/267265/viewspace-1805291/=>[20150920]12c新特性:Last Successful login time.txt
--//如果檢查共享池,可以發現類似的語句:
--//sql_id='395829wtbubru
SELECT exptime,
ltime,
astatus,
lcount,
spare6
FROM user$
WHERE user# = :1;
--//sql_id='d0dwv6jcszbqj'
UPDATE user$
SET exptime =
DECODE (TO_CHAR (:2, 'YYYY-MM-DD'),
'0000-00-00', TO_DATE (NULL),
:2),
ltime =
DECODE (TO_CHAR (:3, 'YYYY-MM-DD'),
'0000-00-00', TO_DATE (NULL),
:3),
astatus = :4,
lcount = :5,
spare6 =
DECODE (TO_CHAR (:6, 'YYYY-MM-DD'),
'0000-00-00', TO_DATE (NULL),
:6)
WHERE user# = :1;
--//注意看sql_id='d0dwv6jcszbqj'是dml語句,你可以想象如果應用存在大量登入,是否會修改這個時間呢?
SCOTT@test01p> select sql_id,executions from v$sql where sql_id in ('395829wtbubru','d0dwv6jcszbqj');
SQL_ID EXECUTIONS
------------- ----------
395829wtbubru 7
d0dwv6jcszbqj 7
--//開啟另外會話執行sqlplus -nologintime scott/btbtms@test01p,雖然不顯示,實際上你可以發現是修改的.
SCOTT@test01p> select sql_id,executions from v$sql where sql_id in ('395829wtbubru','d0dwv6jcszbqj');
SQL_ID EXECUTIONS
------------- ----------
395829wtbubru 8
d0dwv6jcszbqj 8
--//改用toad登入看看.
SCOTT@test01p> select sql_id,executions from v$sql where sql_id in ('395829wtbubru','d0dwv6jcszbqj');
SQL_ID EXECUTIONS
------------- ----------
395829wtbubru 9
d0dwv6jcszbqj 9
--//可以發現執行次數也會增加,特別對以sql_id=d0dwv6jcszbqj的dml語句.
--//也就是講這個可能導致大量爭用.所以講任何新特性都會付出代價.
--//再來看看使用共享模式登入的情況,由於pdb資料庫沒有配置共享連線模式,測試在cdb資料庫下進行:
SYS@test> select con_id,sql_id,executions from v$sql where sql_id in ('395829wtbubru','d0dwv6jcszbqj') and con_id=1;
CON_ID SQL_ID EXECUTIONS
---------- ------------- ----------
1 395829wtbubru 8
1 d0dwv6jcszbqj 7
1 d0dwv6jcszbqj 1
--//執行如下: sqlplus system/btbtms@127.0.0.1:1521/testxdb:shared
D:\tools\rlwrap>sqlplus system/btbtms@127.0.0.1:1521/testxdb:shared
SQL*Plus: Release 12.1.0.1.0 Production on Sat Jun 3 19:26:41 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Last Successful login time: Sat Jun 03 2017 19:25:11 +08:00
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SYSTEM@127.0.0.1:1521/testxdb:shared> select saddr,sid,paddr,status,server from v$session where sid in (select sid from v$mystat);
SADDR SID PADDR STATUS SERVER
---------------- ---------- ---------------- -------- ---------
000007FF49D3EAF0 138 000007FF49A33528 ACTIVE SHARED
SYS@test> select con_id,sql_id,executions from v$sql where sql_id in ('395829wtbubru','d0dwv6jcszbqj') and con_id=1;
CON_ID SQL_ID EXECUTIONS
---------- ------------- ----------
1 395829wtbubru 9
1 d0dwv6jcszbqj 8
1 d0dwv6jcszbqj 1
--//你可以看到採用共享模式也一樣.再次執行:sqlplus system/btbtms@127.0.0.1:1521/testxdb:shared
SYS@test> select con_id,sql_id,executions from v$sql where sql_id in ('395829wtbubru','d0dwv6jcszbqj') and con_id=1;
CON_ID SQL_ID EXECUTIONS
---------- ------------- ----------
1 395829wtbubru 10
1 d0dwv6jcszbqj 9
1 d0dwv6jcszbqj 1
--//12c sqlplus使用sqlplus登陸會顯示上次登陸的時間.實際上其他管理工具toad也一樣.
D:\tools\rlwrap>sqlplus scott/btbtms@test01p
SQL*Plus: Release 12.1.0.1.0 Production on Sat Jun 3 18:11:08 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Last Successful login time: Sat Jun 03 2017 18:10:15 +08:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
--//不顯示執行如下:
D:\tools\rlwrap>sqlplus -nologintime scott/btbtms@test01p
SQL*Plus: Release 12.1.0.1.0 Production on Sat Jun 3 18:11:30 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SCOTT@test01p> select sysdate from dual ;
SYSDATE
-------------------
2017-06-03 18:12:28
--//退出再進入.
D:\tools\rlwrap>sqlplus scott/btbtms@test01p
SQL*Plus: Release 12.1.0.1.0 Production on Sat Jun 3 18:13:01 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Last Successful login time: Sat Jun 03 2017 18:11:30 +08:00
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
--//你可以發現-nologintime僅僅是不顯示,而實際上記錄在資料庫的 sys.user$中的.(spare6欄位)
--//你可以想象如果應用頻繁這樣登入登出也修改sys.user$,就會存在爭用問題.
--//參考我寫的http://blog.itpub.net/267265/viewspace-1805291/=>[20150920]12c新特性:Last Successful login time.txt
--//如果檢查共享池,可以發現類似的語句:
--//sql_id='395829wtbubru
SELECT exptime,
ltime,
astatus,
lcount,
spare6
FROM user$
WHERE user# = :1;
--//sql_id='d0dwv6jcszbqj'
UPDATE user$
SET exptime =
DECODE (TO_CHAR (:2, 'YYYY-MM-DD'),
'0000-00-00', TO_DATE (NULL),
:2),
ltime =
DECODE (TO_CHAR (:3, 'YYYY-MM-DD'),
'0000-00-00', TO_DATE (NULL),
:3),
astatus = :4,
lcount = :5,
spare6 =
DECODE (TO_CHAR (:6, 'YYYY-MM-DD'),
'0000-00-00', TO_DATE (NULL),
:6)
WHERE user# = :1;
--//注意看sql_id='d0dwv6jcszbqj'是dml語句,你可以想象如果應用存在大量登入,是否會修改這個時間呢?
SCOTT@test01p> select sql_id,executions from v$sql where sql_id in ('395829wtbubru','d0dwv6jcszbqj');
SQL_ID EXECUTIONS
------------- ----------
395829wtbubru 7
d0dwv6jcszbqj 7
--//開啟另外會話執行sqlplus -nologintime scott/btbtms@test01p,雖然不顯示,實際上你可以發現是修改的.
SCOTT@test01p> select sql_id,executions from v$sql where sql_id in ('395829wtbubru','d0dwv6jcszbqj');
SQL_ID EXECUTIONS
------------- ----------
395829wtbubru 8
d0dwv6jcszbqj 8
--//改用toad登入看看.
SCOTT@test01p> select sql_id,executions from v$sql where sql_id in ('395829wtbubru','d0dwv6jcszbqj');
SQL_ID EXECUTIONS
------------- ----------
395829wtbubru 9
d0dwv6jcszbqj 9
--//可以發現執行次數也會增加,特別對以sql_id=d0dwv6jcszbqj的dml語句.
--//也就是講這個可能導致大量爭用.所以講任何新特性都會付出代價.
--//再來看看使用共享模式登入的情況,由於pdb資料庫沒有配置共享連線模式,測試在cdb資料庫下進行:
SYS@test> select con_id,sql_id,executions from v$sql where sql_id in ('395829wtbubru','d0dwv6jcszbqj') and con_id=1;
CON_ID SQL_ID EXECUTIONS
---------- ------------- ----------
1 395829wtbubru 8
1 d0dwv6jcszbqj 7
1 d0dwv6jcszbqj 1
--//執行如下: sqlplus system/btbtms@127.0.0.1:1521/testxdb:shared
D:\tools\rlwrap>sqlplus system/btbtms@127.0.0.1:1521/testxdb:shared
SQL*Plus: Release 12.1.0.1.0 Production on Sat Jun 3 19:26:41 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Last Successful login time: Sat Jun 03 2017 19:25:11 +08:00
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SYSTEM@127.0.0.1:1521/testxdb:shared> select saddr,sid,paddr,status,server from v$session where sid in (select sid from v$mystat);
SADDR SID PADDR STATUS SERVER
---------------- ---------- ---------------- -------- ---------
000007FF49D3EAF0 138 000007FF49A33528 ACTIVE SHARED
SYS@test> select con_id,sql_id,executions from v$sql where sql_id in ('395829wtbubru','d0dwv6jcszbqj') and con_id=1;
CON_ID SQL_ID EXECUTIONS
---------- ------------- ----------
1 395829wtbubru 9
1 d0dwv6jcszbqj 8
1 d0dwv6jcszbqj 1
--//你可以看到採用共享模式也一樣.再次執行:sqlplus system/btbtms@127.0.0.1:1521/testxdb:shared
SYS@test> select con_id,sql_id,executions from v$sql where sql_id in ('395829wtbubru','d0dwv6jcszbqj') and con_id=1;
CON_ID SQL_ID EXECUTIONS
---------- ------------- ----------
1 395829wtbubru 10
1 d0dwv6jcszbqj 9
1 d0dwv6jcszbqj 1
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2140256/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20181006]12c sqlplus顯示使用者上次登入時間.txtSQL
- JSP如何儲存使用者上次登入時間JS
- Win10系統設定登入時顯示上次登入資訊的方法Win10
- sqlplus顯示登入使用者名稱和例項名SQL
- 修改sqlplus中顯示時間日期的格式SQL
- Qt 時間顯示QT
- Linux基礎命令—顯示登入使用者wLinux
- Linux基礎命令---顯示登入使用者wLinux
- win10使用者在登入介面顯示使用者列表Win10
- Linux基礎命令---顯示登入使用者lognameLinux
- QT介面顯示實時時間QT
- sqlplus 顯示控制SQL
- js時間顯示設定JS
- 顯示oracle執行時間Oracle
- QT學習 實時顯示時間QT
- Qt實時顯示系統時間QT
- 計算本年使用者最大未登入時間段
- Sqlplus查詢時不能顯示標題欄SQL
- sqlplus 登入時快時慢問題診斷SQL
- android 顯示當前時間(EEEE)顯示星期幾Android
- sqlplus 可以登入 plsql 不能登入SQL
- SQLPLUS顯示亂碼SQL
- 登入ftp伺服器的時候顯示421 Service not availableFTP伺服器AI
- QT顯示當前日期時間QT
- QT版用QLCDnumber顯示時間QT
- linux 終端顯示時間Linux
- asp.net 時間顯示格式ASP.NET
- 如何在 Ubuntu 中再次登入時還原上次執行的應用Ubuntu
- 根據上次輸入操作的時間設定離開狀態
- 定期刪除檔案,限制linux使用者登入時間Linux
- javascript實時顯示時間程式碼例項JavaScript
- asp.net 中實時顯示本地時間ASP.NET
- javaScript動態顯示當前時間JavaScript
- 讓history命令顯示日期和時間
- sqlplus中調節顯示SQL
- 一對一視訊原始碼,登入時輸入密碼時的顯示密碼按鈕原始碼密碼
- win10時間顯示秒怎麼設定_win10時間顯示秒如何調出Win10
- 為什麼ls-l時,有些檔案顯示日期,有些顯示時間?(轉)