图片 32

ORACLE 11g从 11.2.0.1升级到11.2.0.4 详细实战教程_oracle_脚本之家

1、计划安装

上次蒙受难点,cursor:mutex
S导致的load过高,有说可以升官到11.2.0.4就会防止这种难点,所以筹算重新搭建新本子11.2.0.4。

正文收音和录音在Linux
系统化学习种类小说总目录

翻看当前oracle版本,明确是相比较旧的11.2.0.1

安装碰到是:azure云 linux centos6.5。

正文所需的安装包都存放在本身网盘中,需求的私聊~

[oracle@hch_test_121_90 ~]$ rlwrap sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Fri Mar 17 15:20:45 2017 Copyright  1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options [oracle@hch_test_121_90 ~]$ 

1,修正内核

一、安装VMware tools工具(非必须)

上传11.2.0.4的安装包p13390677_112040_Linux-x86-64_1of7.zip、p13390677_112040_Linux-x86-64_2of7.zip到服务器上。Oracle11.2.0.4的安装包下载,请查阅本身的blog地址,那地方有下载源:

1.1 修改sysctl.conf文件

1、虚构机上点击安装

因为本人在虚构机中做的,前面oracle
安装是图形化安装,供给荧屏大一点,不然有个别开关点不住。

图片 1

 

解压缩: [oracle@hch_test_121_90 oracle]$ unzip p13390677_112040_Linux-x86-64_1of7.zip [oracle@hch_test_121_90 oracle]$ unzip p13390677_112040_Linux-x86-64_2of7.zip 打开启动图像界面 [oracle@hch_test_121_90 oracle]$ cd database/ [oracle@hch_test_121_90 database]$ ./runInstaller Starting Oracle Universal Installer... Checking Temp space: must be greater than 120 MB. Actual 6024 MB Passed Checking swap space: must be greater than 150 MB. Actual 1798 MB Passed Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2017-03-17_03-11-29PM. Please wait ...[oracle@hch_test_121_90 database]$ [oracle@hch_test_121_90 database]$ 
[root@orcltest Downloads]# vim/etc/sysctl.conf# add by tim.mankernel.shmmax = 277495689510912kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048586fs.file-max = 6815744 # Controls the maximum number of shared memory segments, in pages kernel.shmall = 4294967296net.ipv4.tcp_max_tw_buckets = 6000net.ipv4.ip_local_port_range = 9000 65500net.ipv4.tcp_tw_recycle = 0net.ipv4.tcp_tw_reuse = 1net.core.somaxconn = 262144net.core.netdev_max_backlog = 262144net.ipv4.tcp_max_orphans = 262144net.ipv4.tcp_max_syn_backlog = 262144net.ipv4.tcp_synack_retries = 2net.ipv4.tcp_syn_retries = 1net.ipv4.tcp_fin_timeout = 1net.ipv4.tcp_keepalive_time = 30net.ipv4.tcp_keepalive_probes = 6net.ipv4.tcp_keepalive_intvl = 5net.ipv4.tcp_timestamps = 0fs.aio-max-nr = 1048576

2、安装

① 解包

[root@along VMware Tools]# cd /media/VMware\ Tools/

[root@along VMware Tools]# tar zxvf VMwareTools-10.1.6-5214329.tar.gz
-C /tmp

 

② 实施安装脚本

[root@along ~]# cd /tmp/vmware-tools-distrib/

[root@along vmware-tools-distrib]# ./vmware-install.pl   实行perl
语言的台本,然后径直回车

 

③ 安装收尾,重启一下机器

 

2、开首晋级换代

1.2 使参数生效

二、安装oracle准备

C:\pic\oracle\100.png,填写邮箱地址,然后下一步

[root@orcltest Downloads]# sysctl –p

1、策画,2个安装包,1个安装脚本

p13390677_112040_Linux-x86-64_1of7.zip

p13390677_112040_Linux-x86-64_2of7.zip

orainst_11g.sh

都在本身的网盘中

 

选拔忽视软件晋级,下一步吗,如101.png

2,扩充顾客和组

2、解压安装包,一定要解压到/root 下,因为脚本中有设置

