THE WORLD DISCUSSES #PYTHIAN ON TWITTER. HAVE A QUESTION? USE OUR HASHTAG AND ASK AWAY.

Installing APEX on Oracle 10gR2 on Mac OS X Leopard (Intel)

Few days ago, I have put together the Quick Install Guide for Oracle 10g Release 2 on Mac OS X Leopard (Intel). I did mention that it would be cool to get APEX working as well but, apparently, APEX isn’t supposed to be running on Oracle 10g Release 2 Database on OS X as few people pointed our on the blogs.

Well, the release notes says that Oracle Application Express is not supported and I would imagine that it’s because Oracle HTTP Server is not supported either. I’m not a frequent user of APEX but I know that APEX 3.2 is not supposed to be configured in Oracle 10g Database using Embedded PL/SQL Gateway. However, looks like few people did manage to run APEX on 10g using Embedded PL/SQL Gateway. For example, Jeff Kemp has some APEX on 10g hints that I perused.

Long story short, I was able to install APEX successfully using the native Mac OS X Oracle 10g Database and here is how…

Basically, you want to follow the standard documentation and skip one 11g step but include one trick that I took from comments to the Jeff Kemp blog I mentioned.

  1. Download APEX installation archive. Unzip it (Oracle database home seems to be a good location). All scripts are then run from that unzipped apex directory.
  2. Identify or create a tablespace for APEX (or two to separate the framework and applications). I created APEX tablespace.
  3. Install APEX framework schemas in the database — @apexins APEX APEX TEMP /i/.
  4. Reset ADMIN password — @apxchpwd
  5. Next is the trick — remove some security on XDB, which is not a good thing, by the way, but I can live with it on my development box that’s available on localhost only:
    Update 2-Jul-09: If you still have troubles, see this post from Scott Spendolini.
    Update 7-Jul-09: If you get an error “Maximum number (%s) of ‘%s’ XML node elements exceeded”, see this comment and say a good word about Tim Hall.

    DECLARE
    configxml XMLType;
    configxml2 XMLType;
    BEGIN
    -- Get the current configuration
    configxml := DBMS_XDB.cfg_get();
    
    -- Modify the configuration
    SELECT INSERTCHILDXML(
    configxml,
    '/xdbconfig/sysconfig/protocolconfig/httpconfig',
    'allow-repository-anonymous-access',
    XMLType('<allow-repository-anonymous-access xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">true</allow-repository-anonymous-access>'),
    'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"')
    INTO configxml2 FROM DUAL;
    -- Update the configuration to use the modified version
    DBMS_XDB.cfg_update(configxml2);
    END;
    /
  6. Now it’s time to configure the Embedded PL/SQL Gateway — @apex_epg_config.sql /Volumes/HD2/oracle/product/10.2.0/db_1. Note that it’s actually the location where you unzipped APEX with images (see comment #17 from hourus. If you follow my instructions in step 1 to the letter — it would be you Oracle database home.
  7. Enabling Oracle XML DB HTTP Server, shared servers and unlocking ANONYMOUS user :
    call dbms_xdb.setHttpPort(8080);
    alter system set shared_servers = 5;
    alter system register;
    alter user anonymous account unlock;

    Verify enabled Oracle XML DB HTTP Server by using lsnrctl status:

      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=macbook)(PORT=8080))(Presentation=HTTP)(Session=RAW))
  8. (Optional) I think I ran the wrong script during the initial installation and installed only run-time environment so after hitting error “ERR-1014″ I had to run @apxdvins to fix it. That actually took 13+ minutes so I must have initially installed only the run-time environment by running @apxrtins APEX APEX TEMP /i/ instead of @apexins APEX APEX TEMP /i/

Now navigate your browser http://localhost:8080/apex and viola:

Oracle APEX on Mac OS X

Oracle APEX on Mac OS X

Obviously, you won’t host your production environment this way and I think it should be possible to hook APEX up via external Apache Server on OS X.

