DBA经常需要安装配置ORACLE,但在LINUX环境下,有时候客户环境受限的原因,导致无法调用图形界面来进行数据库安装,这个时候需要学习静默的方式安装,下面是在LINUX下静默方式安装ORACLE11G:
1、先确定yum能使用,网路能连上网络
yum install vim -y
2、yum install unzip -y
3、安装oracle需要的rpm包,直接运行下面命令即可批量安装:
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
4、安装后检查确定依赖包是否安装成功,如没安装会提示uninstall;检查有没有31个;
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-devel
5、添加安装用户和组
groupadd -g 501 oinstall
groupadd -g 502 dba
groupadd -g 601 asmadmin
groupadd -g 602 asmdba
groupadd -g 603 asmoper
useradd -u 1101 -g oinstall -G dba oracle
id oracle
6、添加内核参数
vim /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 48719476736
kernel.shmmni = 4096
kernel.sem = 250 32000 200 200
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
net.core.rmem_max = 4194304
7、/sbin/sysctl -p
8、修改用户的限制文件
vim /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
9、修改vim /etc/pam.d/login文件
vim /etc/pam.d/login
session required /lib64/security/pam_limits.so
session required pam_limits.so
10、关闭selinux
vim /etc/selinux/config
设置SELINUX=disabled
11、关闭防火墙
service iptables stop
systemctl stop firewalld
systemctl disable firewalld
12、创建目录和设置文件权限
mkdir -p /data/oracle/product/11.2.0
mkdir /data/oracle/oradata
mkdir /data/oracle/inventory
mkdir /data/oracle/fast_recovery_area
chown -R oracle:oinstall /data/oracle
chmod -R 775 /data/oracle
13、解压文件
mkdir -p /data/oracle/oracledir
cd /data/oracle/oracledir
unzip linux.x64_11gR2_database_1of2.zip && unzip linux.x64_11gR2_database_2of2.zip
14、su oracle。 vim .bash_profile
ORACLE_BASE=/data/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0
ORACLE_SID=orcl
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
使该文件生效
source .bash_profile
15、
vim /etc/profile
if [ $USER = "oracle" ] ; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
16、编辑静默安装响应文件
cd /home/oracle
cp -R /data/oracle/oraclesetup/database/response/ .
cd response/
vim db_install.rsp
修改如下
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=CentOS
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/data/oracle/inventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/data/oracle/product/11.2.0
ORACLE_BASE=/data/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=zkz.orcl
oracle.install.db.config.starterdb.SID=orcl
oracle.install.db.config.starterdb.password.ALL=123456
DECLINE_SECURITY_UPDATES=true
17、安装Oracle数据库软件
cd /data/oracle/oracledir/database/
./runInstaller -silent -responseFile /home/oracle/response/db_install.rsp -ignorePrereq
查看日志
18、配置监听
netca /silent /responseFile /home/oracle/response/netca.rsp
运行上面一句话后在 /data/oracle/product/11.2.0/netword/admin 下生成listener.ora文件
修改listener文件
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = orcl)
(ORACLE_HOME = /data/oracle/product/11.2.0)
(global_dbname = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.50)(PORT = 1521))
)
)
)
18、创建实例
vi /home/oracle/response/dbca.rsp
GDBNAME = "orcl"
SID = "orcl"
SYSPASSWORD = "*********"
SYSTEMPASSWORD = "*********"
CHARACTERSET = "ZHS16GBK"
NATIONALCHARACTERSET= "AL16UTF16"
修改后运行dbca创建实例:
dbca -silent -responseFile /home/oracle/response/dbca.rsp
19、启动监听
lsnrctl stop
lsnrctl start
sqlplus /nolog
conn /as sysdba
20、最后启动数据库完成安装!
connect sys/sys as sysdba
shutdown normal
startup mount
alter database open;
天凯科技-数据库技术支持
7*24小时提供数据库运维与优化服务,十年DBA实战经验,长期服务于国内关键行业,深受好评!
服务热线/微信:13926108245
本博客定期分享DBA实战处理经验,请关注本企业博客,同时还有精品视频教程分享,更多资源请点击访问"天凯运维资讯"获得!
发表评论 取消回复