Oracle systemd
Jump to navigation
Jump to search
[root@host02 system]# pwd /usr/local/lib/systemd/system [root@host02 system]# more oracle_listener.service [Unit] Description="Oracle Listener" After=network.target [Service] User=oracle Group=oinstall Type=forking WorkingDirectory=/app/oracle/product/11.2.0/dbhome_1 Environment=ORACLE_BASE=/app/oracle ORACLE_HOME=/app/oracle/product/11.2.0/dbhome_1 Restart=on-failure ExecStart=/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start LISTENER ExecStop=/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl stop LISTENER [Install] WantedBy=multi-user.target
[root@host02 system]# more oracle_database_test.service [Unit] Description="Oracle database test" After=network.target [Service] User=oracle Group=oinstall Type=forking WorkingDirectory=/app/oracle/product/11.2.0/dbhome_1 Environment=ORACLE_BASE=/app/oracle ORACLE_HOME=/app/oracle/product/11.2.0/dbhome_1 ORACLE_SID=test Restart=on-failure ExecStart=/bin/sh -c "echo startup | /app/oracle/product/11.2.0/dbhome_1/bin/sqlplus '/ as sysdba'" ExecStop=/bin/sh -c "echo shutdown immediate | /app/oracle/product/11.2.0/dbhome_1/bin/sqlplus '/ as sysdba'" [Install] WantedBy=multi-user.target