2008年06月19日
Oracle XE 安裝筆記
說明
官網
| Oracle 數據庫 XE 對安裝到的主機的規模和 CPU 數量不作限制(每台計算機一個數據庫),但 XE 將最多存儲 4GB 的用戶數據(純放資料,並不是指oracle的總大小),最多使用 1GB 內存,並在主機上使用一個 CPU。 官方說明: The maximum database size in Oracle Database XE is 5 gigabytes (GB). This includes between 0.5 and 0.9 GB for the data dictionary, internal schemas, and temporary space, which leaves just over 4.0 GB for user data. |
官網
| http://www.oracle.com/technology/software/products/database/xe/files/install.102/b25144/toc.htm#CIHHJEHF http://download.oracle.com/docs/cd/B25329_01/doc/admin.102/b25610/toc.htm |
安裝前先設定環境變數,因為我的db要用big5,所以需要設定對的nls_lang。不然建立後會是預設值utf8
oracle_sid是固定的,無法變動,路徑也是固定的
| ORACLE_SID=XE;export ORACLE_SID ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server;export ORACLE_HOME PATH=$ORACLE_HOME/bin:$PATH;export PATH NLS_LANG="TRADITIONAL CHINESE_TAIWAN".ZHT16BIG5;export NLS_LANG LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH;export LD_LIBRARY_PATH export NLS_LANGUAGE=zh_TW.BIG5 |
安裝流程
| 1、使用root安裝 [root@trainap tmp]# rpm -ivh oracle-xe-univ-10.2.0.1-1.0.i386.rpm Preparing... ########################################### [100%] 1:oracle-xe-univ ########################################### [100%] Executing Post-install steps... You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database. 起動oracle,也是使用root,依提示輸入必要的條件 [root@trainap /]# cd /etc [root@trainap etc]# cd init.d/ [root@trainap 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 <Enter> to accept the defaults. Ctrl-C will abort. Specify the HTTP port that will be used for Oracle Application Express [8080]:12345 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: Passwords do not match. Enter the password: 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:12345/apex" 起動oracle [root@trainap init.d]# ./oracle-xe start Starting Oracle Database 10g Express Edition Instance. 使用oracle提供的轉換指令,修改字元集 1、先把db重開到mount SQL> startup mount; ORACLE instance started. Total System Global Area 805306368 bytes Fixed Size 1261444 bytes Variable Size 209715324 bytes Database Buffers 591396864 bytes Redo Buffers 2932736 bytes Database mounted. SQL> alter system enable restricted session; System altered. SQL> alter system set JOB_QUEUE_PROCESSES=0; System altered. SQL> alter system set AQ_TM_PROCESSES=0; System altered. SQL> alter database open; Database altered. SQL> alter database character set internal_use ZHT16BIG5; Database altered. SQL> shutdown immediate; Database closed. Database dismounted. startupORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 805306368 bytes Fixed Size 1261444 bytes Variable Size 209715324 bytes Database Buffers 591396864 bytes Redo Buffers 2932736 bytes Database mounted. Database opened. 進行查看字元集是否ok |
安裝完後,有些地方還是要再處理一下,以方便作業
| 1、帳號方面 他會自動建立oracle用戶,但環境變數沒有加入 預設的oracle home是在/usr/lib/oracle/xe 執行 vi .bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin # for oracle xe start ORACLE_SID=XE;export ORACLE_SID ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server;export ORACLE_HOME PATH=$ORACLE_HOME/bin:$PATH;export PATH LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH;export LD_LIBRARY_PATH export LANG=zh_TW.BIG5 NLS_LANG="TRADITIONAL CHINESE_TAIWAN".ZHT16BIG5;export NLS_LANG # oracle xe end export NLS_LANGUAGE=zh_TW.BIG5 export PATH unset USERNAME 2、增加listener.ora (SID_DESC = (GLOBAL_DBNAME = XE) (ORACLE_HOME = /usr/lib/oracle/xe/app/oracle/product/10.2.0/server) (SID_NAME = XE) ) 3、重起 listener,進行測試 4、如要開放web介面讓非本機可登入的話,需要進sqlplus執行下列指令: EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE); 5、redo log 預設2個50m,自行調整成系統所需要的 6、預設是noarchivelog mode 7、archivelog file的存放地方 db_recovery_file_dest /usr/lib/oracle/xe/app/oracle/ 8、flashback的空間預設是10g db_recovery_file_dest_size big integer 10G |
參考資料
http://download.oracle.com/docs/cd/B25329_01/doc/install.102/b25144/toc.htm#BABIFECH
引用URL
http://cgi.blog.roodo.com/trackback/6198547
回應文章 
大感謝呀~~
版主大人的這篇文章救了小小弟一命~~我之前一直裝不起來,原來少了環境變數的設定。
Posted by jaceju
at 2008年06月19日 15:09
Posted by 睡貓
at 2008年06月19日 16:23

請問在 Linux 上跑 Oracle database XE 穩定嗎? 我在 Windows 上有些 web 畫面按第1次不正常, 再按2次才出現正常畫面, 發生機率一天好幾次. 我想如果 Linux 上很少出現這種異常, 就換個平台再試看看.
Posted by stoneku
at 2008年08月1日 16:03

想請問XE的授權只有限制1個cpu和1G ram和4G data,那是否可以把寫好的程式+免費的XE一起打包給客戶做無限制的安裝,不知這樣推論是否正確?謝謝
Posted by 魚
at 2009年11月16日 10:44
to 魚:這個部份我不太能確定,可打電話問一下oracle,以免到時出了問題就麻煩了
但我覺的如只吃1g的ram的db,也許可考慮用mysql,配合hibernate。除非你有很多oracle的pl/sql、trigger不想改寫
Posted by 睡貓
at 2009年11月16日 17:12