Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Please help me understand this statement:

A database in MySQL is a schema in Oracle.

I have just started to use Oracle and I find it different from other RDBMS softwares I have used like MSSQL, MySQL and Derby.

For example to create a database, when I use create database ghazals, it throws an error:

ERROR at line 1:
ORA-01501: CREATE DATABASE failed 
ORA-01100: database already mounted

Also, commands like show databases do not work here.

share|improve this question
add comment

2 Answers

up vote 14 down vote accepted

It's simple.

MySQL has a single daemon that runs the database server. Within the server you can create any number of databases - these databases have no direct mapping to users.

Oracle has a single database. When you create a user in an Oracle database, it also creates a Schema with the same name as the user that created it. This is equivalent to a database in MySQL.

Having seen the edit to your question, you really need to forget about mysql while you learn Oracle. DDL and RDBMS concepts are completely different.

Start with the Oracle Server Concepts guide (link). The Oracle documentation home is here: http://www.oracle.com/pls/db112/homepage.

To create a user, the syntax would be:

create user newbie identified by yourpassword;

You'll then need to grant appropriate privileges to allow the user to connect:

grant connect to newbie;
share|improve this answer
    
can you please tell me about the connect privilege ? –  Suhail Gupta Mar 4 '13 at 16:39
3  
No. Sorry to be mean, but this question could still be going on in 5 years time if you keep on changing what you're asking. You need to learn. Read the documentation I have linked to - it's very thorough. Oracle is an incredibly complicated commercial RDBMS and you can't be expected to just pick it up. –  FreshPhilOfSO Mar 4 '13 at 16:42
3  
@SuhailGupta If you have an additional specific question that fits into the guidelines in our FAQ then feel free to post that as a separate question. Adding more questions in the comments section is not accepted. –  JNK Mar 4 '13 at 16:44
add comment

In Oracle, schema contains all the tables, constraints, etc. When in mysql you create create database , in Oracle you create schema. You don't use db1, but alter session set CURRENT_SCHEMA = db1 . Each user has it's own schema, so you get list of schemas by select USERNAME from SYS.ALL_USERS

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.