oracle centos 重啓後報錯ORA-12514, TNS:listener does not currently know of service requested in connect d

oracle centos 重啓後報錯ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
一、查看監聽狀態lsnrctl start
二、經過sqlplus / as sysdba ,執行startup來啓動數據庫,發現報錯,initORCL.ora不存在。
三、進入對應目錄,打開spfileorcl.ora,發現db_name=orcl,
四、查看環境變量 cat ~/.bash_profile,發現ORACLE_SID=ORCL
五、conn / as sysdba,而後startup nomount
   startup nomount選項啓動實例,但不安裝數據庫。當數據庫以這個模式啓動時,參數文件被讀取;後臺進程和內存結構被啓動;但它們不被附加或與數據庫的磁盤結構進行通訊。當實例處於這個狀態時,數據庫是不可以使用的。
  一般啓動到這裏能夠作create database ,create or recreate control file 或者是mount standby database等動做,修改parameter也是能夠的。

六、alter database mount; alter database open;
oracle數據庫啓動分三個步驟:nomount,mount,open; 而startup是數據庫從開始階段的啓動,須要通過上述三個步驟。alter database open是數據庫處於mount狀態,從mount狀態打開數據庫的命令。所以,執行startup nomount,alter database mount; alter database open;正是依次執行啓動數據庫
七、show parameter name;
  經過該命令能夠查看數據庫一些參數,從而判斷是不是由於參數配置問題致使。
八、發現oracleName等參數爲orcl
九、vi ~/.bash_profileORACLE_SID的值改成小寫,即orcl,並執行source ~/.bash_profile來使得配置生效。
十、修改ORACLE_HOME下network/admin下的listener.ora與客戶端對應的tnsnames.ora
十一、重啓監聽lsnrctl start
十二、登陸數據庫:sqlplus system/oracle@//localhost:1521/orcl;sql

相關文章
相關標籤/搜索