linux - 登录到 sqlplus 为什么它总是打印用户名?

标签 linux oracle sqlplus

为什么登录sqlplus后总是在linux中打印用户名?

$ sqlplus

SQL*Plus: Release 11.2.0.4.0 Production on Fri Apr 7 06:32:57 2017

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

Enter user-name: scott

Enter password:

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

USER is "SCOTT"

我不想打印“用户是“SCOTT””。

一个线索是消息“USER is”,我可以在

/software/oracle/cli-11.02.00.04/sqlplus/mesg/sp2us.msg

 sqlplus/mesg/sp2us.msg:572:00291,0, "USER is \"%s\"\n"

我需要在某处更改任何设置吗?

最佳答案

这不是默认的 SQL*Plus 行为。因此,您的个人 login.sql 或全局 glogin.sql 文件中可能有一个 SHOW USER 命令(执行此操作)。

查看 $ORACLE_HOME/sqlplus/admin 子目录中的 glogin.sql 文件。

login.sql 可以在 $SQLPATH 的任何目录中,但 SQL*Plus 在当前目录中开始搜索。因此,幸运的是,该文件将位于合理的位置,例如您的客户端 $ORACLE_HOME

SQL*PLus 配置包含在文档中。 Find out more .

"in /upapps/oracle/dba/tools/login.sql ... there is show user command ... so is that the reason? "

是的。每次我们连接时,SQL*Plus 都会运行 login.sql,例如使用 SET SQLPROMPT 来更改提示。将 SCOTT> 作为您的提示可能比显示您刚刚连接的用户更有用。

" can I override login.sql and glogin.sql so that everytime I connect to sqlplus it will execute my login.sql and glogin.sql?"

您不能覆盖 glogin.sql,因为它们只有一个(g 代表“全局”)。但是 login.sql 可以有多个版本。正如我上面所说,SQL*Plus 开始在当前目录中搜索文件。因此,您需要在您具有写入权限的位置(例如 $HOME/naren)创建一个 login.sql 文件,然后始终从那里启动 SQL*Plus。


" is there any way we can acheive this even when we run from different folder? "

如果您不能在启动 SQL*Plus 的地方写一个文件,并且您不能在可以写文件的地方启动 SQL*Plus,那么这将成为一个政治问题,而不是技术问题。您需要与管理您的 Oracle 环境的人员协商。

或者只是学会接受它。这是一件相当微不足道的事情;我不敢相信我在这个主题上投入了这么多时间和精力 :) 因此,如果 show user 是您工作日中最大的烦恼,那么您应该好好想想。

关于linux - 登录到 sqlplus 为什么它总是打印用户名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43277162/

相关文章:

java - 将 OraclePreparedStatement 与 DBCP 连接结合使用

mysql - ORA-00905 : missing keyword for THEN clause of CASE?

java - IO异常 : The network adapter could not establish the connection

oracle - SQLplus解码执行脚本

linux - 使用 Crontab 将输出格式更改为 SQLplus

c - 为什么我的串口不断收到数据?

linux - Windows 上的 Ubuntu 上的 Bash 上的 Hadoop 权限被拒绝

sql - 如何仅执行 SQL 文件中的选择性语句?

linux - CURL 返回 "Unknown SSL protocol error"

c - 如何在 epoll 上使用具有级别触发行为的 eventfd?