7 Starting and Stopping Oracle Database
You can start and stop the database manually, set it to automatically after the system shuts down and starts, or using Enterprise Manager.
Shutting Down and Starting Up Using the Configuration Services Script
Execute these commands as root
using sudo
.
$ sudo -s
Oracle Linux 6:
You can start and stop the database using the /etc/init.d/oracle-xe-18c
script.
Run the following command to start the listener and database:
# /etc/init.d/oracle-xe-18c start
Run the following command to stop the database and the listener:
# /etc/init.d/oracle-xe-18c stop
Run the following command to stop and start the listener and database:
# /etc/init.d/oracle-xe-18c restart
Oracle Linux 7:
Run the following command to start the listener and database:
# systemctl start oracle-xe-18c
Run the following command to stop the database and the listener:
# systemctl stop oracle-xe-18c
Run the following command to stop and start the listener and database:
# systemctl restart oracle-xe-18c
Shutting Down and Starting Up Using SQL*Plus
You can shut down and start the database using SQL*Plus.
To shutdown the database, login to the oracle user with its environment variables set for access to the XE database, and issue the following SQL*Plus command:
$ sqlplus / as sysdba SQL> SHUTDOWN IMMEDIATE
To start the database, issue the commands:
SQL> STARTUP SQL> ALTER PLUGGABLE DATABASE ALL OPEN;
See Also:
-
Oracle Database 2 Day DBA for general information about managing a database
-
Oracle Multitenant Administration Guide for more information about shutting down and starting a PDB
Automating Shutdown and Startup
Oracle recommends that you configure the system to automatically start Oracle Database when the system starts, and to automatically shut it down when the system shuts down. Automating database shutdown guards against incorrect database shutdown.
root
:$ sudo -s
For Oracle Linux 6, run these commands:
# /sbin/chkconfig oracle-xe-18c on # /sbin/service oracle-xe-18c start
# systemctl daemon-reload # systemctl enable oracle-xe-18c