Linux (CentOS 7) 下静默安装 Oracle 11g 11.2.0 步骤
oracle11g数据库下载地址
1.如果是刚安装的系统,需要检查依赖包安装
rpm -q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc-2.17 glibc-common glibc-devel glibc-headers ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel
2.安装依赖包
如果yum安装较慢建议切换阿里yum源
yum源切换
先安装wget命令yum install wget -y #wget命令就是在线下载一个url的静态资源再执行wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
注:切换之前建议先备份 /etc/yum.repos.d 中的文件
yum install compat-libstdc++-33 -yyum install elfutils-libelf-devel -yyum install gcc-c++ -yyum install glibc-* -yyum install ksh -yyum install libaio -yyum install libaio-devel -yyum install libstdc++-devel -yyum install unixODBC -yyum install unixODBC-devel -y
3.创建需要的用户和用户组
groupadd oinstallgroupadd dbagroupadd asmadmingroupadd asmdbauseradd -g oinstall -G dba,asmdba oracle -d /home/oraclepasswd oracle
4.修改linux内核参数并关闭selinux、防火墙
vim /etc/sysctl.conf 增加或者修改
具体参数参考如下:
fs.aio-max-nr = 1048576fs.file-max = 6815744kernel.shmall = 2097152kernel.shmmax = 536870912kernel.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
关闭selinuxvim /etc/selinux/config设置SELINUX=disabled关闭防火墙systemctl stop firewalld
5.修改/etc/security/limits.conf文件、/etc/pam.d/login文件、/etc/profile文件
vim /etc/security/limits.conf
添加以下设置:
oracle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536oracle soft stack 10240
修改/etc/pam.d/login文件
vim /etc/pam.d/login
添加以下内容
session required /lib64/security/pam_limits.sosession required pam_limits.so
修改/etc/profile文件
vim /etc/profile
添加以下配置
if [ $USER = \"oracle\" ]; thenif [ $SHELL = \"/bin/ksh\" ]; thenulimit -p 16384ulimit -n 65536elseulimit -u 16384 -n 65536fifi
使profile文件生效
source /etc/profile
6.创建数据库相关目录并授权、修改/etc/oraInst.loc文件
mkdir -p /u01/app/chown -R oracle:oinstall /home/oraclechmod -R 775 /home/oraclechown -R oracle:oinstall /u01/app/chmod -R 775 /u01/app/
添加/etc/oraInst.loc文件并授权
vim /etc/oraInst.locinventory_loc=/u01/app/oracle/oraInventoryinst_group=oinstallchown oracle:oinstall /etc/oraInst.locchmod 664 /etc/oraInst.loc
7.切换的oracle用户,并设置用户环境变量
su - oracle
设置如下:
vim ~/.bash_profileexport ORACLE_BASE=/u01/app/oracleexport ORACLE_SID=orcl
使其生效
source /home/oracle/.bash_profile
8.上传已经下载好的数据库安装包到linux任意目录并解压,我这里解压到的是/home/oracle/目录
unzip linux.x64_11gR2_database_1of2.zipunzip linux.x64_11gR2_database_2of2.zip
9.切换到root用户并授权相关文件
su - rootcd /home/oracle/mkdir etccp /home/oracle/database/response/* /home/oracle/etc/chmod 777 /home/oracle/etc/*.rsp
10.切换到oracle用户,配置数据库安装文件
su - oraclevim /home/oracle/etc/db_install.rsp
配置如下:
oracle.install.option=INSTALL_DB_SWONLYORACLE_HOSTNAME=主机名UNIX_GROUP_NAME=oinstallINVENTORY_LOCATION=/u01/app/oracle/oraInventorySELECTED_LANGUAGES=en,zh_CN,zh_TWORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1ORACLE_BASE=/u01/app/oracleoracle.install.db.InstallEdition=EEoracle.install.db.isCustomInstall=falseoracle.install.db.DBA_GROUP=dbaoracle.install.db.OPER_GROUP=oinstall#这里必须填tureDECLINE_SECURITY_UPDATES=true
11.执行安装
./runInstaller -silent -force -responseFile /home/oracle/etc/db_install.rsp -ignorePrereq
此处会卡住,安装完成会出现以下情况则安装成功,若未出现可查看日志文件
12.安装完成后切换到root用户
su root执行sh /u01/app/oracle/product/11.2.0/db_1/root.sh
13.切换成oracle用户配置环境变量
su - oraclevim ~/.bash_profile
添加配置如下:
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1export TNS_ADMIN=$ORACLE_HOME/network/adminexport PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/binexport PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/binexport LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/libexport LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/libexport LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/libexport CLASSPATH=${CLASSPATH}:$ORACLE_HOME/JREexport CLASSPATH=${CLASSPATH}:$ORACLE_HOME/JRE/libexport CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlibexport CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlibexport CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlibexport LIBPATH=${CLASSPATH}:$ORACLE_HOME/lib:$ORACLE_HOME/ctx/libexport ORACLE_OWNER=oracleexport SPFILE_PATH=$ORACLE_HOME/dbsexport ORA_NLS10=$ORACLE_HOME/nls/data
使.bash_profile文件生效
source ~/.bash_profile
14.安装数据库实例,配置dbca.rsp文件
vim /home/oracle/etc/dbca.rsp
配置如下:
GDBNAME = \"orcl\"SID = \"orcl\"SYSPASSWORD = \"oracle\"SYSTEMPASSWORD = \"oracle\"SYSMANPASSWORD = \"oracle\"DBSNMPPASSWORD = \"oracle\"DATAFILEDESTINATION =/u01/app/oracle/oradataRECOVERYAREADESTINATION=/u01/app/oracle/fast_recovery_areaCHARACTERSET = \"ZHS16GBK\"TOTALMEMORY = \"1638\"其中TOTALMEMORY = \"1638\" 为1638MB,物理内存2G*80%。```
15.安装数据库实例
dbca -silent -responseFile /home/oracle/etc/dbca.rsp
出现以下文字则安装成功
实例进程检查
ps -ef | grep ora_ | grep -v grep
16.监听配置,切换到oracle用户
su - oracle配置监听netca /silent /responsefile /home/oracle/database/response/netca.rsp
监听配置成功后如下:
查看监听状态
netstat -tnulp | grep 1521
如果出现以下情况
切换到root用户执行以下操作即可
chmod +s /bin/netstat
17.安装完成,使用sqlplus连接测试
sqlplus system/****
注:如果以上11步出现以下错误,可使用命令行方式安装
静默安装报错:Starting Oracle Universal Installer...Checking Temp space: must be greater than 120 MB. Actual 7328 MB PassedChecking swap space: must be greater than 150 MB. Actual 8191 MB PassedPreparing to launch Oracle Universal Installer from /tmp/OraInstall2011-02-16_10-55-12PM. Please wait ...[oracle@Oracle111 database]$ [FATAL] [INS-10105] The given response file /data1/database/response/myinstall.rsp is not valid.CAUSE: Syntactically incorrect response file. Either unexpected variables are specified or expected variables are not specified in the response file.ACTION: Refer the latest product specific response file templateSUMMARY:- cvc-complex-type.2.4.b: The content of element \'properties\' is not complete. One of \'{\"\":oracle.install.db.CLUSTER_NODES, \"\":oracle.install.db.isRACOneInstall, \"\":oracle.install.db.racOneServiceName, \"\":oracle.install.db.OPER_GROUP, \"\":oracle.install.db.config.starterdb.type, \"\":oracle.install.db.config.starterdb.SID, \"\":oracle.install.db.config.starterdb.globalDBName, \"\":oracle.install.db.config.starterdb.characterSet, \"\":oracle.install.db.config.starterdb.memoryLimit, \"\":oracle.install.db.config.starterdb.enableSecuritySettings, \"\":oracle.install.db.config.starterdb.installExampleSchemas, \"\":oracle.install.db.config.starterdb.memoryOption, \"\":oracle.install.db.config.starterdb.storageType, \"\":oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation, \"\":oracle.install.db.config.starterdb.fileSystemStorage.dataLocation, \"\":oracle.install.db.config.starterdb.password.ALL, \"\":oracle.install.db.config.starterdb.password.SYS, \"\":oracle.install.db.config.starterdb.password.DBSNMP, \"\":oracle.install.db.config.starterdb.password.SYSMAN, \"\":oracle.install.db.config.starterdb.password.SYSTEM, \"\":oracle.install.db.config.starterdb.control, \"\":oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL, \"\":oracle.install.db.config.starterdb.automatedBackup.enable, \"\":oracle.install.db.config.starterdb.automatedBackup.osuid, \"\":oracle.install.db.config.starterdb.automatedBackup.ospwd, \"\":oracle.install.db.config.asm.diskGroup, \"\":oracle.install.db.config.asm.ASMSNMPPassword, \"\":SECURITY_UPDATES_VIA_MYORACLESUPPORT, \"\":DECLINE_SECURITY_UPDATES, \"\":MYORACLESUPPORT_USERNAME, \"\":MYORACLESUPPORT_PASSWORD, \"\":PROXY_PORT, \"\":PROXY_HOST, \"\":PROXY_USER, \"\":PROXY_PWD, \"\":COLLECTOR_SUPPORTHUB_URL, \"\":AUTOUPDATES_MYORACLESUPPORT_USERNAME, \"\":AUTOUPDATES_MYORACLESUPPORT_PASSWORD, \"\":oracle.installer.autoupdates.option, \"\":oracle.installer.autoupdates.downloadUpdatesLoc}\' is expected.A log of this session is currently saved as: /tmp/OraInstall2011-02-16_10-55-12PM/installActions2011-02-16_10-55-12PM.log. Oracle recommends that if you want to keep this log, you should move it from the temporary location to a more permanent location.
命令行安装
./runInstaller -silent -ignorePrereq -debug -force \\FROM_LOCATION=/data/database/stage/products.xml \\oracle.install.option=INSTALL_DB_SWONLY \\UNIX_GROUP_NAME=oinstall \\NVENTORY_LOCATION=/u01/app/oracle/oraInventory \\ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 \\ORACLE_BASE=/u01/app/oracle oracle.install.db.InstallEdition=EE \\oracle.install.db.isCustomInstall=false \\oracle.install.db.DBA_GROUP=dba \\oracle.install.db.OPER_GROUP=oinstall \\oracle.install.db.config.starterdb.characterSet=ZHS16GBK \\oracle.install.db.config.starterdb.memoryLimit=512 \\oracle.install.db.config.starterdb.password.ALL=password \\DECLINE_SECURITY_UPDATES=true
以上就是linux下静默安装oracle11g 11.2.0 的全部过程,欢迎参考!!!