| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
|  |  | |||
Home -> Community -> Mailing Lists -> Oracle-L -> Re: how to make sql prompt like USER@DATABASE> ?
All of the following solutions assume that you have added the prompt modification code to your $ORACLE_HOME/sqlplus/admin/glogin.sql file. Personally I think that is playing with fire and keep a private glogin.sql file and the path to it in my $SQLPATH.
Make sure the $ORACLE_HOME/sqlplus/admin directory is in your $SQLPATH, then once connected do @glogin to reset your path
or
Once you are reconnected type @?/sqlplus/admin/glogin
or
Create a script called connect.sql, place it in your $SQLPATH, then enter @connect username/password_at_whereever; the text of connect.sql should be:
      connect &1
      @?/sqlplus/admin/glogin
                                                                                                                                    
                      "shuan.tay\(PCI$BE"(B                                                                                             
                      $Bc2?(B\)"                  To:       Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>                
                      <shuan.tay_at_pci.co        cc:                                                                                  
                      .id>                     Subject:  Re: how to make sql prompt like USER_at_DATABASE> ?                           
                      Sent by:                                                                                                      
                      root_at_fatcity.com                                                                                              
                                                                                                                                    
                                                                                                                                    
                      02/17/03 04:53 PM                                                                                             
                      Please respond to                                                                                             
                      ORACLE-L                                                                                                      
                                                                                                                                    
                                                                                                                                    
mm...
what if i logged in with SYSTEM first then "conn sys/pswd_at_db"?
it's still show SYSTEM @db.
You can add following lines to your glogin.sql ($ORACLE_HOME/sqlplus/admin directory) file.
 set heading off
 set term off
 set feedback off
 spool myprompt.sql
 select 'set sqlprompt "' || SYS_CONTEXT ('USERENV', 'session_user') || '@'
 || SYS_CONTEXT ('USERENV', 'DB_NAME') || '>"'
 from dual
 /
 spool off
 @myprompt.sql
 set heading on
 set term on
 set feedback on
Alternatively you can create a file with above lines, put that file in bin and call it anytime to make your prompt$B!D(B
 Cheers,
 Rajesh
       ----Original Message-----
       From: root_at_fatcity.com [mailto:root_at_fatcity.com]On Behalf Of
       Salaheldin Aboali
       Sent: Saturday, February 15, 2003 2:14 PM
       To: Multiple recipients of list ORACLE-L
       Subject: how to make sql prompt like USER_at_DATABASE> ?
       hi
       how to make sql prompt like USER_at_DATABASE> ?
       where USER: connected user
       DATABASE: database global name, or database local alias
       Regards,
       Salaheldin Aboali
       -------------------------------------------
       Senior Software Developer
       Management Information Systems
       http://www.mis-kuwait.com
       Phone:
       +965.240.64.25
       +965.240.67.98
       +965.240.80.92
       Ext. 235
       Fax. +965.240.81.53
       Cell. +965.790.31.65
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: INET: Brian_P_MacLean_at_eFunds.Com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Mon Feb 17 2003 - 21:39:11 CST
|  |  |