CentOS上快速安装Oracle11g数据库

下载RMP-GPG-KEY

wget http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol7 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle

oracle-rdbms-server-11gR2-preinstall包所干的事情

  • (1)自动安装oracle所需的RPM包
  • (2)自动创建oracle用户和group组
  • (3)自动配置/etc/sysctl.conf内核参数
  • (4)自动配置/etc/security/limits.conf参数
  • (5)关闭NUMA=OFF (关闭非一致内存访问)

安装必要软件

groupadd dba && useradd -m -G dba oracle && mkdir /u01 && chown oracle:dba /u01
yum install -y oracle-rdbms-server-11gR2-preinstall glibc-static wget unzip && yum clean all

保存脚本

mkdir -p /install
cd /install
wget https://raw.githubusercontent.com/YunWisdom/docker-oracle-ee-11g/master/oracle-11g-ee-base/install/oracle-11g-ee.rsp
wget https://raw.githubusercontent.com/YunWisdom/docker-oracle-ee-11g/master/oracle-11g-ee-base/install/oracle_install.sh
wget https://raw.githubusercontent.com/YunWisdom/docker-oracle-ee-11g/master/entrypoint.sh
wget https://raw.githubusercontent.com/YunWisdom/docker-oracle-ee-11g/master/Dockerfile

下载Oracle安装包

官网下载地址:https://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-linx8664soft-100572.html

# 请执行修改下载链接,AuthParam会自动过期
wget -q -O linux.x64_11gR2_database_1of2.zip https://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_1of2.zip?AuthParam=1561389203_9ccc19db849275e4a7d668f4607586ee# 请执行修改下载链接,AuthParam会自动过期
wget -q -O linux.x64_11gR2_database_2of2.zip https://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_2of2.zip?AuthParam=1561389203_9ccc19db849275e4a7d668f4607586ee

设置环境变量

# ~/.bash_profile文件追加环境变量
vim ~/.bash_profileexport DBCA_TOTAL_MEMORY=32768
export WEB_CONSOLE="true"
export ORACLE_SID=BRCGS
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/BRCGSPATH=$PATH:$ORACLE_HOME/bin
export PATH # ~/.bash_profile修改配置生效
source ~/.bash_profile

执行脚本oracle_install.sh

#!/bin/bashset -e#Delete limits cause of docker limits issue
cat /etc/security/limits.conf | grep -v oracle | tee /etc/security/limits.confecho 'cd /install dir '
cd /install/echo 'Downloading linux.x64_11gR2_database_1of2.zip'
#wget -q -O linux.x64_11gR2_database_1of2.zip http://10.0.1.4:8080/linux.x64_11gR2_database_1of2.zip
echo 'Downloading linux.x64_11gR2_database_2of2.zip'
#wget -q -O linux.x64_11gR2_database_2of2.zip http://10.0.1.4:8080/linux.x64_11gR2_database_2of2.zipecho 'Unzipping'
unzip -q linux.x64_11gR2_database_1of2.zip
unzip -q linux.x64_11gR2_database_2of2.zip
#rm -f linux*.zipmv database /home/oracle/su oracle -c 'cd /home/oracle/database && ./runInstaller -ignorePrereq -ignoreSysPrereqs -silent -responseFile /install/oracle-11g-ee.rsp -waitForCompletion 2>&1'
rm -rf /home/oracle/databasemv /u01/app/oracle/product /u01/app/oracle-product#/u01/app/oraInventory/orainstRoot.sh
#/u01/app/oracle/product/11.2.0/BRCGS/root.sh
#$ORACLE_HOME/bin/dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname BRCGS -sid BRCGS -responseFile NO_VALUE -totalMemory 2048 -emConfiguration LOCAL  -sysPassword oracle -systemPassword oracle -dbsnmpPassword oracle

执行脚本entrypoint.sh

#!/bin/bash
set -e# Prevent owner issues on mounted folders
echo "Preparing oracle installer."
chown -R oracle:dba /u01/app/oracle
rm -f /u01/app/oracle/product
ln -s /u01/app/oracle-product /u01/app/oracle/product#Run Oracle root scripts
echo "Running root scripts."
/u01/app/oraInventory/orainstRoot.sh 2>&1
echo | /u01/app/oracle/product/11.2.0/BRCGS/root.sh 2>&1 || trueimpdp () {set +eDUMP_FILE=$(basename "$1")DUMP_NAME=${DUMP_FILE%.dmp} cat > /tmp/impdp.sql << EOL
-- Impdp User
CREATE USER IMPDP IDENTIFIED BY IMPDP;
ALTER USER IMPDP ACCOUNT UNLOCK;
GRANT dba TO IMPDP WITH ADMIN OPTION;
-- New Scheme User
create or replace directory IMPDP as '/docker-entrypoint-initdb.d';
create tablespace $DUMP_NAME datafile '/u01/app/oracle/oradata/$DUMP_NAME.dbf' size 1000M autoextend on next 100M maxsize unlimited;
create user $DUMP_NAME identified by $DUMP_NAME default tablespace $DUMP_NAME;
alter user $DUMP_NAME quota unlimited on $DUMP_NAME;
alter user $DUMP_NAME default role all;
grant all to $DUMP_NAME;
exit;
EOLsu oracle -c "NLS_LANG=.$CHARACTER_SET $ORACLE_HOME/bin/sqlplus -S / as sysdba @/tmp/impdp.sql"su oracle -c "NLS_LANG=.$CHARACTER_SET $ORACLE_HOME/bin/impdp IMPDP/IMPDP directory=IMPDP dumpfile=$DUMP_FILE $IMPDP_OPTIONS"#Disable IMPDP userecho -e 'ALTER USER IMPDP ACCOUNT LOCK;\nexit;' | su oracle -c "NLS_LANG=.$CHARACTER_SET $ORACLE_HOME/bin/sqlplus -S / as sysdba"set -e
}case "$1" in'')#Check for mounted database filesif [ "$(ls -A /u01/app/oracle/oradata)" ]; thenecho "found files in /u01/app/oracle/oradata Using them instead of initial database"echo "BRCGS:$ORACLE_HOME:N" >> /etc/oratabchown oracle:dba /etc/oratabchown 664 /etc/oratabrm -rf /u01/app/oracle-product/11.2.0/BRCGS/dbsln -s /u01/app/oracle/dbs /u01/app/oracle-product/11.2.0/BRCGS/dbs#Startup Databasesu oracle -c "/u01/app/oracle/product/11.2.0/BRCGS/bin/tnslsnr &"su oracle -c 'echo startup\; | $ORACLE_HOME/bin/sqlplus -S / as sysdba'elseecho "Database not initialized. Initializing database."export IMPORT_FROM_VOLUME=trueif [ -z "$CHARACTER_SET" ]; thenexport CHARACTER_SET="AL32UTF8"fi#printf "Setting up:\nprocesses=$processes\nsessions=$sessions\ntransactions=$transactions\n"mv /u01/app/oracle-product/11.2.0/BRCGS/dbs /u01/app/oracle/dbsln -s /u01/app/oracle/dbs /u01/app/oracle-product/11.2.0/BRCGS/dbsecho "Starting tnslsnr"su oracle -c "/u01/app/oracle/product/11.2.0/BRCGS/bin/tnslsnr &"#create DB for SID: BRCGSecho "Running initialization by dbca"su oracle -c "$ORACLE_HOME/bin/dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname BRCGS -sid BRCGS -responseFile NO_VALUE -characterSet $CHARACTER_SET -totalMemory $DBCA_TOTAL_MEMORY -emConfiguration LOCAL -dbsnmpPassword oracle -sysPassword oracle -systemPassword oracle"# echo "Configuring Apex console"# cd $ORACLE_HOME/apex# su oracle -c 'echo -e "0Racle$\n8080" | $ORACLE_HOME/bin/sqlplus -S / as sysdba @apxconf > /dev/null'# su oracle -c 'echo -e "${ORACLE_HOME}\n\n" | $ORACLE_HOME/bin/sqlplus -S / as sysdba @apex_epg_config_core.sql > /dev/null'# su oracle -c 'echo -e "ALTER USER ANONYMOUS ACCOUNT UNLOCK;" | $ORACLE_HOME/bin/sqlplus -S / as sysdba > /dev/null'# echo "Database initialized. Please visit http://#containeer:8080/em http://#containeer:8080/apex for extra configuration if needed"fiif [ $WEB_CONSOLE == "true" ]; thenecho 'Starting web management console'su oracle -c 'echo EXEC DBMS_XDB.sethttpport\(8080\)\; | $ORACLE_HOME/bin/sqlplus -S / as sysdba'elseecho 'Disabling web management console'su oracle -c 'echo EXEC DBMS_XDB.sethttpport\(0\)\; | $ORACLE_HOME/bin/sqlplus -S / as sysdba'fiif [ $IMPORT_FROM_VOLUME ]; thenecho "Starting import from '/docker-entrypoint-initdb.d':"for f in /docker-entrypoint-initdb.d/*; doecho "found file /docker-entrypoint-initdb.d/$f"case "$f" in*.sh)     echo "[IMPORT] $0: running $f"; . "$f" ;;*.sql)    echo "[IMPORT] $0: running $f"; echo "exit" | su oracle -c "NLS_LANG=.$CHARACTER_SET $ORACLE_HOME/bin/sqlplus -S / as sysdba @$f"; echo ;;*.dmp)    echo "[IMPORT] $0: running $f"; impdp $f ;;*)        echo "[IMPORT] $0: ignoring $f" ;;esacechodoneecho "Import finished"echoelseecho "[IMPORT] Not a first start, SKIPPING Import from Volume '/docker-entrypoint-initdb.d'"echo "[IMPORT] If you want to enable import at any state - add 'IMPORT_FROM_VOLUME=true' variable"echofiecho "Database ready to use. Enjoy! ;)"#### Workaround for graceful shutdown.##while [ "$END" == '' ]; dosleep 1trap "su oracle -c 'echo shutdown immediate\; | $ORACLE_HOME/bin/sqlplus -S / as sysdba'" INT TERMdone;;*)echo "Database is not configured. Please run '/entrypoint.sh' if needed."exec "$@";;
esac

如果没有报错的话,到此oracle11g就安装完毕了

CentOS上快速安装Oracle11g数据库相关推荐

  1. CentOS上快速安装Oracle服务器脚本

    CentOS上快速安装Oracle服务器脚本 配置repos源 # 注释下列代码,可能导致源问题 # cd /etc/yum.repos.d # wget http://yum.oracle.com/ ...

  2. m1芯片安装Oracle11g数据库

    我是2021m1pro版本,安装了pd虚拟机Win11系统,在win11上成功安装Oracle11g数据库,后面改了一下监听文件使用Navicat成功连接数据库!

  3. CentOS 7.2安装Oracle数据库

    1   安装环境 本文在虚拟机CentOS系统上安装oracle数据库,具体版本信息如下 软件  版本       文件名 备注 Vmware workstation 12.0.0 VMware-wo ...

  4. Postgresql在CentOS上的安装(脚本在线安装)

    场景 PostGresSQL简介与Windows上的安装教程: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/113981563 ...

  5. Linux上快速安装软RAID详细步骤

    物理环境:虚拟机CentOS6.4 配置:8G内存.2*2核cpu.3块虚拟硬盘(sda,sdb,sdc,sdb和sdc是完全一样的) 在实际生产环境中,系统硬盘与数据库和应用是分开的,这样有利于系统 ...

  6. 安装flarum的php扩展,在 Windows 上快速安装 Flarum 指南

    在 Windows 上快速安装 Flarum 指南 由 学院君 创建于5年前, 最后更新于 10个月前 版本号 #2 17639 views 6 likes 0 collects 1.下载安装包 去下 ...

  7. 在PK体系下的CentOS上编译安装 MySQL 5.7

    本文主要介绍如何在 PK 体系下的 CentOS 上编译安装 MySQL 5.7,本文使用的操作系统环境为: CentOS 版本: # cat /etc/redhat-release CentOS L ...

  8. centos llvm安装_在CentOS上编译安装llvm-3.8.1详细教程

    在CentOS上编译安装llvm-3.8.1详细教程 2020/1/11  18:12 1682次 注:CentOS版本是6.8,6.x版本的操作类似 安装需求: [list] [*]Cmake: 3 ...

  9. Docker快速安装Sybase数据库DBeaver数据库图形化管理开发工具

    Docker快速安装Sybase数据库 Sybase 15.7 Based on ifnazar/sybase_15_7 Needs about 30 seconds after start for ...

最新文章

  1. 04. Mybatis的resultMap基本应用
  2. 2019年平面设计趋势
  3. pmcaff智囊团开通啦!能人大拿集聚地,名额有限,速度哟~
  4. rsync 相关参数
  5. 【emWin】例程十五:触摸校准实例——五点校准法
  6. Java 1.2.3 文件输入与输出
  7. centos arm-linux-gcc,CentOS 5.5下arm-linux-gcc交叉编译环境的搭建
  8. 什么是mysql事物定义_MySQL中事务概念的简洁学习教程
  9. char* 和char[]的差别
  10. pscc2019滤镜抽出_「PS-CC2019新版教程」魔棒工具,让你一秒钟完成抠图-基础篇
  11. 日语学习|如何快速有效地记忆日语五十音图?
  12. 贵港职称计算机考试网,贵港工程师职称等级时间
  13. Java基础之面向切面编程@Aspect
  14. (二)大话深度学习编译器中的自动调优·DSL与IR
  15. 信捷PLC中Y0用C语言怎么表示,信捷PLC
  16. char、char*和char**区别与联系(入门级)
  17. php 生成各种文件格式
  18. UED专栏 | 携程机票订后服务“航班助手”的三大设计秘籍
  19. web服务器的网站选项,Web服务器配置方法(2)
  20. 魅族html查看程序退出,魅族MX2左下角屏幕失灵自动点击怎么解决_魅族2程序自动返回退出的原因...

热门文章

  1. HTML5: 利用SVG动画动态绘制文字轮廓边框线条
  2. 开启Windows或者Mac OSX 本地服务器 (非安装第三方服务器软件)
  3. php输入流php://input的使用分析
  4. Python实例讲解 -- 接收邮件 (亲测)
  5. codeigniter 辅助函数 - 敏感词过滤
  6. KMP——怪盗基德的挑战书(hdu4552)
  7. IAR #pragma optimize 指令
  8. vs2005常用的调试方法
  9. 华为机试——简单密码
  10. 【BIOS来电重启】Restore AC Power Loss