0


银河麒麟Kylin_s10_sp2安装Oracle11g(FS)(亲测有效)

#!/bin/bash

OS: Kylin-Server-10-SP2-Release-Build09-20210524-x86_64

内存:8G

业务系统:核算系统

主机名:shhs52

IP地址:192.168.1.52

db name: shhsdb

instance name: shhsdb

数据库版本: Oracle 11g FS

所涉及到的软件包可以从redhat7.9(centos7.9等)提取

作者shannon,微信号shannon3730,转载请加上作者信息。

##修改内存大小,设置网卡

2C 8G;1个网卡

##手动设置IP

shhs52:

192.168.1.52

##配置光盘源,安装依赖

cd /etc/yum.repos.d

mkdir bk

mv kylin*.repo bk/

cat << EOF >> local-source.repo

[kylin]

name=kylin

baseurl=file:///mnt

gpgcheck=0

enabled=1

EOF

cat local-source.repo

挂载系统iso到/mnt

mount /dev/cdrom /mnt

dnf clean all

mount /dev/cdrom /mnt

dnf list

mount /dev/cdrom /mnt

From Public Yum or ULN

dnf -y install autoconf

dnf -y install automake

dnf -y install binutils

dnf -y install binutils-devel

dnf -y install bison

dnf -y install dos2unix

dnf -y install ftp

#dnf -y install cpp

#dnf -y install gcc

#dnf -y install gcc-c++

dnf -y install lrzsz

dnf -y install python-devel

dnf -y install compat-db*

dnf -y install compat-gcc-34

dnf -y install compat-gcc-34-c++

dnf -y install compat-libcap1

dnf -y install compat-libstdc++-33

dnf -y install compat-libstdc++-33.i686

dnf -y install glibc-*

dnf -y install glibc-*.i686

dnf -y install libXpm-*.i686

dnf -y install libXp.so.6

dnf -y install libXt.so.6

dnf -y install libXtst.so.6

dnf -y install libXext

dnf -y install libXext.i686

dnf -y install libXtst

dnf -y install libXtst.i686

dnf -y install libX11

dnf -y install libX11.i686

dnf -y install libXau

dnf -y install libXau.i686

dnf -y install libxcb

dnf -y install libxcb.i686

dnf -y install libXi

dnf -y install libXi.i686

dnf -y install libgcc_s.so.1

dnf -y install libstdc++.i686

dnf -y install libstdc++-devel

dnf -y install libstdc++-devel.i686

#dnf -y install libaio

#dnf -y install libaio.i686

#dnf -y install libaio-devel

#dnf -y install libaio-devel.i686

dnf -y install ksh

dnf -y install libXp

dnf -y install libaio-devel

dnf -y install numactl

dnf -y install numactl-devel

dnf -y install make -y

dnf -y install sysstat -y

dnf -y install unixODBC

dnf -y install unixODBC-devel

dnf -y install elfutils-libelf-devel-0.97

dnf -y install elfutils-libelf-devel

dnf -y install redhat-lsb-core

dnf -y install unzip

dnf -y install vnc

dnf -y install libnsl

dnf -y install make

dnf -y install cmake

dnf install -y kmod

dnf install -y kmod-libs

dnf install -y readline

dnf install -y readline-devel

dnf install -y rlwrap

dnf -y install kmod-redhat-oracleasm

#包自备

rpm -ivh compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm

rpm -ivh compat-libcap1-1.10-7.el7.x86_64.rpm

rpm -ivh libnsl-2.28-49.p02.ky10.x86_64.rpm

rpm -ivh ipmiutil-3.1.8-1_el8.x86_64.rpm

rpm -q compat-libstdc++-33 compat-libcap1 readline readline-devel rlwrap ipmiutil

##libaio版本降级

#卸载

rpm -qa|grep libaio

rpm -e --nodeps libaio-devel-0.3.112-1.p01.ky10.x86_64

rpm -e --nodeps libaio-0.3.112-1.p01.ky10.x86_64

#安装

su - root

cd /backup/libaio

ls

#包自备

rpm -ivh libaio-0.3.109-13.el7.i686.rpm

rpm -ivh libaio-devel-0.3.109-13.el7.i686.rpm

rpm -ivh libaio-0.3.109-13.el7.x86_64.rpm

rpm -ivh libaio-devel-0.3.109-13.el7.x86_64.rpm

##gcc降级到4.8.5

#备份

mv /usr/bin/gcc /usr/bin/gcc-7.3

mv /usr/bin/g++ /usr/bin/g++-7.3

#拷贝gcc4.8.5和gcc-c++-4.8.5到/backup/gcc,安装

cd /backup/gcc

rpm -ivh *.rpm --nodeps --force

#包从centos7.9中提取

1:cpp-4.8.5-44.el7.x86_64.rpm

2:gcc-4.8.5-44.el7.x86_64.rpm

3:glibc-devel-2.17-317.el7.x86_64.rpm

4:glibc-headers-2.17-317.el7.x86_64.rpm

5:kernel-headers-3.10.0-1160.el7.x86_64.rpm

6:libmpc-1.0.1-3.el7.x86_64.rpm

7:mpfr-3.1.1-4.el7.x86_64.rpm

8:autogen-libopts-5.18-5.el7.x86_64.rpm

9:gcc-c++-4.8.5-44.el7.x86_64.rpm

10:keyutils-libs-devel-1.5.8-3.el7.x86_64.rpm

11:krb5-devel-1.15.1-50.el7.x86_64.rpm

12:libcom_err-1.42.9-19.el7.x86_64.rpm

13:libselinux-devel-2.5-15.el7.x86_64.rpm

14:libsepol-devel-2.5-10.el7.x86_64.rpm

15:libstdc++-4.8.5-44.el7.x86_64

16:libstdc++-devel-4.8.5-44.el7.x86_64.rpm

17:libverto-devel-0.2.5-4.el7.x86_64.rpm

18:ntp-4.2.6p5-29.el7.centos.2.x86_64.rpm

19:ntpdate-4.2.6p5-29.el7.centos.2.x86_64.rpm

20:openssl-1:1.0.2k-19.el7.x86_64.rpm

21:openssl098e-0.9.8e-29.el7.centos.3.x86_64.rpm

22:openssl-devel-1:1.0.2k-19.el7.x86_64.rpm

23:openssl-libs-1:1.0.2k-19.el7.x86_64.rpm

24:pcre-devel-8.32-17.el7.x86_64.rpm

25:pkgconfig-1:0.27.1-4.el7.x86_64.rpm

26:tcl-1:8.5.13-8.el7.x86_64.rpm

27:zlib-1.2.7-18.el7.x86_64.rpm

28:zlib-devel-1.2.7-18.el7.x86_64.rpm

#验证

gcc -v

g++ -v

#查看libstdc是否安装上

rpm -qa|grep libstdc

libstdc++-4.8.5-44.el7.x86_64

libstdc++-devel-4.8.5-44.el7.x86_64

##编译安装rlwrap-0.42

su - root

cp rlwrap-0.42.tar.gz /tmp

cd /tmp

tar -zxvf rlwrap-0.42.tar.gz

cd rlwrap-0.42/

./configure

make && make install

which rlwrap

rlwrap -version

##设置主机名

hostnamectl set-hostname shhs52

hostname

##设置hosts

echo "192.168.1.52 shhs52" >> /etc/hosts

cat /etc/hosts

##设置英文环境

echo "export LANG=en_US.UTF-8" >> ~/.bash_profile

cat ~/.bash_profile

##配置用户和组

/usr/sbin/groupadd -g 60001 oinstall

/usr/sbin/groupadd -g 60002 dba

/usr/sbin/groupadd -g 60003 oper

useradd -u 61001 -g oinstall -G dba,oper oracle

#passwd oracle

echo "oracle" | passwd --stdin oracle

##创建目录和权限

mkdir -p /oracle

mkdir -p /oracle/app/oracle/product/11.2.0

mkdir -p /oracle/app/oraInventory

chown -R oracle:oinstall /oracle

chown -R oracle:oinstall /oradata

chown -R oracle:oinstall /archive

chown -R oracle:oinstall /backup

chmod -R 775 /oracle

chmod -R 775 /oradata

chmod -R 775 /archive

chmod -R 775 /backup

##配置系统限制

cat << EOF >> /etc/security/limits.conf

#ORACLE SETTING

oracle soft nproc 16384

oracle hard nproc 16384

oracle soft nofile 16384

oracle hard nofile 65536

oracle soft stack 10240

oracle hard stack 32768

oracle hard memlock 6000000

oracle soft memlock 6000000

EOF

cat /etc/security/limits.conf

echo "* soft nproc 16384" > /etc/security/limits.d/20-nproc.conf

cat /etc/security/limits.d/20-nproc.conf

echo "session required pam_limits.so" >> /etc/pam.d/login

cat /etc/pam.d/login

##修改内核参数,物理内存8G

cat << EOF >> /etc/sysctl.conf

#ORACLE SETTING

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 9000 65500

net.core.rmem_default = 262144

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048586

kernel.panic_on_oops = 1

kernel.shmmax = 5033164800

kernel.shmall = 2097152

kernel.shmmni = 4096

vm.nr_hugepages = 2500

EOF

cat /etc/sysctl.conf

sysctl -p

##关闭透明页

cat << EOF >> /etc/rc.d/rc.local

if test -f /sys/kernel/mm/transparent_hugepage/enabled; then

echo never > /sys/kernel/mm/transparent_hugepage/enabled

fi

if test -f /sys/kernel/mm/transparent_hugepage/defrag; then

echo never > /sys/kernel/mm/transparent_hugepage/defrag

fi

EOF

cat /etc/rc.d/rc.local

chmod +x /etc/rc.d/rc.local

##关闭NUMA功能

sed -ie 's/rhgb quiet/rhgb quiet numa=off/g' /etc/default/grub

cat /etc/default/grub

grub2-mkconfig -o /etc/grub2.cfg

##关闭selinux

sed 's/SELINUX=enforcing/SELINUX=disabled/g' -i /etc/selinux/config

setenforce 0

##关闭防火墙

systemctl stop firewalld.service

systemctl disable firewalld.service

#systemctl status firewalld.service

##配置oracle环境变量

cat << EOF >> /home/oracle/.bash_profile

export PS1="[`whoami`@`hostname`:"'$PWD]$'

export TMP=/tmp

export TMPDIR=$TMP

export LANG=en_US.UTF-8

#export LANG=zh_CN.UTF-8

export ORACLE_UNQNAME=shhsdb

export ORACLE_SID=shhsdb

export ORACLE_BASE=/oracle/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1

export ORACLE_TERM=xterm

export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"

export NLS_LANG=AMERICAN_AMERICA.UTF8

export PATH=.:$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:/usr/ccs/bin

export THREADS_FLAG=native

umask=022

alias sqlplus='rlwrap sqlplus'

alias rman='rlwrap rman'

EOF

cat /home/oracle/.bash_profile


Oracle 11gr2 11.2.0.4安装,补丁220118


##上传软件并解压

#上传至backup文件夹

su - root

cd /backup

unzip p13390677_112040_Linux-x86-64_database.zip

chown -R oracle:oinstall /backup

chmod -R 775 /backup

##替换unzip,oracle11g自带的unzip安装会出错

su - oracle

cd /backup/database/install

mv unzip unzip.bak

ln -s /usr/bin/unzip .

##安装

su - oracle

vncserver

--vncserver -list

--vnc

xhost +

env|grep ORACLE

cd /backup/database

ls

./runInstaller

#./runInstaller -jreLoc $JRE_HOME

#./runInstaller -jreLoc /etc/alternatives/jre

#跳出对话框“agent nmhs”,也需要修改ins_emagent.mk 176行

sed -i 's/^(\s$(MK_EMAGENT_NMECTL))\s$/\1 -lnnz11/g' /oracle/app/oracle/product/11.2.0/db_1/sysman/lib/ins_emagent.mk

#以ROOT执行脚本

  1. /oracle/app/oraInventory/orainstRoot.sh

  2. /oracle/app/oracle/product/11.2.0/db_1/root.sh

##创建监听

su - oracle

netca

netstat -an|grep 1521

##创建实例

dbca

shhsdb

存储位置

/oradata

##Oracle 11g 安装后设置

#180天密码过期

alter profile default limit PASSWORD_LIFE_TIME UNLIMITED;

#关闭审计

alter system set audit_trail=none scope=spfile;

shutdown immediate

startup

#关闭所有数据库服务,备份一次安装代码

lsnrctl stop

emctl stop dbconsole

sqlplus / as sysdba

shutdown immediate;

exit;

su - root

cd /

tar -zcvf oracle_20221005.tar.gz /oracle

#设置自动启动

设置dbstart、dbshut的80、50行

sed 's/ORACLE_HOME_LISTNER=$1/ORACLE_HOME_LISTNER=$ORACLE_HOME/g' -i /oracle/app/oracle/product/11.2.0/db_1/bin/dbstart

sed 's/ORACLE_HOME_LISTNER=$1/ORACLE_HOME_LISTNER=$ORACLE_HOME/g' -i /oracle/app/oracle/product/11.2.0/db_1/bin/dbshut

设置开机自启动项

sed 's/db_1:N/db_1:Y/g' -i /etc/oratab

vi /etc/oratab

cat /etc/oratab

cat<<EOF>> /etc/rc.d/rc.local

su - oracle -lc "/oracle/app/oracle/product/11.2.0/db_1/bin/lsnrctl start"

su - oracle -lc "/oracle/app/oracle/product/11.2.0/db_1/bin/dbstart"

su - oracle -lc "/oracle/app/oracle/product/11.2.0/db_1/bin/emctl start dbconsole"

EOF

ll /etc/rc.d/rc.local

chmod +x /etc/rc.d/rc.local

cat /etc/rc.d/rc.local

#reboot

###Oracle 11g 简单操作

#创建数据库表、用户、授权

create tablespace itpux datafile '/oradata/shhsdb/itpux01.dbf' size 20m;

#create tablespace itpux datafile '/oradata/SHHSDB/itpux01.dbf' size 20m;

create user itpux identified by itpux123 default tablespace itpux;

grant dba to itpux;

#创建表

sqlplus "/as sysdba";

conn itpux/itpux123;

create table hs_itpuxt1(id number(12) primary key, name varchar(20)) ;

insert into hs_itpuxt1 values(1,'hsxtitpux01');

insert into hs_itpuxt1 values(2,'hsxtitpux02');

commit;

select * from hs_itpuxt1;

标签: kylin linux 大数据

本文转载自: https://blog.csdn.net/airwolfzhao34/article/details/128182586
版权归原作者 airwolfzhao34 所有, 如有侵权,请联系我们删除。

“银河麒麟Kylin_s10_sp2安装Oracle11g(FS)(亲测有效)”的评论:

还没有评论