Oracle Stop Start Scripts

These are stop-start scripts that have been created to shutdown and startup the following oracle services all running on the same server (designed on Linux O/S):

  • Oracle Database
  • Oracle Listener
  • Oracle OEM Agent
  • Oracle Golden Gate

Prerequisites for these scripts to work are:

  • DB entries must exist in the /etc/oratab
  • Home directory for the oracle user must be /home/oracle

The shutdown/startup scripts will also take care if the database is a standby or an active standby - NOTE, not when DG_BROKER is enabled.

Setup

-- Copy the "ora-installscripts.tgz" to /tmp on the server where the oracle products are installed

[root@my-host tmp]# ls -lrt *.tgz
-rw-r--r--. 1 oracle oinstall 4718 Feb 21 08:50 ora-installscripts.tgz

 

-- extract the contents
[root@my-host tmp]# tar xzvf ora-installscripts.tgz
orascripts.tar
script-install.sh

 

-- Run the install script
[root@my-host tmp]# ./script-install.sh
Initialising oracle services... done
NEW SCRIPTS INSTALLED
GOLDEN GATE OK: 0 of 0 running instances found
PMON OK: 1 of 1 running instances found
LISTENER OK: 1 of 1 running instances found
AGENT OK: 0 of 0 running instances found
-- Delete the files from /tmp
[root@my-host tmp]# rm -rf ora-installscripts.tgz script-install.sh orascripts.tar orascripts

Checks

-- List contents of installation directory

$ su - oracle
oracle 11gR2: cd .stop-start
oracle 11gR2: ls -lrt
total 32
-r-x------. 1 oracle oinstall 970 Feb 25 09:31 oracleinit.sh
-r-x------. 1 oracle oinstall 2567 Feb 25 09:31 statusall.sh
-r-x------. 1 oracle oinstall 4692 Feb 25 09:31 startall.sh
-r-x------. 1 oracle oinstall 3780 Feb 25 09:31 shutall.sh
-r-x------. 1 oracle oinstall 401 Feb 25 09:31 statusfiles
-rw-r--r--. 1 oracle oinstall 8 Feb 25 09:31 sids_down.out
-rw-r--r--. 1 oracle oinstall 45 Feb 25 09:31 listener_down.out
-rw-r--r--. 1 oracle oinstall 0 Feb 25 09:31 agent_down.out
-rw-r--r--. 1 oracle oinstall 35 Feb 25 09:31 gg_down.out

 

-- Check the current status

oracle 11gR2: ./statusall.sh
GOLDEN GATE OK: 0 of 0 running instances found
PMON OK: 1 of 1 running instances found
LISTENER OK: 1 of 1 running instances found
AGENT OK: 0 of 0 running instances found

 

-- Run a ckhconfig and then Shutdown everything

oracle 11gR2: chkconfig --list oracle
oracle 0:off 1:off 2:off 3:on 4:on 5:on 6:off
oracle 11gR2:./shutall.sh
NO Golden Gate Running
Check type of database: MYORCL
SQL*Plus: Release 11.2.0.3.0 Production on Tue Feb 25 09:37:58 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> SQL> SQL> MYORCL,PRIMARY,READ WRITE
SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL*Plus: Release 11.2.0.3.0 Production on Tue Feb 25 09:37:58 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Primary DB MYORCL shutdown
Shutting down Listener LISTENER
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 25-FEB-2014 09:38:09
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=my-host)(PORT=1521)))
The command completed successfully
NO AGENT running

 

-- Confirm by checking status
oracle 11gR2: ./statusall.sh
GOLDEN GATE OK: 0 of 0 running instances found
PMON Stopped
LISTENER Stopped
AGENT OK: 0 of 0 running instances found

 

-- Start services again

oracle 11gR2:./startall.sh
No Agent found in /home/oracle/.stop-start/agent_down.out
Starting Listener LISTENER
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 25-FEB-2014 09:39:41
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.3.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/my-host/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=my-host)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=my-host)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 25-FEB-2014 09:39:41
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/my-host/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=my-host)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "MYORCL" has 1 instance(s).
Instance "MYORCL", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
Starting database MYORCL
SQL*Plus: Release 11.2.0.3.0 Production on Tue Feb 25 09:39:41 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2235208 bytes
Variable Size 553649336 bytes
Database Buffers 507510784 bytes
Redo Buffers 5541888 bytes
Database mounted.
Database opened.
SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Started instance MYORCL
No Golden Gate to Start

 

-- Check status again

oracle 11gR2: ./statusall.sh
GOLDEN GATE OK: 0 of 0 running instances found
PMON OK: 1 of 1 running instances found
LISTENER OK: 1 of 1 running instances found
AGENT OK: 0 of 0 running instances found