您好,登錄后才能下訂單哦!
這篇文章主要介紹如何自動啟動數據庫,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!
自動重啟,需要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 ---如果注冊錯誤可以使用該命令刪除
以上是“如何自動啟動數據庫”這篇文章的所有內容,感謝各位的閱讀!希望分享的內容對大家有幫助,更多相關知識,歡迎關注億速云行業資訊頻道!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。