【小技巧】sqlplus去掉欢迎信息和提示信息,静默模式(silent op
每次登陆sqlplus,都会有提示信息,如下:SQL*Plus: Release 11.1.0.6.0 - Production on Mon Dec 26 14:21:01 2016 Copyright (c) 1982,2007,Oracle. All rights reserved. Connected to: Oracle Database 11g Release 11.1.0.6.0 - Production 在shell中与sqlplus交互时,这些提示信息往往会破坏数据格式。 比如用spool导出数据的时候,不希望显示这些提示信息。 好在sqlplus提供了一个静默选项,关闭所有提示信息。 SILENT Option-S[ILENT] Suppresses all SQL*Plus information and prompt messages,including the command prompt,the echoing of commands,and the banner normally displayed when you start SQL*Plus. If you omit username or password,SQL*Plus prompts for them,but the prompts are not visible! Use SILENT to invoke SQL*Plus within another program so that the use of SQL*Plus is invisible to the user. SILENT is a useful mode for creating reports for the web using the USQLPLS -MARKUP command inside a CGI script or operating system script. The SQL*Plus banner and prompts are suppressed and do not appear in reports created using the SILENT option. 翻译: 静默选项 (-S) sqlplus -S user/passwd@tns 此选项用来抑制所有SQL*Plus信息和提示信息,包含命令行提示(SQL>),命令回显信息(相当于echo off),和通常在你登陆时显示的提示信息。如果你登陆时省略了用户名和密码,SQL*Plus会有提示,但是在静默模式下,提示信息是看不见的。在其他程序里用静默模式调用 SQL*Plus,这个用户是看不到SQL*Plus的使用情况的。 静默模式是一个非常有用的模式,例如在CGI脚本或者shell脚本里,用SQLPLUS 的MARKUP命令选项来创建基于web的报告。 SQL*Plus的欢迎信息和提示信息被移除,就不会显示在用静默选项创建的报告里了。 补充: When SQL*Plus starts,and after CONNECT commands,the site profile 当 SQL*Plus启动的时候,在connect命令之后,系统配置文件(例如:e.g. $ORACLE_HOME/sqlplus/admin/glogin.sql)和用户配置文件(例如:工作目录下的login.sql)会自动运行。这些文件里可能会包含一些命令。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |