作者:Paul Haigh, [email protected]
譯者:曾達康, [email protected]
1.2 版, 一九九八年八月四日(翻譯日期︰一九九八年八月三十一日)
轉為 Wiki: Ping (ping 'at' pingyeh 'dot' net), 2003 年 11 月 27 日
在 Linux 系統中安裝及設定 Oracle 資料庫伺服器之指南。
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 的網頁,這應該會在一九九九年上半年推出。
參考資料:
2. 安裝 Oracle 軟件
2.1. 伺服器的準備工夫
2.1.1. 建立 Oracle 用戶
如大家所料,我們需要一個用戶來保存 Oracle 的資料庫。因為我們不想重新鏈結 Oracle 核心(容後再談),我們要接受 Oracle 內定的使用者及群組名稱,即使用者為 ORACLE,而群組為 DBA。
以 root 的身分簽入
建立使用者 oracle 及群組 dba。
-
$ groupadd dba $ useradd oracle
-
確保使用者 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) 到系統上)。
以 Oracle 的身份簽入
到 /home/oracle/7.3.3.0.0 目錄。
從光碟抄出把所有安裝檔案
-
$ cp -a /mnt/cdrom/* .
-
解壓光碟上的所有 Oracle 檔案。
-
$ find . -name *_ -exec ~/7.3.3.0.0/orainst/oiuncomp {} \;
-
2.3. 安裝後的工作
2.3.1. Root 的工作
把以下數行加到 /etc/profile 或加到每一個會使用 Oracle 的用家的 .profile 中。
-
# Oracle 專用 ORACLE_HOME=/home/oracle/7.3.3.0.0 ORACLE_SID=orcl ORACLE_TERM=vt100 export 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
2.3.2. 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
2.3.3. 可移除的東西
以下目錄可以安全地移除:
$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 = orcl COMPATIBLE=7.3.3.0.0
3.2. 建立資料庫安裝命令稿
在 $ORACLE_HOME/dbs 目錄下建立一個名為 makedb.sql 的命令稿檔:
-
connect internal startup nomount set echo on spool makedb.log create 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, '$ORACLE_HOME/dbs/orcl_redo_02.dbf' size 1M reuse, '$ORACLE_HOME/dbs/orcl_redo_03.dbf' size 1M reuse; @$ORACLE_HOME/rdbms/admin/catalog.sql create tablespace rollback datafile '$ORACLE_HOME/dbs/orcl_roll_01.dbf' size 8.5M reuse; create tablespace temp datafile '$ORACLE_HOME/dbs/orcl_temp_01.dbf' size 5M reuse temporary; create tablespace users datafile '$ORACLE_HOME/dbs/orcl_user_01.dbf' size 10M reuse; create rollback segment r1 tablespace rollback storage ( optimal 5M ); alter rollback segment r1 online; connect system/manager @$ORACLE_HOME/rdbms/admin/catdbsyn.sql connect internal @$ORACLE_HOME/rdbms/admin/catproc.sql connect system/manager @$ORACLE_HOME/sqlplus/admin/pupbld.sql spool off exit
3.3. 執行資料庫的安裝安令稿
開始 svrmgrl 及執行命令稿︰
-
$ cd $ORACLE_HOME/dbs $ svrmgrl Oracle Server Manager Release 2.3.3.0.0 - Production Copyright (c) Oracle Corporation 1994, 1995. All rights reserved. Oracle7 Server Release 7.3.3.0.0 - Production Release PL/SQL Release 2.3.3.0.0 - Production SVRMGR> connect internal Connected. SVRMGR> startup nomount ORACLE instance started. Total System Global Area 4313312 bytes Fixed Size 41876 bytes Variable Size 4140364 bytes Database Buffers 122880 bytes Redo Buffers 8192 bytes SVRMGR> @makedb loads of messages> SVRMGR> exit Server Manager complete.
3.4. 啟動資料庫
開始時,我們要親手啟動資料庫(我們稍後會把這工件自動化)。要啟動 Oracle 的資料庫,我們要來內部連接 (connected internally) 了的情況下執行 startup 指令:
-
$ svrmgrl Oracle Server Manager Release 2.3.3.0.0 - Production Copyright (c) Oracle Corporation 1994, 1995. All rights reserved. Oracle7 Server Release 7.3.3.0.0 - Production Release PL/SQL Release 2.3.3.0.0 - Production SVRMGR> connect internal Connected. SVRMGR> startup ORACLE instance started. Total System Global Area 4313316 bytes Fixed Size 41876 bytes Variable Size 4140368 bytes Database Buffers 122880 bytes Redo Buffers 8192 bytes Database mounted. Database opened. SVRMGR> exit Server Manager complete.
3.5. 停止資料庫
先旨聲明,在未關閉一個 Oracle 資料庫的情況下重新啟動 Linux 很有可能會使資料庫損毀。
因此,在我們執行 Linux 的 shutdown 指令前最好先關閉資料庫:
-
$ svrmgrl Oracle Server Manager Release 2.3.3.0.0 - Production Copyright (c) Oracle Corporation 1994, 1995. All rights reserved. Oracle7 Server Release 7.3.3.0.0 - Production Release PL/SQL Release 2.3.3.0.0 - Production SVRMGR> connect internal Connected. SVRMGR> shutdown Database closed. Database dismounted. ORACLE instance shut down. SVRMGR> exit Server Manager complete.
3.6. 建立內定用戶 (Default User)
在建立資料庫時,會自動產生兩個特別的用戶:
-
Username Password SYSTEM MANAGER SYS change_on_install
這些用戶通常是用來保存標準的資料字典 (data dictionary) 資料在資料庫中。盡快把密碼修改是一個好主意。
可以這樣做:
-
sqlplus system/manager SQL*Plus: Release 3.3.3.0.0 - Production on Sat Feb 21 12:43:33 1998 Copyright (c) Oracle Corporation 1979, 1996. All rights reserved. Connected to: Oracle7 Server Release 7.3.3.0.0 - Production Release SQL> alter user system identified by newpassword>; User altered. SQL> alter user sys identified by newpassword>; User altered. SQL> exit; Disconnected from Oracle7 Server Release 7.3.3.0.0 - Production Release PL/SQL Release 2.3.3.0.0 - Production
用戶 system/manager 就如 UNIX 中的 root,因此我們要建立另一個權力較少的用戶以防損失。(記著要先開啟資料庫才建立用戶。)
連接到 SQL*Plus 及建立用戶:
-
$ sqlplus system/manager SQL*Plus: Release 3.3.3.0.0 - Production on Sat Feb 21 12:43:33 1998 Copyright (c) Oracle Corporation 1979, 1996. All rights reserved. Connected to: Oracle7 Server Release 7.3.3.0.0 - Production Release PL/SQL Release 2.3.3.0.0 - Production SQL> create user user> identified by psw> 2 default tablespace users 3 temporary tablespace temp; User created. SQL> grant connect, resource to user> Grant succeeded. SQL> exit Disconnected from Oracle7 Server Release 7.3.3.0.0 - Production Release PL/SQL Release 2.3.3.0.0 - Production
系統中已有一個新用戶,你可以用他來試用新系統。要簽入 Oracle 資料庫:
-
$ sqlplus user>/password>
如果這在沒有錯誤訊息的情況下完成,你已有一個運作中的 Oracle 資料庫。如果你只會從這部電腦連接到這資料庫,而不會從其他地方,你可休息了!
不過,如果你像大部分人般想設定網絡軟件使你可以從其他電腦連接,請繼續讀下去。
4. 在伺服器上設定 SQL*Net
所有這些檔案都會用於設定 Oracle 的網絡軟件(SQL*Net,和 Oracle8 的 Net8 差不多)。這些檔案應該都建立在伺服器中的 $ORACLE_HOME/network/admin 目錄。
4.1. tnsnames.ora
TNSNAMES.ORA 檔設定所有這電腦提供的服務。現在我們描述所有掛上了伺服器的資料庫。對伺服器上所有資料庫你要加上類似以下的一段:
-
orcl.world = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (COMMUNITY = tcp.world) (PROTOCOL = TCP) (Host = INSERT HOST NAME OF SERVER HERE> ) (Port = 1521) ) (ADDRESS = (COMMUNITY = tcp.world) (PROTOCOL = TCP) (Host = INSERT HOST NAME OF SERVER HERE> ) (Port = 1526) ) ) (CONNECT_DATA = (SID = ORCL) ) )
4.2. listener.ora
listener.ora 檔描述所有其他電腦可得到的服務及伺服器的監聽程式 (listener) 所需的所有設定。
它有一段包括監聽程式名稱、監聽程式地址、監聽程式提供服務的資料庫及參數設定 (listener name, listener address, databases served by the listener and configuration parameters)。
這裡有一個例子:
-
# 監聽程式名稱及所收聽的地址 LISTENER = ( ADDRESS_LIST = (ADDRESS = (PROTOCOL=tcp) (HOST=INSERT HOST>) (PORT=1521) (COMMUNITY=UK_SUP_TCPIP) ) (ADDRESS = (PROTOCOL=ipc) (KEY=700) (COMMUNITY=UK_SUP_TCPIP) ) ) # 列出監聽程式提供的服務 SID_LIST_LISTENER= (SID_LIST= (SID_DESC= (SID_NAME=orcl) (ORACLE_HOME=/home/oracle/7.3.3.0.0) ) ) # 開始參數設定 TRACE_LEVEL_LISTENER=OFF TRACE_FILE_LISTENER = "listener" LOG_FILE_LISTENER = "listener" CONNECT_TIMEOUT_LISTENER = 10 STOP_LISTENER = YES DBA_GROUP = dba
4.3. sqlnet.ora
sqlnet.ora 檔包括對網絡上一個特定節點 (node) 的設定。這些資料和資料庫的數目及監聽程式的數目無關。這個檔案中最重要的東西是 Dead Connection Timeout 變數的設定。
Dead connection timeout 檢查每一個接到該資料庫的行程及確保用戶端仍有反應。如果那用戶(類型不拘)並無反應,對應的 Oracle 伺服器影子行程 (shadow process) 便會被殺。
如果你有很多用戶存取那資料庫,這點非常有用。尤其是當你仍在程式開發階段,用戶多數不能正確地結朿的時候。
以下是我的 sqlnet.ora 檔,供各讀者參考:
-
TRACE_LEVEL_CLIENT = OFF sqlnet.expire_time = 30 # 兩次檢查客戶相差的秒數 names.default_domain = world name.default_zone = world
4.4. 開始及結朿監聽程式
現在有關監聽程式及 SQL*Net 的設定已經完成,我們可以試用網絡軟件來駁到資料庫。(之前我們只是直接連接到資料庫,現在則是在模擬使用遠程 (remote) 用戶。)
使用以上的設定來啟動監聽程式:
-
$ lsnrctl LSNRCTL for SCO System V/386: Version 2.3.3.0.0 - Production on 23-FEB-98 20:38:25 Copyright (c) Oracle Corporation 1994. All rights reserved. Welcome to LSNRCTL, type "help" for information. LSNRCTL> start Starting /home/oracle/7.3.3.0.0/bin/tnslsnr: please wait... TNSLSNR for SCO System V/386: Version 2.3.3.0.0 - Production System parameter file is /home/oracle/7.3.3.0.0/network/admin/listener.ora Log messages written to /home/oracle/7.3.3.0.0/network/log/listener.log Listening on: (ADDRESS=(PROTOCOL=tcp)(DEV=6)(HOST=192.168.1.1)(PORT=1521)) Listening on: (ADDRESS=(PROTOCOL=ipc)(DEV=10)(KEY=700)) Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=magic.com)(PORT=1521)(COMMUNITY=UK_SUP_TCPIP)) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for SCO System V/386: Version 2.3.3.0.0 - Production Start Date 23-FEB-98 20:38:50 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security OFF SNMP ON Listener Parameter File /home/oracle/7.3.3.0.0/network/admin/listener.ora Listener Log File /home/oracle/7.3.3.0.0/network/log/listener.log Services Summary... orcl has 1 service handler(s) The command completed successfully LSNRCTL> exit
要停止監聽程式:
-
$ lsnrctl LSNRCTL for SCO System V/386: Version 2.3.3.0.0 - Production on 23-FEB-98 20:43:20 Copyright (c) Oracle Corporation 1994. All rights reserved. Welcome to LSNRCTL, type "help" for information. LSNRCTL> stop Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=magic.com)(PORT=1521)(COMMUNITY=UK_SUP_TCPIP)) The command completed successfully LSNRCTL> exit
如果你的 DNS 並不傳回指定的主機的 IP 地址,啟動及結朿監聽程式會花一點時間(依據 DNS 2-3 的逾時變數 (timeout variable),大致在 2-3 分鐘之間)。如果真的發生這情況,請耐心等待,不必擔心。
5. 用戶的設定
5.1. 視窗用戶
在 PC 上使用較新版本的 Oracle Client Software 設定 SQL*Net 十分簡單。最佳(也最方便)得到一個運作完全正常的用戶是使用 Oracle 提供的 SQL*Net Easy Configuration 工具。
這工具有一個精靈 (wizard) 的介面,可帶領你設定 tnsnames.ora 及 sqlnet.ora 兩個檔案。
選擇 "Add Database Alias" 及在被問及時打入代號名稱。這代號是你用以指定資料庫的名稱,這應該和資料庫名稱相同(這裡是 orcl)。
在通訊協定 (protocol) 中選擇 TCP/IP,在被問及時回答主機名稱 (machine hosting the database) 及資料庫名稱 (instance name)。
就是這樣了。
不過,即使你沒有 SQL*Net Easy Configuration 工具也不用擔心。你只需在 $ORACLE_HOME/network/admin 目錄中建立和在伺服器中一模一樣的 tnsnames.ora 和 sqlnet.ora 檔。這樣會使你得到相同的別名(這是一個好主意)。
5.2. Unix 用戶
UNIX 用戶和視窗用戶分別不大。如果你有 Oracle 的 Network Manager,做法和以上差不多。沒有的話,再說一次,只需使用和伺服器 $ORACLE_HOME/network/admin 目錄中相同的設定檔。
6. 自動啟動及停止
6.1. dbstart 及 dbstop
Oracle 資料庫的自動啟動及停止可籍 Oracle 提供的 dbstart 及 dbshut 檔達成 (在 7.3.3.0.0 中)。這些檔案又耍依靠 /etc/oratab 存在才能使用(雖然更改 dbshut 和 dbstart 檔可使解除這限制。)
/etc/oratab 檔格式如下:
-
SID:ORACLE_HOME:AUTO
例如
-
orcl:/home/oracle/7.3.3.0.0:Y leaveup:/home/oracle/7.3.2.1.0:N
6.2. init.d 及 rc.d
要在開機關機時自動啟動和結朿資料庫的話,你需要修改 Linux 的啟動命令稿。這並不困難,不過,我需要指出這些改動因應不同的 Linux 發行版本(slackware, debian, redhat 等)而有所不同。我這些例子適用於 Redhat 5.0。要為你所用的 Linux 作出修改,請先參考你手頭上的 Linux 文件。(雖然這實際上應該適用於所有 Sys V UNIX。)
首先,我們要建立會執行 /etc/rc.d/init.d 目錄中 dbshut 及 dbstart 的命令稿。把以下檔案命名為 /etc/rc.d/init.d/oracle:
-
#!/bin/sh # # /etc/rc.d/init.d/oracle # 解說︰啟動及停止 Oracle 資料庫和監聽程式 # 檢查如何執行命令稿 case "$1" in start) echo -n "Starting Oracle Databases: " echo "----------------------------------------------------" >> /var/log/oracle date +"! %T %a %D : Starting Oracle Databases as part of system up." >> /var/log/oracle echo "----------------------------------------------------" >> /var/log/oracle su - oracle -c dbstart >> /var/log/oracle echo "Done." echo -n "Starting Oracle Listeners: " su - oracle -c "lsnrctl start" >> /var/log/oracle echo "Done." echo "" echo "----------------------------------------------------" >> /var/log/oracle date +"! %T %a %D : Finished." >> /var/log/oracle echo "----------------------------------------------------" >> /var/log/oracle touch /var/lock/subsys/oracle ;; stop) echo -n "Shutting Down Oracle Listeners: " echo "----------------------------------------------------" >> /var/log/oracle date +"! %T %a %D : Shutting Down Oracle Databases as part of system down." >> /var/log/oracle echo "----------------------------------------------------" >> /var/log/oracle su - oracle -c "lsnrctl stop" >> /var/log/oracle echo "Done." rm -f /var/lock/subsys/oracle echo -n "Shutting Down Oracle Databases: " su - oracle -c dbshut >> /var/log/oracle echo "Done." echo "" echo "----------------------------------------------------" >> /var/log/oracle date +"! %T %a %D : Finished." >> /var/log/oracle echo "----------------------------------------------------" >> /var/log/oracle ;; restart) echo -n "Restarting Oracle Databases: " echo "----------------------------------------------------" >> /var/log/oracle date +"! %T %a %D : Restarting Oracle Databases as part of system up." >> /var/log/oracle echo "----------------------------------------------------" >> /var/log/oracle su - oracle -c dbstop >> /var/log/oracle su - oracle -c dbstart >> /var/log/oracle echo "Done." echo -n "Restarting Oracle Listeners: " su - oracle -c "lsnrctl stop" >> /var/log/oracle su - oracle -c "lsnrctl start" >> /var/log/oracle echo "Done." echo "" echo "----------------------------------------------------" >> /var/log/oracle date +"! %T %a %D : Finished." >> /var/log/oracle echo "----------------------------------------------------" >> /var/log/oracle touch /var/lock/subsys/oracle ;; *) echo "Usage: oracle {start|stop|restart}" exit 1 esac
不要吝嗇於檢查這個檔案到底有沒有真的正確地啟動和停止系統中的資料庫。請檢查記錄檔(log file),看看有沒有錯誤訊息。
弄妥這命令稿後,我們要在正確的執行等級目錄 (runlevel directories) /etc/rc.d/rcX.d 中建立及刪除符號連結 (symbolic links)。
以下指令確保在執行等級 2, 3 及 4 下會叫出資料庫︰
-
$ ln -s ../init.d/oracle /etc/rc.d/rc2.d/S99oracle $ ln -s ../init.d/oracle /etc/rc.d/rc3.d/S99oracle $ ln -s ../init.d/oracle /etc/rc.d/rc4.d/S99oracle
要在重新啟動時停止資料庫,我們需要以下連結︰
-
$ ln -s ../init.d/oracle /etc/rc.d/rc0.d/K01oracle # 停止 $ ln -s ../init.d/oracle /etc/rc.d/rc6.d/K01oracle # 重新啟動
7. 其他事宜
7.1. Intelligent Agent
如果你需要 Oracle Intelligent Agent,我發現你不需修改任何設定便能執行它。要啟動 IA 的話︰
-
$ lsnrctl dbsnmp_start
要停止 IA︰
-
$ lsnrctl dbsnmp_stop
不會出現任何訊息說明啟動或停止 intelligent agent 是否成功。不過,在用戶端它有對 Enterprise Manager 作出回應,所以我假設它運作正常。
8. 疑難排解
這裡有一些關疑難排解的提示。
8.1. 我不能在 Oracle 7.2.x 中建立資料庫。
Oracle 7.2.x 產品錯誤地假設你想設定平行伺服器 (parallel server)。內置的 init.ora 檔中有以下一句︰
-
# define parallel server (multi-instance) parameters ifile = ora_system:initps.ora
要解決這問題只需把它變為註解︰
-
# define parallel server (multi-instance) parameters #ifile = ora_system:initps.ora
8.2. 7.3.4.x 的 svrmgrl 產生 segmentation fault。
有不少人報告過這問題給我。Gerald Weber [email protected] 解決了它︰
-
Hi Paul, 首先非常感謝你的幫助,不過,你所想到的問題全都和我所遇到的無關。 問題出在於 iBCS 模擬器。 似乎 Oracle 執行了一個目前版本的 iBCS 並不支援的系統設定呼叫 (sysconf-calls)。 請看以下的 trace︰ 7>[22]615 sysconf(34) 7>iBCS2 unsupported sysconf call 34 7>[22]615 sysconf error return linux=-22 -> ibcs=22 Invalid argument> 7>[24]615 sysconf(34) 7>iBCS2 unsupported sysconf call 34 7>[24]615 sysconf error return linux=-22 -> ibcs=22 Invalid argument> 解決方法︰修正 iBCS 源程式碼。使用以下的修正檔︰ --- sysconf.c Sun Apr 19 19:19:15 1998 +++ sysconf.c.ori Sun Apr 19 19:28:45 1998 @@ -60,7 +60,6 @@ #define _SC_JOB_CONTROL 5 #define _SC_SAVED_IDS 6 #define _SC_VERSION 7 -#define _SC_HACK_FOR_ORACLE 34 #define _SC_PAGESIZE 11 @@ -97,11 +96,6 @@ case _SC_SAVED_IDS: { return (1); } - - case _SC_HACK_FOR_ORACLE: { - return (1); - } - case _SC_PAGESIZE: { return PAGE_SIZE;
9. 榮譽
這文件根據 Bob Withers, [email protected] 的一篇文件寫成。其他資料是來自 Georg Rehreld, [email protected] 和 David Mansfield, [email protected] 所寫的文件。
其他的校對工作由 Bob Withers, Mark Watling, [email protected], Peter Sodhi, [email protected] and Greg Hankins, [email protected] 完成。
我要多謝所有參與這篇文件的人的支持及所作出的研究。特別要多謝 Bob Withers 和 Mark Watling 的附加意見及作出的幫忙。