1.运行sqlplus,提示
-
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。
-
# This file controls the state of SELinux on the system.
-
# SELINUX= can take one of these three values:
-
# enforcing - SELinux security policy is enforced.
-
# permissive - SELinux prints warnings instead of enforcing.
-
# disabled - SELinux is fully disabled.
-
-
#SELINUX=enforcing
-
SELINUX=disabled
-
-
# SELINUXTYPE= type of policy in use. Possible values are:
-
# targeted - Only targeted network daemons are protected.
-
# strict - Full SELinux protection.
-
SELINUXTYPE=targeted
保存后重启系统。
2.用sqlplus,输入用户名密码后,提示:
-
Enter user-name: system
-
Enter password:
-
ERROR:
-
ORA-01034: ORACLE not available
-
ORA-27101: shared memory realm does not exist
-
Linux Error: 2: No such file or directory
-
Process ID: 0
-
Session ID: 0 Serial number: 0
原因竟然是oracle没有启动成功,用sqlplus '/as sysdba'命令,然后输入startup来启动oracle,但发现启动oracle时报错:
-
[oracle@localhost dbs]$ sqlplus '/as sysdba'
-
-
SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 25 14:49:49 2012
-
-
Copyright (c) 1982, 2009, Oracle. All rights reserved.
-
-
Connected to an idle instance.
-
-
SQL> startup
-
ORA-01078: failure in processing system parameters
-
LRM-00109: could not open parameter file '/u01/app/oracle/dbs/initliusuping.ora'
继续baigoogledu,这次是百度给了答案:
-
[oracle@localhost oracle]$ find /u01 -name pfile
-
/u01/app/admin/orcl/pfile
-
[oracle@localhost oracle]$ cd /u01/app/admin/orcl/pfile
-
[oracle@localhost pfile]$ ls
-
init.ora.5252012131333
-
[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,数据库终于起来了:
-
[oracle@localhost pfile]$ sqlplus '/as sysdba'
-
-
SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 25 15:13:00 2012
-
-
Copyright (c) 1982, 2009, Oracle. All rights reserved.
-
-
Connected to an idle instance.
-
-
SQL> startup
-
ORACLE instance started.
-
-
Total System Global Area 602619904 bytes
-
Fixed Size 1338168 bytes
-
Variable Size 360711368 bytes
-
Database Buffers 234881024 bytes
-
Redo Buffers 5689344 bytes
-
Database mounted.
-
Database opened.
不知道liusuping是怎么来的,自己建一个库吧。进入/u01/app/oracle/bin,输入.dbca,打开管理界面,在这里可以删除、创建数据库。我们创建一个sid为test的数据库:
3.用客户端连它,连不上,"没有监听程序"。
打开/u01/app/oracle/network/admin/listener.ora,它的内容如下:
-
# listener.ora Network Configuration File: /u01/app/oracle/network/admin/listener.ora
-
# Generated by Oracle configuration tools.
-
-
LISTENER =
-
(DESCRIPTION_LIST =
-
(DESCRIPTION =
-
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
-
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
-
)
-
)
-
-
ADR_BASE_LISTENER = /u01/app
把它改为:
-
# listener.ora Network Configuration File: /u01/app/oracle/network/admin/listener.ora
-
# Generated by Oracle configuration tools.
-
-
SID_LIST_LISTENER =
-
(SID_LIST =
-
(SID_DESC =
-
(GLOBAL_DBNAME = test)
-
(ORACLE_HOME = /u01/app/oracle)
-
(SID_NAME =test)
-
)
-
)
-
-
LISTENER =
-
(DESCRIPTION_LIST =
-
(DESCRIPTION =
-
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
-
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.199)(PORT = 1521))
-
)
-
)
-
-
ADR_BASE_LISTENER = /u01/app
然后运行lsnrctl start,结果如下:
-
[oracle@localhost admin]$ lsnrctl start
-
-
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 25-JUN-2012 18:04:25
-
-
Copyright (c) 1991, 2009, Oracle. All rights reserved.
-
-
Starting /u01/app/oracle/bin/tnslsnr: please wait...
-
-
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
-
System parameter file is /u01/app/oracle/network/admin/listener.ora
-
Log messages written to /u01/app/diag/tnslsnr/localhost/listener/alert/log.xml
-
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
-
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.199)(PORT=1521)))
-
-
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
-
STATUS of the LISTENER
-
------------------------
-
Alias LISTENER
-
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
-
Start Date 25-JUN-2012 18:04:25
-
Uptime 0 days 0 hr. 0 min. 0 sec
-
Trace Level off
-
Security ON: Local OS Authentication
-
SNMP OFF
-
Listener Parameter File /u01/app/oracle/network/admin/listener.ora
-
Listener Log File /u01/app/diag/tnslsnr/localhost/listener/alert/log.xml
-
Listening Endpoints Summary...
-
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
-
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.199)(PORT=1521)))
-
Services Summary...
-
Service "test" has 1 instance(s).
-
Instance "test", status UNKNOWN, has 1 handler(s) for this service...
-
The command completed successfully
然后在用客户端链接一下:
终于连上去了。。。