Ubuntu 22.04 安装Oracle 11g Express Edition

2024-04-29 11:44

本文主要是介绍Ubuntu 22.04 安装Oracle 11g Express Edition,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

目录

一、系统环境

二、预安装软件

三、安装Oracle

四、登录数据库


Ubuntu 22.04上安装Oracle 11g Express Edition的过程。

一、系统环境

操作系统:Ubuntu 22.04.4 LTS

数据库版本:Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

二、预安装软件

1.先通过unzip命令解压

如果没有命令,请通过apt install unzip安装

unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip

2.安装预先安装的包和依赖程序

sudo apt-get install alien libaio1 unixodbc

3.将RPM安装包转换成DEB格式

这里正常的rpm文件路径在DISK下面

cd ./oracle-xe-11.2.0-1.0.x86_64.rpm/Disk1/
sudo alien --scripts -d oracle-xe-11.2.0-1.0.x86_64.rpm

4.创建管理服务chkconfig的脚本

sudo vim /sbin/chkconfig

添加下面的内容并保存

 
#!/bin/bash
# Oracle 11gR2 XE installer chkconfig hack for Ubuntu
file=/etc/init.d/oracle-xe
if [[ ! `tail -n1 $file | grep INIT` ]]; then
echo >> $file
echo '### BEGIN INIT INFO' >> $file
echo '# Provides: OracleXE' >> $file
echo '# Required-Start: $remote_fs $syslog' >> $file
echo '# Required-Stop: $remote_fs $syslog' >> $file
echo '# Default-Start: 2 3 4 5' >> $file
echo '# Default-Stop: 0 1 6' >> $file
echo '# Short-Description: Oracle 11g Express Edition' >> $file
echo '### END INIT INFO' >> $file
fi
update-rc.d oracle-xe defaults 80 01

4.修改chkconfig文件权限

sudo chmod 755 /sbin/chkconfig  

5.设置内核kernel参数

(这是oracle 11g R2 XE安装要求)

sudo vim /etc/sysctl.d/60-oracle.conf

添加下面的内容并保存

# Oracle 11g XE kernel parameters  
fs.file-max=6815744  
net.ipv4.ip_local_port_range=9000 65000  
kernel.sem=250 32000 100 128 
kernel.shmmax=536870912 

使用下面命令通过加载内核餐宿

sudo service procps start

检查新的参数是否加载成功

sudo sysctl -q fs.file-max

6.设置/dev/shm挂载点

sudo vim /etc/rc2.d/S01shm_load

添加下面的内容并保存

#!/bin/sh
case "$1" in
start) mkdir /var/lock/subsys 2>/dev/nulltouch /var/lock/subsys/listenerrm /dev/shm 2>/dev/nullmkdir /dev/shm 2>/dev/nullmount -t tmpfs shmfs -o size=2048m /dev/shm ;;
*) echo errorexit 1 ;;
esac 

添加文件权限

sudo chmod 755 /etc/rc2.d/S01shm_load

9.重启服务器

reboot
三、安装Oracle

1.使用下面命令安装oracle

sudo dpkg --install oracle-xe_11.2.0-2_amd64.deb

2.使用下面命令开始配置oracle

sudo /etc/init.d/oracle-xe configure

 中途会询问你下面的问题

Specify the HTTP port that will be used for Oracle Application Express [8080]:# 定义HTTP网站管理的端口,默认直接回车Specify a port that will be used for the database listener [1521]:# 定义数据库监听的端口,默认直接回车Specify a password to be used for database accounts.  Note that the same
password will be used for SYS and SYSTEM.  Oracle recommends the use of 
different passwords for each database account.  This can be done after 
initial configuration:
Confirm the password:# 要求你设置系统账号SYS的SYSTEM的密码Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:y# 询问是否设置数据库开机启动启动,默认是开机启动,直接回车

正常安装成功的过程日志

root@oracle_01:/# sudo /etc/init.d/oracle-xe configureOracle Database 11g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 11g Express 
Edition.  The following questions will determine whether the database should 
be starting upon system boot, the ports it will use, and the passwords that 
will be used for database accounts.  Press <Enter> to accept the defaults. 
Ctrl-C will abort.Specify the HTTP port that will be used for Oracle Application Express [8080]:Specify a port that will be used for the database listener [1521]:Specify a password to be used for database accounts.  Note that the same
password will be used for SYS and SYSTEM.  Oracle recommends the use of 
different passwords for each database account.  This can be done after 
initial configuration:
Confirm the password:Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:yStarting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.
root@oracle_01:/

3.设置系统环境变量

sudo vim /etc/profile

在最末尾添加下面的内容并保存

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_SID=XE
export NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
export ORACLE_BASE=/u01/app/oracle
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATHif [ $USER = "oracle" ]; thenif [ $SHELL = "/bin/ksh" ]; thenulimit -p 16384ulimit -n 65536elseulimit -u 16384 -n 65536fi
fi

使用下面命令刷新使其生效

sudo source /etc/profile

4.启动oracle服务

sudo systemctl start oracle-xe

5.查看oracle运行状态

sudo systemctl status oracle-xe

下面是正常运行的结果

