27

After successfully installing ORACLE 11gR1 on Windows7 32bit platform, I can go inside the SQL PLUS and I can also create database, but I still don't have any clue how to use database.

in MySQL the command to use database should be:

USE MYDATBASENAME;

In SQL SERVER also quite the same:

USE [DATABASE];

But I have no idea how to use database in ORACLE 11gR1 via SQLPLUS, any body have any ideas?

I'm planning to create a table after I succeed in using the USE command.

3 Answers 3

48

Even though they all use the same noun the term "database" is something completely different between MySQL (SQL Server) and Oracle.

Usually a MySQL database is mapped to a schema/user in Oracle. In Oracle there is a 1:1 relationship between schemas and users.

A "database" in Oracle refers to the complete installation (which is also named "instance"). As there is typically only a single instance/installation there is no sense in "switching a database" in Oracle.

The closest thing to "USE mydatabase" in Oracle would be to switch the current schema:

ALTER SESSION SET current_schema = other_user;

Then you can access all tables of other_user without prefixing them. This of course requires your current user to have at least select privileges on the tables of the other user (i.e schema)

Sign up to request clarification or add additional context in comments.

2 Comments

thank you, i've found it sqlplus MYUSERNAME/MYPASSWORD@MYHOSTNAME:1616 The 1 to 1 relationship really enlighten me :D thanks
You've typoed SESSION in your answer :)
5

you can login into oracle using sqlplusw username/password@connect-string and then do a select * from v$database

use select instance_name from v$instance; to find out which database are you currently connected to

1 Comment

thank you for the assistance sir, i've got the result from SELECT name FROM v$DATABASE; it shows me the database i've just created, now i'm having 2 databases there , how can i use one of them and create table on it,
1

TNSNAMES.ora has the details about which database you are connecting to.

2 Comments

which is in $ORACLE_HOME/network/admin
I suspect the man was referring to schemas, rather than databases per se.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.