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