1. 程式人生 > >CentOS 7上啟動Oracle 11.2.0.3

CentOS 7上啟動Oracle 11.2.0.3

1.正常安裝Oracle 11,執行root指令碼,等等。

2. 安裝後重啟伺服器。

3. 重啟後,用 su - oracle   命令後,檢查oracle使用者的環境變數:

  1. declare -x ORACLE_HOME="/home/oracle/app/oracle/product/11.2.0/dbhome_1"  
  2. declare -x ORACLE_SID="orcl"  
4. 進入 cd $ORACLE_HOME/network/admin,檢查listener.ora:
  1. [[email protected] admin]$ cat listener.ora   
  2. # listener.ora Network Configuration File: /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora  
  3. # Generated by Oracle configuration tools.  
  4. SID_LIST_LISTENER =   
  5. (SID_LIST =   
  6.   (SID_DESC =   
  7.     (SID_NAME = orcl)      
  8.     (ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_1)   
  9.   )   
  10. )  
  11. LISTENER =  
  12.   (DESCRIPTION_LIST =  
  13.     (DESCRIPTION =  
  14.       (ADDRESS = (PROTOCOL = TCP)(HOST = 10.16.33.212)(PORT = 1521))  
  15.     )  
  16.   )  
  17. ADR_BASE_LISTENER = /home/oracle/app/oracle  

重點檢查其中的SID,HOST,PORT,ORACLE_HOME是否正確。如果不正確客戶端會報告ERROR-ORA-12514:TNS:監聽程式當前無法識別連線描述符中請求的服務 錯誤。

如果沒有問題,進入$ORACLE_HOME/bin,啟動監聽器:

  1. [[email protected] bin]$ ./lsnrctl  
  2. LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 16-DEC-2014 11:22:03  
  3. Copyright (c) 1991, 2011, Oracle.  All rights reserved.  
  4. Welcome to LSNRCTL, type "help" for information.  
  1. LSNRCTL> start  
  2. Starting /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...  
  3. TNSLSNR for Linux: Version 11.2.0.3.0 - Production  
  4. System parameter file is /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora  
  5. Log messages written to /home/oracle/app/oracle/diag/tnslsnr/oracle/listener/alert/log.xml  
  6. Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.16.33.212)(PORT=1521)))  
  7. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.16.33.212)(PORT=1521)))  
  8. STATUS of the LISTENER  
  9. ------------------------  
  10. Alias                     LISTENER  
  11. Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production  
  12. Start Date                16-DEC-2014 11:22:07  
  13. Uptime                    0 days 0 hr. 0 min. 0 sec  
  14. Trace Level               off  
  15. Security                  ON: Local OS Authentication  
  16. SNMP                      OFF  
  17. Listener Parameter File   /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora  
  18. Listener Log File         /home/oracle/app/oracle/diag/tnslsnr/oracle/listener/alert/log.xml  
  19. Listening Endpoints Summary...  
  20.   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.16.33.212)(PORT=1521)))  
  21. Services Summary...  
  22. Service "orcl" has 1 instance(s).  
  23.   Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...  
  24. The command completed successfully  
  25. LSNRCTL>   
啟動正常,使用sqlplus啟動資料庫:
  1. [[email protected] bin]$ ./sqlplus '/ as sysdba'  
  2. SQL> startup  
  3. ORACLE instance started.  
  4. Total System Global Area  960372736 bytes  
  5. Fixed Size                  2234160 bytes  
  6. Variable Size             557844688 bytes  
  7. Database Buffers          394264576 bytes  
  8. Redo Buffers                6029312 bytes  
  9. Database mounted.  
  10. Database opened.  

5. Centos7自帶了SELINUX,關掉

6. Centos7自帶了下一代防火牆firewalld,關掉,否則客戶端連線過來會報TNS Timeout異常

  1. [[email protected] ~]# service firewalld stop  
  2. Redirecting to /bin/systemctl stop  firewalld.service  

===============================================

現在其它機器就應該可以正常連線並使用Oracle了。

另:裝Oracle最省事的還是在Oracle自己的Enterprise Linux上安裝。那些依賴,系統引數,等等等都不需要設定了。