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

相关文章

在Ubuntu上打不开GitHub的完整解决方法

《在Ubuntu上打不开GitHub的完整解决方法》当你满心欢喜打开Ubuntu准备推送代码时,突然发现终端里的gitpush卡成狗,浏览器里的GitHub页面直接变成Whoathere!警告页面... 目录一、那些年我们遇到的"红色惊叹号"二、三大症状快速诊断症状1:浏览器直接无法访问症状2:终端操作异常

python依赖管理工具UV的安装和使用教程

《python依赖管理工具UV的安装和使用教程》UV是一个用Rust编写的Python包安装和依赖管理工具,比传统工具(如pip)有着更快、更高效的体验,:本文主要介绍python依赖管理工具UV... 目录前言一、命令安装uv二、手动编译安装2.1在archlinux安装uv的依赖工具2.2从github

Ubuntu向多台主机批量传输文件的流程步骤

《Ubuntu向多台主机批量传输文件的流程步骤》:本文主要介绍在Ubuntu中批量传输文件到多台主机的方法,需确保主机互通、用户名密码统一及端口开放,通过安装sshpass工具,准备包含目标主机信... 目录Ubuntu 向多台主机批量传输文件1.安装 sshpass2.准备主机列表文件3.创建一个批处理脚

JDK8(Java Development kit)的安装与配置全过程

《JDK8(JavaDevelopmentkit)的安装与配置全过程》文章简要介绍了Java的核心特点(如跨平台、JVM机制)及JDK/JRE的区别,重点讲解了如何通过配置环境变量(PATH和JA... 目录Java特点JDKJREJDK的下载,安装配置环境变量总结Java特点说起 Java,大家肯定都

Oracle数据库在windows系统上重启步骤

《Oracle数据库在windows系统上重启步骤》有时候在服务中重启了oracle之后,数据库并不能正常访问,下面:本文主要介绍Oracle数据库在windows系统上重启的相关资料,文中通过代... oracle数据库在Windows上重启的方法我这里是使用oracle自带的sqlplus工具实现的方

Oracle Scheduler任务故障诊断方法实战指南

《OracleScheduler任务故障诊断方法实战指南》Oracle数据库作为企业级应用中最常用的关系型数据库管理系统之一,偶尔会遇到各种故障和问题,:本文主要介绍OracleSchedul... 目录前言一、故障场景:当定时任务突然“消失”二、基础环境诊断:搭建“全局视角”1. 数据库实例与PDB状态2

oracle 11g导入\导出(expdp impdp)之导入过程

《oracle11g导入导出(expdpimpdp)之导入过程》导出需使用SEC.DMP格式,无分号;建立expdir目录(E:/exp)并确保存在;导入在cmd下执行,需sys用户权限;若需修... 目录准备文件导入(impdp)1、建立directory2、导入语句 3、更改密码总结上一个环节,我们讲了

RabbitMQ 延时队列插件安装与使用示例详解(基于 Delayed Message Plugin)

《RabbitMQ延时队列插件安装与使用示例详解(基于DelayedMessagePlugin)》本文详解RabbitMQ通过安装rabbitmq_delayed_message_exchan... 目录 一、什么是 RabbitMQ 延时队列? 二、安装前准备✅ RabbitMQ 环境要求 三、安装延时队

Ubuntu如何升级Python版本

《Ubuntu如何升级Python版本》Ubuntu22.04Docker中,安装Python3.11后,使用update-alternatives设置为默认版本,最后用python3-V验证... 目China编程录问题描述前提环境解决方法总结问题描述Ubuntu22.04系统自带python3.10,想升级

linux系统上安装JDK8全过程

《linux系统上安装JDK8全过程》文章介绍安装JDK的必要性及Linux下JDK8的安装步骤,包括卸载旧版本、下载解压、配置环境变量等,强调开发需JDK,运行可选JRE,现JDK已集成JRE... 目录为什么要安装jdk?1.查看linux系统是否有自带的jdk:2.下载jdk压缩包2.解压3.配置环境