1. 程式人生 > >Oracle APEX installation with ORDS

Oracle APEX installation with ORDS

在開始之前,先介紹下Oracle Application Express(APEX)。

Oracle Application Express—APEX for short, or by its former name HTML DB — is a declarativeWeb-based RAD (Rapid Application development) tool. It is used to develop native Web-based, data centric applications. It requires no software to install on the client.

自2004年開始,Oracle已經開始這一款產品的開發,現在已升級到5.0。細心的人估計以前注意到,Oracle11g中自帶了APEX開頭的賬戶,它們是APEX內建schema, 並且已經繫結到Oracle安裝中。也就是說,在你買了Oracle資料庫情況下,不要額外的License,就可以放心使用APEX。

出了免費外,它的優勢很明顯,

1,一切基於web, 架構在Oracle 資料庫上, 獨立於軟硬體環境

2,快速開發,極大縮短開發週期,支援html,css, javascript

2,相比OBIEE,SAPBO這樣重量級BI報表工具,它更加靈活,可以作為輕量級的BI解決方案

說了那麼多廢話,開始幹正事,準備安裝!

1,建立資料庫環境, 建立兩個表空間, 用於安裝APEX, 以便日後的管理。

CREATE TABLESPACE APEX datafile‘/u01/app/oracle/oradata/APEX/apex.dbf’

SIZE 500M

EXTENT MANAGEMENT LOCAL

SEGMENT SPACE MANAGEMENT AUTO;

CREATE TABLESPACE APEX_FILES datafile‘/u01/app/oracle/oradata/APEX/apex_files.dbf’

SIZE 500M

EXTENT MANAGEMENT LOCAL

SEGMENT SPACE MANAGEMENT AUTO;


2,下載解壓APEX 安裝包, 具體下載地址

http://www.oracle.com/technetwork/developer-tools/apex/overview/index.html

3, 解壓完後, 切換到解壓後的目錄,並以sys登陸資料庫。 這一步目錄切換很重要,在APEX安裝過程中, 路徑用的是相對路徑,如果開始沒切換目錄的話, 過程中, 會報檔案找不到的錯誤

4, 安裝APEX, 命令如下

Full development environment. Run apexins.sql passingthe following four arguments in the order shown:

@apexins.sqltablespace_apex tablespace_files tablespace_tempimages

Where:

  • tablespace_apex is the name of the tablespace for the Oracle Application Express application user.
  • tablespace_files is the name of the tablespace for the Oracle Application Express files user.
  • tablespace_temp is the name of the temporary tablespace or tablespace group.
  • images is the virtual directory for Oracle Application Express images. To support future Oracle Application Express upgrades, define the virtual image directory as /i/.

      我採用的是開發環境的安裝, 當然,在產品環境,可以選擇Runtime environment 模式安裝, sql 指令碼換成 @apxrtins.sql

      之前建立的兩個表空間將tablespace_apex, tablespace_files 替換如下: 

                      @apexins.sqlAPEX APEX_FILES TEMP /i/

     

這一步會花一段時間安裝完如果一切安裝順利的話, 就會出現和截圖一樣

當安裝完後, 一下三個schema 會被建立,有空的話,可以檢視驗證下

■ APEX_050000 - The account that owns the Oracle Application Express schema and
metadata.
■ FLOWS_FILES - The account that owns the Oracle Application Express uploaded
files.
■ APEX_PUBLIC_USER - The minimally privileged account is used for Oracle
Application Express configuration with Oracle REST Data Services or Oracle
HTTP Server and mod_plsql.

5, 執行apxchpwd.sql,  它的作用如下, 就是設定APEX的超級管理員。 執行完後, 重啟資料庫。

Running the apxchpwd.sql script enables your to create or update your Instance
Administrator account. You must run the apxchpwd.sql script in the following
scenarios:
■ New Oracle Application Express installations - Run apxchpwd.sql to create an
Instance Administrator account and password.
■ Converting of a runtime environment to a development environment - Run
apxchpwd.sql to change the Instance Administrator account password.
■ Changing Your Instance Administrator Password -Run apxchpwd.sql to change
the password for an existing Instance Administrator account.
■ Unlocking Your Instance Administrator Account - Run apxchpwd.sql to unlock
an existing Instance Administrator account.

  6,   設定APEX_PUBLIC_USER, 為了下面配置ORDS 用

解鎖

SQL>ALTER USER APEX_PUBLIC_USER ACCOUNT UNLOCK

重置密碼

SQL>alter user apex_public_user identified by apex_public_user

7, 安裝配置Oracle Rest Data Services(ORDS)

     下載地址:http://www.oracle.com/technetwork/developer-tools/rest-data-services/downloads/
