Shell script for installing Oracle in Linux

Source: Internet
Author: User
Installing Oracle on the Linux platform requires a lot of preparation. For example, create a user, modify the environment variables, and set oracle parameters. Now it is compiled into a shell script

Installing Oracle on the Linux platform requires a lot of preparation. For example, create a user, modify the environment variables, and set oracle parameters. Now it is compiled into a shell script

Installing Oracle on the Linux platform requires a lot of preparation. For example, creating a user, modifying environment variables, and some oracle parameters. Now it is compiled into a shell script to facilitate installation.
1. Create an installation script
Vi install. sh
#/Bin/bash
../Adduser. sh
../Sysctl. sh
../Limits. sh
../Mkdir. sh
../Chprofile. sh

2. Add users and user groups
Vi adduser. sh

#/Bin/bash
ADDGROUPS = "oinstall dba"
ADDUSERS = "oracle"

For group in $ ADDGROUPS; do

If [-z "$ (awk-F: '{print $1}'/etc/group | grep $ group)"]; then
Groupadd $ group
Echo "Add new group $ group"
Else
Echo "Group $ group already existed"
Fi
Done

For user in $ ADDUSERS; do

If [-z "$ (awk-F: '{print $1}'/etc/passwd | grep $ user)"]; then
Useradd $ user
Echo "Add new user $ user"
Else
Echo "User $ user already existed"
Fi
Done

If $ (usermod-g oinstall-G dba oracle); then
Echo "Modify user oracle account success"
Else
Echo "Modify user oracle account failure"
Fi

3. create the required directory
Vi mkdir. sh

#/Bin/bash
ORACLE_FILE_BASE = "/u01/app/oracle"
ORACLE_FILE_VAR = "/var/opt/oracle"
ORACLE_FILE_HOME = "$ ORACLE_FILE_BASE/product/10.2.0/db_1"

For directory in $ ORACLE_FILE_BASE $ ORACLE_FILE_VAR $ ORACLE_FILE_HOME; do
If [-d $ directory]; then
Echo "Directory $ directory already existed"
Else
Mkdir-p $ directory
Chown-R oracle. dba $ directory
Echo "Change directory $ directory owner and group success"
Fi
Done

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.