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


当前回答

从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.

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

其他回答

我认为问题在于Oracle使用的术语模式与它的一般含义略有不同。

Oracle的模式(Nebakanezer的回答中解释过):基本上是一个用户帐户拥有的所有表和其他对象的集合,所以大致相当于一个用户帐户 一般模式:构成给定系统/应用程序数据库的所有表、scproc等的集合(如“开发人员应该与dba讨论我们新应用程序的模式”)。

概念2中的图式。是相似的,但不一样的模式在意义1。例如,对于一个使用多个数据库帐户的应用程序,意义2中的模式可能由几个Oracle模式组成:-)。

另外,图式在其他语境中也可以指其他一些不相关的东西(比如在数学中)。

Oracle应该使用“userarea”或“accountobjects”这样的术语,而不是重载“schema”……

从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.

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

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

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

对于大多数更熟悉MariaDB或MySQL的人来说,这似乎有点令人困惑,因为在MariaDB或MySQL中,它们有不同的模式(包括不同的表、视图、PLSQL块和DB对象等),而USERS是可以访问这些模式的帐户。因此,没有特定的用户可以属于任何特定的模式。权限必须被授予该模式,然后用户才能访问它。在MySQL和MariaDB等数据库中,用户和模式是分开的。

在Oracle模式中,用户几乎被视为相同的。要使用该模式,您需要有权限,因此您会觉得模式名只是用户名。可以跨模式授予权限,以便从不同模式访问不同的数据库对象。在oracle中,我们可以说一个用户拥有一个模式,因为当你创建一个用户时,你为它创建了DB对象,反之亦然。

用户:对数据库资源的访问。就像一把进入房子的钥匙。

架构:关于数据库对象的信息集合。就像你书中的索引,它包含了关于该章节的简短信息。

详情请看这里