准备工作
已经通过安装oracle-rdbms-server-11gR2-preinstall包把环境准备好。
[oracle@centos ~]$ rpm -aq|grep oracle oracle-rdbms-server-11gR2-preinstall-1.0-15.el6.x86_64
解压包
unzip p13390677_112040_Linux-x86-64_1of7.zip unzip p13390677_112040_Linux-x86-64_2of7.zip
创建安装目录
sudo mkdir -p /u01/app/oracle sudo mkdir -p /u01/app/oraInventory sudo chown -R oracle:oinstall /u01/app/oracle sudo chmod -R 775 /u01/app/oracle
创建oraInst.loc
sudo echo "inventory_loc=/u01/app/oraInventory" > /etc/oraInst.loc sudo echo "inst_group=oinstall" >> /etc/oraInst.loc
配置oracle用户环境变量
在文件/home/oracle/.bash_profile里添加下面内容(具体值根据实际情况修改)
umask 022 export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1 export ORACLE_SID=orcl export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib export PATH=.:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$ORACLE_HOME/jdk/bin:$PATH export LC_ALL="en_US" export LANG="en_US" export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
使之生效
. .bash_profile
或
source ~/.bash_profile
复制响应文件模板
mkdir -p /u01/etc [oracle@centos ~]$ cp database/response/* /u01/etc 1 2 sed -e '/oracle.install.option/coracle.install.option=INSTALL_DB_SWONLY' \ -e '/^DECLINE_SECURITY_UPDATES/cDECLINE_SECURITY_UPDATES=true' \ -e '/UNIX_GROUP_NAME/cUNIX_GROUP_NAME=oinstall' \ -e '/INVENTORY_LOCATION=/cINVENTORY_LOCATION=\/u01\/oracle\/oraInventory' \ -e '/^SELECTED_LANGUAGES/cSELECTED_LANGUAGES=en,zh_CN' \ -e '/ORACLE_HOSTNAME/cORACLE_HOSTNAME=centos.oracle' \ -e '/ORACLE_HOME/cORACLE_HOME=\/u01\/app\/oracle\/product\/11.2.0\/dbhome_1' \ -e '/ORACLE_BASE=/cORACLE_BASE=\/u01\/app\/oracle' \ -e '/oracle.install.db.InstallEdition=/coracle.install.db.InstallEdition=EE' \ -e '/oracle.install.db.isCustomInstall=/coracle.install.db.isCustomInstall=true' \ -e '/oracle.install.db.DBA_GROUP=/coracle.install.db.DBA_GROUP=dba' \ -e '/oracle.install.db.OPER_GROUP=/coracle.install.db.OPER_GROUP=dba' \ database/response/db_install.rsp > /u01/etc/db_install.rsp diff database/response/db_install.rsp /u01/etc/db_install.rsp
别忘了把hostname的解析加入到/etc/hosts里面,不然会出现:
SEVERE: [FATAL] PRVF-0002 : Could not retrieve local nodename.
安装数据库软件
database/runInstaller -silent -responseFile /u01/etc/db_install.rsp ...... The installation of Oracle Database 11g was successful. Please check '/u01/oracle/oraInventory/logs/silentInstall2020-07-27_02-42-41PM.log' for more details. As a root user, execute the following script(s): 1. /u01/app/oracle/product/11.2.0/dbhome_1/root.sh [oracle@centos ~]$ sudo /u01/app/oracle/product/11.2.0/dbhome_1/root.sh Check /u01/app/oracle/product/11.2.0/dbhome_1/install/root_centos.oracle_2020-07-27_14-52-01.log for the output of root script
配置监听
[oracle@centos ~]$ netca /silent /responsefile /u01/etc/netca.rsp
alter system set local_listener="(address=(protocol=tcp)(host=192.168.87.117)(port=1521))";
创建数据库
我的博客里面有手工创建数据库的脚本,在install的分类中。