- dodyagung / How Do I Start Oracle Service in UNIX or Linux?
- Start oracle services in linux
- Start oracle services in linux
- 2.1 Stopping and Starting Oracle Processes
- 2.1.1 Stopping and Starting Oracle Database and Oracle Automatic Storage Management Instances
- 2.1.2 Stopping and Starting Oracle Restart
- 2.2 About Automating Database Shutdown and Startup
- 2.2.1 Automating Database Startup and Shutdown
- Start oracle services in linux
dodyagung / How Do I Start Oracle Service in UNIX or Linux?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
—- Copied from https://www.cyberciti.biz/faq/how-do-i-start-oracle-service-in-unix/ —- |
How To Startup Oracle Database on a Unix/Linux |
Use the su — username command to login as oracle user. Open the Terminal or login using ssh and type the following command to login |
$ su — oracle |
Start Oracle server in UNIX/Linux |
Now, use the lsnrctl command to start service (usually located at /home/oracle/oracle/product/10.2.0/db_1/bin directory): |
$ lsnrctl start |
Next start database: |
$ dbstart |
If above is not working try to login as sysdba: |
$ sqlplus ‘/ as sysdba’ |
At SQL> type startup command: |
SQL> startup |
Stop Oracle service in UNIX/Linux |
To stop Oracle service type following two commands: |
$ lsnrctl stop |
$ dbshut |
If above failed login as sysdba user: |
$ sqlplus ‘/ as sysdba’ |
At SQL> type shutdown command: |
SQL> shutdown |
Start oracle services in linux
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 .
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:
Run the following command to stop and start the listener and database:
# /etc/init.d/oracle-xe-18c restart
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;
- 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.
To automate the startup and shutdown of the listener and database, execute the following commands as root :
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
Start oracle services in linux
This chapter describes how to identify Oracle Database processes, and provides basic information about how to stop and restart them. It also describes how to set up automatic startup and shutdown of the Oracle Database. It contains the following sections:
When using Oracle Restart, you can use Service Control Utility (SRVCTL), a command-line interface, to manage Oracle processes (database instance, listener, Oracle ASM instance). With SRVCTL, you can manage the Oracle Restart configuration, see the status of processes managed by Oracle Restart, and start or stop processes such as Oracle Database. SRVCTL is enhanced to support Oracle Clusterware, and single instance Oracle databases with Oracle Restart.
2.1 Stopping and Starting Oracle Processes
This section describes how to stop and start Oracle processes. It contains the following topics:
2.1.1 Stopping and Starting Oracle Database and Oracle Automatic Storage Management Instances
This section describes how to stop and start Oracle Database and Oracle Automatic Storage Management instances and contains the following topics:
2.1.1.1 Stopping an Oracle Database or Oracle Automatic Storage Management Instance
Do not stop an Oracle Automatic Storage Management instance until you have stopped all Oracle Database instances that use Oracle Automatic Storage Management instance to manage their storage.
To stop an Oracle Database or Oracle Automatic Storage Management instance:
- Run the following commands to identify the SID and Oracle home directory for the instance that must be shut down:
The oratab file contains lines similar to the following, which identify the SID and corresponding Oracle home directory for each database or Oracle Automatic Storage Management instance on the system:
Note: Oracle recommends that you use the plus sign (+) as the first character in the SID of Oracle Automatic Storage Management instances.
% source /usr/local/bin/coraenv
When prompted, specify the SID for the instance.
$ sqlplus SQL> CONNECT SYS AS SYSDBA Enter password: sys_password SQL> SHUTDOWN NORMAL
2.1.1.2 Restarting an Oracle Database or Oracle Automatic Storage Management Instance
If the database instance uses Oracle Automatic Storage Management for storage management, then you must start the Oracle Automatic Storage Management instance before you start the database instance.
To restart an Oracle Database or Oracle Automatic Storage Management instance:
- Repeat steps 1 and 2, if required, to set the ORACLE_SID and ORACLE_HOME environment variables to identify the SID and Oracle home directory for the instance you want to start.
- Run the following commands to start the instance:
$ sqlplus SQL> CONNECT SYS AS SYSDBA Enter password: sys_password SQL> STARTUP
2.1.2 Stopping and Starting Oracle Restart
To stop or start Oracle Restart, run the following command:
2.2 About Automating Database 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 startup and shutdown guards against incorrect database shutdown.
To automate database startup and shutdown, use the dbstart and dbshut scripts, which are located in the $ORACLE_HOME/bin directory. The scripts refer to the same entries in the oratab file, which are applied on the same set of databases. You cannot, for example, have the dbstart script automatically start sid1 , sid2 , and sid3 , and have the dbshut script shut down only sid1 . However, you can specify that the dbshut script shuts down a set of databases while the dbstart script is not used at all. To do this, include a dbshut entry in the system shutdown file, but do not include the dbstart entry in the system startup files.
The init command in the operating system documentation for more information about system startup and shutdown procedures
2.2.1 Automating Database Startup and Shutdown
To automate database startup and shutdown by using the dbstart and dbshut scripts:
Database entries in the oratab file are displayed in the following format:
In this example, the values Y and N specify whether you want the scripts to start or shut down the database, respectively. For each database for which you want to automate shutdown and startup, first determine the instance identifier (SID) for that database, which is identified by the SID in the first field. Then, change the last field for each to Y .
You can set dbstart to autostart a single-instance database which uses an Automatic Storage Management installation auto-started by Oracle Clusterware. This is the default behavior for an Automatic Storage Management cluster. To do this, you must change the oratab entry of the database and the Automatic Storage Management installation to use a third field with the value W and N , respectively. These values specify that dbstart auto-starts the database only after the Automatic Storage Management instance is started.
If you add new database instances to the system and automate the startup for them, then you must edit the entries for those instances in the oratab file.
Platform | Initialization File Directory |
---|---|
Linux and Oracle Solaris | /etc/init.d |
IBM AIX on POWER Systems (64-Bit) | /etc |
Note: Change the value of the ORA_HOME environment variable to specify the Oracle home directory for the installation. Change the value of the ORA_OWNER environment variable to the user name of the owner of the database installed in the Oracle home directory (typically, oracle ).
#! /bin/sh # description: Oracle auto start-stop script. # # Set ORA_HOME to be equivalent to the $ORACLE_HOME # from which you wish to execute dbstart and dbshut; # # Set ORA_OWNER to the user id of the owner of the # Oracle database in ORACLE_HOME. ORA_HOME= ORA_OWNER= case "$1" in 'start') # Start the Oracle databases: # The following command assumes that the oracle login # will not prompt the user for any values # Remove "&" if you don't want startup as a background process. su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME" & touch /var/lock/subsys/dbora ;; 'stop') # Stop the Oracle databases: # The following command assumes that the oracle login # will not prompt the user for any values su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME" & rm -f /var/lock/subsys/dbora ;; esac
Note: This script can only stop Oracle Net listener for which a password has not been set. In addition, if the listener name is not the default name, LISTENER , then you must specify the listener name in the stop and start commands:
$ORACLE_HOME/bin/lsnrctllistener_name
# chgrp dba dbora # chmod 750 dbora
# ln -s /etc/init.d/dbora /etc/rc0.d/K01dbora # ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora
# ln -s /etc/init.d/dbora /etc/rc.d/rc0.d/K01dbora # ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora # ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora
# ln -s /etc/dbora /etc/rc.d/rc2.d/S99dbora # ln -s /etc/dbora /etc/rc.d/rc0.d/K01dbora
Start oracle services in linux
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 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;
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 :
# systemctl daemon-reload # systemctl enable oracle-xe-21c
# systemctl daemon-reload # systemctl enable oracle-xe-21c
Shutting Down and Starting Up Using the Configuration Services Script
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.
Run the following commands as root using sudo .
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
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
Related Topics