龙空技术网

CentOS7静默安装oracle11g

Cyylog 190

前言:

此时咱们对“centos55vim安装”可能比较着重,我们都需要知道一些“centos55vim安装”的相关内容。那么小编同时在网摘上搜集了一些对于“centos55vim安装””的相关文章,希望你们能喜欢,姐妹们一起来学习一下吧!


操作系统:

[root@cyylog ~]# uname -mx86_64[root@cyylog ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) 


安装前的准备:

1. 修改主机名


#sed -i "s/HOSTNAME=localhost.localdomain/HOSTNAME=oracledb/" /etc/sysconfig/network


2.添加主机名与IP对应记录


# vim /etc/hosts 192.168.0.9 oracledb


3.关闭Selinux

# sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config ​# setenforce 0 

4.检查是否有swap分区.

(我的机器是没有这个,所有后面有报错) Linux一切皆文件,没有就自己造一个

1、检查 Swap 空间在设置 Swap 文件之前,有必要先检查一下系统里有没有既存的 Swap 文件。运行以下命令:​# swapon -s如果返回的信息概要是空的,则表示 Swap 文件不存在。​2、检查文件系统在设置 Swap 文件之前,同样有必要检查一下文件系统,看看是否有足够的硬盘空间来设置 Swap 。运行以下命令:​# df -hal​3、创建并允许 Swap 文件下面使用 dd 命令来创建 Swap 文件。检查返回的信息,还剩余足够的硬盘空间即可。​# dd if=/dev/zero of=/swapfile bs=1024 count=512k参数解读:if=文件名:输入文件名,缺省为标准输入。即指定源文件。< if=input file >of=文件名:输出文件名,缺省为标准输出。即指定目的文件。< of=output file >bs=bytes:同时设置读入/输出的块大小为bytes个字节count=blocks:仅拷贝blocks个块,块大小等于bs指定的字节数。​4、格式化并激活 Swap 文件上面已经创建好 Swap 文件,还需要格式化后才能使用。运行命令:​# mkswap /swapfile​激活 Swap ,运行命令:​# swapon /swapfile以上步骤做完,再次运行命令:​# swapon -s 你会发现返回的信息概要:​1 Filename Type Size Used Priority2 /swapfile file 524284 0 -1 ​如果要机器重启的时候自动挂载 Swap ,那么还需要修改 fstab 配置。用 vim 打开 /etc/fstab 文件,在其最后添加如下一行:​/swapfile swap swap defaults 0 0最后,赋予 Swap 文件适当的权限:​# chown root:root /swapfile # chmod 0600 /swapfile​

5.安装常用工具,配置阿里源

(个人习惯,在使用的主机上面配置这些常用工具)

​# curl -o /etc/yum.repos.d/CentOS-Base.repo  curl -o /etc/yum.repos.d/epel.repo  yum clean all# yum makecache fast​# yum install -y wget ntpdate net-tools vim bash-completion ShellCheck# ntpdate -b ntp1.aliyun.com


安装软件包:

参考官方:

The following or later version of packages for Oracle Linux 7, and Red Hat Enterprise Linux 7 must be installed:

binutils-2.23.52.0.1-12.el7.x86_64 compat-libcap1-1.10-3.el7.x86_64 compat-libstdc++-33-3.2.3-71.el7.i686compat-libstdc++-33-3.2.3-71.el7.x86_64gcc-4.8.2-3.el7.x86_64 gcc-c++-4.8.2-3.el7.x86_64 glibc-2.17-36.el7.i686 glibc-2.17-36.el7.x86_64 glibc-devel-2.17-36.el7.i686 glibc-devel-2.17-36.el7.x86_64 kshlibaio-0.3.109-9.el7.i686 libaio-0.3.109-9.el7.x86_64 libaio-devel-0.3.109-9.el7.i686 libaio-devel-0.3.109-9.el7.x86_64 libgcc-4.8.2-3.el7.i686 libgcc-4.8.2-3.el7.x86_64 libstdc++-4.8.2-3.el7.i686 libstdc++-4.8.2-3.el7.x86_64 libstdc++-devel-4.8.2-3.el7.i686 libstdc++-devel-4.8.2-3.el7.x86_64 libXi-1.7.2-1.el7.i686 libXi-1.7.2-1.el7.x86_64 libXtst-1.2.2-1.el7.i686 libXtst-1.2.2-1.el7.x86_64 make-3.82-19.el7.x86_64 sysstat-10.1.5-1.el7.x86_64unixODBC-2.3.1-6.el7.x86_64 or laterunixODBC-2.3.1-6.el7.i686 or laterunixODBC-devel-2.3.1-6.el7.x86_64 or laterunixODBC-devel-2.3.1-6.el7.i686 or later
binutils-2.23.52.0.1-12.el7.x86_64 compat-libcap1-1.10-3.el7.x86_64 compat-libstdc++-33-3.2.3-71.el7.i686compat-libstdc++-33-3.2.3-71.el7.x86_64gcc-4.8.2-3.el7.x86_64 gcc-c++-4.8.2-3.el7.x86_64 glibc-2.17-36.el7.i686 glibc-2.17-36.el7.x86_64 glibc-devel-2.17-36.el7.i686 glibc-devel-2.17-36.el7.x86_64 kshlibaio-0.3.109-9.el7.i686 libaio-0.3.109-9.el7.x86_64 libaio-devel-0.3.109-9.el7.i686 libaio-devel-0.3.109-9.el7.x86_64 libgcc-4.8.2-3.el7.i686 libgcc-4.8.2-3.el7.x86_64 libstdc++-4.8.2-3.el7.i686 libstdc++-4.8.2-3.el7.x86_64 libstdc++-devel-4.8.2-3.el7.i686 libstdc++-devel-4.8.2-3.el7.x86_64 libXi-1.7.2-1.el7.i686 libXi-1.7.2-1.el7.x86_64 libXtst-1.2.2-1.el7.i686 libXtst-1.2.2-1.el7.x86_64 make-3.82-19.el7.x86_64 sysstat-10.1.5-1.el7.x86_64unixODBC-2.3.1-6.el7.x86_64 or laterunixODBC-2.3.1-6.el7.i686 or laterunixODBC-devel-2.3.1-6.el7.x86_64 or laterunixODBC-devel-2.3.1-6.el7.i686 or later

用yum进行安装

yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 compat-libstdc++-33*.devel compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.devel libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.devel libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686


检测是否31个包都有安装

开放源码绿色蓝色按钮样式

[root@cyylog ~]# rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-develbinutils-2.23.52.0.1-55.el7.x86_64compat-libcap1-1.10-7.el7.x86_64compat-libstdc++-33-3.2.3-72.el7.x86_64compat-libstdc++-33-3.2.3-72.el7.i686gcc-4.8.5-4.el7.x86_64gcc-c++-4.8.5-4.el7.x86_64glibc-2.17-106.el7_2.8.x86_64glibc-2.17-106.el7_2.8.i686glibc-devel-2.17-106.el7_2.8.x86_64glibc-devel-2.17-106.el7_2.8.i686ksh-20120801-22.el7_1.3.x86_64libaio-0.3.109-13.el7.x86_64libaio-0.3.109-13.el7.i686libaio-devel-0.3.109-13.el7.x86_64libaio-devel-0.3.109-13.el7.i686libgcc-4.8.5-4.el7.x86_64libgcc-4.8.5-4.el7.i686libstdc++-4.8.5-4.el7.x86_64libstdc++-4.8.5-4.el7.i686libstdc++-devel-4.8.5-4.el7.x86_64libstdc++-devel-4.8.5-4.el7.i686libXi-1.7.2-2.1.el7.x86_64libXi-1.7.4-2.el7.i686libXtst-1.2.2-2.1.el7.x86_64libXtst-1.2.2-2.1.el7.i686make-3.82-21.el7.x86_64sysstat-10.1.5-7.el7.x86_64unixODBC-2.3.1-11.el7.x86_64unixODBC-2.3.1-11.el7.i686unixODBC-devel-2.3.1-11.el7.x86_64unixODBC-devel-2.3.1-11.el7.i686

计算机代码πόλη ποτάμιου τοπίου

版本号只能大于规定的版本,不能小于。


创建oinstall和dba组

# groupadd oinstall# groupadd dba

创建oracle用户

# useradd -g oinstall -G dba oracle

设置oracle用户密码

# passwd oracle

验证创建是否正确

[root@cyylog ~]# id oracleuid=1000(oracle) gid=1000(oinstall) groups=1000(oinstall),1001(dba)


配置内核参数

[root@cyylog ~]# vim /etc/sysctl.conf ​# System default settings live in /usr/lib/sysctl.d/00-system.conf.# To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file## For more information, see sysctl.conf(5) and sysctl.d(5).fs.aio-max-nr = 1048576fs.file-max = 6815744kernel.shmall = 2097152kernel.shmmax = 536870912 #最低:536870912,最大值:比物理内存小1个字节的值,建议超过物理内存的一半kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048576


参数的值不能小于上面的配置,这是oracle官方建议的最小值,生产环境建议调整这些参数,以优化系统性能。

修改后使之生效

# sysctl -p


修改用户限制

vim /etc/security/limits.conf​#在末尾添加oracle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536oracle soft stack 10240oracle hard stack 10240 

在/etc/pam.d/login 文件中,使用文本编辑器或vi命令增加或修改以下内容

session required /lib64/security/pam_limits.sosession required pam_limits.so

在/etc/profile 文件中,使用文本编辑器或vi命令增加或修改以下内容

if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fifi


使之生效

# source /etc/profile


创建安装目录

# mkdir -p /u01/app/# chown -R oracle:oinstall /u01/app/# chmod -R 775 /u01/app/


配置环境变量

[oracle@cyylog ~]$ vim ~/.bash_profile ​export ORACLE_BASE=/u01/app/oracleexport ORACLE_SID=dbsrv2

使之生效

source ~/.bash_profile

解压oracle软件

[root@cyylog src]# unzip linux.x64_11gR2_database_1of2.zip[root@cyylog src]# unzip linux.x64_11gR2_database_2of2.zip

复制响应文件模板