root@oracle_01:/# sudo systemctl status oracle-xe
● oracle-xe.service - LSB: Oracle 11g Express EditionLoaded: loaded (/etc/init.d/oracle-xe; generated)Active: active (exited) since Sun 2024-04-28 16:02:02 CST; 27min agoDocs: man:systemd-sysv-generator(8)Process: 803 ExecStart=/etc/init.d/oracle-xe start (code=exited, status=0/SUCCESS)CPU: 61msApr 28 16:01:52 oracle_01 systemd[1]: Starting LSB: Oracle 11g Express Edition...
Apr 28 16:01:53 oracle_01 oracle-xe[803]: Starting Oracle Net Listener.
Apr 28 16:01:53 oracle_01 su[899]: (to oracle) root on none
Apr 28 16:01:53 oracle_01 su[899]: pam_unix(su:session): session opened for user oracle(uid=1002) by (uid=0)
Apr 28 16:01:55 oracle_01 oracle-xe[803]: Starting Oracle Database 11g Express Edition instance.
Apr 28 16:01:55 oracle_01 su[940]: (to oracle) root on none
Apr 28 16:01:55 oracle_01 su[940]: pam_unix(su:session): session opened for user oracle(uid=1002) by (uid=0)
Apr 28 16:02:02 oracle_01 systemd[1]: Started LSB: Oracle 11g Express Edition.
root@oracle_01:/# 
四、登录数据库

1.使用下面命令用system账号登录

sqlplus system/123456Ab as sysdba;

2.登录后执行SQL语句查询数据库版本

select * from v$version;

下面是完整登录操作记录

root@oracle_01:/# sqlplus sys/123456Ab as sysdba;SQL*Plus: Release 11.2.0.2.0 Production on Sun Apr 28 15:59:18 2024Copyright (c) 1982, 2011, Oracle.  All rights reserved.Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit ProductionSQL> select * from v$version;BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE	11.2.0.2.0	Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - ProductionSQL> exit
Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

这篇关于Ubuntu 22.04 安装Oracle 11g Express Edition的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/945994

相关文章

mac安装nvm(node.js)多版本管理实践步骤

《mac安装nvm(node.js)多版本管理实践步骤》:本文主要介绍mac安装nvm(node.js)多版本管理的相关资料,NVM是一个用于管理多个Node.js版本的命令行工具,它允许开发者在... 目录NVM功能简介MAC安装实践一、下载nvm二、安装nvm三、安装node.js总结NVM功能简介N

python安装whl包并解决依赖关系的实现

《python安装whl包并解决依赖关系的实现》本文主要介绍了python安装whl包并解决依赖关系的实现,文中通过图文示例介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面... 目录一、什么是whl文件?二、我们为什么需要使用whl文件来安装python库?三、我们应该去哪儿下

MySQL安装时initializing database失败的问题解决

《MySQL安装时initializingdatabase失败的问题解决》本文主要介绍了MySQL安装时initializingdatabase失败的问题解决,文中通过图文介绍的非常详细,对大家的学... 目录问题页面:解决方法:问题页面:解决方法:1.勾选红框中的选项:2.将下图红框中全部改为英

MySQL9.0默认路径安装下重置root密码

《MySQL9.0默认路径安装下重置root密码》本文主要介绍了MySQL9.0默认路径安装下重置root密码,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们... 目录问题描述环境描述解决方法正常模式下修改密码报错原因问题描述mysqlChina编程采用默认安装路径,

Python使用国内镜像加速pip安装的方法讲解

《Python使用国内镜像加速pip安装的方法讲解》在Python开发中,pip是一个非常重要的工具,用于安装和管理Python的第三方库,然而,在国内使用pip安装依赖时,往往会因为网络问题而导致速... 目录一、pip 工具简介1. 什么是 pip?2. 什么是 -i 参数?二、国内镜像源的选择三、如何

oracle DBMS_SQL.PARSE的使用方法和示例

《oracleDBMS_SQL.PARSE的使用方法和示例》DBMS_SQL是Oracle数据库中的一个强大包,用于动态构建和执行SQL语句,DBMS_SQL.PARSE过程解析SQL语句或PL/S... 目录语法示例注意事项DBMS_SQL 是 oracle 数据库中的一个强大包,它允许动态地构建和执行

Ubuntu固定虚拟机ip地址的方法教程

《Ubuntu固定虚拟机ip地址的方法教程》本文详细介绍了如何在Ubuntu虚拟机中固定IP地址,包括检查和编辑`/etc/apt/sources.list`文件、更新网络配置文件以及使用Networ... 1、由于虚拟机网络是桥接,所以ip地址会不停地变化,接下来我们就讲述ip如何固定 2、如果apt安

Python安装时常见报错以及解决方案

《Python安装时常见报错以及解决方案》:本文主要介绍在安装Python、配置环境变量、使用pip以及运行Python脚本时常见的错误及其解决方案,文中介绍的非常详细,需要的朋友可以参考下... 目录一、安装 python 时常见报错及解决方案(一)安装包下载失败(二)权限不足二、配置环境变量时常见报错及

PLsql Oracle 下载安装图文过程详解

《PLsqlOracle下载安装图文过程详解》PL/SQLDeveloper是一款用于开发Oracle数据库的集成开发环境,可以通过官网下载安装配置,并通过配置tnsnames.ora文件及环境变... 目录一、PL/SQL Developer 简介二、PL/SQL Developer 安装及配置详解1.下

MySQL8.2.0安装教程分享

《MySQL8.2.0安装教程分享》这篇文章详细介绍了如何在Windows系统上安装MySQL数据库软件,包括下载、安装、配置和设置环境变量的步骤... 目录mysql的安装图文1.python访问网址2javascript.点击3.进入Downloads向下滑动4.选择Community Server5.