怎么随系统systemctl启动数据库-创新互联
本篇内容主要讲解“怎么随系统systemctl启动数据库”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“怎么随系统systemctl启动数据库”吧!
成都创新互联专注于印台企业网站建设,成都响应式网站建设,商城网站定制开发。印台网站建设公司,为印台等地区提供建站服务。全流程按需网站策划,专业设计,全程项目跟踪,成都创新互联专业和态度为您提供的服务一、 修改oratab文件
[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
二、 编辑ora19c调用文件
[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
三、 编辑ora19c服务配置文件
[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>
七、 方法二,时候老版本Linux
7.1 编辑/etc/oratab
[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
7.2 编辑dbora服务文件
[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
7.3 修改文件权限
[root@adg19c ~]# chgrp dba /etc/init.d/dbora [root@adg19c ~]# chmod 750 /etc/init.d/dbora
7.4 添加到启动文件中
[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启动数据库”有了更深的了解,不妨来实际操作一番吧!这里是创新互联网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
新闻标题:怎么随系统systemctl启动数据库-创新互联
文章分享:http://lswzjz.com/article/dhscgp.html