2010-08-31

Ubuntu Linux server 10.04 上安裝 Oracle APEX 4.0.1

Ubuntu Linux server + Oracle APEX

Ubuntu telnet port 23 預設不開放 , 需使用 SSH telnet port 22(PuTTY or PieTTY)

如果Server環境無法連Internet , 則建立 proxy 讓 apt-get 可由Internet安裝及更新程式.
  • Proxy server
    • 申請proxy to internet服務
    • 或-自行安裝 freeproxy for Windows
  • edit Ubuntu /etc/apt/apt.conf
    • cd /etc/apt
    • sudo vim apt.conf
      • press INS key
      • Acquire::Http::Proxy "http://serverxx:x8080";
      • ESC :wq
  • sudo apt-get update <=執行看是否可成功自 Internet 取得資料更新

放大 swap file for Oracle-XE
  • $ cd /
  • $ sudo mkdir swap
  • $ cd /swap
  • $ sudo dd if=/dev/zero of=swapfile bs=1024 count=1048000
  • $ sudo mkswap /swap/swapfile
  • $ sudo swapon /swap/swapfile
To activate /swap/swapfile after Linux system reboot, add entry to /etc/fstab file. Open this file using text editor such as vi:
  • $ sudo vim /etc/fstab
Append following line:
/swap/swapfile swap swap defaults 0 0
So next time Linux comes up after reboot, it enables the new swap file for you automatically.
verify swap is activated or not? Simply use free command:
  • $ free -m

Install FTP daemon
  • $ sudo apt-get install vsftpd
  • $ sudo vim /etc/vsftpd.conf <= 需修改後才能 upload
    • write_enable=YES
    • local_umask=022
  • $ sudo /etc/init.d/vsftpd restart
  • $ netstat -tul|grep ftp <= check ftp status

Install Oracle 10g XE

修改 /etc/oratab
  • $ vim /etc/oratab
找到你的SID,将该行最后的N改为Y

安裝成功之後,還需要在設置相關的環境變量。
編輯 /etc/environment,添加如下幾行:
  • ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
  • LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
  • TNS_ADMIN=/usr/lib/oracle
  • PATH=$PATH:$ORACLE_HOME
編輯 /etc/profile,添加如下幾行:
  • PATH=$PATH:$ORACLE_HOME/bin
  • export PATH

Expand disk space on Ubuntu 10.04 (VMWare Guest) link

存檔後執行 $ source /etc/environment

  • $ dpkg -l|grep oracle <= debiean package list & filter
  • $ dpkg -r oracle-xe-universal <= remove package

Uninstall Oracle-Xe 包含 configre file
  • $ apt-get remove --purge oracle-xe-universal

  • $ sudo -i <= switch to root
  • $ sudo reboot

  • $ df <= 目錄使用率
  • $ sudo du -hs <== check 目錄檔案size
  • $ mount <== 查看 mount device
  • $ more /etc/fstab <== The contains descriptions of filesystems that you mount often

Making Oracle Database XE Server Available to Remote Clients
  1. Click the Application menu (on Gnome) or the K menu (on KDE), then point to Oracle Database 10g Express Edition, and then Go To Database Home Page.
  2. In the Database Login page, log in as SYSTEM, enter the password, and then click Login.
  3. In the Oracle Database XE home page, click Administration.
  4. Under Tasks, click Manage HTTP Access.
  5. Under Manage HTTP Access, select Available from local server and remote clients.
  6. Click Apply Changes.

export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server

安裝 x-window desktop management GUI
  • apt-get install x-window-system-core <= 安裝 X windows系統
  • sudo apt-get install gdm <= 安裝 GNOME desktop
  • sudo /etc/init.d/gdm start <= 啟動 GNOME desktop (只在Console看得到)

  • $ /etc/init.d/oracle-xe start
  • $ /etc/init.d/oracle-xe status
  • $ $ORACLE_HOME/bin/sqlplus / as sysdba
    • Enter user-name: SYS as sysdba
    • Enter password:
  • SQL> shutdown abort
    • ORACLE instance shut down.
  • SQL> startup
    • ORACLE instance started.

  • /etc/profile: 系統 all users 設置環境信息,當用戶第一次登錄時,該文件被執行.並從/etc/profile.d目錄的配置文件中蒐集shell的設置.
  • /etc/bashrc:為每一個運行bash shell的用戶執行此文件.當bash shell被打開時,該文件被讀取.
  • ~/.bash_profile:user專用於自己使用的shell信息,當用戶登錄時執行一次.
  • ~/.bashrc:user bash shell的bash信息,當登錄時以及每次打開新的shell時,該文件被讀取.
  • ~/.bash_logout:當每次退出系統(退出bash shell)時,執行該文件.
另外,/etc/profile中設定的變量(全局)的可以作用於任何用戶,而~/.bashrc等中設定的變量(局部)只能繼承/etc/profile中的變量,他們是"父子"關係.
  • ~/.bash_profile 是交互式、login 方式進入 bash 運行的
  • ~/.bashrc 是交互式 non-login 方式進入 bash 運行的
通常二者設置大致相同,所以通常前者會調用後者。

APEX 4.0 升級完畢, 建立 schema XOZ 後, 需使用 sysdba 授權才能建 database link
  • Grant create database link to XOZ ;
自我檢查權限
  • select user from dual ;
  • select * from user_role_privs;
  • select * from user_sys_privs;

重裝 Oracle XE with APEX 2.1 , 再 upgrade to APEX 4.0.1
Remove Oracle-XE
  • $ dpkg --list|grep oracle <= 查詢安裝套件名稱
  • $ sudo dpkg --remove oracle-xe-universal
  • $ sudo vim /etc/oratab <=將XE整行delete
Intsall Oracle-XE/APEX2.1
  • $ sudo dpkg -i --force-architecture oracle-xe-universal_10.2.0.1-1.0_i386.deb
  • $ sudo /etc/init.d/oracle-xe configure
    • port: 8080 <=建議勿更動
    • pwd for SYS and SYSTEM
  • $ vim /etc/oratab <=find你的SID,将该行最后的N改为Y
Upgrade APEX 4.0.1
  • ftp & unzip to /home/somebody/apex401/apex
  • cd /home/somebody/apex401/apex
  • Run SQLPLUS
    • SYS as sysdba
    • $passwd$
  • sql> @owa/owainst.sql <= run upgrate sql owa to 10.1.2.0.6
  • sql> @apexins.sql SYSAUX SYSAUX TEMP /i/ <= run update sql
  • Run sqlplus
  • sql> @apxldimg.sql /home/somebody/apex401 <=run sql for images
  • sql> @apxchpwd.sql <= run sql for initial ADMIN password

Starting use APEX 4.0.1
  • Create Workspace 'XO'
    • schema: ozdb/....
    • admin: ADMIN/....
  • Use SQLPLUS logon as SYSDBA
  • SQL> grant create database link to ozdb; <=允許 schema ozdb 權限
TEST APEX 4.0.1 OK

* SQL> alter system set job_queue_processes=20; <= minimum 20 * SQL> alter system set shared_servers=5 scope=both;

PL/SQL API for LDAP ( DBMS_LDAP package )
* load the DBMS_LDAP package:
** SQL> CONNECT / AS SYSDBA
** SQL> @?/rdbms/admin/catldap.sql

Oracle Application Express / APEX 4.0.1

Oracle Application Express official web site link APEX官網

apex.oracle.com link APEX 試用平台