41 Responses

  1. Scott says:

    Alex,

    Thanks so much for this post! I didn’t realize that EPG was part of 10g on Mac OS X, as they seemed to have stripped most of the other stuff out.

    One question re: your steps:

    When I run step 6, I get the following error:

    ERROR at line 1:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00210: expected ‘<’ instead of ‘t’
    Error at line 1
    ORA-06512: at “SYS.XMLTYPE”, line 301
    ORA-06512: at line 1
    ORA-06512: at line 6

    Any thoughts?

    Thanks!

    - Scott -

  2. My bad — I forgot to use HTML codes for < and < symbols and tags got stripped off.

    Step 5 has been fixed now. Can you try again and let me know?

  3. Darko says:

    SQL>@apex_epg_config D:\download\Apex\Stage3.2

    (directory with apex images is:
    D:\download\Apex\Stage3.2\apex\images)
    Scott, please check directory that is submitted to apex_epg_config….

  4. RSG_Shyam says:

    Hi..,
    I want to install oracle database 10.2 on mac os server 10.5.5.
    I tried it but not succeeded. some times, it give DYLD_Library path not found/image not found. While I configured well the oracle home.

    I took help from your documents as well as Reimonds’s installation documents published at oracle site.

    After login through root I found xclock command runs well but when I login through oracle xclock does not run.

    Can you suggest what is the problem ??

    For your reference, kindly visit this blog and see all the correspondence between me and Raimonds.
    http://blog.rayapps.com/2009/04/12/how-to-install-oracle-database-10g-on-mac-os-x-intel/

    Regards,
    Shyam

  5. RSG_Shyam, please see the another relevant thread on the blog where you posted this comment.

  6. Lori Olson says:

    So, if this step fails:

    Verify enabled Oracle XML DB HTTP Server by using lsnrctl status:

    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=macbook)(PORT=8080))(Presentation=HTTP)(Session=RAW))

    How do you troubleshoot it? I see only this:

    Listening Endpoints Summary…
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))

  7. Hm… good question..
    1. Check if that port is not used already.
    2. Check listener log file.
    3. Try to enable listener trace.

    Actually, does listener dynamic registration work? Do you see services are registered with listener? Maybe you can set local_listener=localhost.

  8. Lori Olson says:

    The port is not used… now. I sometimes run Tomcat there, so I changed the port to 8090 like this:

    call dbms_xdb.setHttpPort(8090);

    Listen log looks like:

    TNSLSNR for MacOS X Server: Version 10.2.0.4.0 – Production on 14-MAY-2009 20:57:19

    Copyright (c) 1991, 2007, Oracle. All rights reserved.

    System parameter file is /Users/oracle/oracle/product/10.2.0/db_1/network/admin/listener.ora
    Log messages written to /Users/oracle/oracle/product/10.2.0/db_1/network/log/listener.log
    Trace information written to /Users/oracle/oracle/product/10.2.0/db_1/network/trace/listener.trc
    Trace level is currently 0

    Started with pid=17141
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC2)))
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))

    TIMESTAMP * CONNECT DATA [* PROTOCOL INFO] * EVENT [* SID] * RETURN CODE
    WARNING: Subscription for node down event still pending
    14-MAY-2009 20:57:19 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=draco.local)(USER=oracle))(COMMAND=status)(ARGUMENTS=64)(SERVICE=LISTENER)(VERSI
    ON=169870336)) * status * 0

    Trace level is 0. Looking at how to enable tracing now.

  9. Lori,

    lsnrct trace [user|admin|support]

    “user: is probably enough. Even without trace, I don’t see dynamic registration in your log file – ALTER SYSTEM REGISTER should produce an entry there as I recall. If not, you need to set local_listener.

    Paste full output from “lsnrctl status” – you could see there is services are registered or have only static registration (if any).

  10. Carlos says:

    Keep asking for XDB username and password…

  11. Carlos says:

    After a reboot works, for now…
    Thx

  12. @Carlos: I recall step #5 is the one fixing this issue if I understood your problem correctly.

  13. [...] happened to run across this article on Installing APEX on Oracle 10gR2 on Mac OS X Leopard (Intel) and wanted to share with all of the Oracle and, more importantly, Mac lovers out there. This [...]

  14. hourus says:

    Hi Alex, i´m having several issues while running @apexins.

    one of the errors is:
    declare
    *
    ERROR at line 1:
    ORA-04063: package body “APEX_030200.WWV_FLOW_API” has errors
    ORA-06508: PL/SQL: could not find program unit being called:
    “APEX_030200.WWV_FLOW_API”
    ORA-06512: at line 5

  15. hourus says:

    ok managed to get that error corrected but on step 6 i get this

    SQL> @apex_epg_config.sql /Users/oracle/product/10.2.0/db_1/

    PL/SQL procedure successfully completed.

    PL/SQL procedure successfully completed.

    Directory created.

    declare
    *
    ERROR at line 1:
    ORA-22288: file or LOB operation FILEOPEN failed
    No such file or directory
    ORA-06512: at “SYS.DBMS_LOB”, line 523
    ORA-06512: at “SYS.XMLTYPE”, line 287
    ORA-06512: at line 18

    Commit complete.

    PL/SQL procedure successfully completed.

    PL/SQL procedure successfully completed.

    timing for: Load Images
    Elapsed: 00:00:00.06

    Session altered.

    PL/SQL procedure successfully completed.

    Commit complete.

    Session altered.

    Directory dropped.

  16. hourus says:

    apex doesn´t start listener doesn´t register http server

  17. hourus says:

    ok got it working all right, had to change some stuff didn´t exactly work out of the box with the steps here, so for me this worked:

    step 5:
    http://spendolini.blogspot.com/2009/04/apex-on-mac-os-x-update.html
    but i fired up nano on the terminal and put the xml line with the true attribute in one line had to remove whitespaces though

    step 6:
    didn´t pass $ORACLE_HOME into it, as per documentation passed images dir where i unzipped apex that should be my oracle user home directory where i also unzipped oracle db

  18. Thanks mate. Updated steps 5 & 6.

  19. Hourus says:

    Just a side note when you issue lsntcrl status IT doesn’t show xdb pointer straight away give IT a few seconds but IT will show up then you can access apex

  20. @Hourus: I thought ALETER SYSTEM REGISTER; is what speeds it up otherwise might take a minute or so.

  21. fons says:

    Hi,
    On step 5 I keep getting this error:
    What can I do to solve this?

    Error report:
    ORA-30936: Maximum aantal (1) allow-repository-anonymous-access XML-node-elementen overschreden
    ORA-06512: in regel 8
    30936. 00000 – “Maximum number (%s) of ‘%s’ XML node elements exceeded”
    *Cause: An attempt was made to insert more than the allowed number
    of elements (specified by the maxoccurs facet) into an XML
    document.
    *Action: Do not attempt to add more than the maximum number of elements
    to XML documents.

  22. @fons: I think that it’s either enabled already and you can skip it or it’s disabled implicitly so you need to change this element instead of disabling it. Thanks for my good friend Tim Hall for this post that contains this code you can use:

    CONN sys/password AS SYSDBA
    
    SET SERVEROUTPUT ON
    DECLARE
      l_configxml XMLTYPE;
      l_value     VARCHAR2(5) := 'true'; -- (true/false)
    BEGIN
      l_configxml := DBMS_XDB.cfg_get();
    
      IF l_configxml.existsNode('/xdbconfig/sysconfig/protocolconfig/httpconfig/allow-repository-anonymous-access') = 0 THEN
        -- Add missing element.
        SELECT insertChildXML
               (
                 l_configxml,
           	     '/xdbconfig/sysconfig/protocolconfig/httpconfig',
           	     'allow-repository-anonymous-access',
           	     XMLType('' ||
           	              l_value ||
           	             ''),
           	     'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
           	   )
        INTO   l_configxml
        FROM   dual;
    
        DBMS_OUTPUT.put_line('Element inserted.');
      ELSE
        -- Update existing element.
        SELECT updateXML
               (
                 DBMS_XDB.cfg_get(),
                 '/xdbconfig/sysconfig/protocolconfig/httpconfig/allow-repository-anonymous-access/text()',
                 l_value,
                 'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
               )
        INTO   l_configxml
        FROM   dual;
    
        DBMS_OUTPUT.put_line('Element updated.');
      END IF;
    
      DBMS_XDB.cfg_update(l_configxml);
      DBMS_XDB.cfg_refresh;
    END;
    /
  23. fons says:

    @Alex: Great, I can use apex now.
    Thanks a lot for this wonderfull blog

  24. Vedran says:

    Hi,
    I’ve tried this procedure with 10.2.0.4 database on Linux/Intel and APEX 3.2. Upon logging on the “Application Express Administration Services” page the login mask just keeps reappearing again and again asking for APEX administrator username and password ?
    Best regards

  25. @Vedran: I think I had the same and I recall it was because I only installed the run-time component. See step 8.

  26. Vedran says:

    @Alex: I’ve installed the full development environment using apexins.sql. One prior additional step was installing PL/SQL Web Toolkit (10.1.2.0.6) delivered with APEX 3.2, since the toolkit which comes with the 10.2.0.4 database is too old (10.1.2.0.5).

  27. Vedran says:

    @all: sorry for the fuss – turns out to be my browser. During APEX login the IE7 shows this strange behaviour, Firefox2 works OK. Thanx again

  28. Graham B says:

    Awesome! Worked first time. I know that I would never have figured out step 5 and would have given up!
    Thanks Alex, you’re a star!

  29. achilles says:

    Hi Alex,

    I am new to Oracle database. I have installed Oracle by your earlier post. Can you please, explain steps 2-4 in details please with exact commands. Much appreciated.

  30. @achilles:

    step 2 – RTFM at http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7003.htm

    step 3&4 – those are commands you are running from SQL*Plus. You need to go into apex directory that you unzipped after download and call sqlplus using sqlplus "/ as sysdba". For details, RTFM – http://download.oracle.com/docs/cd/E14373_01/install.32/e13366/otn_install.htm#BEHGEFDI

  31. Ryan says:

    Hi Alex,

    I’ve followed your steps all the way but I’m unable to access apex via ‘http://localhost:8080/apex’. I tried setting the port to ‘8090′ (call dbms_xdb.setHttpPort(8090);)per another users issue but that has not helped.

    Here is the output from `lsnrctl status`:

    LSNRCTL for MacOS X Server: Version 10.2.0.4.0 – Production on 19-SEP-2009 18:15:00

    Copyright (c) 1991, 2007, Oracle. All rights reserved.

    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
    STATUS of the LISTENER
    ————————
    Alias LISTENER
    Version TNSLSNR for MacOS X Server: Version 10.2.0.4.0 – Production
    Start Date 19-SEP-2009 18:01:45
    Uptime 0 days 0 hr. 13 min. 14 sec
    Trace Level user
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File /Users/oracle/oracle/product/ora10g/network/admin/listener.ora
    Listener Log File /Users/oracle/oracle/product/ora10g/network/log/listener.log
    Listener Trace File /Users/oracle/oracle/product/ora10g/network/trace/listener.trc
    Listening Endpoints Summary…
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
    Services Summary…
    Service “PLSExtProc” has 1 instance(s).
    Instance “PLSExtProc”, status UNKNOWN, has 1 handler(s) for this service…
    Service “mac10g” has 1 instance(s).
    Instance “mac10g”, status UNKNOWN, has 1 handler(s) for this service…
    The command completed successfully

    Any help would be appreciated. Thanks in advance.

  32. MT says:

    Guys,

    How did you managed to fix the error in step 6:

    ..
    ERROR at line 1:
    ORA-22288: file or LOB operation FILEOPEN failed
    No such file or directory
    ORA-06512: at “SYS.DBMS_LOB”, line 523
    ORA-06512: at “SYS.XMLTYPE”, line 287
    ORA-06512: at line 18

    Thanks.

  33. @MT: I didn’t have this error. Check your path and troubleshoot.

  34. MT says:

    Hi Alex,

    You’re right. It has something to do with the path.
    I have ran it successfully.

    However, when I tried to access apex screen via http://localhost:8080/apex_admin

    It prompted me to change the admin password. After entering details and clicking the ‘Apply Changes’ button, nothing happens.

    Also, APEX images in the logon page is not displaying. (like in step 8).

    What am I missing?

    Thanks.

  35. Cory says:

    Thanks Alex for another excellent set of instructions.

    I did have a problem with the XML DB HTTP Server but it appears to be a default setting in Snow Leopard – running “sudo ipfw list” and “sudo ipfw flush” as per http://discussions.apple.com/thread.jspa?threadID=1561149
    resolved the issue.

    Also, I initially needed to log onto http://localhost:8080/apex/apex_admin but everything else was cut and paste. Thanks again.

  36. Thanks for update Cory.

  37. Hari says:

    Steps 1 through 6 worked perfectly fine without any errors. In Step 7, I used call dbms_xdb.setHttpPort(8090); and observed the following entry in the listener.ora file:

    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=8090))). The PRESENTATION and SESSION tags are not present in the entry.

    When I started the listener (lsnctl start), it complained that the port is already being used. So I used

    call dbms_xdb.setHttpPort(65530); and
    alter system register;
    with a different port address. Unfortunately the listener.ora file is not updated. I tried manually changing this file by updating the port address, and adding the PRESENTATION and SESSION tags, but there was no luck.

    I want to know is there any way to change the DBMS XDB Http port without reinstalling apex from Step-3?

  38. George Ch says:

    in the beginning I want to thank you for your publications
    which help explore oracle on mac os x..
    after start @apexins APEX APEX TEMP / i /
    I get the following error
    SP2-0310: unable to open file “coreins.sql”
    and disconnected from oracle db..
    What possible reason for this?..

  39. @George: it’s either that your download is not complete/unzipped properly or you are in the wrong directory. Please think about this message – it cleanly can’t find coreins.sql which is part of APEX download package.

  40. George Ch says:

    re-downloaded apex.zip, but the same problem, and coreins.sql available

    Igor-MacBook-Pro:apex oracle$ ls -al coreins.sql
    -r–r–r–@ 1 oracle admin 84368 Jul 23 2009 coreins.sql

    SYS>@?/apex/apexins APEX APEX TEMP /i/

    #blablabla

    PL/SQL procedure successfully completed.

    .
    … Prerequisite check complete. Result passed.
    .

    FOO3
    ——————————
    install2010-03-16_19-18-55.log

    no rows selected

    PL/SQL procedure successfully completed.

    SP2-0310: unable to open file “coreins.sql”
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0

    – in the log is only: SP2-0310: unable to open file “coreins.sql”

    :( I cant understand

  41. George Ch says:

    ok, it’s wrong: @?/apex/apexins
    must login in sqlplus from ./apex directory
    and run script @apexins

Leave a Reply

Start NowWith Pythian - database design, management and emergency handling capabilities...

Live Updates

pythian: RT @sheeri: #confoo talk "Bending Queries to your Will with EXPLAIN" slides http://bit.ly/explainslides & handout
more



Testimonials

  • Serge Racine

    DBA, Brookfield Energy

    We are very satisfied by the service given to us by Andre and Shakir in support of our recent data quality and reorganization initiative.... more