Microsoft

Web Development

Language

More

Oracle/PLSQL: Create a Schema

This Oracle tutorial explains how to create a schema in Oracle with syntax and examples.

Description

Creating a schema in Oracle, can at first, appear to be a little confusing. You might think that the CREATE SCHEMA statement would create your schema, but that is not the case. The CREATE SCHEMA statement is used only to create objects (ie: tables, views, etc) in your schema in a single SQL statement, but does not actually create the schema itself.

This CREATE USER statement would create a new user called smithj in the Oracle database whose password is pwd4smithj, the default tablespace would be tbs_perm_01 with a quota of 20MB, and the temporary tablespace would be tbs_temp_01.

Step 2 - Assign SYSTEM privileges to new user in Oracle

The next step in setting up your schema is to assign "system privileges" to the new user smithj.

These "system privileges" will allow our new user to create a session in Oracle as well as create tables, views, triggers, procedures, sequences, and synonyms in the new schema. Here is an example of how we might grant those system privileges: