2

根据我的一篇文章(如下),Oracle 中似乎没有数据库之类的东西。我们在 MySQL 和 MS-SQL 中称为数据库的东西在 Oracle 中称为模式。如果是这样,那么为什么 oracle 文档会提到 create database 语句?作为记录,我使用的是 Oracle 11g 和 oracle SQL Developer GUI 工具。

Post- 如何使用Oracle 11g和SQL Developer创建一个小而简单的数据库?

下面给出了 oracle 文档中的 create database 语句。如果没有数据库的概念,那么这个命令是怎么出现的呢?

CREATE DATABASE
CREATE DATABASE [ database ]
{ USER SYS IDENTIFIED BY password
| USER SYSTEM IDENTIFIED BY password
| CONTROLFILE REUSE
| MAXDATAFILES integer
| MAXINSTANCES integer
| CHARACTER SET charset
| NATIONAL CHARACTER SET charset
| SET DEFAULT
{ BIGFILE | SMALLFILE } TABLESPACE
| database_logging_clauses
| tablespace_clauses
| set_time_zone_clause
}... ;
4

2 回答 2

5

Oracle中有“数据库”的概念。术语“数据库”在 Oracle 术语中的含义与该术语在 MySQL 或 SQL Server 中的含义不同。

由于您使用的是 express 版本,OracleCREATE DATABASE会在安装过程中自动运行该语句。一台机器上只能有 1 个速成版数据库。如果您要安装不同的版本,您可以选择是让安装程序创建数据库作为安装过程的一部分,还是CREATE DATABASE稍后通过语句手动执行。如果您刚刚学习 Oracle,最好让 Oracle 在安装时为您创建数据库——您只能通过命令行工具(而不是 SQL Developer)创建数据库,而且很少有人刚开始需要以安装程序没有提示您的方式调整数据库设置。

In Oracle, a "database" is a set of data files that includes the data files for the SYS and SYSTEM schemas which contain all the Oracle data dictionary tables, the data files for the TEMP tablespace where sorts and other temporary operations occur, and the data files for whatever schemas you want to create. In SQL Server and other RDBMSs, these would be separate "databases". In SQL Server, you have a master database, a tempdb database, additional database for different products (i.e. msdb for the SQL Server Agent), and then additional user-defined databases. In Oracle, these would all be separate schemas in a larger container that Oracle refers to as a "database".

Occasionally, a DBA will want to run multiple Oracle databases on the same server-- most commonly when there are different packaged applications that have different requirements about database versions or parameters. If you want to run application A that requires an 11.2 database and application B that doesn't support 11.2 yet, you would need to have two different databases on the server. The DBA could create a separate database and a separate instance but that doubles the memory requirements, doubles the number of background processes required to run the database, and generally makes things less scalable. It's necessary if you really want to run different versions of the database simultaneously but it's not ideal.

于 2012-08-08T00:02:47.920 回答
3

回答您原始问题的人是正确的。上面的 DDL(数据定义语言)为模式准备了空间,类似于 MySQL 的“数据库”。上面的语句定义了模式的特征,例如时区、表的 MB 空间、编码字符集、root 帐户等。然后,您将发出 DDL 语句,例如您其他帖子中的那些来创建模式,这些语句定义了每个用户可以看。

于 2012-08-07T23:47:32.757 回答