Saturday, July 16, 2022

How to Start - Stop Oracle Database on Single Instance and RAC

 How to Start and Stop Oracle Database 

For single instance Database (Shutdown Sequence):


$ sudo -iu oracle
$ cat /etc/oratab 
$ export ORACLE_HOME=/path/to/oracle/home/dir            
$ export ORACLE_SID=your_sid_from_oratab
$ export PATH=$ORACLE_HOME/bin:$PATH
$ export LD_LIBRARY_PATH=$ORACLE_HOME/lib 
oracle@host $ sqlplus / as sysdba
SQL> shutdown immediate;
SQL> exit;
$ ps -ef | grep -i tns 
$ lsnrctl stop Listener_Name;

For single instance Database (Startup Sequence) :


$ sudo -iu oracle
$ export ORACLE_HOME=/path/to/oracle/home/dir            
$ export ORACLE_SID=your_sid_from_oratab
$ export PATH=$ORACLE_HOME/bin:$PATH
$ export LD_LIBRARY_PATH=$ORACLE_HOME/lib 
oracle@host $ sqlplus / as sysdba
SQL> startup ;
SQL> set linesize 400;
SQL> alter session set nls_date_format = 'dd.mm.yyyy hh24:mi:ss';
SQL> select inst_id,instance_name,host_name,status,logins,status_time,database_status from                   gv$instance order by inst_id;

For RAC Database (Shutdown Sequence):

do it on all nodes:

$ ps -ef | grep -i pmon 
$ sudo -iu oracle
$ srvctl stop database -d db_unique_name;
$ srvctl status database -d db_unique_name;
$ ps -ef | grep -i d.bin
$ cd [path/to]/bin 
/bin # ./crsctl stop cluster 
/bin # ./crsctl stop crs 

For RAC Database (Startup Sequence):

do it on all nodes if  crs auto restart is not enable

/bin # ./crsctl start crs
/bin # ./crsctl start cluster
# sudo -iu oracle 
$ srvctl start database -d db_unique_name 
$ srvctl status database -d db_unque_name
$ ps -ef | grep -i d.bin 
$ cd [path/to]/bin 
$ ./crsctl status res -t 

Note: to only start and shut single database instance execute below command


$ sudo -iu oracle
$ srvctl start instance -d database_name -i instance_name .............( to start the instance)
$ srvctl stop instance -d database_name -i instance_name .............( to stop the instance) 

Note: crsctl utility can only run with root user 

No comments:

Post a Comment

Enable OpenSSH on Windows 11

Step 1: Install OpenSSH Server You can do this via PowerShell (run as Administrator ): Check if it's already available: Get-WindowsCapab...