Use slient mode of SQL*PLUS in a script

C:\Users\chenk6>sqlplus -H

...

-S            Sets silent mode which suppresses the display of

                the SQL*Plus banner, prompts, and echoing of

                commands.

...


C:\Ken\SQL\Learning>type query_oracle_version.bat

sqlplus -S system/emc123 @selectview.sql

C:\Ken\SQL\Learning>type selectview.sql
select * from v$version;
exit;

C:\Ken\SQL\Learning>sqlplus -S system/emc123 @selectview.sql

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
PL/SQL Release 11.1.0.6.0 - Production
CORE    11.1.0.6.0      Production
TNS for 64-bit Windows: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production

C:\Ken\SQL\Learning>
/* DEFINES */ /**************************************************************************************************/ /* * brief enable/disable cli output debug information */ #define CLI_ENABLE_DEBUG_PRINT /* * brief define cli runtime mode */ #define CLI_MODE_NONE 0 #define CLI_MODE_NORMAL 1 #define CLI_MODE_CONFIG 2 #define CLI_MODE_PRIVILEGE 3 #define CLI_MODE_INTERFACE 4 /* num 5~15 for interface mode extern */ #define CLI_MODE_DEBUG 16 #define CLI_MODE_OEM 20 /* * brief define cli login-user identifier */ #define CLI_USER_NONE 0 #define CLI_USER_USER 1 #define CLI_USER_ADMIN 2 #define CLI_USER_ROOT 3 #define CLI_USER_DEBUG 4 /* only shell can switch to shell Added by Li Chenglong , 2011-Sep-27.*/ #define CLI_USER_SHELL 20 /* Ended by Li Chenglong , 2011-Sep-27.*/ /* * brief define cli error message */ #define CLI_ERROR_COMMAND "Command not found" #define CLI_ERROR_PARAM "Invalid parameter" #define CLI_ERROR_VALUE "Invalid value" #define CLI_ERROR_COMM "Exeute command failed" #define CLI_ERROR_UNKNOWN "Unknown error" /* * brief define error message when calling rdp-opt failed */ #define CMM_GET_OBJ_ERROR "CMM: RDP_OPT_GET_OBJ failed\n" #define CMM_SET_OBJ_ERROR "CMM: RDP_OPT_SET_OBJ failed\n" #define CMM_ADD_OBJ_ERROR "CMM: RDP_OPT_ADD_OBJ failed\n" #define CMM_DEL_OBJ_ERROR "CMM: RDP_OPT_DEL_OBJ failed\n" #define CMM_CREATE_OBJ_ERROR "CMM: RDP_OPT_CREATE_OBJ failed\n" /* * brief define some array length for cli model */ #define CLI_MAX_HISTORY_NUM 8 #define CLI_MAX_CMD_LEN 1024 #define CLI_MAX_USERNAME_LEN 32 #define CLI_MAX_PASSWORD_LEN 32 #define CLI_MAX_ARG_NUM 40 #define CLI_MAX_PROMPT_LEN 128 #define CLI_MAX_HELPINFO_LEN 128 /* modified from 3 to 5, by Yin Jun, 17May2013 */ #define CLI_MAX_AUTH_TIMES 5 /* How long we keep slient after the user failed to login, in seconds. Add by Yin Jun, 17May2013 */ #define CLI_AUTH_FAIL_SLIENT_TIME (10 * 60) /* * brief define cli login-in welcome information */ #define CLI_PRODUCT_NAME "%s" #define WELCOME_MODULE_NAME " %s CLI Module." #define WELCOME_COPYRIGHT "Copyright(C) 2010-2011 by %s Technologies Co. Ltd." /* * brief define max command nodes number,if necessary,you SHOULD NOT modify this value */ #define CLI_MAX_CMD_DEPTH 4 /* * brief define cli timeout information */ #define CLI_TIMEOUT_SECONDS 2000 #define CLI_TIMEOUT_STRING "\nCLI exited after timing out\n" /* * brief cli welcome string */ #define CLI_WELCOME_STRING "Welcome To Use %s COMMAND-LINE Interface Model." /* * brief define cli return value */ #if 0 #define CLI_STATUS int #define CLI_STATUS_OK 1 #define CLI_STATUS_FAILED -1 #endif typedef enum { CLI_RET_ERROR = -1, CLI_RET_OK = 0, CLI_RET_ARGS_INVALID = 1 /*ADD ERR TYPE here. Added by Li Chenglong , 2011-Sep-29.*/ }CLI_RET; #define CLI_SHELL_NAME "shell" #define CLI_SHELL_PSW "sh" /* * brief define key value for cli input parse mod */ #define ESC 27 #define DEL 127 /* * brief default terminal width */ #define DEFAULT_TERM_WIDTH 80 /* * brief cli terminal operation functions */ #if defined(__LINUX_OS_FC__) #define setTermSettings(fd,argp) tcsetattr(fd,TCSANOW,argp) #define getTermSettings(fd,argp) tcgetattr(fd, argp) #else #define setTermSettings(fd,argp) #define getTermSettings(fd,argp) #endif /*__LINUX_OS_FC__*/ #define RDP_MAX_DESC_SIZE 48 #define MAX_OBJ_INSTANCE_DEPTH 6 #define CLI_FALSE 0 #define CLI_TRUE 1 /* * brief whether c is a printable character */ #define Isprint(c) ( (c) >= ' ' && (c) != ((unsigned char)'\233') ) /* * brief up-key and down-key */ #define CLI_UP_ARROW 1 #define CLI_DOWN_ARROW 2 /* * brief beep.... */ #define CLI_BEEP() (putchar('\007')) /* Added by Li Chenglong , 2011-Oct-08.*/ #define CLI_HELP(info) printf(info) /* Added by Li Chenglong , 2011-Oct-08.*/ #define CLI_REPLY(response) printf("%s\r\n",response) #define CLI_PRINT printf #define CLI_PERROR(ret) \ do { \ if (CMM_NO_MORE_INSTANCES != ret) \ { \ CLI_ERROR("ret=%d", ret); \ } \ }while(0) /*use the macro instead, Added by Li Chenglong , 2011-Oct-09.*/ #define CMD_DELIM ":" #define CMD_SUCC "cmd:SUCC" #define CMD_FAIL "cmd:FAIL" /* * brief choose a bigger one */ #define CLI_MAX(a, b) ((a) > (b) ? (a) : (b)) #define CLI_MAGIC_NUM 0XCA #if 0 #define __FUNC__ __FUNCTION__ /* * brief for display cli debug information */ #ifdef CLI_ENABLE_DEBUG_PRINT #define CLI_DEBUG_PRINT(str) {cli_printf(str);} #define CLI_DEBUG_PRINT1(str, p1) {cli_printf(str, p1);} #define CLI_DEBUG_PRINT2(str, p1, p2) {cli_printf(str, p1,p2);} #else /* CLI_ENABLE_DEBUG_PRINT */ #define CLI_DEBUG_PRINT(str) #define CLI_DEBUG_PRINT1(str, p1) #define CLI_DEBUG_PRINT2(str, p1, p2) #endif /* CLI_ENABLE_DEBUG_PRINT */ #endif /**************************************************************************************************/ /* TYPES */ /**************************************************************************************************/ #if 0 typedef unsigned char BOOL; typedef signed char SINT8; typedef signed short SINT16; typedef signed int SINT32; typedef unsigned char UINT8; typedef unsigned short UINT16; typedef unsigned int UINT32; /* * brief for rdl */ #define RDL_MAX_DESC_SIZE 31 #define RDL_MAX_STRING_SIZE 3999 /* 10k */ #ifndef UINT8 #define UINT8 char #endif /* UINT8 */ /* * brief for cmm communiction */ 那么我的CLI_DEBUG_PRINT 启用了吗
最新发布
11-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值