Skip to content

Instantly share code, notes, and snippets.

@brianduff
Created December 28, 2019 22:21
Show Gist options
  • Save brianduff/f6718c3d02dbaf4534a3ec7c5a2ae435 to your computer and use it in GitHub Desktop.
Save brianduff/f6718c3d02dbaf4534a3ec7c5a2ae435 to your computer and use it in GitHub Desktop.
Ancient script to start / stop oracle on gentoo
#!/sbin/runscript
#
# name: /etc/init.d/oracle
# description: starts and stops Oracle on Gentoo Linux
# author: Brian.Duff@oracle.com
#
# Change this to your Oracle user
oracle_user=ora92
depend() {
need net
use cupsd
}
start() {
ebegin "Starting oracle"
echo 1073741824 > /proc/sys/kernel/shmmax
result=$?
su - "$oracle_user" > /dev/null <<EOO
#
# If you have not defined ORACLE_HOME, ORACLE_BASE, ORACLE_SID and
# updated the PATH in the oracle user's .profile, you will need to
# uncomment the following lines and fill in the correct
# values for ORACLE_BASE, ORACLE_HOME and ORACLE_SID
#
# export ORACLE_BASE=/u01/app/oracle
# export ORACLE_HOME=$ORACLE_BASE/product/9.2.0.1.0
# export ORACLE_SID=yoursid
# export PATH=$PATH:$ORACLE_HOME/bin
#
lsnrctl start
sqlplus /nolog<<EOS
connect / as sysdba
startup
EOS
EOO
result=$(( $result + $? ))
eend $result
}
stop() {
ebegin "Stopping oracle"
su - "$oracle_user" > /dev/null <<EOO
#
# If you have not defined ORACLE_HOME, ORACLE_BASE, ORACLE_SID and
# updated the PATH in the oracle user's .profile, you will need to
# uncomment the following lines and fill in the correct
# values for ORACLE_BASE, ORACLE_HOME and ORACLE_SID
#
# export ORACLE_BASE=/u01/app/oracle
# export ORACLE_HOME=$ORACLE_BASE/product/9.2.0.1.0
# export ORACLE_SID=yoursid
# export PATH=$PATH:$ORACLE_HOME/bin
#
lsnrctl stop
sqlplus /nolog<<EOS
connect / as sysdba
shutdown immediate
EOS
EOO
eend $?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment