240
一线老司机

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

然后在用客户端链接一下:

终于连上去了。。。

posted @ 2012-06-25 18:06  明年我18  阅读(5748)  评论(0编辑  收藏  举报