Ubuntu 22.04 安装Oracle 11g Express Edition

锦通  金牌会员 | 2024-8-24 01:34:55 | 显示全部楼层 | 阅读模式
打印 上一主题 下一主题

主题 554|帖子 554|积分 1662

目次
一、系统环境
二、预安装软件
三、安装Oracle
四、登录数据库



Ubuntu 22.04上安装Oracle 11g Express Edition的过程,因为oracle没有提供Ubuntu系统deb格式安装包,我这里是转换得到文件。鉴于oralce官网不再提供oracle 11g xe的安装包下载,需要的朋友可以评论留下邮箱,我会在看到后回复给大家。

一、系统环境

   操作系统:Ubuntu 22.04.4 LTS
  数据库版本:Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
  安装方式:deb安装包
  
二、预安装软件


1.先通过unzip命令解压
如果没有命令,请通过apt install unzip安装
  1. unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip
复制代码
2.安装预先安装的包和依赖程序
  1. sudo apt-get install alien libaio1 unixodbc
复制代码
3.将RPM安装包转换成DEB格式
这里正常的rpm文件路径在DISK下面
  1. cd ./oracle-xe-11.2.0-1.0.x86_64.rpm/Disk1/
复制代码
  1. sudo alien --scripts -d oracle-xe-11.2.0-1.0.x86_64.rpm
复制代码
4.创建管理服务chkconfig的脚本
  1. sudo vim /sbin/chkconfig
复制代码
添加下面的内容并生存
  1. #!/bin/bash
  2. # Oracle 11gR2 XE installer chkconfig hack for Ubuntu
  3. file=/etc/init.d/oracle-xe
  4. if [[ ! `tail -n1 $file | grep INIT` ]]; then
  5. echo >> $file
  6. echo '### BEGIN INIT INFO' >> $file
  7. echo '# Provides: OracleXE' >> $file
  8. echo '# Required-Start: $remote_fs $syslog' >> $file
  9. echo '# Required-Stop: $remote_fs $syslog' >> $file
  10. echo '# Default-Start: 2 3 4 5' >> $file
  11. echo '# Default-Stop: 0 1 6' >> $file
  12. echo '# Short-Description: Oracle 11g Express Edition' >> $file
  13. echo '### END INIT INFO' >> $file
  14. fi
  15. update-rc.d oracle-xe defaults 80 01
复制代码
4.修改chkconfig文件权限
  1. sudo chmod 755 /sbin/chkconfig  
复制代码
5.设置内核kernel参数
(这是oracle 11g R2 XE安装要求)
  1. sudo vim /etc/sysctl.d/60-oracle.conf
复制代码
添加下面的内容并生存
  1. # Oracle 11g XE kernel parameters  
  2. fs.file-max=6815744  
  3. net.ipv4.ip_local_port_range=9000 65000  
  4. kernel.sem=250 32000 100 128
  5. kernel.shmmax=536870912
复制代码
使用下面命令通过加载内核餐宿
  1. sudo service procps start
复制代码
检查新的参数是否加载乐成
  1. sudo sysctl -q fs.file-max
复制代码
6.设置/dev/shm挂载点
  1. sudo vim /etc/rc2.d/S01shm_load
复制代码
添加下面的内容并生存
  1. #!/bin/sh
  2. case "$1" in
  3. start) mkdir /var/lock/subsys 2>/dev/null
  4.        touch /var/lock/subsys/listener
  5.        rm /dev/shm 2>/dev/null
  6.        mkdir /dev/shm 2>/dev/null
  7.        mount -t tmpfs shmfs -o size=2048m /dev/shm ;;
  8. *) echo error
  9.    exit 1 ;;
  10. esac
复制代码
添加文件权限
  1. sudo chmod 755 /etc/rc2.d/S01shm_load
复制代码
9.重启服务器
  1. reboot
复制代码
三、安装Oracle

1.使用下面命令安装oracle
  1. sudo dpkg --install oracle-xe_11.2.0-2_amd64.deb
复制代码
2.使用下面命令开始配置oracle
  1. sudo /etc/init.d/oracle-xe configure
复制代码
 中途会询问你下面的题目
  1. Specify the HTTP port that will be used for Oracle Application Express [8080]:
  2. # 定义HTTP网站管理的端口,默认直接回车
  3. Specify a port that will be used for the database listener [1521]:
  4. # 定义数据库监听的端口,默认直接回车
  5. Specify a password to be used for database accounts.  Note that the same
  6. password will be used for SYS and SYSTEM.  Oracle recommends the use of
  7. different passwords for each database account.  This can be done after
  8. initial configuration:
  9. Confirm the password:
  10. # 要求你设置系统账号SYS的SYSTEM的密码
  11. Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:y
  12. # 询问是否设置数据库开机启动启动,默认是开机启动,直接回车
复制代码
正常安装乐成的过程日志
  1. root@oracle_01:/# sudo /etc/init.d/oracle-xe configure
  2. Oracle Database 11g Express Edition Configuration
  3. -------------------------------------------------
  4. This will configure on-boot properties of Oracle Database 11g Express
  5. Edition.  The following questions will determine whether the database should
  6. be starting upon system boot, the ports it will use, and the passwords that
  7. will be used for database accounts.  Press <Enter> to accept the defaults.
  8. Ctrl-C will abort.
  9. Specify the HTTP port that will be used for Oracle Application Express [8080]:
  10. Specify a port that will be used for the database listener [1521]:
  11. Specify a password to be used for database accounts.  Note that the same
  12. password will be used for SYS and SYSTEM.  Oracle recommends the use of
  13. different passwords for each database account.  This can be done after
  14. initial configuration:
  15. Confirm the password:
  16. Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:y
  17. Starting Oracle Net Listener...Done
  18. Configuring database...Done
  19. Starting Oracle Database 11g Express Edition instance...Done
  20. Installation completed successfully.
  21. root@oracle_01:/
复制代码
3.设置系统环境变量
  1. sudo vim /etc/profile
复制代码
在最末尾添加下面的内容并生存
  1. # Oracle Settings
  2. TMP=/tmp; export TMP
  3. TMPDIR=$TMP; export TMPDIR
  4. ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
  5. ORACLE_HOME=$ORACLE_BASE/product/11.2.0/xe; export ORACLE_HOME
  6. ORACLE_SID=XE; export ORACLE_SID
  7. ORACLE_TERM=xterm; export ORACLE_TERM
  8. PATH=/usr/sbin:$PATH; export PATH
  9. PATH=$ORACLE_HOME/bin:$PATH; export PATH
  10. TNS_ADMIN=$ORACLE_HOME/network/admin
  11. LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
  12. CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
  13. if [ $USER = "oracle" ]; then
  14.   if [ $SHELL = "/bin/ksh" ]; then
  15.     ulimit -p 16384
  16.     ulimit -n 65536
  17.   else
  18.     ulimit -u 16384 -n 65536
  19.   fi
  20. fi
复制代码
使用下面命令革新使其生效
  1. sudo source /etc/profile
复制代码
4.启动oracle服务
  1. sudo systemctl start oracle-xe
复制代码
5.查看oracle运行状态
  1. sudo systemctl status oracle-xe
复制代码
下面是正常运行的结果
  1. root@oracle_01:/# sudo systemctl status oracle-xe
  2. ● oracle-xe.service - LSB: Oracle 11g Express Edition
  3.      Loaded: loaded (/etc/init.d/oracle-xe; generated)
  4.      Active: active (exited) since Sun 2024-04-28 16:02:02 CST; 27min ago
  5.        Docs: man:systemd-sysv-generator(8)
  6.     Process: 803 ExecStart=/etc/init.d/oracle-xe start (code=exited, status=0/SUCCESS)
  7.         CPU: 61ms
  8. Apr 28 16:01:52 oracle_01 systemd[1]: Starting LSB: Oracle 11g Express Edition...
  9. Apr 28 16:01:53 oracle_01 oracle-xe[803]: Starting Oracle Net Listener.
  10. Apr 28 16:01:53 oracle_01 su[899]: (to oracle) root on none
  11. Apr 28 16:01:53 oracle_01 su[899]: pam_unix(su:session): session opened for user oracle(uid=1002) by (uid=0)
  12. Apr 28 16:01:55 oracle_01 oracle-xe[803]: Starting Oracle Database 11g Express Edition instance.
  13. Apr 28 16:01:55 oracle_01 su[940]: (to oracle) root on none
  14. Apr 28 16:01:55 oracle_01 su[940]: pam_unix(su:session): session opened for user oracle(uid=1002) by (uid=0)
  15. Apr 28 16:02:02 oracle_01 systemd[1]: Started LSB: Oracle 11g Express Edition.
  16. root@oracle_01:/#
复制代码
四、登录数据库

1.使用下面命令用system账号登录
  1. sqlplus system/123456Ab as sysdba;
复制代码
2.登录后实行SQL语句查询数据库版本
  1. select * from v$version;
复制代码
下面是完备登录操作记录
  1. root@oracle_01:/# sqlplus sys/123456Ab as sysdba;
  2. SQL*Plus: Release 11.2.0.2.0 Production on Sun Apr 28 15:59:18 2024
  3. Copyright (c) 1982, 2011, Oracle.  All rights reserved.
  4. Connected to:
  5. Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
  6. SQL> select * from v$version;
  7. BANNER
  8. --------------------------------------------------------------------------------
  9. Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
  10. PL/SQL Release 11.2.0.2.0 - Production
  11. CORE        11.2.0.2.0        Production
  12. TNS for Linux: Version 11.2.0.2.0 - Production
  13. NLSRTL Version 11.2.0.2.0 - Production
  14. SQL> exit
  15. Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
复制代码
到此完结!

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

锦通

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表