Editar el archivo oratab
editamos el archivo oratab con usuario root
vi /etc/oratab
editamos la linea TEST:/oracle/app/oracle/10.2.0/db:N y la cambiamos a Y
TEST:/oracle/app/oracle/10.2.0/db:Y
Crear Archivo de Inicio "Oracle"
Crearemos el archivo que iniciara las bases de datos automáticamente, llamaremos a este archivo oracle la ubicación de este archivo será:
Linux
/etc/init.d
Linux
/etc/init.d
HP-UX
/sbin/init.d
# /etc/init.d --- LINUX
# /sbin/init.d --- HP-UX
# Description: Starts and stops the Oracle database and listeners
ORA_HOME=/oracle/app/oracle/10.2.0/db
case "$1" in
start)
echo -n "Starting Oracle Databases: "
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Starting Oracle DB as part of system up." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
su - oracle -c $ORA_HOME/bin/dbstart >> /var/log/oracle
echo "Done."
echo -n "Starting Oracle Listeners: "
su - oracle -c "$ORA_HOME/bin/lsnrctl start" >> /var/log/oracle
echo "Done."
echo ""
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Finished." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
touch /var/lock/subsys/oracle
;;
stop)
echo -n "Shutting Down Oracle Listeners: "
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Shutting Down Oracle DB as part of system down." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
su - oracle -c "$ORA_HOME/bin/lsnrctl stop" >> /var/log/oracle
echo "Done."
rm -f /var/lock/subsys/oracle
echo -n "Shutting Down Oracle Databases: "
su - oracle -c $ORA_HOME/bin/dbshut >> /var/log/oracle
echo "Done."
echo ""
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Finished." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
;;
restart)
echo -n "Restarting Oracle Databases: "
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Restarting Oracle DB as part of system up." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
su - oracle -c $ORA_HOME/bin/dbstop >> /var/log/oracle
su - oracle -c $ORA_HOME/bin/dbstart >> /var/log/oracle
echo "Done."
echo -n "Restarting Oracle Listeners: "
su - oracle -c "$ORA_HOME/bin/lsnrctl stop" >> /var/log/oracle
su - oracle -c "$ORA_HOME/bin/lsnrctl start" >> /var/log/oracle
echo "Done."
echo ""
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Finished." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
touch /var/lock/subsys/oracle
;;
*)
echo "Usage: oracle {start|stop|restart}"
exit 1
esac
# /sbin/init.d --- HP-UX
# Description: Starts and stops the Oracle database and listeners
ORA_HOME=/oracle/app/oracle/10.2.0/db
case "$1" in
start)
echo -n "Starting Oracle Databases: "
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Starting Oracle DB as part of system up." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
su - oracle -c $ORA_HOME/bin/dbstart >> /var/log/oracle
echo "Done."
echo -n "Starting Oracle Listeners: "
su - oracle -c "$ORA_HOME/bin/lsnrctl start" >> /var/log/oracle
echo "Done."
echo ""
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Finished." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
touch /var/lock/subsys/oracle
;;
stop)
echo -n "Shutting Down Oracle Listeners: "
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Shutting Down Oracle DB as part of system down." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
su - oracle -c "$ORA_HOME/bin/lsnrctl stop" >> /var/log/oracle
echo "Done."
rm -f /var/lock/subsys/oracle
echo -n "Shutting Down Oracle Databases: "
su - oracle -c $ORA_HOME/bin/dbshut >> /var/log/oracle
echo "Done."
echo ""
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Finished." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
;;
restart)
echo -n "Restarting Oracle Databases: "
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Restarting Oracle DB as part of system up." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
su - oracle -c $ORA_HOME/bin/dbstop >> /var/log/oracle
su - oracle -c $ORA_HOME/bin/dbstart >> /var/log/oracle
echo "Done."
echo -n "Restarting Oracle Listeners: "
su - oracle -c "$ORA_HOME/bin/lsnrctl stop" >> /var/log/oracle
su - oracle -c "$ORA_HOME/bin/lsnrctl start" >> /var/log/oracle
echo "Done."
echo ""
echo "----------------------------------------------------" >> /var/log/oracle
date +"! %T %a %D : Finished." >> /var/log/oracle
echo "----------------------------------------------------" >> /var/log/oracle
touch /var/lock/subsys/oracle
;;
*)
echo "Usage: oracle {start|stop|restart}"
exit 1
esac
Privilegios de ejecución del Archivo
Asignamos privilegios de ejecución al archivo que creamos
Linux
chmod 750 /etc/init.d/oracle
HP-UX
chmod 750 /sbin/init.d/oracle
Linux
chmod 750 /etc/init.d/oracle
HP-UX
chmod 750 /sbin/init.d/oracle
Asociar Archivo
Linux
Asociamos el archivo como servicio, de acuerdo al nivel de ejecución
chkconfig --add oracle
Asociamos el archivo como servicio, de acuerdo al nivel de ejecución
chkconfig --add oracle
HP-UX
En la ruta /etc/rc.config.d creamos un archivo llamado oracle con la siguiente configuración:
ORACLE_START=1
export ORACLE_START
Links Simbólicos
Creamos los links simbólicos Para el nivel de ejecución apropiado
Linux
# ln -s /etc/init.d/oracle /etc/rc.d/rc3.d/K01oracle
# ln -s /etc/init.d/oracle /etc/rc.d/rc3.d/S99oracle
# ln -s /etc/init.d/oracle /etc/rc.d/rc5.d/K01oracle
# ln -s /etc/init.d/oracle /etc/rc.d/rc5.d/S99oracle
HP-UX
# ln -s /sbin/init.d/dbora /sbin/rc3.d/S990oracle
# ln -s /sbin/init.d/dbora /sbin/rc3.d/K001oracle
Linux
# ln -s /etc/init.d/oracle /etc/rc.d/rc3.d/K01oracle
# ln -s /etc/init.d/oracle /etc/rc.d/rc3.d/S99oracle
# ln -s /etc/init.d/oracle /etc/rc.d/rc5.d/K01oracle
# ln -s /etc/init.d/oracle /etc/rc.d/rc5.d/S99oracle
HP-UX
# ln -s /sbin/init.d/dbora /sbin/rc3.d/S990oracle
# ln -s /sbin/init.d/dbora /sbin/rc3.d/K001oracle
Este comentario ha sido eliminado por el autor.
ResponderEliminarSolo debes poner las bases de datos que necesites dentro del mismo archivo /etc/oratab
ResponderEliminarTEST:/oracle/app/oracle/10.2.0/db:Y
TEST1:/oracle/app/oracle/10.2.0/db:Y