如何自动启动数据库
这篇文章主要介绍如何自动启动数据库,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
成都创新互联公司长期为上千家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为耀州企业提供专业的成都做网站、网站建设,耀州网站改版等技术服务。拥有十年丰富建站经验和众多成功案例,为您定制开发。
自动重启,需要grid的支持
自动管理资源
[oracle@edsir1p8-+ASM ~]$ crs_stat -t Name Type Target State Host ------------------------------------------------------------ ora.DATA.dg ora....up.type ONLINE ONLINE edsir1p8 ora.asm ora.asm.type ONLINE ONLINE edsir1p8 ora.cssd ora.cssd.type ONLINE ONLINE edsir1p8 ora.diskmon ora....on.type ONLINE ONLINE edsir1p8
通常2种方式自动启动数据库
1.
[oracle@edsir1p8-+ASM ~]$ tail -3 /etc/oratab PROD4:/u01/app/oracle/product/11.2.0/db_1:N EMREP:/u01/app/oracle/product/11.2.0/db_1:N +ASM:/u01/app/oracle/product/11.2.0/grid:N ---这种方式通常不好用
2.crs_stat
这是个资源表,让数据库和监听注册到这个表里
[oracle@edsir1p8-+ASM ~]$ srvctl add database -d PROD4 -o /u01/app/oracle/product/11.2.0/db_1 [oracle@edsir1p8-+ASM ~]$ srvctl config database --查看哪些数据库已经注册
关监听,注册
[oracle@edsir1p8-+ASM ~]$ srvctl add listener -l listener -p 1521 -o /u01/app/or acle/product/11.2.0/db_1PRCN-2061 : Failed to add listener ora.LISTENER.lsnr PRCN-2065 : Port(s) 1521 are not available on the nodes given PRCN-2035 : Port 1521 is not available on node(s) or virtual host(s): edsir1p8.us. oracle.com
--关监听
[oracle@edsir1p8-+ASM ~]$ lsnrctl stop [oracle@edsir1p8-+ASM ~]$ srvctl add listener -l listener -p 1521 -o /u01/app/oracle/pr oduct/11.2.0/db_1 [oracle@edsir1p8-+ASM ~]$ srvctl config listener --查看监听是否注册成功
[oracle@edsir1p8-+ASM ~]$ crs_stat -t Name Type Target State Host ------------------------------------------------------------ ora.DATA.dg ora....up.type ONLINE ONLINE edsir1p8 ora....ER.lsnr ora....er.type OFFLINE OFFLINE ora.asm ora.asm.type ONLINE ONLINE edsir1p8 ora.cssd ora.cssd.type ONLINE ONLINE edsir1p8 ora.diskmon ora....on.type ONLINE ONLINE edsir1p8 ora.prod4.db ora....se.type OFFLINE OFFLINE
=============================================================
--重启服务器,看效果
oracle@edsir1p8- ~]$ ps -ef | grep smon oracle 5387 5106 0 09:25 pts/2 00:00:00 grep smon --没有实例启动 [oracle@edsir1p8- ~]$ lsnrctl status -bash: lsnrctl: command not found --没有任何的Oracle环境变量
[oracle@edsir1p8- ~]$ . oraenv ORACLE_SID = [oracle] ? +ASM The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid is /u01/app/oracle [oracle@edsir1p8-+ASM ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 22-JUN-2017 09:25:58 Copyright (c) 1991, 2009, Oracle. All rights reserved. Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) TNS-12541: TNS:no listener TNS-12560: TNS:protocol adapter error TNS-00511: No listener Linux Error: 111: Connection refused --监听没有启动
[oracle@edsir1p8-+ASM ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Thu Jun 22 09:28:48 2017 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to an idle instance.
SQL> quit Disconnected
[oracle@edsir1p8-+ASM ~]$ srvctl start database -d PROD4 PRCD-1027 : Failed to retrieve database PROD4 PRCR-1070 : Failed to check if resource ora.prod4.db is registered Cannot communicate with crsd
[oracle@edsir1p8-+ASM ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Thu Jun 22 09:30:20 2017 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to an idle instance.
SQL> startup ORA-01078: failure in processing system parameters ORA-29701: unable to connect to Cluster Synchronization Service SQL> quit Disconnected
[oracle@edsir1p8-+ASM ~]$ crsctl start has CRS-4123: Oracle High Availability Services has been started.
[oracle@edsir1p8-+ASM ~]$ crs_stat -t Name Type Target State Host ------------------------------------------------------------ ora.DATA.dg ora....up.type ONLINE OFFLINE ora....ER.lsnr ora....er.type ONLINE ONLINE edsir1p8 ora.asm ora.asm.type ONLINE OFFLINE ora.cssd ora.cssd.type ONLINE OFFLINE ora.diskmon ora....on.type ONLINE ONLINE edsir1p8 ora.prod4.db ora....se.type OFFLINE OFFLINE
[oracle@edsir1p8-+ASM ~]$ crsctl enable has CRS-4622: Oracle High Availability Services autostart is enabled. --必须开机自启动,只有他开机自启动,注册到里面的资源才能开机自启动
重启服务器,看效果
===========================================================
--集群管理的方式将数据库开
[oracle@edsir1p8-+ASM ~]$ srvctl start database -d PROD4 --执行相反操作 srvctl remove database -d PROD4 ---移除数据库 srvctl remove listener -l listener ---如果注册错误可以使用该命令删除
以上是“如何自动启动数据库”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!
分享名称:如何自动启动数据库
浏览地址:http://azwzsj.com/article/jgpicp.html