Debian 12 下,安装 Oracle Database Express Edition 21c

2023-12-17 23:21

 

尝试在Debian 12 下,安装 Oracle Database Express Edition 21c,成功。

 

Oracle Database Express Edition 21c 可免费使用。虽说容量有些限制,用于开发还是不错的。安装起来还算容易,基本上一次安装成功。步骤如下:

1) 下载 oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm, 网址:https://www.oracle.com/cn/database/technologies/xe-downloads.html

如果是在 Windows 下下载文件,下载完成之后,将文件传到 Debian 系统里。

 

2) 在 Debian terminal 下,依次执行 su,apt install alien,export PATH=/usr/loca/sbin:/usr/sbin:/sbin:$PATH,作为提前准备。

 

3) 切换到 oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm 文件所在目录,执行 alien -k --scripts oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm, 将文件转换成 .deb 格式。

 

4) 执行 dpkg -i oracle-database-xe-21c_1.0-1_amd64.deb,进行 Oracle database 安装。

 

5) 得到如下结果:

正在选中未选择的软件包 oracle-database-xe-21c。
(正在读取数据库 ... 系统当前共安装有 149972 个文件和目录。)
准备解压 oracle-database-xe-21c_1.0-1_amd64.deb  ...
ln: 无法创建符号链接 '/bin/awk': 文件已存在
正在解压 oracle-database-xe-21c (1.0-1) ...
正在设置 oracle-database-xe-21c (1.0-1) ...
[INFO] Executing post installation scripts...
[SEVERE] An error occurred while configuring the directories for the Oracle home. Verify the execution of the following command: /opt/oracle/product/21c/dbhomeXE/bin/roohctl -enable
dpkg: 处理软件包 oracle-database-xe-21c (--install)时出错:
已安装 oracle-database-xe-21c 软件包 post-installation 脚本 子进程返回错误状态 1
正在处理用于 libc-bin (2.36-9+deb12u3) 的触发器 ...
在处理时有错误发生:
oracle-database-xe-21c

 

6) 执行 apt-get -f -y install,常识修补,补安装所需功能组件,得到结果如下:

正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成
下列软件包是自动安装的并且现在不需要了:
linux-image-6.1.0-15-amd64
使用'apt autoremove'来卸载它(它们)。
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 1 个软件包未被升级。
有 1 个软件包没有被完全安装或卸载。
解压缩后会消耗 0 B 的额外空间。
正在设置 oracle-database-xe-21c (1.0-1) ...
[INFO] Executing post installation scripts...
[SEVERE] An error occurred while configuring the directories for the Oracle home. Verify the execution of the following command: /opt/oracle/product/21c/dbhomeXE/bin/roohctl -enable
dpkg: 处理软件包 oracle-database-xe-21c (--configure)时出错:
已安装 oracle-database-xe-21c 软件包 post-installation 脚本 子进程返回错误状态 1
正在处理用于 libc-bin (2.36-9+deb12u3) 的触发器 ...
在处理时有错误发生:
oracle-database-xe-21c
E: Sub-process /usr/bin/dpkg returned an error code (1)

 

7) 执行命令,安装所需各小组件: apt-get install build-essential binutils libcap-dev gcc g++ libc6-dev ksh libaio-dev make libxi-dev libxtst-dev libxau-dev libxcb1-dev sysstat rpm xauth unzip

 

8) 修改 /etc/hosts 文件,添加明确的固定 IP-host(此处为 IPv4),比如:192.168.1.247 debian-hp

 

9) 进行配置:/etc/init.d/oracle-xe-21c configure,得到如下结果:

Specify a password to be used for database accounts. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. Note that the same password will be used for SYS, SYSTEM and PDBADMIN accounts:
******
Confirm the password:
Configuring Oracle Listener.
已完成 100%
数据库创建完成。有关详细信息, 请查看以下位置的日志文件:
/opt/oracle/cfgtoollogs/dbca/XE。
数据库信息:
全局数据库名:XE
系统标识符 (SID):XE
有关详细信息, 请参阅日志文件 "/opt/oracle/cfgtoollogs/dbca/XE/XE.log"。

Connect to Oracle Database using one of the connect strings:
    Pluggable database: debian-hp:1539/XEPDB1
    Multitenant container database: debian-hp:1539
Use https://localhost:5500/em to access Oracle Enterprise Manager for Oracle Database XE

不同的电脑,安装后的端口可能有所变化。

 

10) 从另一台电脑中,使用 SQuirreL SQL Client 通过 JDBC 连接到此 Oracle database,连接参数为:jdbc:oracle:thin:@192.168.1.247:1539:XE, 用户名为: system, 密码为刚才输入的。

 

11) 在 SQuirreL SQL Client 的 SQL 窗口里,执行 SQL 做验证:select sysdate from dual;, 检查执行结果。

 

 


请选择网站语言: