CentOS 6 静默安装oracle 11g
机器名修改
vim /etc/sysconfig/network
磁盘空间,需安装目录20G以上
df -h
#统架构
cat /proc/version
uname -a
#查看系统核心
uname -r
基础信息
vim /etc/sysconfig/selinux
SELINUX=enforcing改成SELINUX=disabled
setenforce 0
service iptables stop
chkconfig iptables off
vim /etc/hosts
添加一行内容:IP 机器名
修改用户的限制文件
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
net.ipv4.ip_local_port_range = 32768 60999
fs.file-max = 185933
kernel.shmall = 4294967296
kernel.shmmax = 68719476736
kernel.shmmni = 4096
kernel.sem = 250 32000 32 128
net.core.rmem_max = 124928
net.core.rmem_default = 124928
net.core.wmem_max = 124928
net.core.wmem_default = 124928
fs.aio-max-nr = 1048576
sysctl -p #使配置生效
依赖包检查安装
yum -y install \
binutils \
compat-libcap1 \
compat-libstdc++-33 \
compat-libstdc++-33*.i686 \
elfutils-libelf-devel \
gcc \
gcc-c++ \
glibc*.i686 \
glibc \
glibc-devel \
glibc-devel*.i686 \
ksh \
libgcc*.i686 \
libgcc \
libstdc++ \
libstdc++*.i686 \
libstdc++-devel \
libstdc++-devel*.i686 \
libaio \
libaio*.i686 \
libaio-devel \
libaio-devel*.i686 \
make \
sysstat \
unixODBC \
unixODBC*.i686 \
unixODBC-devel \
unixODBC-devel*.i686 \
libXp
建立用户,组,设置密码 groupadd oinstall groupadd dba groupadd oper
useradd -g oinstall -G dba,oper oracle
echo "oracle" | passwd --stdin oracle
查看一下 id oracle uid=501(oracle) gid=501(oinstall) 组=501(oinstall),502(dba),503(oper)
新建目录
mkdir -p /home/oracle/app/oracle/product/11.2.0/dbhome_1 #安装目录
mkdir -p /home/oracle/backup #数据备份目录
mkdir -p /home/oracle/oraInventory #清单目录,数据库创建及使用过程中的日志目录
修改权限
chown -R oracle:oinstall /home/oracle/app
chown -R oracle:oinstall /home/oracle/backup
chown -R oracle:oinstall /home/oracle/oraInventory
chmod -R 775 /home/oracle/app
设置环境变量(必须要设置在oracle用户的家目录下,可以su - oracle进入再修改,也可以用如下方法) su - oracle vim /home/oracle/.bash_profile
export ORACLE_BASE=/home/oracle/app
exportORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=ora11g
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
source /home/oracle/.bash_profile #环境变量生效
安装 解压安装包,注意切换用户,注意安装解压软件
yum install -y unzip zip
su - oracle
cd /home/oracle/app/oracle
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
解压后得到database目录,其中包含response目录,该目录中有三个rsp文件,用来作为静默安装时的应答文件的模板。三个文件作用分别是:
db_install.rsp:安装应答
dbca.rsp:创建数据库应答
netca.rsp:建立监听、本地服务名等网络设置的应答
修改配置文件,安装oracle软件
修改后的静默安装配置文件db_install.rsp
less /home/oracle/app/oracle/database/response/db_install.rsp |grep -v "#"|grep -v "^$"
#(照着下面结果一一对应)
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=bigdata06
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/home/oracle/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/home/oracle/app/
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=false
oracle.install.db.customComponents=oracle.server:11.2.0.1.0,oracle.sysman.ccr:10.2.7.0.0,oracle.xdk:11.2.0.1.0,oracle.rdbms.oci:11.2.0.1.0,oracle.network:11.2.0.1.0,oracle.network.listener:11.2.0.1.0,oracle.rdbms:11.2.0.1.0,oracle.options:11.2.0.1.0,oracle.rdbms.partitioning:11.2.0.1.0,oracle.oraolap:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,oracle.rdbms.dv:11.2.0.1.0,orcle.rdbms.lbac:11.2.0.1.0,oracle.rdbms.rat:11.2.0.1.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
oracle.install.db.CLUSTER_NODES=
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=ora11g
oracle.install.db.config.starterdb.SID=ora11g
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=1500
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
oracle.install.db.config.starterdb.password.ALL=oracle
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.SYSMAN=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false
oracle.install.db.config.starterdb.dbcontrol.emailAddress=
oracle.install.db.config.starterdb.dbcontrol.SMTPServer=
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.automatedBackup.osuid=
oracle.install.db.config.starterdb.automatedBackup.ospwd=
oracle.install.db.config.starterdb.storageType=
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=
MYORACLESUPPORT_USERNAME=
MYORACLESUPPORT_PASSWORD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=
DECLINE_SECURITY_UPDATES=true //一定要设为 true
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
静默安装
cd /home/oracle/database
./runInstaller -silent -responseFile /home/oracle/database/response/db_install.rsp
查看安装进度
tail -f cd /home/oracle/app/oracle/oraInventory/logs/installActions*log
As a root user, execute the following script(s):
1. /home/oracle/oraInventory/orainstRoot.sh
2. /home/oracle/app/oracle/product/11.2.0/dbhome_1/root.sh
Successfully Setup Software.
在新打开的客户端使用root登录的窗口中执行下面的脚本
/home/oracle/oraInventory/orainstRoot.sh
/home/oracle/app/oracle/product/11.2.0/dbhome_1/root.sh
配置oracle监听
export DISPLAY=localhost:0.0
cd /home/oracle/database/response
netca -silent -responsefile /home/oracle/database/response/netca.rsp
成功运行后,在/home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin目录下
生成sqlnet.ora和listener.ora两个文件。
看到监听器已经在1521端口
netstat -tlnp | grep 1521
手动启动监听程序。
/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start LISTENER
配置oracle数据库
vim /home/oracle/app/oracle/database/response/dbca.rsp
GDBNAME = "ora11g.poc01" # 全局数据库的名字=SID+主机域名
SID="ora11g" # 对应的实例名字(环境变量export ORACLE_SID=ora11g配置相同,否则出现错误)
SYSPASSWORD = "oracle" #
SYSTEMPASSWORD = "oracle" #
CHARACTERSET="AL32UTF8" #编码,字符集,重要!!! 建库后一般不能更改,所以建库前要确定清楚
NATIONALCHARACTERSET="UTF8" #编码
创建dbca数据库
$ORACLE_HOME/bin/dbca -silent -responseFile /home/oracle/database/response/dbca.rsp
启动数据库
sqlplus / as sysdba
select status from V$instance;
注意事项 需注意ORACLE_SID的问题,确认静默dbca建库时配置(SID="ora11g"//149行 ) 与环境变量export ORACLE_SID=ora11g配置相同,否则出现错误。 错误提示: ORA-01078: failure in processing system parameters LRM-00109: could not open parameter file '/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/initxtwl.ora'
注意:本文归作者所有,未经作者允许,不得转载