?? 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 + -