小型而简单的数据库

小型而简单的数据库

本文介绍了如何使用Oracle 11 g和SQL Developer创建一个小型而简单的数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Oracle 11 g和SQL Developer创建小型而简单的数据库?我看到太多错误,找不到任何方法来制作简单的数据库.例如

How to create a small and simple database using Oracle 11 g and SQL Developer ?I am seeing too many errors and I cannot find any way to make a simple database.For example

create database company;

导致以下错误:

Error starting at line 1 in command:
create database company
Error at Command Line:1 Column:0
Error report:
SQL Error: ORA-01501: CREATE DATABASE failed
ORA-01100: database already mounted
01501. 00000 -  "CREATE DATABASE failed"
*Cause:    An error occurred during create database
*Action:   See accompanying errors.

编辑-这与我熟悉的MySQL和MS-SQL完全不同.不像我期望的那样直观.

EDIT-This is completely different from MySQL and MS-SQL that I am familiar with.Not as intuitive as I was expecting.

推荐答案

首先,Oracle所说的数据库"通常不同于大多数其他数据库产品所说的数据库". MySQL或SQL Server中的数据库"更接近于Oracle所谓的模式",即特定用户拥有的一组对象.在Oracle中,通常每个服务器只有一个数据库(大型服务器上可能只有几个数据库),其中每个数据库都有许多不同的架构.如果使用的是Oracle的快速版,则每个服务器只能有1个数据库.如果您通过SQL Developer连接到Oracle,则表明您已经创建了Oracle数据库.

First off, what Oracle calls a "database" is generally different than what most other database products call a "database". A "database" in MySQL or SQL Server is much closer to what Oracle calls a "schema" which is the set of objects owned by a particular user. In Oracle, you would generally only have one database per server (a large server might have a handful of databases on it) where each database has many different schemas. If you are using the express edition of Oracle, you are only allowed to have 1 database per server. If you are connected to Oracle via SQL Developer, that indicates that you already have the Oracle database created.

假设您确实要创建一个模式,而不是一个数据库(使用Oracle术语),那么您将创建用户

Assuming that you really want to create a schema, not a database (using Oracle terminology), you would create the user

CREATE USER company
  IDENTIFIED BY <<password>>
  DEFAULT TABLESPACE <<tablespace to use for objects by default>>
  TEMPORARY TABLESPACE <<temporary tablespace to use>>

然后,您将为用户分配所需的任何特权

You would then assign the user whatever privileges you wanted

GRANT CREATE SESSION TO company;
GRANT CREATE TABLE TO company;
GRANT CREATE VIEW TO company;
...

完成后,您可以以COMPANY身份连接到(现有)数据库,并在COMPANY模式中创建对象.

Once that is done, you can connect to the (existing) database as COMPANY and create objects in the COMPANY schema.

这篇关于如何使用Oracle 11 g和SQL Developer创建一个小型而简单的数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 22:13