Oracle startup script: differenze tra le versioni

Da Emigar.
Jump to navigation Jump to search
Riga 19: Riga 19:
. oraenv
. oraenv
lsnrctl start LISTENER
lsnrctl start LISTENER
echo startup |
echo startup | sqlplus '/ as sysdba'
;;
;;
stop)
stop)

Versione delle 16:05, 20 mag 2026

/etc/init.d/oracle

#! /bin/sh
#
# chkconfig: 2345 29 20
# description: start Oracle RDBMS at system boot
#
### BEGIN INIT INFO
# Provides: oracle
# Required-Stop:
# Default-Start: 2 3 5
# Default-Stop:
### END INIT INFO
case "$1" in
    start)
        ORACLE_SID=
        ORAENV_ASK=NO
        export ORACLE_SID ORAENV_ASK
        . oraenv
        lsnrctl start LISTENER
        echo startup | sqlplus '/ as sysdba'
	;;
    stop)
    ;;
	*)
	    echo "Usage: $0 {start|stop|restart|status}"
        exit 1
esac
exit 0


Upstart

# description "start and stop oracle instance"

start on runlevel [3]
stop on runlevel [!3]

console log
chdir /home/oracle
setuid oracle
setgid oinstall
expect fork

env ORACLE_BASE=/u01/app/oracle
env ORACLE_SID=ORCL
env ORAENV_ASK=NO

script
 . oraenv
 echo startup | sqlplus '/ as sysdba'
 lsnrctl start LISTENER
 echo 'ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;' | sqlplus '/ as sysdba'

end script

pre-stop script
 . oraenv
 echo 'ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;' | sqlplus '/ as sysdba'
 echo 'shutdown immediate' | sqlplus '/ as sysdba'
 lsnrctl stop LISTENER

end script



systemd