[20190110]rlwrap sqlplus tee相關問題3.txt
[20190110]rlwrap sqlplus tee相關問題3.txt
--//前幾天測試使用rlwrap sqlplus加tee的問題,透過rlwrap的filter功能解決問題,連結:http://blog.itpub.net/267265/viewspace-2375095/
--//不過我發現一些小瑕疵.記錄一下:
1.問題提出:
$ rlwrap -z 'outfilter tee -a /tmp/aa.txt' sqlplus sys as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Jan 10 08:53:05 2019
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL*Plus: Release 11.2.0.4.0 Production on Thu Jan 10 08:53:05 2019
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SYS@book> startup
ORACLE instance started.
Total System Global Area 643084288 bytes
Fixed Size 2255872 bytes
Variable Size 205521920 bytes
Database Buffers 427819008 bytes
ORACLE instance started.
Total System Global Area 643084288 bytes
Fixed Size 2255872 bytes
Variable Size 205521920 bytes
Database Buffers 427819008 bytes
ORACLE instance started.
Total System Global Area 643084288 bytes
Fixed Size 2255872 bytes
Variable Size 205521920 bytes
Database Buffers 427819008 bytes
Database opened.
Database opened.
--//載入sqlplus時,有時候前面內容會顯示2次,有時候沒有出現.如果提示要口令就一定不會出現.比如執行:
--//rlwrap -z 'outfilter tee -a /tmp/aa.txt' sqlplus / as sysdba
--//或者
--//rlwrap -z 'outfilter tee -a /tmp/aa.txt' sqlplus scott
--//如果啟動資料庫會出現奇特相關資訊顯示3次的情況.
SYS@book> shutdown immediate;
Database closed.
Database closed.
ORACLE instance shut down.
--//關閉資料庫也會出現Database closed.2次.正常關閉如下,比前面重複問題更嚴重的是,關閉資料庫漏掉"Database dismounted."資訊.
SYS@book> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
--//正常啟動資料庫如下:
SYS@book> startup
ORACLE instance started.
Total System Global Area 643084288 bytes
Fixed Size 2255872 bytes
Variable Size 205521920 bytes
Database Buffers 427819008 bytes
Redo Buffers 7487488 bytes
Database mounted.
Database opened.
--//你可以發現漏掉了
--//Redo Buffers 7487488 bytes,
--//Database mounted.
--//2行資訊.
2.簡單探究:
--//關於輸出重複.
--//檢視rlwrap手冊可以發現如下:
-w, --wait-before-prompt timeout
In order to determine if command's last output is a prompt, rlwrap waits timeout millisecs after receiving it. Only
when no more output has arrived, it is cooked (coloured, filtered and/or replaced by a substitute prompt) and
displayed as a prompt. Before this the prompt is displayed "uncooked". Most users won't notice, but heavy cookers can
prepend the timeout with a minus sign, making rlwrap hold back the prompt until it has been cooked ("patient mode").
This will prevent flashing of the prompt, but it will also interfere with long output lines and make switches from
direct to readline mode less reliable. Default timeout: 40 ms.
--//你可以測試如果使用過濾,-w 引數要加大才能避免重複輸出.我的測試-w 200基本前面重複的資訊不再出現.
3.簡單探究2:
--//關於輸出遺漏.
--//我不知道這個有什麼好方法,遺漏資訊是因為outfilte指令碼執行如下:
$filter->output_handler(sub {""});
--//而如果沒有這行,輸出資訊會重複.而它就是輸出採用如下:
my $output = $filter->cumulative_output;
--//當執行指令碼時間輸出中間停頓"很長"的情況下,問題很容易再現,透過例子來顯示問題.
$ rlwrap -z 'outfilter tee -a /tmp/aa.txt' -w 200 sqlplus scott/book
SQL*Plus: Release 11.2.0.4.0 Production on Thu Jan 10 15:23:50 2019
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
--//GRANT EXECUTE ON SYS.DBMS_LOCK TO SCOTT;
CREATE OR REPLACE FUNCTION SCOTT.sleep (seconds IN NUMBER)
RETURN NUMBER
AS
BEGIN
sys.DBMS_LOCK.sleep (seconds);
RETURN seconds;
END;
/
SCOTT@book> create table t as select rownum id,'test' name from dual connect by level<=200;
Table created.
SCOTT@book> set array 4
SCOTT@book> select t.* ,sleep(1) from t where rownum<=10;
ID NAME SLEEP(1)
---------- -------------------- ----------
1 test 1
2 test 1
3 test 1
ID NAME SLEEP(1)
---------- -------------------- ----------
1 test 1
2 test 1
3 test 1
5 test 1
6 test 1
7 test 1
ID NAME SLEEP(1)
---------- -------------------- ----------
1 test 1
2 test 1
3 test 1
5 test 1
6 test 1
7 test 1
9 test 1
10 test 1
10 rows selected.
--//你可以輸出漏掉了幾行.(id=4,8),並且重複了.放棄,不知道如何改寫outfilter指令碼.
--//問題多多,出於安全考慮不建議使用.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2375436/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20190108]rlwrap sqlplus tee相關問題.txtSQL
- [20191223]關於共享記憶體段相關問題3.txt記憶體
- [20200309]rlwrap: error: Cannot execute sqlplus: Too many levels of symbolic linErrorSQLSymbol
- [20181124]關於降序索引問題3.txt索引
- octomap相關問題
- django相關問題Django
- electron相關問題
- Docker 相關問題Docker
- SpringBoot-相關問題Spring Boot
- Java相關問題整理Java
- 大模型相關問題大模型
- python pip相關問題Python
- 關於tee指令
- Spring相關問題記錄Spring
- 瀏覽器相關問題瀏覽器
- mysql相關問題總結MySql
- Silverlight安裝相關問題
- RUST所有權相關問題Rust
- [20181106]12c sqlplus rowprefetch引數3.txtSQL
- 關於盒模型相關的問題模型
- [20191202]關於hugepages相關問題.txt
- 關於 go-micro 相關問題Go
- [20221203]sqlplus set trimspool 問題.txtSQL
- [20221202]sqlplus set trimout 問題.txtSQL
- HandlerThread解析以及相關問題分析thread
- 多執行緒相關問題執行緒
- 中介軟體相關問題整理
- 個人專案相關問題
- 資料庫事物相關問題資料庫
- 上傳下載相關問題
- java語言相關的問題Java
- 前端面試之js相關問題前端面試JS
- [20180413]熱備模式相關問題.txt模式
- SpringBoot --spring.profiles.active相關問題Spring Boot
- 面試遇到的redis相關問題面試Redis
- Laravel佇列相關問題記錄Laravel佇列
- TCP/IP 協議相關的問題TCP協議
- svn相關問題解決辦法