Schema

From Oracle FAQ
Jump to: navigation, search

A schema is the set of objects (tables, views, indexes, etc) that belongs to an user account. It is often used as another way to refer to an Oracle account.

The CREATE SCHEMA statement lets one specify (in a single SQL statement) all data and privilege definitions for a new schema. One can also add definitions to the schema later using DDL statements.

[edit] Examples

Create a new database account with an empty schema:

CREATE USER willie IDENTIFIED BY willie123 
DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp;

Create schema objects as a single command:

CONNECT willie/willie123 
CREATE SCHEMA AUTHORIZATION frank
  CREATE TABLE t1 (id NUMBER, doc CLOB)
  GRANT select ON t1 TO public
  CREATE TABLE t2 (id NUMBER, stamp DATE)
  GRANT select ON t2 TO public;
Glossary of Terms
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #