RHEL裝完oracle 11g后遇到的問題


1.運行sqlplus,提示

  1. sqlplus: error while loading shared libraries: /u01/app/oracle/product/11.2.0/dbhome_1/lib/libclntsh.so.11.1: cannot restore segment prot after reloc: Permission denied

這個問題是由於SELINUX引起的。 解決辦法:

編輯/etc/sysconfig/selinux配置文件, 把SELINUX=enforcing 改為 SELINUX=disabled。

  1. # This file controls the state of SELinux on the system.
  2. # SELINUX= can take one of these three values:
  3. # enforcing - SELinux security policy is enforced.
  4. # permissive - SELinux prints warnings instead of enforcing.
  5. # disabled - SELinux is fully disabled.
  6.  
  7. #SELINUX=enforcing
  8. SELINUX=disabled
  9.  
  10. # SELINUXTYPE= type of policy in use. Possible values are:
  11. # targeted - Only targeted network daemons are protected.
  12. # strict - Full SELinux protection.
  13. SELINUXTYPE=targeted

保存后重啟系統。

2.用sqlplus,輸入用戶名密碼后,提示:

  1. Enter user-name: system
  2. Enter password:
  3. ERROR:
  4. ORA-01034: ORACLE not available
  5. ORA-27101: shared memory realm does not exist
  6. Linux Error: 2: No such file or directory
  7. Process ID: 0
  8. Session ID: 0 Serial number: 0

原因竟然是oracle沒有啟動成功,用sqlplus '/as sysdba'命令,然后輸入startup來啟動oracle,但發現啟動oracle時報錯:

  1. [oracle@localhost dbs]$ sqlplus '/as sysdba'
  2.  
  3. SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 25 14:49:49 2012
  4.  
  5. Copyright (c) 1982, 2009, Oracle. All rights reserved.
  6.  
  7. Connected to an idle instance.
  8.  
  9. SQL> startup
  10. ORA-01078: failure in processing system parameters
  11. LRM-00109: could not open parameter file '/u01/app/oracle/dbs/initliusuping.ora'

繼續baigoogledu,這次是百度給了答案:

  1. [oracle@localhost oracle]$ find /u01 -name pfile
  2. /u01/app/admin/orcl/pfile
  3. [oracle@localhost oracle]$ cd /u01/app/admin/orcl/pfile
  4. [oracle@localhost pfile]$ ls
  5. init.ora.5252012131333
  6. [oracle@localhost pfile]$ cp init.ora.5252012131333 /u01/app/oracle/dbs/initliusuping.ora

即找到另外一個ora文件,然后把它復制到/u01/app/oracle/dbs下面,並重命名為initliusuping.ora。靠,為什么我的sid是liusuping?我裝oracle的時候貌似沒看到有設置sid的地方啊,怎么給默認這個了。

再次startup,數據庫終於起來了:

  1. [oracle@localhost pfile]$ sqlplus '/as sysdba'
  2.  
  3. SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 25 15:13:00 2012
  4.  
  5. Copyright (c) 1982, 2009, Oracle. All rights reserved.
  6.  
  7. Connected to an idle instance.
  8.  
  9. SQL> startup
  10. ORACLE instance started.
  11.  
  12. Total System Global Area 602619904 bytes
  13. Fixed Size 1338168 bytes
  14. Variable Size 360711368 bytes
  15. Database Buffers 234881024 bytes
  16. Redo Buffers 5689344 bytes
  17. Database mounted.
  18. Database opened.

不知道liusuping是怎么來的,自己建一個庫吧。進入/u01/app/oracle/bin,輸入.dbca,打開管理界面,在這里可以刪除、創建數據庫。我們創建一個sid為test的數據庫:

 

3.用客戶端連它,連不上,"沒有監聽程序"。

打開/u01/app/oracle/network/admin/listener.ora,它的內容如下:

  1. # listener.ora Network Configuration File: /u01/app/oracle/network/admin/listener.ora
  2. # Generated by Oracle configuration tools.
  3.  
  4. LISTENER =
  5.   (DESCRIPTION_LIST =
  6.     (DESCRIPTION =
  7.       (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
  8.       (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
  9.     )
  10.   )
  11.  
  12. ADR_BASE_LISTENER = /u01/app

把它改為:

  1. # listener.ora Network Configuration File: /u01/app/oracle/network/admin/listener.ora
  2. # Generated by Oracle configuration tools.
  3.  
  4. SID_LIST_LISTENER =
  5.   (SID_LIST =
  6.     (SID_DESC =
  7.       (GLOBAL_DBNAME = test)
  8.        (ORACLE_HOME = /u01/app/oracle)
  9.       (SID_NAME =test)
  10.     )
  11.    )
  12.  
  13. LISTENER =
  14.   (DESCRIPTION_LIST =
  15.     (DESCRIPTION =
  16.       (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
  17.       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.199)(PORT = 1521))
  18.     )
  19.   )
  20.  
  21. ADR_BASE_LISTENER = /u01/app

然后運行lsnrctl start,結果如下:

  1. [oracle@localhost admin]$ lsnrctl start
  2.  
  3. LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 25-JUN-2012 18:04:25
  4.  
  5. Copyright (c) 1991, 2009, Oracle. All rights reserved.
  6.  
  7. Starting /u01/app/oracle/bin/tnslsnr: please wait...
  8.  
  9. TNSLSNR for Linux: Version 11.2.0.1.0 - Production
  10. System parameter file is /u01/app/oracle/network/admin/listener.ora
  11. Log messages written to /u01/app/diag/tnslsnr/localhost/listener/alert/log.xml
  12. Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  13. Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.199)(PORT=1521)))
  14.  
  15. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
  16. STATUS of the LISTENER
  17. ------------------------
  18. Alias LISTENER
  19. Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
  20. Start Date 25-JUN-2012 18:04:25
  21. Uptime 0 days 0 hr. 0 min. 0 sec
  22. Trace Level off
  23. Security ON: Local OS Authentication
  24. SNMP OFF
  25. Listener Parameter File /u01/app/oracle/network/admin/listener.ora
  26. Listener Log File /u01/app/diag/tnslsnr/localhost/listener/alert/log.xml
  27. Listening Endpoints Summary...
  28.   (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  29.   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.199)(PORT=1521)))
  30. Services Summary...
  31. Service "test" has 1 instance(s).
  32.   Instance "test", status UNKNOWN, has 1 handler(s) for this service...
  33. The command completed successfully

然后在用客戶端鏈接一下:

終於連上去了。。。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM