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
然后在用客戶端鏈接一下:
終於連上去了。。。