index.html

      下載完後, 解壓指定好的安裝目錄。 解壓完後, 你可以發現ORDS這個就是個war包

   7.1 Disabling Oracle XML DB Protocol Server

SQL>EXEC DBMS_XDB.SETHTTPPORT(0);

SQL>

    7.2  configure RESTful Services in Oracle Application Express

           SQL>@apex_rest_config.sql

When configuring RESTful Services in OracleApplication Express, it creates two

new database accounts.

■ APEX_LISTENER - The account used to query RESTfulServices definitions

stored in Oracle Application Express.

■ APEX_REST_PUBLIC_USER - The account used whencalling RESTful Services

definitions stored in Oracle Application Express.

SQL>@apex_rest_config.sql

Entera password for the APEX_LISTENER user              []

Entera password for the APEX_REST_PUBLIC_USER user              []

...createAPEX_LISTENER user

...createAPEX_REST_PUBLIC_USER user

SQL>

SQL>

     7.3 Granting Connect Privileges, 這一步是賦連線的許可權給web 主機, 使它能能夠與ORDS進行連線

SQL>

SQL>DECLARE

  2 ACL_PATH VARCHAR2(4000);

  3 BEGIN

  4  --Look for the ACL currently assigned to '*' and give APEX_050000

  5  --the "connect" privilege if APEX_050000 does not have the privilegeyet.

  6 SELECT ACL INTO ACL_PATH FROM DBA_NETWORK_ACLS

  7 WHERE HOST = '*' AND LOWER_PORT IS NULL AND UPPER_PORT IS NULL;

  8  IFDBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE(ACL_PATH, 'APEX_050000',

  9 'connect') IS NULL THEN

 10 DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,

 11 'APEX_050000', TRUE, 'connect');

 12  ENDIF;

 13 EXCEPTION

 14  --When no ACL has been assigned to '*'.

 15  WHENNO_DATA_FOUND THEN

 16 DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('power_users.xml',

 17  'ACLthat lets power users to connect to everywhere',

 18 'APEX_050000', TRUE, 'connect');

 19 DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('power_users.xml','*');

 20  END;

 21  /

COMMIT;

SQL>SQL> 


      7.3 Configuring Oracle Application Express Images

Copy the contents ofthe <apex directory>/images folder to <Tomcatdirectory>/webapps/i/.

Where:

–<apexdirectory> is the directory location of the Oracle Application Expressdistribution.

–<Tomcatdirectory> is the folder where Apache Tomcat is installed.

    7.4 Configuring Oracle REST Data Services

  a,  copyords.war from ordspackage to tomcat webapps directory.

      b, configure REST DATA Services

           cd ../<tomcatdirecotory>/webapps

drwxrwxrwx 14 oracleoinstall     4096 Mar 27 14:04 docs

drwxrwxrwx  7 oracle oinstall     4096 Mar 27 14:04 examples

drwxrwxrwx  5 oracle oinstall     4096 Mar 27 14:04 host-manager

drwxrwxrwx 33 oracleoinstall    40960 May 11 02:56 i

drwxrwxrwx  5 oracle oinstall     4096 Mar 27 14:04 manager

-rw-r--r--  1 oracle oinstall 28491706 May 11 20:17ords.war

drwxrwxrwx  3 oracle oinstall     4096 Mar 27 14:04 ROOT

7.5 配置ORDS連線

[[email protected]]$ java -jar ords.war setup

Jun 09, 201512:26:03 AM oracle.dbtools.common.config.file.ConfigurationFolderlogConfigFolder

INFO: Usingconfiguration folder: /tmp/apex

Enter the name ofthe database server [localhost]:

Enter the databaselisten port [1521]:

Enter 1 to specifythe database service name, or 2 to specify the database SID [1]:2          

Enter the databaseSID [xe]:yang01

Enter the databaseuser name [APEX_PUBLIC_USER]:apex_public_user

Enter the databasepassword for apex_public_user:

Confirm password:

Enter 1 to enterpasswords for the RESTful Services database users(APEX_LISTENER,APEX_REST_PUBLIC_USER), 2 to use the same password as used forapex_public_user or, 3 to skip this step [1]:

Enter the databasepassword for APEX_LISTENER:

Confirm password:

Enter the databasepassword for APEX_REST_PUBLIC_USER:

Confirm password:

Jun 09, 201512:27:19 AM oracle.dbtools.common.config.file.ConfigurationFiles update

INFO: Updatedconfigurations: defaults, apex, apex_al, apex_rt

[[email protected]]$

啟用Tomcat訪問報錯,已經檢查過,apex3個數據賬號並沒有問題。

