在 Ubuntu 上的 Oracle XE 下创建新数据库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/705823/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Creating new database under Oracle XE on Ubuntu
提问by Gabriel
I've just installed Oracle XE in Ubuntu. Is there any way to create new databases, besides the one that comes with the installation, preferably from the command line so that I can do it from a script? It would be nice to have multiple databases started in the same time, if possible.
我刚刚在 Ubuntu 中安装了 Oracle XE。除了安装附带的数据库之外,还有什么方法可以创建新数据库,最好是从命令行创建,以便我可以从脚本中创建?如果可能,同时启动多个数据库会很好。
If it is not possible to create new databases, then maybe there is a way to "clean up" the default database? What I need is to be able to "start over" at any time with a fresh database.
如果无法创建新数据库,那么也许有一种方法可以“清理”默认数据库?我需要的是能够随时使用新数据库“重新开始”。
I don't have experience with Oracle administration, so any hints, links, suggestions are welcome.
我没有 Oracle 管理经验,因此欢迎提供任何提示、链接和建议。
Thanks.
谢谢。
回答by andri
I don't know if you are aware of this, but most beginners confuse this about Oracle:
我不知道你是否意识到这一点,但大多数初学者都对 Oracle 感到困惑:
In Oracle, a databasemeans a collection of data files and control files stored on disk. You can have only one database with Oracle XE. A database is mountedby a Oracle instance, which means all the background daemons and programs that you can see with ps
.
在 Oracle 中,数据库是指存储在磁盘上的数据文件和控制文件的集合。使用 Oracle XE 只能拥有一个数据库。数据库由 Oracle实例装载,这意味着您可以看到所有后台守护程序和程序。ps
You probably want a schema, which is what other DBMS products (e.g. MySQL) often refer to as a "database". IIRC there was no limit on the number of schemas in Oracle XE. You can create those from the APEX UI that comes with XE, or from command line (with CREATE USER
-- again, confusingly, a userand schemaare largely synonymous in this case).
您可能需要一个schema,这就是其他 DBMS 产品(例如 MySQL)通常所说的“数据库”。IIRC 对 Oracle XE 中的模式数量没有限制。您可以从 XE 附带的 APEX UI 或从命令行(使用CREATE USER
-- 同样令人困惑的是,在这种情况下,用户和架构在很大程度上是同义词)创建它们。
I recommend reading the Conceptsguide from Oracle documentation, most of this basic stuff (e.g. how things are called in Oracle-lingo) is covered there.
我建议阅读Oracle 文档中的概念指南,其中涵盖了大部分基本内容(例如,在 Oracle-lingo 中如何调用事物)。
回答by FerranB
No. It's not possible to install multiple XE instances. Oracle XE only allows one instance by machine from the Oracle XE home pageyou can read:
不能。不能安装多个 XE 实例。Oracle XE 只允许一个实例从Oracle XE 主页你可以阅读:
Oracle Database XE can be installed on any size host machine with any number of CPUs (one database per machine), but XE will store up to 4GB of user data, use up to 1GB of memory, and use one CPU on the host machine.
Oracle 数据库 XE 可以安装在具有任意数量 CPU(每台机器一个数据库)的任何大小的主机上,但 XE 将存储多达 4GB 的用户数据,使用多达 1GB 的内存,并在主机上使用一个 CPU。
To add more instances you can:
要添加更多实例,您可以:
- Use virtualization with an XE instace by virtual machine.
- Download for free dev/personal use any other Oracle Database edition, for instance Oracle Standard Edition One.
- 通过虚拟机在 XE 实例中使用虚拟化。
- 免费下载开发/个人使用任何其他Oracle 数据库版本,例如Oracle 标准版一。
Anyway, in most of the cases only one instance is enough for all the scenarios. Explain why do you need more instance to assistance about solutions.
无论如何,在大多数情况下,只有一个实例就足以满足所有场景。解释为什么您需要更多实例来帮助解决解决方案。
To recreate the Xe instance, i thing the best and easy way is uninstall i and install again.
要重新创建 Xe 实例,最好且最简单的方法是卸载 i 并重新安装。