Sunday, September 2, 2012

Setting up Oracle APEX for the first time

Once you are done with installing your Oracle DB instance  ( 11g or 10g )  , the next step is to make sure your Oracle APEX is kick started .


1) Make sure your Oracle Database is up and running .

2) Make sure your default port for the webserver that is (8080) is not occupied by any other product .

3) As the Oracle Database already comes with oracle XML DB and Oracle embedded plsql gateway server , you actually need not bother about configuring the apex  , as APEX uses the embedded plsql gateway as the default Application server .


4) There are many default scripts which comes with oracle apex which can be used for installing , configuring or adminsitrting or customizing the settings of the oracle apex .

       C:\Oracle_home\APEX\    ---- you will find many sql scripts which starts with the apex_version_no_script_description.sql
 EX:-  apxldimg.sql  this is used for loading the images of the application developer of the apex during the apex installation from scratch or it upgradation .


5) One the files is apxconf.sql  , this is used for configuring the APEX   .

When you run this particular command , you will be shown the default port no which is being used or available :- 8080 .

Then  you will be asked to enter the password for the APEX ADMIN :- " enter the password".
Then you need to reneter the password for the confirmation again :  " renter the password " .

Note this password will be the admin password for you default workspace of apex thats nothing but ( Internal ) .

 You will be asked to enter the port , incase you wanna continue with the same default port then u can enter (8080) as you port no ,else you can change for any other .




[oracle@db11gr2 apex]$ cd $ORACLE_HOME/apex
[oracle@db11gr2 apex]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Sun Mar 11 00:48:32 2012

Copyright (c) 1982, 2009, Oracle. All rights reserved.

SQL> connect sys as sysdba
Enter password:
Connected.
SQL>
SQL>
SQL>
SQL> @apxconf

PORT
----------
 8080

Enter values below for the XDB HTTP listener port and the password for the Application Express ADMIN user.
Default values are in brackets [ ].
Press Enter to accept the default value.
Enter a password for the ADMIN user []
Enter a port for the XDB HTTP listener [ 8080]
...changing HTTP Port

PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
Session altered.

...changing password for ADMIN

PL/SQL procedure successfully completed.
Commit complete.

 6) Using the Following Comand cross verify whether your  web server is up and running .

SQL> SELECT DBMS_XDB.GETHTTPPORT FROM DUAL;

GETHTTPPORT
-----------
 8080

 You can mak apex down , by runnnig the comman

SQL>EXEC DBMS_XDB.SETHTTPPORT(0);
SQL>EXEC DBMS_XDB.SETHTTPPORT(8080);
again makes the Oracle APEX Up .



7)  Now login into oracle apex instance as

http://localhost:8080/apex/apex_admin

or 

http://localhost:8080/apex 
Workspace:-  Internal 
  User:-  Admin 
Password :- enter admin password .



Now create your development  workspace ,schemas and  users,



8)Incase you wanna use the pdf printing functionality or email fucntionality then you need to run this package , the package exists in the installation document , kindly! go thru it once .



DECLARE
 ACL_PATH VARCHAR2(4000);
 ACL_ID RAW(16);
BEGIN
 -- Look for the ACL currently assigned to '*' and give APEX_030200
 -- the "connect" privilege if APEX_030200 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;

-- Before checking the privilege, ensure that the ACL is valid
 -- (for example, does not contain stale references to dropped users).
 -- If it does, the following exception will be raised:
 --
 -- ORA-44416: Invalid ACL: Unresolved principal 'APEX_030200'
 -- ORA-06512: at "XDB.DBMS_XDBZ", line ...
 --
 SELECT SYS_OP_R2O(extractValue(P.RES, '/Resource/XMLRef')) INTO ACL_ID
 FROM XDB.XDB$ACL A, PATH_VIEW P
 WHERE extractValue(P.RES, '/Resource/XMLRef') = REF(A) AND
 EQUALS_PATH(P.RES, ACL_PATH) = 1;

DBMS_XDBZ.ValidateACL(ACL_ID);
 IF DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE(ACL_PATH, 'APEX_030200',
 'connect') IS NULL THEN
 DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,
 'APEX_030200', 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_030200', TRUE, 'connect');
 DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('power_users.xml','*');
END;
/
COMMIT;