查了好久,注意到了頁面這一行字,此例項使用……, 與上面配置預設給的路徑

INFO: Using configuration folder: /tmp/apex,並不是一個路徑。


既然這樣,只能指定一個路徑專門放配置資訊

[[email protected]]$ java -jar ords.war configdir

Jun 09, 201512:55:30 AM oracle.dbtools.common.config.cmds.ConfigDir execute

INFO: The config.dirsetting is not set

[[email protected]]$ java -jar ords.war configdir/u01/app/apache-tomcat-7.0.61/webapps/ordsconfig

Jun 09, 2015 1:01:57AM oracle.dbtools.common.config.cmds.ConfigDir execute

INFO: Set config.dirto /u01/app/apache-tomcat-7.0.61/webapps/ordsconfig in:/u01/app/apache-tomcat-7.0.61/webapps/ords.war

配置完路徑後,重新配置ORDS

[[email protected]]$ java -jar ords.war setup

Jun 09, 2015 1:03:05AM oracle.dbtools.common.config.file.ConfigurationFolder logConfigFolder

INFO: Usingconfiguration folder: /u01/app/apache-tomcat-7.0.61/webapps/ordsconfig/ords

Enter the name ofthe database server [localhost]:

Enter the databaselisten port [1521]:

Enter 1 to specifythe database service name, or 2 to specify the database SID [1]:2

Enter the databaseSID [xe]:yang01

Enter the databaseuser name [APEX_PUBLIC_USER]:apex_public_user

Enter the databasepassword for apex_public_user:

Confirm password:

Enter 1 to enterpasswords for the RESTful Services database users(APEX_LISTENER,APEX_REST_PUBLIC_USER), 2 to use the same password as used forapex_public_user or, 3 to skip this step [1]:

Enter the databasepassword for APEX_LISTENER:

Confirm password:

Enter the databasepassword for APEX_REST_PUBLIC_USER:

Confirm password:

Jun 09, 2015 1:03:59AM oracle.dbtools.common.config.file.ConfigurationFiles update

INFO: Updatedconfigurations: defaults, apex, apex_al, apex_rt

[[email protected]]$ ll

total 27924

drwxrwxrwx 14 oracleoinstall     4096 Mar 27 14:04 docs

drwxrwxrwx  7 oracle oinstall     4096 Mar 27 14:04 examples

drwxrwxrwx  5 oracle oinstall     4096 Mar 27 14:04 host-manager

drwxrwxrwx 33 oracleoinstall    40960 May 11 02:56 i

drwxrwxrwx  5 oracle oinstall     4096 Mar 27 14:04 manager

drwxr-xr-x  6 oracle oinstall     4096 Jun 9 01:02 ords

drwxr-xr-x  3 oracle oinstall     4096 Jun 9 01:02 ordsconfig

-rw-r--r--  1 oracle oinstall 28491732 Jun  9 01:02 ords.war

drwxrwxrwx  3 oracle oinstall     4096 Mar 27 14:04 ROOT

重啟tomcat大功告成!

倒騰了這麼久, 給大家展示下介面,以及它的一個示例應用。 真心推薦大家研究並使用這個工具,很不錯~


相關推薦

Oracle APEX installation with ORDS

在開始之前,先介紹下Oracle Application Express(APEX)。 Oracle Application Express—APEX for short, or by its former name HTML DB — is a declarative, 

Oracle APEX 5.1 with Ords 17 in Tomcat 9–Error tips: 請求無法映射到任何數據庫。請確保請求 URL 正確, 並且已正確配置 URL 到數據庫的映射

開機 oracle round error das pex wid rac isp 一次意外關機引發的血案 1、重新開機打開 tomcat 9, 一切正常 2、打開 ords,異常報錯: 404 Not Found 請求無法映射到任何數據庫。請確保請求 URL 正確

Oracle Apex 有用筆記系列 6 - 可編輯交互報告 Editable Interactive Report

gin where 表格 報告 查詢 查詢語句 item 提醒 lis 據筆者所知。Apex 4.x 是沒有提供可編輯交互報告組件的。這就須要我們手動實現。事實上這也並非非常復雜,僅僅須要簡單幾步。 1. 依據向導建立一個interactive report。查詢語句能

oracle 的 start with connect by prior 學習

哪些 num 例子 value 開始 一個 分享 語法 節點 語法: SELECT ... FROM + 表名 START WITH + 條件1 CONNECT BY PRIOR + 條件2 WHERE + 條件3

oracle的start with connect by prior如何使用

SQ font 過濾 圖片 acl http nec con IT oracle的start with connect by prior是根據條件遞歸查詢"樹",分為四種使用情況: 第一種:start with 子節點ID=‘...‘ connect by prior 子節

