Tuesday, 25 June 2024

Oracle Database Bounce automatically shell scripts

 Dear All,


In this post i am going to share you the step by step Oracle database bounce automation steps .


Note : this scripts works in my demo instance this is purely education purpose you can test before you implement on any important servers .


Start the database automatically script : 

Below script will help you to start the database automatically , you need to schedule cron jobs and schedule the below scripts as per your requirement.


export ORACLE_HOME=/u01/db/product/12C/db_home

export ORACLE_SID=racsinfo

export NLS_LANG=******.AL32UTF8

export LD_LIBRARY_PATH=/u01/db/product/12C/db_home/lib:/usr/X11R6/lib:/u01/db/product/12C/db_home/ctx/lib

export PATH=$ORACLE_HOME/bin:$PATH

export TNS_ADMIN=/u01/db/product/12C/db_home/network/admin


date > database_instance_start.log

sqlplus -s / as sysdba << EOF

spool database_instance_start.log append;

startup;

spool off;

EOF


lsnrctl start racsinfo > database_listener_start.log


Stop the database automatically script : 

Below script will help you to stop the database automatically , you need to schedule cron jobs and schedule the below scripts as per your requirement.

export ORACLE_HOME=/u01/db/product/12C/db_home

export ORACLE_SID=racsinfo

export NLS_LANG=*******.AL32UTF8

export LD_LIBRARY_PATH=/u01/db/product/12C/db_home/lib:/usr/X11R6/lib:/u01/db/product/12C/db_home/ctx/lib

export PATH=$ORACLE_HOME/bin:$PATH

export TNS_ADMIN=/u01/db/product/12C/db_home/network/admin


date > database_instance_stop.log

sqlplus -s / as sysdba << EOF

spool database_instance_stop.log append;

--select to_char(sysdate,'YYYY/MM/DD HH24:MI:SS') from dual;

shutdown immediate;

spool off;

EOF


lsnrctl stop racsinfo > database_listener_stop.log


Happy Learning from Racsinfotech ... Lab Video will be available in youtube cannel @RACSINFOTECH

Thanks,

Srini 

No comments:

Post a Comment


No one has ever become poor by giving