oracle:11.2.0.4
linux:红帽6.5
依赖包,是全部都写上来了,按照需求选择,也可以全部都安装一遍
yum install -y binutils-* compat-libstdc++-33-* elfutils-libelf-* elfutils-libelf-devel-* gcc-* gcc-c++-* glibc-* glibc-common-* glibc-devel-* glibc-headers-* ksh-* libaio-* libgcc-* libstdc++-* make-* sysstat-* unixODBC-* unixODBC-devel-* ld-linux.so.2 libXp.so.6 libXt.so.6 libXtst.so.6 glibc.i686 libgcc.i686 glibc-devel.i686
yum install -y binutils compat-libcap1 compat-libstdc++-33 e2fsprogs e2fsprogs-libs glibc glibc-devel ksh libaio-devel libaio libgcc libstdc++ libstdc++-devel libxcb libX11 libXau libXi libXtst make net-tools nfs-utils smartmontools sysstat gcc-c++-4.* gcc-4.*
yum install binutils-2.* compat-libstdc++-33* elfutils-libelf-0.* elfutils-libelf-devel-* gcc-4.* gcc-c++-4.* glibc-2.* glibc-common-2.* glibc-devel-2.* glibc-headers-2.* libaio-0.* libaio-devel-0.* libgcc-4.* libstdc++-4.* libstdc++-devel-4.* make-3.* sysstat-7.* unixODBC-2.* unixODBC-devel-2.*
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
创建oracle用户和属组,grid用户,这里是嫌麻烦,所以就直接创建了oracle和grid用户
groupadd oinstall
groupadd dba
useradd -m -g oinstall -G dba oracle
passwd oracle
useradd -m -g oinstall -G dba grid
passwd grid
vim /etc/hosts
--------------------------
192.168.100.100 oracle
--------------------------
vim /etc/selinux/config
----------------------
SELINUX=disabled
---------------------
修改oracle用户限制
vi /etc/security/limits.conf
----------------------------------------
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
----------------------------------------
修改系统参数
vi /etc/sysctl.conf
----------------------------------------
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
fs.file-max = 6815744
----------------------------------------
sysctl -p
最全创建目录,按照需求创建目录,给予权限,为了方便,我把grid目录也创建了:
mkdir -p /u01/app
chown -R grid:oinstall /u01/app/
chmod -R 775 /u01/app/
mkdir -p /u01/app/grid
mkdir -p /u01/app/oracle
chown -R grid:oinstall /u01/app/grid/
chown -R oracle:oinstall /u01/app/oracle/
chmod -R 775 /u01/app/grid/
chmod -R 775 /u01/app/oracle/
mkdir -p /u01/app/11.2.0/grid
chown -R grid:oinstall /u01/app/11.2.0/grid
chmod -R 775 /u01/app/11.2.0/grid
mkdir -p /u01/app/oracle/oradata
chown -R oracle:oinstall /u01/app/oracle/oradata
chmod -R 775 /u01/app/oracle/oradata
mkdir -p /u01/app/oraInventory
chown -R oracle:oinstall /u01/app/oraInventory
chmod -R 775 /u01/app/oraInventory
mkdir -p /u01/app/oracle/product/11.2.0/db_1
chown -R oracle:oinstall /u01/app/oracle/product/11.2.0/db_1
chmod -R 775 /u01/app/oracle/product/11.2.0/db_1
设置 oracle 帐号登录时环境
(以下以 oracle 身份登录): 编辑文件
su - oracle
vim .bash_profile
添加如下行:
-----------------------------
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
ORACLE_SID=ora11g
LD_LIBRARY_PATH=$ORACLE_HOME/lib
PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin
export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATH
-----------------------------
保存退出后执行如下命令使以上设置立即生效:
source .bash_profile
好了,前期安装准备,都是一样的,接下来是静默安装的
响应文件所在的目录:
vim /u01/database/response/db_install.rsp--------------------------------------------------------
oracle.install.option=INSTALL_DB_SWONLY // 安装类型
ORACLE_HOSTNAME=docker // 主机名称(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_home
ORACLE_BASE=/u01/app/oracle //oracle_base
oracle.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 //globalDBName
oracle.install.db.config.starterdb.SID=dbsrv2 //SID
oracle.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:不管地址对不对)
-------------------------------------------------------------------------------------------------------------------------
运行静默安装
su -oracle
./runInstaller -silent -ignoreSysPrereqs -showProgress -responseFile /u01/database/response/db_install.rsp
其中-silent指的是静默安装,-ignorePrereq忽略prerequisite的检查结果,showProgress显示进度,responseFile是种子文件。
查看安装日志
tail -f /u01/app/oraInventory/logs/installActions2018-11-27_06-56-29PM.log
运行完成后,会让执行两个脚本
root用户执行以下两个脚本
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0.4/db_1/root.sh
运行静默安装监听
netca.rsp在 /u01/app/database/response中
我因为是默认的,所以就没改
netca -silent -responseFile /u01/app/database/response/netca.rsp
静默安装库,需要修改项
vim /u01/database/response/dbca.rsp
-------------------------------------------------------
RESPONSEFILE_VERSION = "10.0.0"
OPERATION_TYPE = "createDatabase"
GDBNAME = "ora11g" //数据库全局名称
SID = "ora11g" //这个sid 必须要和前面的/home/oracle/.bash_profile文件中的sid相同
TEMPLATENAME = "New_Database.dbt"
SYSPASSWORD = "oracle" //SYS 用户的初始密码
SYSTEMPASSWORD = "oracle" //SYSTEM 用户的初始密码
DATAFILEDESTINATION ="/u01/app/oracle/oradata/"
RECOVERYAREADESTINATION="/u01/app/oracle/flash_recovery_area"
STORAGETYPE=FS
CHARACTERSET = "ZHS16GBK" //数据库字符集(中文为
ZHS16GBK )
MEMORYPERCENTAGE = "40"
SCRIPTDESTINATION ="/u01/app/oracle/admin/ora10g/scripts"
EMCONFIGURATION=”LOCAL”
SYSMANPASSWORD = "system"
DBSNMPPASSWORD = "system"
其中最后1项不是必须的,这个的目的是在建立数据库的同时生成脚本。
下面就可以开始SILENT模式的数据库创建了。
----------------------------------------------------------------
dbca -silent -responseFile /u01/database/response/dbca.rsp
执行后,如果出现清屏,请一定要检查,实例名、sys密码、system密码的正确性
如果出现错误:
SQL> startup
ORA-01081: cannot start already-running ORACLE - shut it down first
解决方法:
shutdown abort;
startup;
即可
shutdown abort;
startup;
来源:https://www.cnblogs.com/liukk/p/10031017.html