oracle中 start with .. connect by prior.. 用法簡介

bsp 簡單 parent 目錄樹 lena prior conn 就是 比較 我們經常會將一個比較復雜的目錄樹存儲到一個表中。或者將一些部門存儲到一個表中,而這些部門互相有隸屬關系。這個時候你就會用到connect by prior start with。oracle 提

oracle 中start with 的用法

oracle 提供了start wit h c onnect by 語法結構可以實現遞迴查詢。 1. 一個簡單舉例: SQL> select *   from test; BILL_MONTH      &

oracle遞迴with

簡介 基本語法 結果集順序 與connect相關語法的等效替換 LEVEL CONNECT_B

Oracle的start with connect by prior 遞迴查詢

這個子句主要是用於B樹結構型別的資料遞迴查詢,給出B樹結構型別中的任意一個結點,遍歷其最終父結點或者子結點。 建立測試表: create table a_test ( parentid varchar2(10), subid varchar2(10)); in

oracle 多個with as

今天去面試,遇到一個問題。 題目是這樣的: 表1: SQL> select * from tb_data; ID CODE1 CODE2 ---------- ---------- ---------- 1

mysql的逆襲:如何做oracle的start with connect by prior遞迴層次查詢

mysql的逆襲:如何做遞迴層次查詢   最近在做一個從oracle資料庫到mysql資料庫的移植,遇到一個這樣的問題        在Oracle 中我們知道有一個 Hierarchical Queries 通過CONNECT BY

oracle中start with和connect by的用法理解

 1.樹結構的描述     樹結構的資料存放在表中,資料之間的層次關係即父子關係,通過表中的列與列間的關係來描述,如EMP表中的EMPNO和MGR,EMPNO表示該僱員的編號,MGR表示領導該僱員的人的編號,即子節點的MGR值等於父節點的EMPNO值。在表的每一行中都有一個表示父節點的MGR(除根節點外),通

oracle中用start with...connect by prior子句實現遞迴查詢[例子不錯]

  今天在做許可權這一塊,碰到要讀取oracle中的樹形結構,所以就用到了start with...connect by prior。所以留個腳印以後碰到可以看看。   在oracle中的select語句可以用start with...connect by prior

Oracle Apex 5.0安裝教程

1- The installation requiresBefore installing  Oracle Application Express (Oracle APEX) you need to:Install Oracle Database (10g, 11g or 1

oracle 臨時表 with as 寫法

專案中早些時間,有個oracle查詢語句寫的極其複雜,因為資料量小的關係,當時也並沒有怎麼在意,回來隨著時間過去,客戶資料庫數量越來越大,那段語句的劣性就體現的非常明顯。優化時,發現查詢關係邏輯混亂又複雜(雖然資料查詢

Oracle APEX 系列文章3:在阿里雲上打造屬於你自己的APEX完整開發環境 (安裝CentOS, Tomcat, Nginx)

引言 在這一章節裡,我們將一起動手安裝CentOS 7作業系統、Tomcat以及Nginx,併為後面的安裝做一些初始化設定。 安裝配置CentOS 7 在阿里雲控制檯購買並啟動CentOS 之前說過,我們選擇阿里雲作為雲提供商。註冊

Oracle APEX 系列文章11:全站啟用 HTTPS,讓你的 APEX 更安全

引言 目前主流的網站都要求 HTTPS 安全訪問,Google Chrome 瀏覽器、微信內建瀏覽器開啟非 HTTPS 的網頁,都會提示不安全。如果做微信端開發,也是必須要 HTTPS 的網址才可以,可見 HTTPS 越來越重要了。 如果你按照鋼

Oracle用Start with...Connect By子句遞迴查詢

ORACLE 提供了一個有趣的功能 connect by 子句,它可以對具有家族樹結構的分枝進行排序。它的用途有機構或公司的各層結構,財務的科目程式碼等。 要使用查詢遍歷,需要在將資料在基表中按照層次結構進行儲存。比如一個組織機構就是這樣的典型例子。 實現語句:SELECT

oracle 的start with connect by prior 的用法

1.   select sys_connect_by_path(t.dept_id,'/') from syc_smg_dpt t start with t.dept_id='RT_DISTRICT_JN_01' connect by prior dept_id = par

Oracle APEX 系列文章13:Oracle APEX 入門基礎資料整理

引言 經常有剛剛接觸 Oracle APEX 的同學,在初步瞭解了 Oracle APEX 後,想自己動手試一試,但卻找不到比較好的入門教程。其實網上有很多,比如 Oracle Learning Library,或者 Youtube 上都有,問的人多了,索