[oracle@cyylog ~]$ mkdir etc[oracle@cyylog ~]$ cp /usr/local/src/database/response/* /home/oracle/etc/[oracle@cyylog ~]$ ls etcdbca.rsp db_install.rsp netca.rsp

设置响应文件权限

[oracle@cyylog ~]$ su - root​[root@cyylog ~]# chmod 700 /home/oracle/etc/*.rsp


静默安装Oracle软件

su - oracle

修改安装Oracle软件的响应文件/home/oracle/etc/db_install.rsp

oracle.install.option=INSTALL_DB_SWONLY // 安装类型ORACLE_HOSTNAME=oracledb // 主机名称(hostname查询)UNIX_GROUP_NAME=oinstall // 安装组INVENTORY_LOCATION=/u01/app/oraInventory //INVENTORY目录(不填就是默认值)SELECTED_LANGUAGES=en,zh_CN,zh_TW // 选择语言ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 //oracle_homeORACLE_BASE=/u01/app/oracle //oracle_baseoracle.install.db.InstallEdition=EE     // oracle版本oracle.install.db.isCustomInstall=false   //自定义安装,否,使用默认组件oracle.install.db.DBA_GROUP=dba /  / dba用户组oracle.install.db.OPER_GROUP=oinstall // oper用户组oracle.install.db.config.starterdb.type=GENERAL_PURPOSE //数据库类型oracle.install.db.config.starterdb.globalDBName=orcl //globalDBNameoracle.install.db.config.starterdb.SID=dbsrv2 //SIDoracle.install.db.config.starterdb.memoryLimit=81920 //自动管理内存的内存(M)oracle.install.db.config.starterdb.password.ALL=oracle //设定所有数据库用户使用同一个密码SECURITY_UPDATES_VIA_MYORACLESUPPORT=false //(手动写了false)DECLINE_SECURITY_UPDATES=true   //设置安全更新(貌似是有bug,这个一定要选true,否则会无限提醒邮件地址有问题,终止安装。PS:不管地址对不对)
oracle.install.option=INSTALL_DB_SWONLY // 安装类型ORACLE_HOSTNAME=oracledb // 主机名称(hostname查询)UNIX_GROUP_NAME=oinstall // 安装组INVENTORY_LOCATION=/u01/app/oraInventory //INVENTORY目录(不填就是默认值)SELECTED_LANGUAGES=en,zh_CN,zh_TW // 选择语言ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 //oracle_homeORACLE_BASE=/u01/app/oracle //oracle_baseoracle.install.db.InstallEdition=EE     // oracle版本oracle.install.db.isCustomInstall=false   //自定义安装,否,使用默认组件oracle.install.db.DBA_GROUP=dba /  / dba用户组oracle.install.db.OPER_GROUP=oinstall // oper用户组oracle.install.db.config.starterdb.type=GENERAL_PURPOSE //数据库类型oracle.install.db.config.starterdb.globalDBName=orcl //globalDBNameoracle.install.db.config.starterdb.SID=dbsrv2 //SIDoracle.install.db.config.starterdb.memoryLimit=81920 //自动管理内存的内存(M)oracle.install.db.config.starterdb.password.ALL=oracle //设定所有数据库用户使用同一个密码SECURITY_UPDATES_VIA_MYORACLESUPPORT=false //(手动写了false)DECLINE_SECURITY_UPDATES=true   //设置安全更新(貌似是有bug,这个一定要选true,否则会无限提醒邮件地址有问题,终止安装。PS:不管地址对不对)


开始静默安装

[oracle@cyylog database]$ ./runInstaller -silent -responseFile /home/oracle/etc/db_install.rsp

新开一个终端 查看安装日志

# tail -f /u01/app/oraInventory/logs/installActions2016-08-31_06-56-29PM.log

出现类似如下提示表示安装完成:

------------------------------------------------------------------------

The following configuration scripts need to be executed as the "root" user. #!/bin/sh #Root scripts to run

/u01/app/oraInventory/orainstRoot.sh /u01/app/oracle/product/11.2.0/db_1/root.sh To execute the configuration scripts:

Open a terminal window Log in as "root" Run the scripts Return to this window and hit "Enter" key to continue

Successfully Setup Software.

-----------------------------------------------------------------------------

使用root用户执行脚本

$ su - root# /u01/app/oraInventory/orainstRoot.sh# /u01/app/oracle/product/11.2.0/db_1/root.sh

增加或修改oracle的环境变量

# su - oracle# vim ~/.bash_profile


#for oracleexport ORACLE_BASE=/u01/app/oracleexport ORACLE_SID=dbsrv2export ROACLE_PID=ora11g#export NLS_LANG=AMERICAN_AMERICA.AL32UTF8export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/libexport ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1export PATH=$PATH:$ORACLE_HOME/bin​export LANG="zh_CN.UTF-8"export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'​​刷新环境变量# source ~/.bash_profile

配置监听程序

[oracle@cyylog ~]$ netca /silent /responsefile /home/oracle/etc/netca.rsp​Parsing command line arguments:Parameter "silent" = trueParameter "responsefile" = /home/oracle/etc/netca.rspDone parsing command line arguments.Oracle Net Services Configuration:Profile configuration complete.Oracle Net Listener Startup:Running Listener Control: /u01/app/oracle/product/11.2.0/db_1/bin/lsnrctl start LISTENERListener Control complete.Listener started successfully.Listener configuration complete.Oracle Net Services configuration successful. The exit code is 0

启动监控程序

[oracle@cyylog ~]$ lsnrctl start​LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 01-SEP-2016 11:23:31​Copyright (c) 1991, 2009, Oracle. All rights reserved.​Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...​TNSLSNR for Linux: Version 11.2.0.1.0 - ProductionSystem parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.oraLog messages written to /u01/app/oracle/diag/tnslsnr/cyylog/listener/alert/log.xmlListening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=cyylog)(PORT=1521)))​Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))STATUS of the LISTENER------------------------Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.1.0 - ProductionStart Date 01-SEP-2016 11:23:31Uptime 0 days 0 hr. 0 min. 0 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.oraListener Log File /u01/app/oracle/diag/tnslsnr/cyylog/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=cyylog)(PORT=1521)))The listener supports no servicesThe command completed successfully

静默dbca建库

编辑应答文件

[oracle@cyylog ~]$ vi etc/dbca.rsp
[GENERAL]RESPONSEFILE_VERSION = "11.2.0"OPERATION_TYPE = "createDatabase"[CREATEDATABASE]GDBNAME = "dbsrv2"SID = "dbsrv2"TEMPLATENAME = "General_Purpose.dbc"CHARACTERSET = "AL32UTF8"

建库(我的finashell会闪屏,但是不影响使用)

[oracle@cyylog ~]$ dbca -silent -responseFile etc/dbca.rsp​Enter SYS user password:  Enter SYSTEM user password:  sh: /bin/ksh: No such file or directorysh: /bin/ksh: No such file or directoryCopying database files1% complete3% complete11% complete18% complete26% complete37% completeCreating and starting Oracle instance40% complete45% complete50% complete55% complete56% complete57% complete60% complete62% completeCompleting Database Creation66% complete70% complete73% complete74% complete85% complete96% complete100% completeLook at the log file Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl11g/orcl11g.log" for further details.
[oracle@cyylog ~]$ dbca -silent -responseFile etc/dbca.rsp​Enter SYS user password:  Enter SYSTEM user password:  sh: /bin/ksh: No such file or directorysh: /bin/ksh: No such file or directoryCopying database files1% complete3% complete11% complete18% complete26% complete37% completeCreating and starting Oracle instance40% complete45% complete50% complete55% complete56% complete57% complete60% complete62% completeCompleting Database Creation66% complete70% complete73% complete74% complete85% complete96% complete100% completeLook at the log file Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl11g/orcl11g.log" for further details.

查看输出日志

[oracle@cyylog ~]$ tailf /u01/app/oracle/cfgtoollogs/dbca/silent.logCopying database filesDBCA_PROGRESS : 1%DBCA_PROGRESS : 3%DBCA_PROGRESS : 11%DBCA_PROGRESS : 18%DBCA_PROGRESS : 26%DBCA_PROGRESS : 37%Creating and starting Oracle instanceDBCA_PROGRESS : 40%DBCA_PROGRESS : 45%DBCA_PROGRESS : 50%DBCA_PROGRESS : 55%DBCA_PROGRESS : 56%DBCA_PROGRESS : 60%DBCA_PROGRESS : 62%Completing Database CreationDBCA_PROGRESS : 66%DBCA_PROGRESS : 70%DBCA_PROGRESS : 73%DBCA_PROGRESS : 85%DBCA_PROGRESS : 96%DBCA_PROGRESS : 100%Database creation complete. For details check the logfiles at: /u01/app/oracle/cfgtoollogs/dbca/orcl11g.Database Information:Global Database Name:orcl11g.us.oracle.comSystem Identifier(SID):dbsrv2

至此完成数据库实例的创建。


-----------------------------------------------------------------------------------

-----------------------------------------------------------------------------------

附:

删除实例:

[oracle@cyylog ~]$ dbca -silent -deleteDatabase -sourcedb dbsrv2

文章来源:

标签: #centos55vim安装