這篇文章主要介紹如何自動啟動數(shù)據(jù)庫,文中介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們一定要看完!
成都創(chuàng)新互聯(lián)公司長期為上千家客戶提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊(duì)從業(yè)經(jīng)驗(yàn)10年,關(guān)注不同地域、不同群體,并針對不同對象提供差異化的產(chǎn)品和服務(wù);打造開放共贏平臺,與合作伙伴共同營造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為耀州企業(yè)提供專業(yè)的成都做網(wǎng)站、網(wǎng)站建設(shè),耀州網(wǎng)站改版等技術(shù)服務(wù)。擁有十年豐富建站經(jīng)驗(yàn)和眾多成功案例,為您定制開發(fā)。
自動重啟,需要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種方式自動啟動數(shù)據(jù)庫
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
這是個資源表,讓數(shù)據(jù)庫和監(jiān)聽注冊到這個表里
[oracle@edsir1p8-+ASM ~]$ srvctl add database -d PROD4 -o /u01/app/oracle/product/11.2.0/db_1 [oracle@edsir1p8-+ASM ~]$ srvctl config database --查看哪些數(shù)據(jù)庫已經(jīng)注冊
關(guān)監(jiān)聽,注冊
[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
--關(guān)監(jiān)聽
[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 --查看監(jiān)聽是否注冊成功
[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
=============================================================
--重啟服務(wù)器,看效果
oracle@edsir1p8- ~]$ ps -ef | grep smon oracle 5387 5106 0 09:25 pts/2 00:00:00 grep smon --沒有實(shí)例啟動 [oracle@edsir1p8- ~]$ lsnrctl status -bash: lsnrctl: command not found --沒有任何的Oracle環(huán)境變量
[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 --監(jiān)聽沒有啟動
[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. --必須開機(jī)自啟動,只有他開機(jī)自啟動,注冊到里面的資源才能開機(jī)自啟動
重啟服務(wù)器,看效果
===========================================================
--集群管理的方式將數(shù)據(jù)庫開
[oracle@edsir1p8-+ASM ~]$ srvctl start database -d PROD4 --執(zhí)行相反操作 srvctl remove database -d PROD4 ---移除數(shù)據(jù)庫 srvctl remove listener -l listener ---如果注冊錯誤可以使用該命令刪除
以上是“如何自動啟動數(shù)據(jù)庫”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!