Oracle 19C Database Auto Startup and Auto Shutdown
step 1: create a file oracle19c.service in /usr/lib/systemd/system
cd /usr/lib/systemd/system
vi oracle19c.service
[Unit]
Description=Oracle Database 19C Service
After=network.target
[Service]
Type=forking
User=oracle
Group=oinstall
Environment="ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1"
Environment="ORACLE_SID=pearl"
ExecStartPre=/u01/app/oracle/product/19.0.0/dbhome_1/bin/lsnrctl start
ExecStart=/u01/app/oracle/product/19.0.0/dbhome_1/bin/dbstart $ORACLE_HOME >> /var/log/oracle19c.log 2>&1
ExecStop=/u01/app/oracle/product/19.0.0/dbhome_1/bin/dbshut $ORACLE_HOME >> /var/log/oracle19c.log 2>&1
ExecStopPost=/u01/app/oracle/product/19.0.0/dbhome_1/bin/lsnrctl stop
TimeoutSec=120
Restart=always
[Install]
WantedBy=multi-user.target
step 2: Change N to Y in oratab
vi /etc/oratab
pearl:/u01/app/oracle/product/19.0.0/dbhome_1:Y
step 3: enable the oracle service
systemctl daemon-reload #Reload systemd
systemctl enable oracle19c.service #Enable the service
systemctl start oracle19c.service #Start the Oracle 19c service
systemctl status oracle19c.service #Check the Oracle 19c service status
systemctl stop oracle19c.service #stop the Oracle 19c service
step 4: Check DB Open or Closed
SELECT status FROM v$instance; #Database Level
ps -ef|grep pmon #OS Level
Comments
Post a Comment