Showing posts with label Database. Show all posts
Showing posts with label Database. Show all posts

Monday, November 7, 2011

Difference between oracle database schema and user.


Oracle's schema is set of all tables and other objects owned by a user account, so roughly equivalent to a user account. Schema is set of all tables, proceduress etc. that make up the database for a given system / application.

The CREATE USER command creates a USER . If that user can create objects, then the collection of objects owned by that user is called a SCHEMA. So every SCHEMA corresponds to a USER, but not every USER corresponds to a SCHEMA.

* A schema is collection of database objects, including logical structures such as tables, views, sequences, stored procedures, synonyms, indexes, clusters, and database links.
* A user owns a schema.
* A user and a schema have the same name.
* The CREATE USER command creates a user. It also automatically creates a schema for that user.
* The CREATE SCHEMA command does not create a "schema" as it implies, it just allows you to create   multiple tables and views and perform multiple grants in your own schema in a single transaction.
* For all intents and purposes you can consider a user to be a schema and a schema to be a user.