-- To find out which database you are connected to:
SQL> select name from v$database;
NAME
---------
DBSTAR
or you can query the v$parameter view:
SELECT UPPER(value) db_name
FROM V$Parameter
WHERE UPPER(name) = 'DB_NAME';
DB_NAME
--------------------
DBSTAR
You can also tailor the SQL prompt to identify the user connected to the database and the database itself.
Add this to your login.sql to have the user id you connected as, as part of your sql prompt:
-- Store username
col xuser_name new_value xxuser_name
select username xuser_name from user_users
where username = user;
-- Store database name
-- Add this to your login.sql to have the database you are connected to as part of your sql prompt:
-- You need select privileges on v$database for this to work
column xsid new_value osid
select name xsid from v$database;
--
set sqlprompt '&osid:&xxuser_name> '
|