Wednesday, September 25, 2013

Oracle: Setup APEX on Linux


 Install Oracle HTTP Server


Download binary (Oracle Webtier Utilities) from http://www.oracle.com/technetwork/java/webtier/downloads/index2-303202.html

Create user/group
user name: ohs
group: ohs

log on as ohs

extract binary into /var/tmp/ohs

$ cd /var/tmp/ohs/Disk1
$ ./runInstaller


Follow the instructions on screen to create an instance called apex and finish installation, at the end you will see the url to connect to your OHS.

to uninstall it, please run below command in  <Web_Tier_ORACLE_HOME>/oui/bin

$ ./runInstaller -deinstall


Download and Install APEX

Download the binary from
http://www.oracle.com/technetwork/developer-tools/apex/downloads/index.html

extract it into /var/tmp/apex

Full development environment

Run apexins.sql passing the following four arguments in the order shown:

SQL> @apexins.sql tablespace_apex tablespace_files tablespace_temp images

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/.
 

connect to your database using sqlplus as sysdba


$ cd /var/tmp/apex/apex
$ sqlplus / as sysdba
SQL> @apexins.sql SYSAUX SYSAUX TEMP /i/


Change the Password for the ADMIN Account

Login as sysdba

SQL> @apxchpwd.sql

 Type in your password when asked.

Configure APEX_PUBLIC_USER Account

Run the following statement:

SQL> ALTER USER APEX_PUBLIC_USER ACCOUNT UNLOCK

Changing the Password for the APEX_PUBLIC_USER Account

SQL> ALTER USER APEX_PUBLIC_USER IDENTIFIED BY new_password

About Password Expiration in Oracle Database 11g

 SQL> CREATE PROFILE UNLIMITED_PASSWORD_LIFETIME LIMIT
  SESSIONS_PER_USER DEFAULT
  CPU_PER_SESSION DEFAULT
  CPU_PER_CALL DEFAULT
  CONNECT_TIME DEFAULT
  IDLE_TIME DEFAULT
  LOGICAL_READS_PER_SESSION DEFAULT
  LOGICAL_READS_PER_CALL DEFAULT
  COMPOSITE_LIMIT DEFAULT
  PRIVATE_SGA DEFAULT
  FAILED_LOGIN_ATTEMPTS DEFAULT
  PASSWORD_LIFE_TIME UNLIMITED  
  PASSWORD_REUSE_TIME DEFAULT
  PASSWORD_REUSE_MAX DEFAULT
  PASSWORD_LOCK_TIME DEFAULT
  PASSWORD_GRACE_TIME DEFAULT
  PASSWORD_VERIFY_FUNCTION DEFAULT;

SQL> ALTER USER APEX_PUBLIC_USER
  PROFILE UNLIMITED_PASSWORD_LIFETIME
  ACCOUNT UNLOCK;


Granting Connect Privileges


The following example demonstrates how to grant connect privileges to any host for the APEX_040200 database user. This example assumes you connected to the database where Oracle Application Express is installed as SYS specifying the SYSDBA role.

DECLARE
  ACL_PATH  VARCHAR2(4000);
BEGIN
  -- Look for the ACL currently assigned to '*' and give APEX_040200
  -- the "connect" privilege if APEX_040200 does not have the privilege yet.

  SELECT ACL INTO ACL_PATH FROM DBA_NETWORK_ACLS
   WHERE HOST = '*' AND LOWER_PORT IS NULL AND UPPER_PORT IS NULL;

  IF DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE(ACL_PATH, 'APEX_040200',
     'connect') IS NULL THEN
      DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,
     'APEX_040200', TRUE, 'connect');
  END IF;

EXCEPTION
  -- When no ACL has been assigned to '*'.
  WHEN NO_DATA_FOUND THEN
  DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('power_users.xml',
    'ACL that lets power users to connect to everywhere',
    'APEX_040200', TRUE, 'connect');
  DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('power_users.xml','*');
END;
/
COMMIT;

Enable

Enabling Oracle XML DB Protocol Server


EXEC DBMS_XDB.SETHTTPPORT(8080);

Load Images


if below script failed, user will see blank page when connect to workspace.

SQL> @apxldimg.sql

PL/SQL procedure successfully completed.

Enter value for 1: /var/tmp

PL/SQL procedure successfully completed.

. Loading images directory: /var/tmp/apex/images

Directory created.


PL/SQL procedure successfully completed.


PL/SQL procedure successfully completed.


PL/SQL procedure successfully completed.


Commit complete.


Directory dropped.

timing for: Load Images
Elapsed: 00:03:18.77

No comments:

Post a Comment