1. 程式人生 > >Centos7 Minimal安裝Oracle 11gR2

Centos7 Minimal安裝Oracle 11gR2

log ech 數據庫 系統配置文件 oot chm 註意 nls_lang sqlplus

Centos7 Minimal安裝Oracle 11gR2

環境vm12+新裝的centos7 x64 Minimal


#root 一些軟件
yum install wget unzip net-tool -y

#root 安裝環境自動配置
cd /etc/yum.repos.d
wget http://public-yum.oracle.com/public-yum-ol7.repo
wget http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol7 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
yum
install oracle-rdbms-server-11gR2-preinstall -y #root 配置oracle系統配置文件 cat >> /etc/oraInst.loc <<EOF inventory_loc=/home/oracle/ora11g/oraInventory inst_group=oinstall EOF #root 授權 chmod 664 /etc/oraInst.loc #root 加載內核參數 sysctl -p sysctl -f #root 備份一下 #/var/log/oracle-rdbms-server-11gR2-preinstall #root 移除安裝環境配置軟件
yum remove oracle-rdbms-server-11gR2-preinstall #安裝缺少的一個依賴 rpm -e ksh-20120801-34.el7.x86_64 wget http://vault.centos.org/5.11/os/x86_64/CentOS/pdksh-5.2.14-37.el5_8.1.x86_64.rpm rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm ######root if虛擬機沒有或者不夠swap空間 dd if=/dev/zero of=/data/swap4g bs=1M count=4096 mkswap
/data/swap4g chmod 600 /data/swap4g swapon /data/swap4g #root 設置密碼 passwd oracle #oracle cat >> /home/oracle/.bash_profile <<EOF ORACLE_HOSTNAME=$(hostname) ORACLE_BASE=/home/oracle/ora11g ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 ORACLE_SID=orcl NLS_LANG="american_america.UTF8" PATH=$ORACLE_HOME/bin:$PATH export ORACLE_BASE export ORACLE_HOME export ORACLE_SID export ORACLE_TERM export PATH export NLS_LANG alias sysdba=sqlplus "/ nolog" EOF #生效 source /home/oracle/.bash_profile echo $PATH #這兩個文件上傳在/home/oracle/ unzip linux.x64_11gR2_database_1of2.zip unzip linux.x64_11gR2_database_2of2.zip #oracle 配置初始化安裝文件 sed -i s/oracle.install.option=.*/oracle.install.option=INSTALL_DB_SWONLY/g db_install.rsp sed -i "s/ORACLE_HOSTNAME=.*/ORACLE_HOSTNAME=$(hostname)/g" db_install.rsp sed -i s/UNIX_GROUP_NAME=.*/UNIX_GROUP_NAME=oinstall/g db_install.rsp sed -i s/INVENTORY_LOCATION=.*/INVENTORY_LOCATION=\/home\/oracle\/ora11g\/oraInventory/g db_install.rsp sed -i s/SELECTED_LANGUAGES=.*/SELECTED_LANGUAGES=en,zh_CN/g db_install.rsp sed -i s/ORACLE_HOME=.*/ORACLE_HOME=\/home\/oracle\/ora11g\/product\/11.2.0\/db_1/g db_install.rsp sed -i s/ORACLE_BASE=.*/ORACLE_BASE=\/home\/oracle\/ora11g/g db_install.rsp sed -i s/oracle.install.db.InstallEdition=.*/oracle.install.db.InstallEdition=EE/g db_install.rsp sed -i s/oracle.install.db.isCustomInstall=.*/oracle.install.db.isCustomInstall=true/g db_install.rsp sed -i s/oracle.install.db.DBA_GROUP=.*/oracle.install.db.DBA_GROUP=dba/g db_install.rsp sed -i s/oracle.install.db.OPER_GROUP=.*/oracle.install.db.OPER_GROUP=oinstall/g db_install.rsp sed -i s/oracle.install.db.config.starterdb.type=.*/oracle.install.db.config.starterdb.type=GENERAL_PURPOSE/g db_install.rsp sed -i s/oracle.install.db.config.starterdb.globalDBName=.*/oracle.install.db.config.starterdb.globalDBName=orcl.lan/g db_install.rsp sed -i s/oracle.install.db.config.starterdb.SID=.*/oracle.install.db.config.starterdb.SID=orcl/g db_install.rsp sed -i s/oracle.install.db.config.starterdb.characterSet=.*/oracle.install.db.config.starterdb.characterSet=AL32UTF8/g db_install.rsp sed -i s/oracle.install.db.config.starterdb.memoryOption=.*/oracle.install.db.config.starterdb.memoryOption=true/g db_install.rsp sed -i s/oracle.install.db.config.starterdb.password.ALL=.*/oracle.install.db.config.starterdb.password.ALL=oracle/g db_install.rsp sed -i s/oracle.install.db.config.starterdb.control=.*/oracle.install.db.config.starterdb.control=DB_CONTROL/g db_install.rsp sed -i s/oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=.*/oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=true/g db_install.rsp sed -i s/DECLINE_SECURITY_UPDATES=.*/DECLINE_SECURITY_UPDATES=true/g db_install.rsp #oracle 配置監聽應答文件 sed -i s/INSTALL_TYPE=.*/INSTALL_TYPE=""custom""/g netca.rsp #oracle 配置數據庫應答文件 sed -i s#GDBNAME =.*#GDBNAME = "orcl"#g dbca.rsp sed -i s#SID =.*#SID = "orcl"#g dbca.rsp sed -i s/#SYSPASSWORD =.*/SYSPASSWORD = "oracle"/g dbca.rsp sed -i s/#SYSTEMPASSWORD =.*/SYSPASSWORD = "oracle"/g dbca.rsp #oracle /home/oracle/database/runInstaller -silent -ignorePrereq -responseFile /home/oracle/database/response/db_install.rsp #root 檢測安完成後,會提示用root用戶執行以下面的命令去完成最後的安裝 sh /home/oracle/ora11g/product/11.2.0/db_1/root.sh #oracle 創建實例 dbca -silent -responseFile /home/oracle/database/response/dbca.rsp 不管退格 輸入密碼oracle #oracle 創建監聽 netca /silent /responseFile /home/oracle/database/response/netca.rsp #oracle sqlplus / as sysdba #sqlplus 查看狀態 select status from v$instance;

查看監聽netstat等等
遠程連接的話註意配置防火墻

Centos7 Minimal安裝Oracle 11gR2