Saturday 27 May 2023

Starting Oracle processes via shell script

 In this post we will learn how to start Oracle processes via shell script


Lets write a script to start listener and then the database :


[oracle@node2 ~]$ cat start.sh

ORACLE_SID=orcl

ORAENV_ASK=NO

. oraenv

lsnrctl stop

lsnrctl start

sqlplus -s /nolog  <<EOF

connect / as sysdba

startup

exit;

EOF

>> Now lets execute the script :

[oracle@node2 ~]$ ./start.sh
The Oracle base remains unchanged with value /u01/app/oracle

LSNRCTL for Linux: Version 21.0.0.0.0 - Production on 28-MAY-2023 11:41:41

Copyright (c) 1991, 2021, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=node2.example.com)(PORT=1521)))
The command completed successfully

LSNRCTL for Linux: Version 21.0.0.0.0 - Production on 28-MAY-2023 11:41:41

Copyright (c) 1991, 2021, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/21.3.0/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 21.0.0.0.0 - Production
System parameter file is /u01/app/oracle/homes/OraDB21Home1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/node2/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=node2.example.com)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=node2.example.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 21.0.0.0.0 - Production
Start Date                28-MAY-2023 11:41:41
Uptime                    0 days 0 hr. 0 min. 20 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/homes/OraDB21Home1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/node2/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=node2.example.com)(PORT=1521)))
The listener supports no services
The command completed successfully
ORACLE instance started.

Total System Global Area 1073740680 bytes
Fixed Size                  9694088 bytes
Variable Size             448790528 bytes
Database Buffers          612368384 bytes
Redo Buffers                2887680 bytes
Database mounted.
Database opened.

>> Job done. 

No comments:

Post a Comment