Oracle – Difference Between Schema and Database

oracleoracle-10goracle-11g-r2

In Oracle, datafile are system files where actual data is stored. The collection of datafiles make tablespace and, at last, database is collection of tablespaces.

Correct me if I am wrong on the concepts of datafile, tablespace and database.

I would like to understand the difference between Schema and Database in details. Online resources are helpful but seemed confusing, regarding this difference.

Best Answer

If all else fails read the documentation. Try here for starters (v. good diagram). In Oracle, a schema is a database. Also see here - particularly this:

One characteristic of an RDBMS is the independence of physical data storage from logical data structures. In Oracle Database, a database schema is a collection of logical data structures, or schema objects [i.e. related tables]. A database schema is owned by a database user and has the same name as the user name.

A further distinction is between the physical database files "the database" and the "instance" - the running software that makes up the fully working system.

In one sense, an Oracle "database" is useless - it's just a bunch of bits on a disk - it's the software which turns it into a system (i.e. a database in the sense that information is retrievable/modifiable).

An Oracle database is a running instance plus data (+ control + redo &c.) files which itself may contain 1 or many schemas which are themselves "databases" - i.e. as the layman would understand them - i.e. a HR, CRM or ERP (&...) schemas/systems.