create schema 语句 
create schema 语句
初见create schema 这条语句,还以为oracle 中的schema 是使用该条语句创建呢。其实oracle 中create user 才是创建schema 的语句,user 和 schema 是不可分的。create schema 只不过是提供了一种填充schema 的方式,可以将条DDL语句和DCL语句打包在一起。省去了一条一条执行这些命令的繁琐,被create schema 打包起来的命令整体组成了一个事务,要么全部执行成功,要么不执行。
SQL> conn hr/oracle
Connected.
SQL> create schema authorization hr
  2  create table temp as select employee_id,first_name,last_name,salary
  3  from employees
  4  create view temp1 as select employee_id,first_name,last_name,salary
  5  from employees
  6  grant select on temp1 to scott;
Schema created.
create schema 语句可以打包create table ,create view 和grant 语句 (即在名为hr的schema下打包执行create table ,create view 和grant 语句),要能够执行create schema 语句,必须拥有权限执行上述这些命令。
SQL> desc temp
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 EMPLOYEE_ID                                        NUMBER(6)
 FIRST_NAME                                         VARCHAR2(20)
 LAST_NAME                                 NOT NULL VARCHAR2(25)
 SALARY                                             NUMBER(8,2)
SQL> desc temp1
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 EMPLOYEE_ID                               NOT NULL NUMBER(6)
 FIRST_NAME                                         VARCHAR2(20)
 LAST_NAME                                 NOT NULL VARCHAR2(25)
 SALARY                                             NUMBER(8,2)
SQL> conn scott/oracle
Connected.
SQL> select count(*) from hr.temp1;
  COUNT(*)
----------
       107
======================================
  oracle中Schema和User两个到底是什么关系

Oracle数据库中Schema和User的关系是一一对应的,也就是说一个Schema只对应一个User,一个User对应一个Schema。当某个User下面有table,view,Index......等Schema Object时,这个User就成了一个Schema,也就是在Enterprise Manager中出现的那个,如果某个User下面没有table,view,Index......等Schema Object时,这个User不会在Enterprise Manager中Schema对象出现。

 

schema只是OEM为了管理方便而引入的一个逻辑概念而已,类似一个容器,如果查创建一个user后如果没有创建人数属于该user的table,index.....的时候是不会有schema的,如果创建了table,index...则和用户几乎是一一对应。

 

A schema is collection of database objects, including logical structures such as tables, views, sequences, stored procedures, synonyms, indexes, clusters, and database links.

schema是数据库对象的集合,包括表,视图,序列,存储过程,逻辑结构,索引,集群和数据库链接等等逻辑结构。
* A user owns a schema.

一个user拥有一个schema
* A user and a schema have the same name.

user和他的schema的名字相同
* The CREATE USER command creates a user. It also automatically creates a schema for that user.
CREATE USER命令创建一个user,同时也为这个user创建一个schema
* 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.
CREATE SCHEMA命令并不像命令说的那样创建一个SCHEMA, 他只是给你创建table的权限和在同一个事务中在你创建的schema中查看和进行赋与权限的权限。
* For all intents and purposes you can consider a user to be a schema and a schema to be a user.
在任何情况下你都可以把用户和schema当作同一个东西。