您好,登錄后才能下訂單哦!
本篇內容主要講解“怎么隨系統systemctl啟動數據庫”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“怎么隨系統systemctl啟動數據庫”吧!
[root@adg19c ~]# grep woo /etc/oratab woo:/DBSoft/oracle/product/19.3/dbhome_1:N [root@adg19c ~]# sed -i 's/:N/:Y/' /etc/oratab [root@adg19c ~]# grep woo /etc/oratab woo:/DBSoft/oracle/product/19.3/dbhome_1:Y
[root@adg19c ~]# cat /usr/local/ora19c.sh #! /bin/bash echo ################################ echo # script For orac19c.service # echo ################################ /DBSoft/oracle/product/19.3/dbhome_1/lsnrctl start /DBSoft/oracle/product/19.3/dbhome_1/bin/dbstart /DBSoft/oracle/product/19.3/dbhome_1/ ~ [root@adg19c ~]# chmod +x /usr/local/ora19c.sh
[root@adg19c ~]# cat /etc/systemd/system/ora19c.service [Unit] Description=Oracle19c After=syslog.target network.target [Service] LimitMEMLOCK=infinity LimitNOFILE=65535 Type=oneshot RemainAfterExit=yes User=oracle Environment="ORACLE_HOME=/DBSoft/oracle/product/19.3/dbhome_1" ExecStart=/usr/local/ora19c.sh [Install] WantedBy=multi-user.target
[root@adg19c ~]# systemctl enable ora19c.service [root@adg19c ~]# systemctl start ora19c.service [root@adg19c ~]# systemctl status ora19c.service * ora19c.service - Oracle19c Loaded: loaded (/etc/systemd/system/ora19c.service; enabled; vendor preset: disabled) Active: active (exited) since Thu 2020-03-12 18:26:26 CST; 11s ago Process: 4607 ExecStart=/usr/local/ora19c.sh (code=exited, status=0/SUCCESS) Main PID: 4607 (code=exited, status=0/SUCCESS) CGroup: /system.slice/ora19c.service `-4611 /DBSoft/oracle/product/19.3/dbhome_1/bin/tnslsnr LISTENER -inherit Mar 12 18:26:25 adg19c ora19c.sh[4607]: SNMP OFF Mar 12 18:26:25 adg19c ora19c.sh[4607]: Listener Parameter File /DBSoft/oracle/product/19.3/dbhome_1/network/admin/listener.ora Mar 12 18:26:25 adg19c ora19c.sh[4607]: Listener Log File /DBSoft/oracle/diag/tnslsnr/adg19c/listener/alert/log.xml Mar 12 18:26:25 adg19c ora19c.sh[4607]: Listening Endpoints Summary... Mar 12 18:26:25 adg19c ora19c.sh[4607]: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=adg19c)(PORT=1521))) Mar 12 18:26:25 adg19c ora19c.sh[4607]: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) Mar 12 18:26:25 adg19c ora19c.sh[4607]: The listener supports no services Mar 12 18:26:25 adg19c ora19c.sh[4607]: The command completed successfully Mar 12 18:26:25 adg19c ora19c.sh[4607]: Processing Database instance "woo": log file /DBSoft/oracle/product/19.3/dbhome_1/rd...tup.log Mar 12 18:26:26 adg19c systemd[1]: Started Oracle19c. Hint: Some lines were ellipsized, use -l to show in full.
[root@adg19c ~]# systemctl status ora19c.service * ora19c.service - Oracle19c Loaded: loaded (/etc/systemd/system/ora19c.service; enabled; vendor preset: disabled) Active: active (exited) since Thu 2020-03-12 18:30:01 CST; 57min ago Process: 1177 ExecStart=/usr/local/ora19c.sh (code=exited, status=0/SUCCESS) Main PID: 1177 (code=exited, status=0/SUCCESS) CGroup: /system.slice/ora19c.service |-1350 /DBSoft/oracle/product/19.3/dbhome_1/bin/tnslsnr LISTENER -inherit |-1481 ora_pmon_woo |-1483 ora_clmn_woo |-1485 ora_psp0_woo |-1490 ora_vktm_woo |-1494 ora_gen0_woo |-1496 ora_mman_woo |-1500 ora_gen1_woo |-1503 ora_diag_woo |-1505 ora_ofsd_woo |-1508 ora_dbrm_woo |-1510 ora_vkrm_woo |-1512 ora_svcb_woo |-1514 ora_pman_woo |-1516 ora_dia0_woo |-1518 ora_dbw0_woo |-1520 ora_lgwr_woo |-1522 ora_ckpt_woo |-1524 ora_lg00_woo |-1526 ora_smon_woo |-1528 ora_lg01_woo |-1530 ora_smco_woo |-1532 ora_reco_woo |-1534 ora_w000_woo |-1536 ora_lreg_woo |-1538 ora_w001_woo |-1540 ora_pxmn_woo |-1544 ora_mmon_woo |-1546 ora_mmnl_woo |-1548 ora_d000_woo |-1550 ora_s000_woo |-1552 ora_tmon_woo |-1575 ora_m000_woo |-1579 ora_p000_woo |-1581 ora_p001_woo |-1583 ora_p002_woo |-1585 ora_tt00_woo |-1588 ora_tt01_woo |-1590 ora_tt02_woo |-1594 ora_aqpc_woo |-1598 ora_p003_woo |-1600 ora_p004_woo |-1602 ora_p005_woo |-1604 ora_p006_woo |-1606 ora_p007_woo |-1609 ora_cjq0_woo |-1611 ora_w002_woo |-1858 ora_m001_woo |-1860 ora_m002_woo |-1862 ora_m003_woo |-1890 ora_w003_woo |-1898 ora_w004_woo |-1900 ora_qm02_woo |-1906 ora_q003_woo |-1947 ora_q00f_woo |-2456 ora_w005_woo |-2460 ora_w006_woo `-2469 ora_w007_woo Mar 12 18:29:48 adg19c ora19c.sh[1177]: SNMP OFF Mar 12 18:29:48 adg19c ora19c.sh[1177]: Listener Parameter File /DBSoft/oracle/product/19.3/dbhome_1/network/admin/listener.ora Mar 12 18:29:48 adg19c ora19c.sh[1177]: Listener Log File /DBSoft/oracle/diag/tnslsnr/adg19c/listener/alert/log.xml Mar 12 18:29:48 adg19c ora19c.sh[1177]: Listening Endpoints Summary... Mar 12 18:29:48 adg19c ora19c.sh[1177]: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=adg19c)(PORT=1521))) Mar 12 18:29:48 adg19c ora19c.sh[1177]: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) Mar 12 18:29:48 adg19c ora19c.sh[1177]: The listener supports no services Mar 12 18:29:48 adg19c ora19c.sh[1177]: The command completed successfully Mar 12 18:29:48 adg19c ora19c.sh[1177]: Processing Database instance "woo": log file /DBSoft/oracle/product/19.3/dbhome_1/rd...tup.log Mar 12 18:30:01 adg19c systemd[1]: Started Oracle19c. Hint: Some lines were ellipsized, use -l to show in full.
[root@adg19c ~]# su - oracle [oracle@adg19c ~]$ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Thu Mar 12 18:30:42 2020 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 SQL> select instance_name,status from gv$instance; INSTANCE_NAME STATUS ---------------- ------------ woo OPEN SQL>
[root@adg19c ~]# grep woo /etc/oratab woo:/DBSoft/oracle/product/19.3/dbhome_1:N [root@adg19c ~]# sed -i 's/:N/:Y/' /etc/oratab [root@adg19c ~]# grep woo /etc/oratab woo:/DBSoft/oracle/product/19.3/dbhome_1:Y
[root@adg19c ~]# vi /etc/init.d/dbora #! /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=/DBSoft/oracle/product/19.3/dbhome_1 ORA_OWNER=oracle 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
[root@adg19c ~]# chgrp dba /etc/init.d/dbora [root@adg19c ~]# chmod 750 /etc/init.d/dbora
[root@adg19c init.d]# ln -s /etc/init.d/dbora /etc/rc.d/rc0.d/K01dbora [root@adg19c init.d]# ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora [root@adg19c init.d]# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora
到此,相信大家對“怎么隨系統systemctl啟動數據庫”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。