[root@along ~]# unzip p13390677_112040_Linux-x86-64_1of7.zip
;unzip p13390677_112040_Linux-x86-64_2of7.zip

解压完,会在/root 下生成一个database 的目录

 

下一场接受晋级,如下102.png

[root@orcltestDownloads]# groupadd oinstall[root@orcltestDownloads]# groupadd dba[root@orcltestDownloads]# groupadd oper[root@orcltestDownloads]# useradd -g oinstall -G dba,oper oracle[root@orcltestDownloads]# passwd oracle

3、安装脚本如下

#!/bin/bash
#1.安装依赖包
PKG="    #定义一个变量,需要安装的包
unixODBC
unixODBC-devel
binutils
compat-libstdc++-33
elfutils-libelf
elfutils-libelf-devel
elfutils-libelf-devel-static
gcc
gcc-c++
glibc
glibc-common
glibc-devel
glibc-headers
kernel-headers
ksh
libaio
libaio-devel
libgcc
libgomp
libstdc++
libstdc++-devel
make
numactl-devel
sysstat
"
PACKINSTALL=

for PACKAGE in $PKG ;do    #for循环,安装
    rpm -q $PACKAGE || PACKINSTALL="$PACKINSTALL $PACKAGE"
done
echo
if [ -z "$PACKINSTALL" ];then
   true
  else
   echo "The followling packages will be install: $PACKINSTALL "
   read -p "Continue? (y/N): " answer
   case $answer in
        ([yY]|[Yy][Ee][Ss])
             echo 1
             yum -y install $PACKINSTALL ;;
        (*);;
   esac
fi

#2.创建所需要的组、和用户
cat /etc/group |grep oinstall &> /dev/null || /usr/sbin/groupadd oinstall
cat /etc/group |grep dba &> /dev/null || /usr/sbin/groupadd dba

id oracle &> /dev/null 
    if [ $? = 0 ];then
     groups oracle | grep dba &> /dev/null || /usr/sbin/usermod -g oinstall -G dba oracle
    else
     /usr/sbin/useradd -g oinstall -G dba oracle
     echo oracle |passwd --stdin oracle
    fi

