廣告聯播

2008年8月25日 星期一

[DataBase] 更改Oracle XE for Windows 的 HTTP port number?

From: Polin Wei

  Oracle XE (eXpresss Edition) 是一套免費的資料庫管理系統。軟體可以從 這裡來下載

  它的功能和 performance 當然無法和正式的 Oracle 10g Database 相比。但是,當作小型的網頁後端資料庫,已是綽綽有餘。

  Oracle XE 目前已有 for Windows 和 for Linux 兩個平台的版本,而 for Linux 的版本,又分成給 Redhat/Fedora Core 和 SuSE 用的 RPM 版,以及給 Debian 和 Ubuntu 用的 DEB 版。

  只用過 for Windows 版和 RPM 版,雖然安裝好了之後,由於操作界面採用 Web 形式,所以完全相同。但是在安裝的過程中,卻有一點點的差異。RPM 版在安裝完畢後,會出現以下這條訊息,告訴你還有一些東西要設定,其中就包括 HTTP port number。
You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.

  一旦你如以下輸入,我們可以看到第一個問題就是詢問 HTTP port number,當然還有像 SYSTEM/SYS 的密碼設定,還有是否要開機時自動啟動等等:




$ /etc/init.d/oracle-xe configure

Oracle Database 10g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 10g Express
Edition. The following questions will determine whether the database should
be starting upon system boot, the ports it will use, and the passwords that
will be used for database accounts. Press to accept the defaults.

== 下列就是要作修改的設定 ===
Ctrl-C will abort. Specify the HTTP port that will be used for Oracle Application Express [8080]:XXXX
Specify a port that will be used for the database listener [1521]:
Specify a password to be used for database accounts. Note that the same
password will be used for SYS and SYSTEM. Oracle recommends the use of
different passwords for each database account. This can be done after

initial configuration:
Confirm the password:
Do you want Oracle Database 10g Express Edition to be started on boot (y/n) [y]:


Starting Oracle Net Listener...Done
Configuring Database...Done
Starting Oracle Database 10g Express Edition Instance...Done
Installation Completed Successfully.
To access the Database Home Page go to "http://127.0.0.1:8051/apex"


為什麼要更動這個 port number?
  主要的原因是,有很多 HTTP 應用在主機上的 port 80 已經被 web server 使用掉後,第一個想到就是改用 port 8080。這包括 Apache Tomcat,還有很多 Java Servlet Container 都是這樣預設的。所以,除非你的機器已是 production server,不容許安裝一堆奇奇怪怪的東西,否則在 develop system 上 port 8080 已被占用的可能性極高,尤其是 Java server side 應用的開發者。

  接下來,我們要離開 Linux ,來開始我們的 Windows 上的工作。既然無法在安裝時就設定,那麼只好手動來更改了。主要要更動的地方有三個。


第一個步驟:
  到開始功能表中,找到 Oracle Database 10g Express Edition / 執行 SQL 命令行,打開 SQL*Plus。然後在 SQL*Plus 下如以下輸入,xxxx 代表要輸入的 port number,比如 8088:


SQL*Plus: Release 10.2.0.1.0 - Production Copyright (c) 1982, 2005, Oracle. All rights reserved. SQL> connect system as sysdba;

輸入密碼: *****
已連線.

SQL> exec dbms_xdb.sethttpport(8088);

已順利完成 PL/SQL 程序.

SQL>exit



下達 exit 指令後,就會跳出 SQL*Plus 環境了。


第二個步驟:
  先找到你安裝 Oracle XE 的安裝目錄。預設值是 C:\oraclexe。如果你安裝時是接受預設值,那麼打開檔案總管,找到這個目錄下的 C:\oraclexe\app\oracle\product\10.2.0\server 這個目錄,打開來。你會發現在這個目錄下有六個網際網路捷徑:


第三步驟:
  我們要修改的是 Database_homepage 及 Online_help 這兩個網際網路捷徑。當你把滑鼠游標到其中一個時,按下右鍵->打開捷徑選單->選擇內容。打開內容對話方塊時;以Database_homepage 這個網際網路捷徑為例;在網頁文件頁籤中,URL 輸入方塊目前是http://127.0.0.1:8080/apex,請將它改成 http://127.0.0.1:xxxx/apex。這裡的 xxxx 就是剛才你更改的 HTTP port number,比如是 8088。然後按下確定鈕。

  同樣的方法修改 Online_help 網際網路捷徑,這樣就大功告成了。這樣你就可以直接使用開始功能表中的 Oracle Database 10g Express Edition / 移到資料庫首頁就可以跳到你的資料庫管理界面了。


沒有留言:

張貼留言