Oracle 12CR2 installation on CentOS-7

Source: Internet
Author: User
Tags gpg file permissions sqlplus

Installing Oracle-database-server-12cr2-preinstall

wget http://public-yum.oracle.com/public-yum-ol7.repo -O /etc/yum.repos.d/public-yum-ol7.repowget http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol7 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracleyum clean allyum -y updateyum -y groupinstall 'X Window System'yum -y install oracle-database-server-12cR2-preinstall

Create an Oracle installation directory

mkdir -p /u01/app/oracle/product/12.2.0.1/db_1chown -R oracle:oinstall /u01chmod -R 775 /u01

Create an Oracle environment variable configuration file

mkdir /home/oracle/scriptscat > /home/oracle/scripts/setEnv.sh <<EOF# Oracle Settingsexport TMP=/tmpexport TMPDIR=\$TMPexport ORACLE_HOSTNAME=ol7-122.localdomainexport ORACLE_UNQNAME=cdb1export ORACLE_BASE=/u01/app/oracleexport ORACLE_HOME=\$ORACLE_BASE/product/12.2.0.1/db_1export ORACLE_SID=cdb1export PATH=/usr/sbin:/usr/local/bin:\$PATHexport PATH=\$ORACLE_HOME/bin:\$PATHexport LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/libexport CLASSPATH=\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlibEOFecho ". /home/oracle/scripts/setEnv.sh" >> /home/oracle/.bash_profile

Create an Oracle startup script, placed in /home/oracle/scripts/dbora.sh :

#!/bin/bash. /home/oracle/scripts/setenv.shexport Oraenv_ask=no. Oraenvexport oraenv_ask=yesstartup_log=/home/oracle/scripts/startup.logshutdown_log=/home/oracle/scripts/ Shutdown.logfunction Oracle_start () {# Start the Oracle Databases:echo "-------------------------------------------    ------"Date +"%T%a%d:starting Oracle Databases as part of the system up. " echo "-------------------------------------------------" ${oracle_home}/bin/sqlplus/nolog << EOF conn/as sy    SDBA startup alter pluggable database all open;    Exiteof echo "done." # Start the Listener:echo "-------------------------------------------------" date + "%T%a%d:starting Oracle Li    Steners as part of the system up. "     echo "-------------------------------------------------" ${oracle_home}/bin/lsnrctl start echo "done."    echo "-------------------------------------------------" date + "%T%a%d:finished." echo "-------------------------------------------------"}function Oracle_stop () {# Stop the Oracle Listener:echo "-------------------------------------------------" dat     E + "%T%a%d:stoping Oracle Listener as part of the system down."       echo "-------------------------------------------------" ${oracle_home}/bin/lsnrctl stop echo "done." # Stop the Oracle database:echo "-------------------------------------------------" date + "%T%a%d:stoping Ora     CLE Databases as part of the system down. echo "-------------------------------------------------" ${oracle_home}/bin/sqlplus/nolog << EOF conn/as sy    SDBA Alter pluggable database all close immediate;     Shutdown immediate exiteof echo "done."    echo "echo"-------------------------------------------------"date +"%T%a%d:finished. " echo "-------------------------------------------------"}case "Instart" echo "Starting Oracle Databases. . "Oracle_start >> $startup _log echo" Oracle Started SUCCESSFUlly. ";; Stop) echo "stoping Oracle Databases ... "Oracle_stop >> $shutdown _log echo" Oracle Stopped. "; Restart) echo "Restarting Oracle Databases ... "Oracle_stop >> $shutdown _log oracle_start >> $startup _log echo" Oracle restarted. "; status) ${oracle_home}/bin/lsnrctl status;; *) echo "Usage: $ (basename $) {start|strop|restart|status}" exit 1esacexit 0

To adjust script file permissions:

chown -R oracle.oinstall /home/oracle/scriptschmod u+x /home/oracle/scripts/*.sh

Write systemd.service service scripts, in /etc/systemd/system/oracle.service :

[Unit]Description=Oracle ServiceAfter=network.targetAfter=syslog.target[Service]User=oracleGroup=dbaType=oneshotExecStart=/home/oracle/scripts/dbora.sh startExecReload=/home/oracle/scripts/dbora.sh restartExecStop=/home/oracle/scripts/dbora.sh stopRemainAfterExit=yes[Install]WantedBy=multi-user.target

rootEXECUTE AS User:systemctl enable oracle.service
Start Oracle Universal Installations (OUI) when you're done

Oracle 12CR2 installation on CentOS-7

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.