Oracle 11.2.0.1.0
Linux 5.4
instance name PATIENTS
Purpose: creating an auto-start script on PATIENTS database
Log in as Oracle
vi start_PATIENTS
add this line:
#!/bin/sh
ORACLE_SID=PATIENTS
export
ORACLE_SID
PATH=$ORACLE_HOME/bin:$PATH
export
PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export
LD_LIBRARY_PATH
echo
"Starting Database $ORACLE_SID"
sqlplus
/nolog >/dev/null <
connect / as sysdba
startup;
exit
EOF
if [ $?
!= 0 ] ; then
echo "Database $ORACLE_SID did not
start!"
else
echo "Database $ORACLE_SID started!"
fi
vi stop_PATIENTS
add this line:
#!/bin/sh
ORACLE_SID= PATIENTS
export
ORACLE_SID
PATH=$ORACLE_HOME/bin:$PATH
export
PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export
LD_LIBRARY_PATH
echo
"Stopping Database $ORACLE_SID"
sqlplus
/nolog >/dev/null <
connect / as sysdba
shutdown immediate;
exit
EOF
if [ $?
!= 0 ] ; then
echo "Database $ORACLE_SID did not
stop!"
else
echo "Database $ORACLE_SID stopped!"
fi
vi start_listener
add this line:
#!/bin/sh
echo
"Starting listener"
lsnrctl
start > /dev/null
if [ $?
!= 0 ] ; then
echo "listener did not start"
else
echo "listener started!"
fi
vi stop_listener
add this line:
#!/bin/sh
echo
"Stopping listener"
lsnrctl
stop > /dev/null
if [ $?
!= 0 ] ; then
echo "listener did not stop"
else
echo "listener stopped!"
fi
change file to executable
[oracle@localhost ~]$ chmod +x start_PATIENTS
[oracle@localhost ~]$ chmod +x stop_PATIENTS
[oracle@localhost ~]$ chmod +x start_listener
[oracle@localhost ~]$ chmod +x stop_listener
launching the script:
[oracle@localhost ~]$ ./start_listener
Starting listener
listener started!
[oracle@localhost ~]$ ./start_PATIENTS
Starting Database PATIENTS
Database PATIENTS started!
[oracle@localhost ~]$ ./stop_PATIENTS
Stopping Database PATIENTS
Database PATIENTS stopped!
[oracle@localhost ~]$ ./stop_listener
Stopping listener
listener stopped!
launching the script:
Log in as Oracle (SSH or Putty)
From /home/oracle, launch the files.
Start database in this order….
Launch start_listener
Launch start_PATIENTS
Stop database this way….
Launch stop_PATIENTS
Launch stop_listener
You should get this message after launching the script…
[oracle@localhost ~]$ ./start_listener
Starting listener
listener started!
[oracle@localhost ~]$ ./start_PATIENTS
Starting Database PATIENTS
Database PATIENTS started!
[oracle@localhost ~]$ ./stop_PATIENTS
Stopping Database PATIENTS
Database PATIENTS stopped!
[oracle@localhost ~]$ ./stop_listener
Stopping listener
listener stopped!
Thanks for reading.
No comments:
Post a Comment