1. 程式人生 > >Linux 下 SQLPLUS 中 退格 方向鍵問題

Linux 下 SQLPLUS 中 退格 方向鍵問題

. 退格鍵的問題

如果退格鍵不能用,可以使用stty命令來解決。該命令可以改變並列印終端行設定。

以前整理的Blog

stty 命令

看這個命令的幫助:

[[email protected] ~]$ stty --help

Usage: stty [-F DEVICE] [--file=DEVICE] [SETTING]...

or:stty [-F DEVICE] [--file=DEVICE] [-a|--all]

or:stty [-F DEVICE] [--file=DEVICE] [-g|--save]

Print or change terminal characteristics.

-a, --allprint all current settings in human-readable form

-g, --saveprint all current settings in a stty-readable form

-F, --file=DEVICEopen and use the specified DEVICE instead of stdin

--helpdisplay this help and exit

--versionoutput version information and exit

Optional - before SETTING indicates negation.An * marks non-POSIX

settings.The underlying system defines which settings are available.

Special characters:

* dsusp CHARCHAR will send a terminal stop signal once input flushed

eof CHARCHAR will send an end of file (terminate the input)

eol CHARCHAR will end the line

* eol2 CHARalternate CHAR for ending the line

erase CHARCHAR will erase the last character typed

intr CHARCHAR will send an interrupt signal

kill CHARCHAR will erase the current line

* lnext CHARCHAR will enter the next character quoted

quit CHARCHAR will send a quit signal

* rprnt CHARCHAR will redraw the current line

start CHARCHAR will restart the output after stopping it

stop CHARCHAR will stop the output

susp CHARCHAR will send a terminal stop signal

* swtch CHARCHAR will switch to a different shell layer

* werase CHARCHAR will erase the last word typed

....

Handle the tty line connected to standard input.Without arguments,prints baud rate, line discipline, and deviations from stty sane.In settings, CHAR is taken literally, or coded as in ^c, 0x37, 0177 or 127; special values ^- or undef used to disable special characters.

Report bugs to <[email protected]>.

[[email protected] ~]$

與退格鍵相關的設定是erase,它表示刪除最後一個字元。

$stty erase ^H

說明:按下退格鍵會顯示成^H

如果在當前視窗執行的話,只對當前的視窗有效,下次登陸的時候還需要重新設定,可以把這個命令寫入shell 的配置檔案,如~/.bashrc 中,這樣每次都能生效了。

. 方向鍵的問題

WIN 下使用方向鍵是沒有問題的,但是在Linux下,方向鍵是使用不了了。 可以安裝一下rlwrap 工具。

rlwrap本身是個遵循GPL 標準的Shell 指令碼,可以執行任何你提供給它的命令包括引數,並新增命令歷史瀏覽功能。

可以在http://rpm.pbone.net/ 上搜到這個工具的RPM包。

[[email protected] mnt]# rpm -ivh rlwrap-0.37-1.el5.i386.rpm

warning: rlwrap-0.37-1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6

Preparing...########################################### [100%]

1:rlwrap########################################### [100%]

[[email protected] ~]$ rlwrap sqlplus / as sysdba;

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Feb 3 15:13:13 2012

Copyright (c) 1982, 2005, Oracle.All rights reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> select * from v$version;

BANNER

----------------------------------------------------------------

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod

PL/SQL Release 10.2.0.1.0 - Production

CORE10.2.0.1.0Production

TNS for Linux: Version 10.2.0.1.0 - Production

NLSRTL Version 10.2.0.1.0 - Production

SQL> select * from v$version;

現在就可以上下翻動了。 但是這樣沒事都需要加上rlwrap 也是很麻煩的,可以對rlwrap 做一個別名,放到shell 的配置檔案裡,在~/.bashrc 檔案裡新增如下內容:

alias sqlplus='rlwrap sqlplus'

[[email protected] ~]$ cat ~/.bashrc

# .bashrc

# Source global definitions

if [ -f /etc/bashrc ]; then

. /etc/bashrc

fi

# User specific aliases and functions

alias sqlplus='rlwrap sqlplus'

[[email protected] ~]$

[[email protected] ~]$ source ~/.bashrc--讓引數生效

[[email protected] ~]$ sqlplus / as sysdba;-- 然後就可以正常使用sqlplus

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Feb 3 15:18:07 2012

Copyright (c) 1982, 2005, Oracle.All rights reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> select * from v$version;

BANNER

----------------------------------------------------------------

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod

PL/SQL Release 10.2.0.1.0 - Production

CORE10.2.0.1.0Production

TNS for Linux: Version 10.2.0.1.0 - Production

NLSRTL Version 10.2.0.1.0 - Production

SQL>

其他一些組合鍵:

Ctrl+Aahead,到行的頂端,相當於 Home

Ctrl+Eend,到行的末端,相當於end

Ctrl+Bbehind,後退一個字元,相當於left

Ctrl+Fforward,前進一個子放入,相當於right

Ctrl+Pprev.,上一行歷史記錄,相當於up

Ctrl+Nnext.,下一行歷史記錄,相當於down

Ctrl+Uundo,回覆操作,這行就被清空掉了

Ctrl+W:剪下

Ctrl+Y:貼上

Ctrl+LcLear,清屏

整理自網路

------------------------------------------------------------------------------

QQ:492913789

Email:[email protected]


網上資源: http://tianlesoftware.download.csdn.net

相關視訊:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx

DBA1 群:62697716(滿); DBA2 群:62697977(滿)

DBA3 群:62697850DBA 超級群:63306533;

聊天 群:40132017

--加群需要在備註說明Oracle表空間和資料檔案的關係,否則拒絕申請