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

Note:

The XE configuration script shows an incorrect listener status message. When the database listener is stopped or down, the script might show the following listener status message :

/etc/init.d/oracle-xe-21c status
Status of the Oracle XE 21c service:

LISTENER status: NOT CONFIGURED
XE Database status: STOPPED

This is an incorrect listener status message. It does not mean that the script in incorrectly configured.

Execute the following commands as root using sudo.

$ sudo -s

Oracle Linux 7:

Run the following command to start the listener and database:

# systemctl start oracle-xe-21c

Run the following command to stop the database and the listener:

# systemctl stop oracle-xe-21c

Run the following command to stop and start the listener and database:

# systemctl restart oracle-xe-21c

Oracle Linux 8:

Run the following command to start the listener and database:

# systemctl start oracle-xe-21c

Run the following command to stop the database and the listener:

# systemctl stop oracle-xe-21c

Run the following command to stop and start the listener and database:

# systemctl restart oracle-xe-21c

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:

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.

To automate the startup and shutdown of the listener and database, execute the following commands as root:
$ sudo -s
For Oracle Linux 7, run the following commands:
# systemctl daemon-reload
# systemctl enable oracle-xe-21c
For Oracle Linux 8, run the following commands:
# systemctl daemon-reload
# systemctl enable oracle-xe-21c