[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
- rlwrap sqlplus in linuxSQLLinux
- [20191223]關於共享記憶體段相關問題3.txt記憶體
- [20171113]修改表結構刪除列相關問題3.txt
- Docker 相關問題Docker
- django相關問題Django
- electron相關問題
- Java相關問題整理Java
- PHP相關問題集合PHP
- 大模型相關問題大模型
- rlwrap sqlplus下的回顯工具SQL
- rlwrap包解決Linux下sqlplus中上下鍵,退格鍵不能用的問題LinuxSQL
- 關於tee指令
- 轉載__sqlplus相關tipSQL
- mysql相關問題總結MySql
- 個人專案相關問題
- Sql Mode及相關問題SQL
- Oracle MTS的相關問題Oracle
- 瀏覽器相關問題瀏覽器
- python pip相關問題Python
- RUST所有權相關問題Rust
- rlwrap的安裝使用 [SQLPlus上下鍵]SQL
- 關於盒模型相關的問題模型
- 關於 go-micro 相關問題Go
- 【Oracle】-【sqlplus相關】-serveroutput引數OracleSQLServer
- 中介軟體相關問題整理
- java語言相關的問題Java
- Spring相關問題記錄Spring
- 面試遇到的redis相關問題面試Redis
- 資料庫事物相關問題資料庫
- SpringBoot-相關問題Spring Boot
- Oracle kill session相關問題(上)OracleSession
- Oracle kill session相關問題(下)OracleSession
- 多執行緒相關問題執行緒
- GoldenGate實施相關問題Go
- 【Java面試題】如何回答GC相關問題Java面試題GC
- rlwrap實現sqlplus環境 方向鍵等使用SQL
- HandlerThread解析以及相關問題分析thread