Getting data base name using SQL Plus?

Asked By 0 points N/A Posted on -
qa-featured

I want to know the database name and I am using SQL *Plus command prompt of Oracle. Also, how can I figure it out that which user created that database? How can I achieve this using SQL *PLUS command prompt?

SHARE
Best Answer by Terry Young
Best Answer
Best Answer
Answered By 0 points N/A #92793

Getting data base name using SQL Plus?

qa-featured

To get the database name in oracle use this query:

  • select * from global_name; or
  • SELECT global_name FROM global_name;
  • In oracle, global_name is composed of database name + database domain name. That is the default value but you can also change that by using this query:
  • ALTER DATABASE RENAME GLOBAL_NAME TO <your db name choice>.
  • About your second question, who created the database, we better look on Schema.
  • In oracle, a schema is a collection of objects (can be tables, views, procedures, etc..) owned by a user. The schema owner will then grant access to users of his objects. So in order to determine the schema owners you may use these queries:
  • SELECT DISTINCT owner FROM dba_tables;  or
  • SELECT DISTINCT owner from dba_objects;  or
  • SELECT * FROM user_tab_privs; → through this query you can then check the table names you are granted and from there check the OWNER of that tables.
Answered By 5 points N/A #92795

Getting data base name using SQL Plus?

qa-featured

There are several ways to get the database name when working with SQL Plus. If you want to get the database name with which you are working, you need to run any of the following queries to get the database name.

  • SELECT * FROM GLOBAL_NAME;
  • SELECT NAME FROM $database;

In the result set of these queries, you will find the databases names and can easily find the database name you are working with.

 

Related Questions