-
sqlplus question
Hello all...
ORacle 9.2
how do i get username@service_name.hostname when i login sqlplus everytime. ?...
For ex: my username = system
host = pedpiora2
service_name= heat
so i should get system@heat.pedpiora2> ...
the reason for this is, i have to login to many DB's and sometimes, i don't know on which database iam working and with what account .
anyhelp is appreciated
Ron
-
Hi
Put this in your login.sql file
set termout off
col user_name new_value user_name
col db_name new_value db_name
select lower(user) user_name,
ltrim(rtrim(lower(global_name))) db_name
from global_name;
set sqlprompt "&user_name@&db_name> "
set termout on
set trimspool on
set trimout on
set serveroutput on
regards
Hrishy
-
Use this script an place it in the working directory of the sqlplus, meaning %oracle_home%/../dbs, call it login.sql
Code:
define _editor=vi
set serveroutput on size 1000000
set trimspool on
set long 5000
set linesize 100
set pagesize 9999
column plan_plus_exp format a80
column global_name new_value gname
set termout off
select lower(user) || '@' ||
decode(global_name, 'ORACLE8.WORLD', '8.0', 'ORA8I.WORLD',
'8i', global_name ) global_name from global_name;
set sqlprompt '&gname> '
set termout on
and as well as place this one.. call it..connect.sql
Code:
set termout off
connect &1
@login
set termout on
Tarry Singh
I'm a JOLE(JavaOracleLinuxEnthusiast)
--- Everything was meant to be---
-
Hello all
This is what iam getting now
********************************
system@j2eetest.us.oracle.com> connect sys@j2eetest as sysdba
Enter password: *******
Connected.
system@j2eetest.us.oracle.com>
*********************************
Though, i connected as 'sys', i still see it say that iam connected as 'system';
any clues ?..
Thanks
Ron
-
login.sql is only called when sqlplus is started, NOT after a connect statement. You need to call it again after the connect.
"The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman
-
. . . or use Tarry's script as:
@connect user@sid
note the @ as first character.
"The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|