#3.对内核的调整,设置内核的值
KELNUM=$(cat /etc/sysctl.conf |grep -v ^# |grep -v ^$ |grep -E "fs.aio-max-nr|fs.file-max|kernel.shmall|kernel.shmmax|kernel.shmmni|kernel.sem|net.ipv4.ip_local_port_range|net.core.rmem_default|net.core.rmem_max|net.core.wmem_default|net.core.wmem_max" |awk '{print $1}' |sort -u |wc -l )

if [ $KELNUM -lt 11 ];then
cat >> /etc/sysctl.conf <<EOF
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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 = 1048586
EOF
/sbin/sysctl -p
fi

#4.修改limits.conf 文件
grep oracle /etc/security/limits.conf &> /dev/null 
  if [ $? != 0 ];then
cat >> /etc/security/limits.conf << EOF
oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  1024
oracle              hard    nofile  65536
oracle              soft    stack   1024
EOF
 fi

#5.修改/etc/pam.d/login 的值
grep pam_limits.so /etc/pam.d/login &> /dev/null
  if [ $? != 0 ];then
cat >> /etc/pam.d/login <<EOF
session required pam_limits.so
EOF
  fi

#6.创建oracle 安装的目录,这个目录所在的区或盘需要最少30G,建议生产环境,最好放在逻辑卷上
[ -d /mnt/app ] || ( mkdir -p /mnt/app/ ; chown -R oracle:oinstall /mnt/app/ ; chmod -R 775 /mnt/app )

#7.修改一些环境变量
grep -i oracle ~oracle/.bash_profile &> /dev/null
  if [ $? != 0 ];then
cat >> ~oracle/.bash_profile <<EOF
export ORACLE_BASE=/mnt/app/oracle    #oracle软件的主目录
export ORACLE_HOME=\$ORACLE_BASE/11.2.0/db_1    #oracle数据库的目录
export ORACLE_SID=orcl   #oracle实例
export PATH=\$PATH:\$ORACLE_HOME/bin   #oracle命令
EOF
  fi

#8.启动安装程序
xhost +    #切换oracle用户
[ -d ~oracle/database ] || mv /root/database ~oracle 
cd ~oracle;su - oracle -c 'database/runInstaller'

 

然后继续进行,有个INS-35373谬误,选用Yes,如下

3,修改limits.conf限制

4、脚本推行前需注意

① IP地址必需是静态获取,无法是dhcp动态获取

② 保证主机名能解析,ping自身的主机名

[root@along ~]# vim /etc/hosts    #丰盛深入分析自个儿的主机名

192.168.10.6   along

③ oracle
安装的目录所在的区或盘须求最少30G,建议临盆意况,最棒放在逻辑卷上

 

接下来接收好语言种类,简体汉语、繁体中文、乌Crane语、中式乌克兰语等,如104.png所示:

[root@orcltestDownloads]# vim /etc/security/limits.conforacle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024oracle hard nofile 65536

5、思谋安装oracle 须要的硬盘

① 虚构加三个30G硬盘

图片 2

② 查看参加硬盘的名字

[root@along ~]# fdisk -l

图片 3

③ 分区,把具有空中都分成一个区

[root@along ~]# fdisk /dev/sdb

图片 4

④ 文件系统格式化

[root@along ~]# mkfs.ext4 /dev/sdb1

⑤ 挂载

[root@along ~]# mount /dev/sdb1 /mnt

 

波澜起伏下一步,选用公司版,如

4,修改/etc/pam.d/login

6、实行脚本

① 给脚本加权限,注意必要在图形化中试行

图片 5

② 试行完脚本,会弹出安装Oracle的框

图片 6

③ 假诺十分大心关闭了安装框,在图形化中,张开八个新的顶峰

[root@along ~]# xhost +

[root@along ~]# su – oracle

[oracle@along ~]$ ./database/runInstaller    就能够弹出安装框了

 

接下去,初叶选取oracle目录了,是选用新建的目录呢依然选项原本的老版本11.2.0.1的目录呢?这里最棒选拔一个新的目录,因为假若升级退步了,老的oracle版本软件目录未有被遮住掉,还足以三回九转采取的,不然进级失败,就大旨独有深透暴力扼杀全数文件以致注册音讯,之后重新安装oracle了。

[root@orcltestDownloads]# vim /etc/pam.d/loginsession required/lib64/security/pam_limits.so

三、安装Oracle软件

1、招待界面

因为没买正版,所以去掉√

图片 7

2、令你输入账号,跳过就好

图片 8

3、安装方式

① 既安装Oracle,又安装数据库(风流倜傥部成功)

② 只安装Oracle软件(√)

③ 更新已存在的数据库

为了让大家理解怎么去安插数据库,笔者选取第贰个

图片 9

4、实例接受

① 单实例数据库

② 多实例数据库

笔者设置最中央的,单实例

图片 10

 5、字符集,加上汉语

图片 11

 6、安装版本,选取最高档版本

图片 12

7、安装路径,因为脚本设置过了

图片 13

8、上一步直接跳过,这一步选拔暗许的数额库oinstall

图片 14

9、自行检查错误

① 需修正八个参数,遵照他须要的改变

[root@along ~]# vim /etc/sysctl.conf

kernel.shmmax = 2001682432

[root@along ~]# sysctl -p    生效一下

② 贫乏二个包,安装。(这些包,我的网盘有提供)

[root@along ~]# rpm -e ksh   卸载二个包,因为和内需安装的包冲突

[root@along ~]# rpm -ivh pdksh-5.2.14-30.x86_64.rpm   安装

图片 15

③ 再检查实验,检查实验通过

图片 16

10、安装,等待就能够;安装的是Oracle软件

图片 17

11、必要运维2个本子

当心必要root权限运维,复制脚本,运转时,有怎么着晋升,都回车就能够图片 18

12、安装Oracle软件实现,原来就有Oracle命令了

图片 19

 

本人那边就筛选八个新的目录11.2.0.4的目录,如106.png、107.png所示

5,修改bash_profile文件

四、安装Oracle库

依旧图形化安装

1、展开配置框

[root@along ~]# su – oracle

[oracle@along ~]$ dbca   #反响会某些慢

图片 20

2、创立数据库

图片 21

3、选用健康配置

图片 22

4、实例名配置

图片 23

5、基于web分界面管理工科具,假若急需那项作用,则要求监听管理工科具

图片 24

初叶监听处理工科具,注意要用oracle客商

[oracle@along ~]$ lsnrctl start

 

6、设置密码,若是密码太简单,会有提示,继续yes就行

图片 25

 7、开启归档,上一步跳过

图片 26

8、需无需安装示例库

图片 27

9、字符集和操作系统的如出大器晚成辙

图片 28

10、开头安装

图片 29

11、等待安装就可以

图片 30

安装达成,弹出轻巧的证实

图片 31

总体安装进程旁逸横出!

 

接下去,继续,选取新的的Inventory
Directory目录,默许的会报错,如108.png所示

修改profile:

五、登入数据库

[root@along ~]# su – oracle

[oracle@along ~]$ sqlplus / as sysdba

/:本地系统验证(省去登陆顾客密码的步骤)

as + 角色

图片 32

 

 下意气风发篇,再讲授Oracle的语法知识,尽情期望~

 

接下去选取客商组和操作组,如109.png所示:

 [root@orcltest Downloads]# vim /etc/profile # add by tim.manif [ $USER = "oracle" ]; thenif [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536else ulimit -u 16384 -n 65536fifi

接下去,会有checking各样lib包,一些相比较偏的,缺少了也没事,间接Ignore忽视掉就ok,如110.png所示:

修改bash_profile:

下一步看安装的目录以至着力音讯,如111.png所示:

[oracle@orcltest ~]$ vim .bash_profileexport EDITOR=viexport ORACLE_SID=doea5dbexport ORACLE_BASE=/u01/app/oracleexport ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1export INVENTORY_LOCATION=/oraInventoryexport LD_LIBRARY_PATH=$ORACLE_HOME/libexport NLS_LANG="American_america.zhs16gbk"export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:$PATH:$HOME/binumask 022

然后点击“”Install“”按键,开首设置,如图112.png

使bash_profile生效:

中间须要推行配置脚本,如图112_1.png

[oracle@orcltest ~]$ source .bash_profile

再也展开xshell,ssh连接到数据库,在命令行去执行命令:

6,成立目录

[root@hch_test_121_90 oracle]# bash -x/oracle/app/oraInventory11.2.0.4/orainstRoot.sh[root@hch_test_121_90 oracle]# bash -x/oracle/app/oracle/product/11.2.0.4/dbhome_1/root.sh

[root@hch_test_121_90 oracle]# bash -x /oracle/app/oraInventory11.2.0.4/orainstRoot.sh + AWK=/bin/awk + CHMOD=/bin/chmod + CHGRP=/bin/chgrp + CP=/bin/cp + ECHO=/bin/echo + MKDIR=/bin/mkdir ++ /usr/bin/id ++ /bin/awk '-F(' '{print $1}' ++ /bin/awk -F= '{print $2}' + RUID=0 + '[' 0 '!=' 0 ']' + '[' -d /etc ']' + /bin/chmod 755 /etc + '[' -f /oracle/app/oraInventory11.2.0.4/oraInst.loc ']' + /bin/cp /oracle/app/oraInventory11.2.0.4/oraInst.loc /etc/oraInst.loc + /bin/chmod 644 /etc/oraInst.loc + /bin/echo 'Changing permissions of /oracle/app/oraInventory11.2.0.4. Adding read,write permissions for group. Removing read,write,execute permissions for world. ' Changing permissions of /oracle/app/oraInventory11.2.0.4. Adding read,write permissions for group. Removing read,write,execute permissions for world. + /bin/chmod -R g+rw,o-rwx /oracle/app/oraInventory11.2.0.4 + '[' 0 '!=' 0 ']' + /bin/echo 'Changing groupname of /oracle/app/oraInventory11.2.0.4 to oinstall.' Changing groupname of /oracle/app/oraInventory11.2.0.4 to oinstall. + /bin/chgrp -R oinstall /oracle/app/oraInventory11.2.0.4 + '[' 0 '!=' 0 ']' + /bin/echo 'The execution of the script is complete.' The execution of the script is complete. [root@hch_test_121_90 oracle]# [root@hch_test_121_90 oracle]# [root@hch_test_121_90 ~]# sh /oracle/app/oracle/product/11.2.0.4/dbhome_1/root.sh Performing root user operation for Oracle 11g The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /oracle/app/oracle/product/11.2.0.4/dbhome_1 Enter the full pathname of the local bin directory: [/usr/local/bin]: /oracle/app/oracle/product/11.2.0.4/dbhome_1/bin The contents of "dbhome" have not changed. No need to overwrite. The contents of "oraenv" have not changed. No need to overwrite. The contents of "coraenv" have not changed. No need to overwrite. Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root script. Now product-specific root actions will be performed. Finished product-specific root actions. [root@hch_test_121_90 ~]# 
[root@orcltest~]# mkdir /data/oracle[root@orcltest~]# chown oracle:oinstall /data [root@azure_earth_dbm1_3_112 app]# mkdir /data/oracle[root@azure_earth_dbm1_3_112 app]# mkdir /data/oraInventory[root@azure_earth_dbm1_3_112 app]# cd /oracle/app[root@azure_earth_dbm1_3_112 app]# ln -s /data/oracle oracle[root@azure_earth_dbm1_3_112 app]# ln -s /data/oraInventory oraInventory [root@azure_earth_dbm1_3_112 app]# chown -R oracle.oinstall /data[root@azure_earth_dbm1_3_112 app]# chown -R oracle.oinstall /oracle[root@azure_earth_dbm1_3_112 app]#[root@ azure_earth_dbm1_3_112 oracle]# mkdir -p /oracle/app/oracle[root@ azure_earth_dbm1_3_112 oracle]# chown -R oracle:oinstall /oracle/app/oracle[root@ azure_earth_dbm1_3_112 oracle]# chmod -R 775 /oracle/app/oracle[root@ azure_earth_dbm1_3_112 oracle]#

自此回来vnc远程的窗口,点击分界面的OK,会提醒安装Oracle Net Configuration
Assistant: Welcome操作:

7,安装rpms包

接下去会计划网络,如下113.png、114.png

Rpm包安装:rpm -ivh *–force –nodeps

设置sys密码,如115.png所示

Muranopms安装有的时候候不必然保险有效,能够再用yum安装:

看来这里,问题来了,中间未有数据库让您筛选去进步,难题在何地吗,在/etc/oratab未有配置,所以火速去布署:

# 采用yum安装,如下:yum install -y binutils*yum install -y compat-libstdc*yum install -y elfutils-libelf*yum install -y gcc*yum install -y glibc*yum install -y ksh*yum install -y libaio*yum install -y libgcc*yum install -y libstdc*yum install -y make*yum install -y sysstat* yum install libXp* -yyum install -y glibc-kernheaders # 检查下lib是否安装齐全:[root@powerlong4 ~]# rpm -q --queryformat %-{name}-%{version}-%{release}-%{arch}"\n" \ compat-libstdc++-33 glibc-kernheaders glibc-headers libaio libgcc glibc-devel xorg-x11-deprecated-libs
[root@hch_test_121_90 ~]# more /etc/oratab # # This file is used by ORACLE utilities. It is created by root.sh # and updated by either Database Configuration Assistant while creating # a database or ASM Configuration Assistant while creating ASM instance. # A colon, ':', is used as the field terminator. A new line terminates # the entry. Lines beginning with a pound sign, '#', are comments. # # Entries are of the form: # $ORACLE_SID:$ORACLE_HOME:: # # The first and second fields are the system identifier and home # directory of the database respectively. The third filed indicates # to the dbstart utility that the database should , "Y", or should not, # "N", be brought up at system boot time. # # Multiple entries with the same $ORACLE_SID are not allowed. # powerdes:/hom/oracle/app/oracle/product/11.2.0/dbhome_1:Y [root@hch_test_121_90 ~]# 

假设贫乏,就气势磅礡设置缺失的组件包。

布署完后,前边的步调重新来一次,到此就能够有下边的产出的database接受项让大家选择,如116.png、117.png、118.png所示:

8,安装vnc

接下去,选用升级时区以至备份数据库,如119.png所示:

vnc安装参照他事他说加以考查://www.jb51.net/article/110095.htm