Search This Blog

Wednesday, July 27, 2016

APEX 5 installation steps with REST Data services and Tomcat Apache




create tablespace APEXlab3 datafile '/lab3_data01/data/apex3data/apex_lab3.dbf' size 4096m;

@apexins APEXlab3 APEXlab3 TEMP /i/

Oracle Application Express is installed in the APEX_050000 schema.
The structure of the link to the Application Express administration services is as follows:
http://host:port/pls/apex/apex_admin (Oracle HTTP Server with mod_plsql)
http://host:port/apex/apex_admin     (Oracle XML DB HTTP listener with the embedded PL/SQL gateway)
http://host:port/apex/apex_admin     (Oracle REST Data Services)
The structure of the link to the Application Express development interface is as follows:
http://host:port/pls/apex (Oracle HTTP Server with mod_plsql)
http://host:port/apex     (Oracle XML DB HTTP listener with the embedded PL/SQL gateway)
http://host:port/apex     (Oracle REST Data Services)

SQL> select USERNAME,ACCOUNT_STATUS from dba_users where USERNAME like '%APEX%';
USERNAME                       ACCOUNT_STATUS
------------------------------ --------------------------------
APEX_050000                    EXPIRED & LOCKED
APEX_PUBLIC_USER               EXPIRED & LOCKED

SQL> alter user APEX_050000 account unlock;
User altered.
SQL> alter user APEX_PUBLIC_USER account unlock;
User altered.
SQL>  select USERNAME,ACCOUNT_STATUS from dba_users where USERNAME like '%APEX%';
USERNAME                       ACCOUNT_STATUS
------------------------------ --------------------------------
APEX_050000                    EXPIRED
APEX_PUBLIC_USER               EXPIRED

SQL> alter user APEX_050000 identified by Ap$;
User altered.
SQL> alter user APEX_PUBLIC_USER identified by Ap$;
User altered.
SQL> select USERNAME,ACCOUNT_STATUS from dba_users where USERNAME like '%APEX%';

USERNAME                       ACCOUNT_STATUS
------------------------------ --------------------------------
APEX_050000                    OPEN
APEX_PUBLIC_USER               OPEN
SQL>

Ap$lab3
SQL> @apxchpwd.sql
================================================================================
This script can be used to change the password of an Application Express
instance administrator. If the user does not yet exist, a user record will be
created.
================================================================================
Enter the administrator's username [ADMIN]
User "ADMIN" does not yet exist and will be created.
Enter ADMIN's email [ADMIN] lab3@test.com
Enter ADMIN's password []
Created instance administrator ADMIN.

SQL>

SQL> @apxconf.sql
      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.

================================================================================
This script can be used to change the password of an Application Express
instance administrator. If the user does not yet exist, a user record will be
created.
================================================================================
Enter the administrator's username [ADMIN]
User "ADMIN" exists.
Enter ADMIN's email [lab3@test.com]
Enter ADMIN's password []   -----
Changed password of instance administrator ADMIN.
Enter a port for the XDB HTTP listener [      8080]
...changing HTTP Port
SQL>

-===============================================================================
SQL> @apex_rest_config.sql  
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
Enter a password for the APEX_LISTENER user              []
Enter a password for the APEX_REST_PUBLIC_USER user              []
...create APEX_LISTENER user
PL/SQL procedure successfully completed.
...create APEX_REST_PUBLIC_USER user
PL/SQL procedure successfully completed.
User altered.
.
.
.
PL/SQL procedure successfully completed.
SQL>
===========================================================================
[apexora@labdb3 dbs]$ pwd
/lab3_ora/oracle/product/11.2.0/dbs
[apexora@labdb3 dbs]$ orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=Ap$
[apexora@labdb3 dbs]$ ls -ltr orapw*

-rw-r----- 1 apexora dba 1536 Jul 26 17:33 orapwapex3
[apexora@labdb3 dbs]$ sqlplus '/as sysdba'
SQL*Plus: Release 11.2.0.3.0 Production on Tue Jul 26 17:36:57 2016
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> grant sysdba to sys;
Grant succeeded.
SQL> alter user sys identified by manager;
User altered.

[apexlab@lab3 ~]$ sqlplus sys/manager as sysdba
SQL*Plus: Release 10.1.0.5.0 - Production on Tue Jul 26 17:38:59 2016
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[apexlab@lab3 ~]$

==============================================================================

