เริ่มต้นด้วยการใช้ apexins_con.sql ติดตั้ง APEX แบบ development บน CDB.
SQL> select CON_ID, NAME, OPEN_MODE from v$pdbs;เนื่องจากต้องการใช้ Embedded PL/SQL Gateway เลยเซต HTTP port บน PDB (PDB_OPUN) และเปลี่ยน Password + unlock ให้กับ ANONYMOUS
CON_ID NAME OPEN_MODE
---------- ------------------------------ ----------
2 PDB$SEED READ ONLY
3 PDB_OPUN READ WRITE
SQL> select COMP_ID, VERSION, CON_ID from cdb_registry where COMP_ID='APEX';
no rows selected
SQL>
[oracle@test12c ~]$ unzip -l apex_4.2.3.zip|tail
2256 08-22-2012 10:46 apex/apxconf.sql
4301 08-15-2013 04:08 apex/apxdvins.sql
1150 08-22-2012 10:46 apex/apxchpwd.sql
5 08-22-2012 10:46 apex/apxexit.sql
4706 03-02-2013 22:19 apex/catapx.sql
538 03-07-2008 21:20 apex/apxe102.sql
3271 03-02-2013 22:19 apex/apxxepwd.sql
13889 06-18-2011 00:08 apex/apexvalidate.sql
--------- -------
989017663 12307 files
[oracle@test12c ~]$ ls -la apex_4.2.3.zip
-rw-r--r--. 1 oracle oinstall 162660590 Sep 18 13:15 apex_4.2.3.zip
[oracle@test12c ~]$ cd /tmp/
[oracle@test12c tmp]$ man unzip
[oracle@test12c tmp]$ unzip /home/oracle/apex_4.2.3.zip ^C
[oracle@test12c tmp]$ pwd
/tmp
[oracle@test12c tmp]$ cd apex/
[oracle@test12c apex]$ ls
apex_epg_config_con.sql apex_rest_config.sql apxdevrm.sql apxexit.sql apxremov2.sql apxxepwd.sql images
apex_epg_config_core.sql apexvalidate.sql apxdvins_con.sql apxldimg_con.sql apxremov_con.sql builder load_trans.sql
apex_epg_config.sql appins.sql apxdvins.sql apxldimg.sql apxremov.sql catapx.sql owa
apexins_con.sql apxchpwd.sql apxe101.sql apxpatch.sql apxrtins_con.sql core utilities
apexins.sql apxconf.sql apxe102.sql apxprereq.sql apxrtins.sql coreins.sql
apex_rest_config_con.sql apxdbmig.sql apxe111.sql apxrelod.sql apxsqler.sql devins.sql
apex_rest_config_core.sql apxdevrm_con.sql apxe112.sql apxremov1.sql apxxemig.sql endins.sql
[oracle@test12c apex]$
[oracle@test12c apex]$ ls -l apexins_con.sql
-rw-r--r--. 1 oracle oinstall 2042 Aug 31 13:38 apexins_con.sql
[oracle@test12c apex]$ sqlplus /nolog
SQL*Plus: Release 12.1.0.1.0 Production on Wed Sep 18 14:12:33 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> connect / as sysdba
Connected.
SQL> @apexins_con.sql SYSAUX SYSAUX TEMP /i/
PL/SQL procedure successfully completed.
Performing installation in multitenant container database in the background.
The installation progress is spooled into apexins_con*.log files.
Please wait...
Installation completed. Log files for each container can be found in:
apexins_con*.log
You can quickly scan for ORA errors or compilation errors by using a utility
like grep:
grep ORA- *.log
grep PLS- *.log
SQL> select CON_ID, NAME, OPEN_MODE from v$pdbs;
CON_ID NAME OPEN_MODE
---------- ------------------------------ ----------
2 PDB$SEED READ ONLY
3 PDB_OPUN READ WRITE
SQL> select COMP_ID, VERSION, CON_ID from cdb_registry where COMP_ID='APEX';
COMP_ID VERSION CON_ID
------------------------------ ------------------------------ ----------
APEX 4.2.3.00.08 1
APEX 4.2.3.00.08 2
APEX 4.2.3.00.08 3
SQL> alter session set container = PDB_OPUN;จากนั้นก็ได้เวลาติดตั้ง Embedded PL/SQL Gateway
Session altered.
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 value below for the password for the Application Express ADMIN user.
Enter a password for the ADMIN user []
Session altered.
...changing password for ADMIN
PL/SQL procedure successfully completed.
Enter a port for the XDB HTTP listener [ 8080] 8000
...changing HTTP Port
PL/SQL procedure successfully completed.
SQL>
SQL> ALTER SESSION SET CONTAINER = CDB$ROOT;
Session altered.
SQL> ALTER USER ANONYMOUS IDENTIFIED BY PASSWORD ACCOUNT UNLOCK;
User altered.
SQL> select con_id, account_status from cdb_users where username='ANONYMOUS';
CON_ID ACCOUNT_STATUS
---------- --------------------------------
3 OPEN
2 EXPIRED & LOCKED
1 OPEN
SQL>
SQL> !lsnrctl status |grep 8000
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test12c)(PORT=8000))(Presentation=HTTP)(Session=RAW))
SQL>
- apex_epg_config_con.sql ติดตั้ง Embedded PL/SQL Gateway ให้กับ CDB$ROOT, PDB$SEED และ PDB...
- apex_epg_config.sql ใช้ติดตั้งบน PDB ต้องการ
ในตัวอย่างนี้ ผมติดตั้ง Embedded PL/SQL Gateway ใน PDB_OPUN
[oracle@test12c apex]$ ls -l apex_epg_config_con.sqlหลังจากนั้นทดสอบเรียกจาก Browser ...
-rw-r--r--. 1 oracle oinstall 2130 Aug 31 13:38 apex_epg_config_con.sql
[oracle@test12c apex]$ ls -l apex_epg_config.sql
-rw-r--r--. 1 oracle oinstall 831 Apr 6 13:09 apex_epg_config.sql
[oracle@test12c apex]$
[oracle@test12c apex]$
[oracle@test12c apex]$ sqlplus /nolog
SQL*Plus: Release 12.1.0.1.0 Production on Wed Sep 18 18:21:05 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> alter session set container = PDB_OPUN;
Session altered.
SQL> show con_name
CON_NAME
------------------------------
PDB_OPUN
SQL> @apex_epg_config /tmp
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
. Loading images directory: /tmp/apex/images
Directory created.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
Commit complete.
Directory dropped.
timing for: Load Images
Elapsed: 00:02:13.11
PL/SQL procedure successfully completed.
Commit complete.
SQL>
ตอนนี้เราสามารถใช้ APEX 4.2.3 ใน PDB (PDB_OPUN) ผ่าน Embedded PL/SQL Gateway.
จากนั้นเราอาจอนุญาติให้ APEX_040200 นั้นสามารถติดต่อไป Network ข้างนอก
SQL> conn / as sysdbaอ่านเพิ่มเติม http://docs.oracle.com/cd/E16655_01/install.121/e17958/toc.htm
Connected.
SQL> alter session set container=pdb_opun;
Session altered.
SQL> show con_name
CON_NAME
------------------------------
PDB_OPUN
SQL> DECLARE
2 ACL_PATH VARCHAR2(4000);
3 BEGIN
4 -- Look for the ACL currently assigned to '*' and give APEX_040200
5 -- the "connect" privilege if APEX_040200 does not have the privilege yet.
6
7 SELECT ACL INTO ACL_PATH FROM DBA_NETWORK_ACLS
8 WHERE HOST = '*' AND LOWER_PORT IS NULL AND UPPER_PORT IS NULL;
9
10 IF DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE(ACL_PATH, 'APEX_040200',
11 'connect') IS NULL THEN
12 DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,
13 'APEX_040200', TRUE, 'connect');
14 END IF;
15
16 EXCEPTION
17 -- When no ACL has been assigned to '*'.
18 WHEN NO_DATA_FOUND THEN
19 DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('power_users.xml',
20 'ACL that lets power users to connect to everywhere',
21 'APEX_040200', TRUE, 'connect');
22 DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('power_users.xml','*');
23 END;
24 /
COMMIT;
PL/SQL procedure successfully completed.
SQL>
Commit complete.
SQL>
ไม่มีความคิดเห็น:
แสดงความคิดเห็น