ORACLE DATABASE 23AI+Apex+ORDS -纯享版
一、下载软件
# 23 AI Database Download
https://www.oracle.com/database/free/get-started/软件:oracle-database-free-23ai-1.0-1.el8.x86_64.rpm
oracle-database-preinstall-23ai-1.0-2.el9.x86_64.rpm# 24.1 Apex Download
https://www.oracle.com/tools/downloads/apex-241-downloads/
软件:apex_24.1.zip# 24.2.3 ORDS Download
https://www.oracle.com/technologies/appdev/rest-data-services-downloads-2423.html
软件:ords-24.2.3.201.1847.zip
二、要求
三、安装Oracle Linux 8
注意:当前不再演示Linux安装
1、关闭防火墙
$ systemctl stop firewalld.service && systemctl disabled firewalld.service
2、关闭Selinux策略
$ vi /etc/selinux/config
SELINUX=disabled
四、安装数据库
1、安装预装包
$ dnf -y install oracle-database-preinstall-23ai-1.0-2.el8.x86_64.rpm
2、安装数据库软件
$ dnf -y install oracle-database-free-23ai-1.0-1.el8.x86_64.rpm
3、配置环境变量
$ su – oracle
$ vi .bash_profile
export ORACLE_HOME=/opt/oracle/product/23ai/dbhomeFree
export ORACLE_SID=FREE
export PDB_NAME=FREEPDB1
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
export PATH=${ORACLE_HOME}/bin:${ORACLE_HOME}/OPatch:$OGG_HOME:${PATH}export PATH=$ORACLE_HOME/bin:$PATH$ source .bash_profile
4、安装数据库
$ cd /etc/init.d
$ ./oracle-free-23ai configure
5、登录数据库
# 登录CDB
$ sqlplus / as sysdba
# 登录PDB
$ export ORACLE_PDB_ID=[PDB_SID]
$ sqlplus / as sysdba
五、安装APEX
1、PDB中创建APEX表空间
SQL> create tablespace tbs_apex datafile '/opt/oracle/oradata/FREE/FREEPDB1/tbs_apex.dbf' size 100m autoextend on maxsize 30G;
2、安装APEX
注意:此处需要指定刚才新建的表空间。并耐心等待即可
SQL> @apexins.sql TBS_APEX TBS_APEX TEMP /i/;
3、创建APEX管理员密码
SYS> @apxchpwd.sql
…… 输入密码:
4、配置RESTful Services服务
SYS> @apex_rest_config.sql
5、查询ACL角色
注意:此处的用户在安装APEX时即会创建。需要通过该用户来开启。用户名为:APEX_240100
SYS> select username from dba_users where username like 'APEX%';
USERNAME
------------------------------------------------------------------
APEX_LISTENER
APEX_PUBLIC_ROUTER
APEX_PUBLIC_USER
APEX_REST_PUBLIC_USER
APEX_240100
6、授予远程网络访问权限
SQL> BEGIN
DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(
host => '*',
ace => xs$ace_type(privilege_list => xs$name_list('connect'),
principal_name => 'APEX_240100',
principal_type => xs_acl.ptype_db));
END;
/
7、禁用数据库内置PL/SQL网关
SQL> exec dbms_xdb.sethttpport(0);
SQL> exec dbms_xdb.setftpport(0);
8、解锁APEX 账号
SQL> alter user APEX_LISTENER account unlock;
SQL> alter user APEX_REST_PUBLIC_USER account unlock;
SQL> alter user APEX_PUBLIC_USER account unlock;
SQL> alter user APEX_PUBLIC_USER identified by Welcome123##;
SQL> CREATE PROFILE password_unlimited LIMIT PASSWORD_LIFE_TIME UNLIMITED;
SQL> ALTER USER apex_public_user PROFILE password_unlimited;
SQL> alter profile default limit password_verify_function null;
9、汉化APEX(可选)
SQL> alter session set CURRENT_SCHEMA = APEX_240100;
SQL> start ./builder/zh-cn/load_zh-cn.sql;
10、安装JDK
注意:此为安装ORDS的前提,ORDS 20 版本以上的均需要安装JDK 11及以上
$ tar xvpfz jdk-21_linux-x64_bin.tar.gz –C .# 配置环境变量
$ su – root
$ vi /etc/profile
export JAVA_HOME=/u01/jdk
export PATH=$JAVA_HOME/bin:$PATH
$ source /etc/profile
$ su – oracle
$ vi .bash_profile
export JAVA_HOME=/u01/jdk
export JAVA_HOME=/u01/jdk
$ source .bash_profile
$ java -version
11、设置ORDS环境变量
$ su – oracle
$ vi .bash_profile
export ORDS=/u01/ords
export ORDS_CONFIG=/u01/ords/conf
export PATH=${ORACLE_HOME}/bin: $OGG_HOME:$JAVA_HOME/bin:$ORDS/bin:${PATH}
$ source .bash_profile
12、创建静态资源目录
注意:此处需要拉取APEX的静态资源目录。可以任意指定存放静态资源目录
$ su - oracle
$ cd
$ mkdir apex_images
$ cp –r /u01/apex/images/* .
13、创建conf配置目录
# 在ORDS目录下创建一个conf目录
$ cd $ ORDS
$ mkdir conf
14、开始配置ORDS
注意:由于使用的是CDB架构,所以此处我选择安装在PDB中。所以选择了2.同时最后需要选择A。
$ su - oracle
$ ords --config /u01/ords/conf install
[oracle@ai ords]$ ords --config /u01/ords/conf install
2025-01-22T03:38:58.335Z WARNING Your configuration folder /u01/ords/conf is located in ORDS product folder. Oracle recommends to use a different configuration folder.
Refer to Oracle REST Data Services Documentation on how to setup your configuration folder.
ORDS: Release 24.2 Production on Wed Jan 22 03:38:58 2025
Copyright (c) 2010, 2025, Oracle.
Configuration:/u01/ords/conf
The configuration folder /u01/ords/conf does not contain any configuration files.
Oracle REST Data Services - Interactive InstallEnter a number to select the TNS net service name to use from /opt/oracle/product/23ai/dbhomeFree/network/admin/tnsnames.ora or s pecify the database connection[1] FREE SERVICE_NAME=FREE[2] FREEPDB1 SERVICE_NAME=freepdb1[S] Specify the database connectionChoose [1]: 2
Provide database user name with administrator privileges.Enter the administrator username: sys
Enter the database password for SYS AS SYSDBA:Retrieving information.
ORDS is not installed in the database. ORDS installation is required.Enter a number to update the value or select option A to Accept and Continue[1] Connection Type: TNS[2] TNS Connection: TNS_NAME=FREEPDB1 TNS_FOLDER=/opt/oracle/product/23ai/dbhomeFree/network/adminAdministrator User: SYS AS SYSDBA[3] Database password for ORDS runtime user (ORDS_PUBLIC_USER): [4] ORDS runtime user and schema tablespaces: Default: SYSAUX Temporary TEMP[5] Additional Feature: Database Actions[6] Configure and start ORDS in Standalone Mode: Yes[7] Protocol: HTTP[8] HTTP Port: 8080[9] APEX static resources location:[A] Accept and Continue - Create configuration and Install ORDS in the database[Q] Quit - Do not proceed. No changesChoose [A]: A
The setting named: db.connectionType was set to: tns in configuration: default
15、配置ORDS静态内容
$ su - oracle
$ ords config set --global standalone.static.context.path /i
$ ords config set --global standalone.static.path /home/oracle/apex_images
16、开启ORDS服务
$ su - oracle
$ ords --config /u01/app/ords/conf serve
17、访问地址
# APEX 登录地址:
http://192.168.6.8:8080/ords/apex_admin
用户名:ADMIN 密码:Welcome123### ORDS登录地址
http://192.168.6.8:8080/ords
workspace:internal
username:admin
password:Welcome123##