SQL> create temporary tablespace TEMP3 tempfile '/lab3_data01/data/apex3data/apex_temp03.dbf' size 2048m;
Tablespace created.

SQL>

[apexlab@lab3 ORDS]$ /lab3_ora/apex3/apex_lab3/JDK8/jdk1.8.0_77/bin/java -jar ords.war install advanced
Enter the name of the database server [localhost]:labdb3.local
Enter the database listen port [1521]:1542
Enter 1 to specify the database service name, or 2 to specify the database SID [1]:2
Enter the database SID [xe]:apex3
Enter 1 if you want to verify/install Oracle REST Data Services schema or 2 to skip this step [1]:
Enter the database password for ORDS_PUBLIC_USER:
Confirm password:
Please login with SYSDBA privileges to verify Oracle REST Data Services schema.
Enter the username with SYSDBA privileges to verify the installation [SYS]:
Enter the database password for SYS:
Confirm password:
Enter the default tablespace for ORDS_METADATA [SYSAUX]:APEXlab3
Jul 26, 2016 5:43:37 PM oracle.dbtools.rt.config.setup.CdbPdbSetup isValidTablespace
INFO: Error the temporary tablespace TEMP does not exist. An existing tablespace is required for ORDS installation.
Enter the temporary tablespace for ORDS_METADATA [SYSAUX]:APEXlab3
Jul 26, 2016 5:44:13 PM oracle.dbtools.rt.config.setup.CdbPdbSetup isValidTablespace
INFO: Error the temporary tablespace APEXlab3 does not exist. An existing tablespace is required for ORDS installation.
Enter the temporary tablespace for ORDS_METADATA [SYSAUX]:TEMP
Jul 26, 2016 5:49:26 PM oracle.dbtools.rt.config.setup.CdbPdbSetup isValidTablespace
INFO: Error the temporary tablespace TEMP does not exist. An existing tablespace is required for ORDS installation.
Enter the temporary tablespace for ORDS_METADATA [SYSAUX]:TEMP3
Enter the default tablespace for ORDS_PUBLIC_USER [SYSAUX]:APEXlab3
Jul 26, 2016 5:49:56 PM oracle.dbtools.rt.config.setup.CdbPdbSetup isValidTablespace
INFO: Error the temporary tablespace TEMP does not exist. An existing tablespace is required for ORDS installation.
Enter the temporary tablespace for ORDS_PUBLIC_USER [SYSAUX]:TEMP3
Enter 1 if you want to use PL/SQL Gateway or 2 to skip this step.
If using Oracle Application Express or migrating from mod_plsql then you must enter 1 [1]:
Enter the PL/SQL Gateway database user name [APEX_PUBLIC_USER]:
Enter the database password for APEX_PUBLIC_USER:
Confirm password:
Enter 1 to specify passwords for Application Express RESTful Services database users (APEX_LISTENER, APEX_REST_PUBLIC_USER) or 2 to skip this step [1]:
Enter the database password for APEX_LISTENER:
Confirm password:
Enter the database password for APEX_REST_PUBLIC_USER:
Confirm password:
Jul 26, 2016 5:52:44 PM oracle.dbtools.common.config.file.ConfigurationFilesBase update
INFO: Updated configurations: defaults, apex, apex_pu, apex_al, apex_rt
Installing Oracle REST Data Services version 3.0.6.176.08.46
... Log file written to /lab3_ora/apex3/apex_lab3/ORDS/logs/ords_install_core_2016-07-26_175244_00423.log
... Verified database prerequisites
... Created Oracle REST Data Services schema
... Created Oracle REST Data Services proxy user
... Granted privileges to Oracle REST Data Services
... Created Oracle REST Data Services database objects
... Log file written to /lab3_ora/apex3/apex_lab3/ORDS/logs/ords_install_datamodel_2016-07-26_175313_00934.log
Completed installation for Oracle REST Data Services version 3.0.6.176.08.46. Elapsed time: 00:00:32.655
Enter 1 if you wish to start in standalone mode or 2 to exit [1]:2
You have new mail in /var/spool/mail/apexlab
[apexlab@lab3 ORDS]$

==============================================================================
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 privilege yet.
  6  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_050000',
  7    8    9  'connect') IS NULL THEN
 10  DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,
 11  'APEX_050000', TRUE, 'connect');
END IF;
 12   13  EXCEPTION
 14  -- When no ACL has been assigned to '*'.
 15  WHEN NO_DATA_FOUND THEN
 16  DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('power_users.xml',
 17  'ACL that 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;
PL/SQL procedure successfully completed.

SQL>
Commit complete.

SQL>
==========================================================================


You have new mail in /var/spool/mail/apexlab
[apexlab@lab3 webapps]$ cp /lab3_ora/apex3/apex_lab3/ORDS/ords.war /lab3_ora/apex3/apex_lab3/TomCat/apache-tomcat-9.0.0.M9/webapps
[apexlab@lab3 webapps]$ ls -ltr /lab3_ora/apex3/apex_lab3/TomCat/apache-tomcat-9.0.0.M9/webapps
total 48212
drwxr-xr-x  3 apexlab dba     4096 Jul  4 19:23 ROOT
drwxr-xr-x  5 apexlab dba     4096 Jul  4 19:23 manager
drwxr-xr-x  5 apexlab dba     4096 Jul  4 19:23 host-manager
drwxr-xr-x  6 apexlab dba     4096 Jul  4 19:23 examples
drwxr-xr-x 14 apexlab dba     4096 Jul  4 19:23 docs
-rw-r--r--  1 apexlab dba 49320473 Jul 26 18:01 ords.war
[apexlab@lab3 webapps]$

[apexlab@lab3 webapps]$ pwd
/lab3_ora/apex3/apex_lab3/TomCat/apache-tomcat-9.0.0.M9/webapps
[apexlab@lab3 webapps]$ scp -rp apexora@labdb3:/lab3_ora/oracle/apex_lab3/software/apex/images i
============================================================================[apexlab@lab3 bin]$ pwd
/lab3_ora/apex3/apex_lab3/TomCat/apache-tomcat-9.0.0.M9/bin
[apexlab@lab3 bin]$ pwd
/lab3_ora/apex3/apex_lab3/TomCat/apache-tomcat-9.0.0.M9/bin

[apexlab@lab3 bin]$ vi tomcat.env
[apexlab@lab3 bin]$ chmod +x tomcat.env
[apexlab@lab3 bin]$ cat tomcat.env
export JAVA_HOME=/lab3_ora/apex3/apex_lab3/JDK8/jdk1.8.0_77
export TOMCAT_HOME=/lab3_ora/apex3/apex_lab3/TomCat/apache-tomcat-9.0.0.M9
[apexlab@lab3 bin]$ . tomcat.env

[apexlab@lab3 bin]$ echo $JAVA_HOME
/lab3_ora/apex3/apex_lab3/JDK8/jdk1.8.0_77
[apexlab@lab3 bin]$


[apexlab@lab3 bin]$ chmod +x *.sh
[apexlab@lab3 bin]$ sh startup.sh
Using CATALINA_BASE:   /lab3_ora/apex3/apex_lab3/TomCat/apache-tomcat-9.0.0.M9
Using CATALINA_HOME:   /lab3_ora/apex3/apex_lab3/TomCat/apache-tomcat-9.0.0.M9
Using CATALINA_TMPDIR: /lab3_ora/apex3/apex_lab3/TomCat/apache-tomcat-9.0.0.M9/temp
Using JRE_HOME:        /lab3_ora/apex3/apex_lab3/JDK8/jdk1.8.0_77
Using CLASSPATH:       /lab3_ora/apex3/apex_lab3/TomCat/apache-tomcat-9.0.0.M9/bin/bootstrap.jar:/lab3_ora/apex3/apex_lab3/TomCat/apache-tomcat-9.0.0.M9/bin/tomcat-juli.jar
Tomcat started.
[apexlab@lab3 bin]$


[apexlab@lab3 bin]$ lsof -i:8080
COMMAND  PID    USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
java    2928 apexlab   46u  IPv4 14292877      0t0  TCP *:webcache (LISTEN)

[apexlab@lab3 bin]$

http://lab1.local:8080/ords/apex_admin
=======================================================================
Workspace Information:
Name     lab3_WS
Workspace ID     System Assigned
Description     Work space created for lab3...

Administrator Information:
User Name     ADMIN
E-mail     lab3@test.com

Schema Information:
Reuse Existing Schema     No
Schema Name     APEXlab3
Tablespace will be created     APEX_XXX
Datafile for tablespace     /lab3_data01/data/apex3data/APEX_XXX.DBF



lab3/lab3

Transportable tablespace refresh

  1.check tablespace for the user which need to refresh -------------------------------------------------------------------  SQL> select ...