Oracle中的用户和模式有什么区别?


当前回答

摘自《问汤姆》

您应该将模式视为用户帐户和其中所有对象的集合 作为所有意图和目的的模式。

SCOTT是一个包含EMP、DEPT和奖金表的模式,以及各种授权 其他的东西。

SYS是一个包含大量表、视图、授权等的模式。

SYSTEM是一个模式.....

从技术上讲——模式是数据库使用的元数据(数据字典)的集合, 通常使用DDL生成。模式定义数据库的属性,例如 表、列和属性。数据库模式是数据库中数据的描述 数据库。

其他回答

Schema是DB的封装。对象关于一个想法/感兴趣的领域,并拥有一个用户。然后,它将由具有抑制角色的其他用户/应用程序共享。所以用户不需要拥有一个模式,但是模式需要有一个所有者。

一个用户帐户就像持有你家钥匙的亲戚,但不拥有任何东西,即一个用户帐户不拥有任何数据库对象…没有数据字典…

而模式是数据库对象的封装。这就像房子的主人拥有你房子里的所有东西,只有当主人(即模式)给它所需的授权时,用户帐户才能访问家里的商品。

模式是对象的容器。 它由用户拥有。

从WikiAnswers:

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.

此外,用户可以访问除自己的模式之外的模式中的对象,如果他们有权限这样做的话。

模式和数据库用户是一样的,但如果模式拥有数据库对象,他们可以对对象做任何事情,但用户只能访问对象,他们不能做任何DDL操作,直到模式用户给你适当的特权。