📄 oracle-howto.txt
字号:
Oracle Database HOWTO 作者:Paul Haigh, paul@nailed.demon.co.uk译者:曾达康, a9504480@graduate.hku.hk 1.2 版, 一九九八年八月四日(翻译日期∶一九九八年八月三十一日) _________________________________________________________________ 在 Linux 系统中安装及设定 Oracle 资料库伺服器之指南。 _________________________________________________________________ 1. 导言 * 1.1 版本历史 * 1.2 Copyright * 1.3 Disclaimer * 1.4 本 HOWTO 的目的 * 1.5 系统要求 * 1.6 Oracle Corporation 的新消息 2. 安装 Oracle 软件 * 2.1 伺服器的准备工夫 * 2.2 从光碟安装 * 2.3 安装後的工作 3. 建立一个资料库 * 3.1 建立初始档 (Initialisation File) * 3.2 建立资料库安装命令稿 * 3.3 执行资料库的安装安令稿 * 3.4 启动资料库 * 3.5 停止资料库 * 3.6 建立内定用户 (Default User) 4. 在伺服器上设定 SQL*Net * 4.1 tnsnames.ora * 4.2 listener.ora * 4.3 sqlnet.ora * 4.4 开始及结□监听程式 5. 用户的设定 * 5.1 视窗用户 * 5.2 Unix 用户 6. 自动启动及停止 * 6.1 dbstart 及 dbstop * 6.2 init.d 及 rc.d 7. 其他事宜 * 7.1 Intelligent Agent 8. 疑难排解 * 8.1 我不能在 Oracle 7.2.x 中建立资料库。 * 8.2 7.3.4.x 的 svrmgrl 产生 segmentation fault。 9. 荣誉 _________________________________________________________________ 1. 导言1.1 版本历史 * 0.1 版 - 一九九八年二月廿一日 - Paul Haigh - 最先的版本。 * 0.2 版 - 一九九八年三月一日 - Paul Haigh - 加上了校对者的评论。 * 1.0 版 - 一九九八年三月十日 - Paul Haigh - 在 LDP 出版。 * 1.1 版 - 一九九八年六月二十日 - Paul Haigh - 重新整理及加上疑难排解 。 * 1.2 版 - 一九九八年八月四日 - Paul Haigh - 加上 Oracle Corporation 的新闻及删去未来改进一节。 1.2 Copyright The Oracle Database HOWTO copyright (c) 1998, Paul Haigh. Like all Linux HOWTO documents, this may be reproduced and distributed in whole or in part, in any medium, physical or electronic, so long as this copyright notice is retained on all copies. Commercial redistribution is allowed and encouraged; however the author would like to be notified of such distributions. You may translate this HOWTO into any language whatsoever provided that you leave this copyright statement and disclaimer intact, and that you append a notice stating who translated the document. 1.3 Disclaimer While I have tried to include the most correct and up to date information available to me, I cannot guarantee that usage of information in this document does not result in loss of data or equipment. I provide NO WARRANTY about the information in the HOWTO and I cannot be made liable for any consequences resulting from using the information in this HOWTO. 1.4 本 HOWTO 的目的 在这 HOWTO 中我会尝试说明如何安装及管理一个在 Linux 上执行的 Oracle 资 料库,我会特别说明 Oracle 伺服器的安装,SQL*Net 的设定及用户 (client) 的设定。 这文件并不是一份有关使用及管理一个 Oracle 资料库的入指引。如果你想要这 类资料,O'Reilly 及其他出版商都有推出这方面的佳作。 我也不会说明在 Unix 上 Oracle 程式的开发过程。如果你对这有绝对需要,我 建议你从 SCO 处购买 SCO development system (包括 OpenServer 5.x)。据我 所知,这可以十分合理的十九块美元从 www.sco.com 得到。 1.5 系统要求 要跟从这篇 HOWTO 的内容,你需要以下东西。 * Oracle Server CD 中的 SCO Openserver (7.3.3.0.0 版) 这必须是合法的版本。记著 Oracle 是一间牟利的公司,她会对其 产品收费。如果你想要免费而又支援 SQL 的资料库,请用 PostgresSQL 或其他类以程式。 你也可从 Oracle 网页中下载一个 tar 档案,从中得到一个六十 天的试用许可证 (license) 及安装 Oracle 。我并没有亲自试过 它,它是未经确认的。 * 一台 Linux 伺服器 如果没有的话,你就不会阅读这文件了,是吗? * 2.0.30+ 的核心 我不保证这些指示对任何其他核心来说准确。(我对 2.0.30 也不 作出保证……) * iBCS 安装及使用你所用的平台的最新版本非常重要。(我正在使用 Redhat Linux 的 iBCS-2.0-10.i386.rpm。) * 大量磁碟空间 600 Mb 以上是个合理的数字。使用更少的空间也可以,但你需要 作出一些牺牲,我从不这样开始。不过,我会尝试指出在哪里可腾 出空间。 * 32Mb 以上记忆体 我知道这听起来很多,特别是以 Linux 来说, 但请记著 Oracle 是个复杂的软件。在 SCO,你不会觉得有问题! 我不是说 Oracle 不能在较少记忆体的情形下工作,不过这样会少 过 Oracle 的建议,我也不赞成这样做。 * Oracle 的许可证 (License) 我知道我已提出过,但我想大家知道这是重要的。没有许可证而使 用 Oracle 的软件是违法的。 1.6 Oracle Corporation 的新消息 Oracle 屈服於来自 Linux 社群的压力。Oracle Corporation 已经决定向在 Linux 平台的 Oracle 8 提供官方支援。据 Oracle 网址说,这将会在一九九八 年十二月推出。 更好的消息是 Oracle 会把 Oracle 应用软件移植到 Linux 平台。根据 Oracle 的网页,这应该会在一九九九年上半年推出。 参考资料: * [1]http://www.oracle.com/html/linux.html * [2]http://www.news.com/News/Item/0,4,24436,00.html * [3]http://www.zdnet.com/pcweek/news/0720/20morac.html 2. 安装 Oracle 软件2.1 伺服器的准备工夫 建立 Oracle 用户 如大家所料,我们需要一个用户来保存 Oracle 的资料库。因为我们不想重新链 结 Oracle 核心(容後再谈),我们要接受 Oracle 内定的使用者及群组名称, 即使用者为 ORACLE,而群组为 DBA。 1. 以 root 的身分签入 2. 建立使用者 oracle 及群组 dba。 ______________________________________________________________ $ groupadd dba$ useradd oracle ______________________________________________________________ 3. 确保使用者 oracle 有初始目录 (home directory) ______________________________________________________________ $ mkdir /home/oracle$ mkdir /home/oracle/7.3.3.0.0 (Oracle 的版本)$ chown -R oracle.dba /home/oracle ______________________________________________________________ 2.2 从光碟安装 不幸地,SCO 光碟的 Oracle 安装程式不能运作。使用者会遇到一连串不同的问 题,从 core dump 到当机。所以我们要自己从光碟把档案抄到硬碟及解压: (确保光碟已挂 (mount) 到系统上)。 1. 以 Oracle 的身份签入 2. 到 /home/oracle/7.3.3.0.0 目录。 3. 从光碟抄出把所有安装档案 ______________________________________________________________ $ cp -a /mnt/cdrom/* . ______________________________________________________________ 4. 解压光碟上的所有 Oracle 档案。 ______________________________________________________________ $ find . -name *_ -exec ~/7.3.3.0.0/orainst/oiuncomp {} \; ______________________________________________________________ 2.3 安装後的工作 Root 的工作 把以下数行加到 /etc/profile 或加到每一个会使用 Oracle 的用家的 .profile 中。 ______________________________________________________________ # Oracle 专用ORACLE_HOME=/home/oracle/7.3.3.0.0ORACLE_SID=orclORACLE_TERM=vt100export ORACLE_HOME ORACLE_SID ORACLE_TERM# 为 Oracle 修改路径PATH="$PATH:$ORACLE_HOME/bin" ______________________________________________________________ 我们也需要修改 Oracle ulimit 提升工具的拥有人及许可 (permissions)。 ______________________________________________________________ $ chown root.root $ORACLE_HOME/bin/osh$ chmod u+s $ORACLE_HOME/bin/osh ______________________________________________________________ Oracle 的工件 修改 Oracle 档案的许可来确保操作正确。 ______________________________________________________________ $ chmod +x $ORACLE_HOME/bin/*$ chmod u+s $ORACLE_HOME/bin/oracle ______________________________________________________________ Oracle 的工具要求把讯息放在 $ORACLE_HOME/tool_name/mesg 目录。所以我们 要把及 msg_ship 目录下的msg 档案移到 mesg 目录下。 ______________________________________________________________ $ mv $ORACLE_HOME/plsql/mesg/mesg_ship/* $ORACLE_HOME/plsql/mesg/.$ mv $ORACLE_HOME/rdbms/mesg/mesg_ship/* $ORACLE_HOME/rdbms/mesg/.$ mv $ORACLE_HOME/svrmgr/mesg/mesg_ship/* $ORACLE_HOME/svrmgr/mesg/. ______________________________________________________________ 如果没有以下目录,要建立它们: ______________________________________________________________ $ mkdir $ORACLE_HOME/rdbms/log$ mkdir $ORACLE_HOME/rdbms/audit$ mkdir $ORACLE_HOME/network/log ______________________________________________________________ 可移除的东西 以下目录可以安全地移除: * $ORACLE_HOME/guicommon2/ * $ORACLE_HOME/ctx/ * $ORACLE_HOME/md/ * $ORACLE_HOME/mlx/ * $ORACLE_HOME/precomp/ * $ORACLE_HOME/slax/ 3. 建立一个资料库 Oracle 伺服器现已安装了,我们需要建立一个资料库来测试它。 如果你使用 Oracle 7.2.x 或之前版本,请阅读下面的疑难排解部分。 3.1 建立初始档 (Initialisation File) 把 $ORACLE_HOME/dbs/init.ora 抄到 $ORACLE_HOME/dbs/initorcl.ora: ______________________________________________________________ $ cd $ORACLE_HOME/dbs$ cp init.ora initorcl.ora ______________________________________________________________ 加上以下数行: ______________________________________________________________ db_name = orclCOMPATIBLE=7.3.3.0.0 ______________________________________________________________ 3.2 建立资料库安装命令稿 在 $ORACLE_HOME/dbs 目录下建立一个名为 makedb.sql 的命令稿档: ______________________________________________________________ connect internalstartup nomountset echo onspool makedb.logcreate database orcl maxinstances 1 maxlogfiles 8 datafile '$ORACLE_HOME/dbs/orcl_syst_01.dbf' size 40M reuse logfile '$ORACLE_HOME/dbs/orcl_redo_01.dbf' size 1M reuse,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -