分享

10分钟!一键部署Oracle 11GR2单机

 LuciferLiu 2021-12-10

无人值守安装Oracle 11GR2单机,只需要10分钟?没错,通过脚本静默安装,真的只需要10分钟,包括安装补丁,建库。

脚本下载链接SHELL脚本进行oracle数据库一键安装,实现真正的无人值守安装

一、主机准备

主机版本主机内存主机磁盘空间主机网卡主机IP
redhat 7.98G50Geth010.211.55.100

注意:

1.主机内存不得低于2G

2.磁盘空间不得低于50G

二、安装前准备

1.挂载ISO镜像源

##1.通过cdrom挂载
mount /dev/cdrom /mnt

##2.通过安装镜像源挂载
mount -o loop /soft/rhel-server-7.9-x86_64-dvd.iso /mnt

2.创建目录并上传安装介质

##1.创建安装介质上传目录
mkdir /soft
[root@localhost ~]# cd /soft/

##2.上传安装介质
[root@localhost soft]# du -sh *
##linux7系统缺少补丁包
192Kcompat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
##无人值守shell脚本
140KOracleShellInstall.sh
##oracle 11GR2官方安装包
1.3Gp13390677_112040_Linux-x86-64_1of7.zip
1.1Gp13390677_112040_Linux-x86-64_2of7.zip
##oracle 11GR2 PSU 最终版补丁包+6880880 OPatch补丁包
374Mp31537677_112040_Linux-x86-64.zip
118Mp6880880_112000_Linux-x86-64.zip
##上下文切换软件(可选)
276Krlwrap-0.42.tar.gz

##3.授权脚本执行权限
chmod +x OracleShellInstall.sh

三、安装

注意:可通过./OracleShellInstall.sh --help查看命令帮助

安装命令如下:

cd /soft
./OracleShellInstall.sh -i 10.211.55.100 `#Public ip`-n s11g `# hostname`-o s11g `# oraclesid`-op oracle `# oracle user password`-b /oracle/app `# install basedir`-s AL32UTF8 `# characterset`-opa 31537677 `# oracle psu number`

敲下回车将开始无人值守安装......

开始时间:22:15

执行过程太多.....略

安装日志记录在/soft目录下:oracleAllSilent_*.log,在文末展示安装日志

安装结束后,将自动创建好一个上述指定实例名为s11g的数据库实例,并安装上传补丁31537677。

等待安装结束.......

结束时间:22:25

安装结束。

总耗时:10分钟。

安装日志如下:

[root@s11g soft]# cat oracleAllSilent_20210506025105.log 
####################################################################################

# Installation Logging

####################################################################################

####################################################################################

# OS Version

####################################################################################

OS Version :

linux7

####################################################################################

# DB Version

####################################################################################

DB Version :

11.2.0.4

####################################################################################

# HOSTNAME

####################################################################################

HOSTNAME :

s11g

####################################################################################

# RPM Check

####################################################################################

RPM Check :

bc-1.06.95-13.el7.x86_64
binutils-2.27-44.base.el7.x86_64
compat-libcap1-1.10-7.el7.x86_64
compat-libstdc++-33-3.2.3-72.el7.x86_64
gcc-4.8.5-44.el7.x86_64
gcc-c++-4.8.5-44.el7.x86_64
elfutils-libelf-0.176-5.el7.x86_64
elfutils-libelf-devel-0.176-5.el7.x86_64
glibc-2.17-317.el7.x86_64
glibc-devel-2.17-317.el7.x86_64
ksh-20120801-142.el7.x86_64
libaio-0.3.109-13.el7.x86_64
libaio-devel-0.3.109-13.el7.x86_64
libgcc-4.8.5-44.el7.x86_64
libstdc++-4.8.5-44.el7.x86_64
libstdc++-devel-4.8.5-44.el7.x86_64
libxcb-1.13-1.el7.x86_64
libX11-1.6.7-2.el7.x86_64
libXau-1.0.8-2.1.el7.x86_64
libXi-1.7.9-1.el7.x86_64
libXtst-1.2.3-1.el7.x86_64
libXrender-0.9.10-1.el7.x86_64
libXrender-devel-0.9.10-1.el7.x86_64
make-3.82-24.el7.x86_64
net-tools-2.0-0.25.20131004git.el7.x86_64
nfs-utils-1.3.0-0.68.el7.x86_64
smartmontools-7.0-2.el7.x86_64
sysstat-10.1.5-19.el7.x86_64
e2fsprogs-1.42.9-19.el7.x86_64
e2fsprogs-libs-1.42.9-19.el7.x86_64
fontconfig-devel-2.13.0-4.3.el7.x86_64
expect-5.45-14.el7_1.x86_64
unzip-6.0-21.el7.x86_64
openssh-clients-7.4p1-21.el7.x86_64
readline-6.2-11.el7.x86_64

####################################################################################

# /etc/hosts

####################################################################################

/etc/hosts :

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

#Public IP
10.211.55.100s11g

####################################################################################

# Create user and groups(oracle)

####################################################################################

Create user and groups(oracle) :

uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54330(racdba)

####################################################################################

# chronyd

####################################################################################

chronyd :

● chronyd.service - NTP client/server
   Loaded: loaded (/usr/lib/systemd/system/chronyd.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:chronyd(8)
           man:chrony.conf(5)

May 06 14:23:54 localhost.localdomain systemd[1]: Starting NTP client/server...
May 06 14:23:54 localhost.localdomain chronyd[731]: chronyd version 3.4 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +SECHASH +IPV6 +DEBUG)
May 06 14:23:54 localhost.localdomain systemd[1]: Started NTP client/server.
May 06 14:51:58 s11g chronyd[731]: chronyd exiting
May 06 14:51:58 s11g systemd[1]: Stopping NTP client/server...
May 06 14:51:58 s11g systemd[1]: Stopped NTP client/server.

####################################################################################

# Time dependent

####################################################################################

Time dependent :

Thu May  6 14:51:58 CST 2021

####################################################################################

# avahi-daemon

####################################################################################

avahi-daemon :


####################################################################################

# Firewalld

####################################################################################

Firewalld :

● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

May 06 14:23:54 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
May 06 14:23:55 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
May 06 14:23:55 localhost.localdomain firewalld[750]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be removed in a future release. Please consider disabling it now.
May 06 14:51:58 s11g systemd[1]: Stopping firewalld - dynamic firewall daemon...
May 06 14:51:59 s11g systemd[1]: Stopped firewalld - dynamic firewall daemon.

####################################################################################

# SELINUX

####################################################################################

SELINUX :

Permissive

####################################################################################

# /etc/default/grub

####################################################################################

/etc/default/grub :

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="spectre_v2=retpoline rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet transparent_hugepage=never numa=off"
GRUB_DISABLE_RECOVERY="true"

####################################################################################

# Transparent_hugepages

####################################################################################

Transparent_hugepages :

[always] madvise never

####################################################################################

# NUMA

####################################################################################

NUMA :

BOOT_IMAGE=/vmlinuz-3.10.0-1160.el7.x86_64 root=/dev/mapper/rhel-root ro spectre_v2=retpoline rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet LANG=en_US.UTF-8

####################################################################################

# NetworkManager

####################################################################################

NetworkManager :

● NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; disabled; vendor preset: enabled)
   Active: inactive (dead) since Thu 2021-05-06 14:52:01 CST; 149ms ago
     Docs: man:NetworkManager(8)
 Main PID: 771 (code=exited, status=0/SUCCESS)

May 06 14:43:52 localhost.localdomain NetworkManager[771]: <info>  [1620283432.5700] device (eth1): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
May 06 14:43:52 localhost.localdomain NetworkManager[771]: <info>  [1620283432.5703] device (eth1): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
May 06 14:43:52 localhost.localdomain NetworkManager[771]: <info>  [1620283432.5722] device (eth1): Activation: successful, device activated.
May 06 14:51:53 s11g NetworkManager[771]: <info>  [1620283913.2720] hostname: hostname changed from "localhost.localdomain" to "s11g"
May 06 14:51:53 s11g NetworkManager[771]: <info>  [1620283913.2726] policy: set-hostname: set hostname to 's11g' (from system configuration)
May 06 14:52:01 s11g NetworkManager[771]: <info>  [1620283921.7011] caught SIGTERM, shutting down normally.
May 06 14:52:01 s11g systemd[1]: Stopping Network Manager...
May 06 14:52:01 s11g NetworkManager[771]: <info>  [1620283921.7057] manager: NetworkManager state is now CONNECTED_SITE
May 06 14:52:01 s11g NetworkManager[771]: <info>  [1620283921.7080] exiting (success)
May 06 14:52:01 s11g systemd[1]: Stopped Network Manager.

####################################################################################

# rlwrap

####################################################################################

rlwrap :

rlwrap 0.42

####################################################################################

# /etc/sysctl.conf

####################################################################################

/etc/sysctl.conf :

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 8365367295
kernel.shmmni = 4096
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 = 1048576

####################################################################################

# NOZEROCONF

####################################################################################

NOZEROCONF :

# Created by anaconda
#OracleBegin
NOZEROCONF=yes
#OracleEnd

####################################################################################

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

####################################################################################

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

# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.

*          -       nproc     16384
root       soft    nproc     unlimited

####################################################################################

# /etc/security/limits.conf

####################################################################################

/etc/security/limits.conf :

# /etc/security/limits.conf
#
#This file sets the resource limits for the users logged in via PAM.
#It does not affect resource limits of the system services.
#
#Also note that configuration files in /etc/security/limits.d directory,
#which are read in alphabetical order, override the settings in this
#file in case the domain is the same or more specific.
#That means for example that setting a limit for wildcard domain here
#can be overriden with a wildcard setting in a config file in the
#subdirectory, but a user specific setting here can be overriden only
#with a user specific setting in the subdirectory.
#
#Each line describes a limit for a user in the form:
#
#<domain>        <type>  <item>  <value>
#
#Where:
#<domain> can be:
#        - a user name
#        - a group name, with @group syntax
#        - the wildcard *, for default entry
#        - the wildcard %, can be also used with %group syntax,
#                 for maxlogin limit
#
#<type> can have the two values:
#        - "soft" for enforcing the soft limits
#        - "hard" for enforcing hard limits
#
#<item> can be one of the following:
#        - core - limits the core file size (KB)
#        - data - max data size (KB)
#        - fsize - maximum filesize (KB)
#        - memlock - max locked-in-memory address space (KB)
#        - nofile - max number of open file descriptors
#        - rss - max resident set size (KB)
#        - stack - max stack size (KB)
#        - cpu - max CPU time (MIN)
#        - nproc - max number of processes
#        - as - address space limit (KB)
#        - maxlogins - max number of logins for this user
#        - maxsyslogins - max number of logins on the system
#        - priority - the priority to run user process with
#        - locks - max number of file locks the user can hold
#        - sigpending - max number of pending signals
#        - msgqueue - max memory used by POSIX message queues (bytes)
#        - nice - max nice priority allowed to raise to values: [-20, 19]
#        - rtprio - max realtime priority
#
#<domain>      <type>  <item>         <value>
#

#*               soft    core            0
#*               hard    rss             10000
#@student        hard    nproc           20
#@faculty        soft    nproc           20
#@faculty        hard    nproc           50
#ftp             hard    nproc           0
#@student        -       maxlogins       4

# End of file
#OracleBegin
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
oracle soft nproc 2047
oracle hard nproc 16384
oracle hard memlock 134217728
oracle soft memlock 134217728
#OracleEnd

####################################################################################

# /etc/pam.d/login

####################################################################################

/etc/pam.d/login :

#%PAM-1.0
auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so
auth       substack     system-auth
auth       include      postlogin
account    required     pam_nologin.so
account    include      system-auth
password   include      system-auth
# pam_selinux.so close should be the first session rule
session    required     pam_selinux.so close
session    required     pam_loginuid.so
session    optional     pam_console.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session    required     pam_selinux.so open
session    required     pam_namespace.so
session    optional     pam_keyinit.so force revoke
session    include      system-auth
session    include      postlogin
-session   optional     pam_ck_connector.so
#OracleBegin
session required pam_limits.so 
session required /lib64/security/pam_limits.so
#OracleEnd

####################################################################################

# /dev/shm

####################################################################################

/dev/shm :


#
# /etc/fstab
# Created by anaconda on Thu May  6 02:11:47 2021
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/rhel-root   /                       xfs     defaults        0 0
UUID=32cd2453-e3e4-4e58-a3c5-d7eb092d7469 /boot                   xfs     defaults        0 0
/dev/mapper/rhel-home   /home                   xfs     defaults        0 0
/dev/mapper/rhel-swap   swap                    swap    defaults        0 0
/swapfile swap swap defaults 0 0
tmpfs /dev/shm tmpfs size=8169304k 0 0

####################################################################################

# df -hP

####################################################################################

df -hP :

Filesystem             Size  Used Avail Use% Mounted on
devtmpfs               3.9G     0  3.9G   0% /dev
tmpfs                  7.8G     0  7.8G   0% /dev/shm
tmpfs                  3.9G  9.1M  3.9G   1% /run
tmpfs                  3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/rhel-root   39G  6.5G   32G  17% /
/dev/sda1             1014M  137M  878M  14% /boot
/dev/mapper/rhel-home   19G   33M   19G   1% /home
tmpfs                  798M     0  798M   0% /run/user/0
/dev/sr0               4.3G  4.3G     0 100% /mnt

####################################################################################

# Oracle Profile

####################################################################################

Oracle Profile :

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH
################OracleBegin#########################
umask 022
export TMP=/tmp
export TMPDIR=$TMP
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8 #AL32UTF8,ZHS16GBK
export ORACLE_BASE=/oracle/app/oracle
export ORACLE_HOME=/oracle/app/oracle/product/11.2.0/db
export ORACLE_HOSTNAME=s11g
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=s11g
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
alias sas='sqlplus / as sysdba'
alias alert='tail -500f $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/trace/alert_$ORACLE_SID.log|more'
export PS1="[`whoami`@`hostname`:"'$PWD]$ '
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
alias lsnrctl='rlwrap lsnrctl'
alias asmcmd='rlwrap asmcmd'
alias adrci='rlwrap adrci'
alias ggsci='rlwrap ggsci'
alias dgmgrl='rlwrap dgmgrl'
################OracleEnd###########################

####################################################################################

# /soft/db.rsp

####################################################################################

/soft/db.rsp :

oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=s11g
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/oracle/app/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/oracle/app/oracle/product/11.2.0/db
ORACLE_BASE=/oracle/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oper
DECLINE_SECURITY_UPDATES=true
oracle.installer.autoupdates.option=SKIP_UPDATES

####################################################################################

# /soft/netca.rsp

####################################################################################

/soft/netca.rsp :

[GENERAL]
RESPONSEFILE_VERSION="11.2"
CREATE_TYPE="CUSTOM"
[oracle.net.ca]
INSTALLED_COMPONENTS={"server","net8","javavm"}
INSTALL_TYPE=""typical""
LISTENER_NUMBER=1
LISTENER_NAMES={"LISTENER"}
LISTENER_PROTOCOLS={"TCP;1521"}
LISTENER_START=""LISTENER""
NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}
NSN_NUMBER=1
NSN_NAMES={"EXTPROC_CONNECTION_DATA"}
NSN_SERVICE={"PLSExtProc"}
NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}

####################################################################################

# Oracle RDBMS

####################################################################################

Oracle RDBMS :


SQL*Plus: Release 11.2.0.4.0 Production


####################################################################################

# Oracle OPatch Version

####################################################################################

Oracle OPatch Version :

OPatch Version: 11.2.0.3.28

OPatch succeeded.

####################################################################################

# OPatch lspatches

####################################################################################

OPatch lspatches :

31537677;Database Patch Set Update : 11.2.0.4.201020 (31537677)

OPatch succeeded.

####################################################################################

# ORACLE Instance

####################################################################################

ORACLE Instance :


LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 06-MAY-2021 15:00:40

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                06-MAY-2021 14:55:04
Uptime                    0 days 0 hr. 5 min. 36 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/app/oracle/product/11.2.0/db/network/admin/listener.ora
Listener Log File         /oracle/app/oracle/diag/tnslsnr/s11g/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=s11g)(PORT=1521)))
Services Summary...
Service "s11g" has 1 instance(s).
  Instance "s11g", status READY, has 1 handler(s) for this service...
The command completed successfully

####################################################################################

# Oracle Implied parameters

####################################################################################

Oracle Implied parameters :


SQL*Plus: Release 11.2.0.4.0 Production on Thu May 6 15:00:41 2021

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
audit_trail     string DB

NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
deferred_segment_creation     boolean FALSE

NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
result_cache_max_size     big integer 0

NAME VALUE    DESCRIB
---------------------------------------- ---------- ------------------------------------------------------------
_use_adaptive_log_file_sync TRUE    Adaptively switch between post/wait and polling
_optimizer_cartesian_enabled FALSE    optimizer cartesian join enabled

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多