参考网络资料,安装服务器成功在于以下:
1. 防火墙
这会导致别人不能登录你的数据库
setup
-> firewall -> ...
2. gcc g++ 等的编译环境和支持库
在安装数据库的时候出错
yum -y install binutils compat-libstdc++-33 compat-libstdc++-33.i686 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc.i686 glibc-common glibc-devel glibc-devel.i686 glibc-headers ksh libaio libaio.i686 libaio-devel libaio-devel.i686 libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel make sysstat libXp
3. oracle用户的属主、属组正确
root@xiaoqw:[~]# groupadd oinstall
root@xiaoqw:[~]# groupadd dba
root@xiaoqw:[~]# useradd -m -g oinstall -G dba oracle
root@xiaoqw:[~]# id oracle
uid=503(oracle) gid=503(oinstall) groups=503(oinstall),504(dba)
root@xiaoqw:[~]## passwd oracle
oracle正常配置后在使用时遇到以下问题:
1. 在登录的时候 必须 sqlplus "as sysdba" 才能正常登录oracle
这个问题在于安装后的数据库用户是数据库的管理员用户,需要再创建一个普通的用户
create user <username> indentfifed by <password>
2. 用sqldeveloper 从客户端连接时出现以下错误:
Status:Failure-Test failed:The Network Adapter could not establish the conne
这个错误是由于服务器的监听没有启动
root@xiaoqw:[~]# lsnrctl status
在监听的时候出现以下错误:
TNS-12541: TNS:no listener TNS-12560: TNS:protocol adapter error TNS-00511:
修改配置文件:/etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.0.42 oracle
root@xiaoqw:[~]# lsnrctl status
root@xiaoqw:[~]# lsnrctl start
success 成功
3. 用了一段时间后,重启服务器,用sqldeveloper链接服务器时候又出现了错误
Status:Failure-Test failed:The Network Adapter could not establish the conne
启动监听服务时候出现以下错误:
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.40)(PORT=1521)))
TNS-12545: Connect failed because target host or object does not exist
TNS-12560: TNS:protocol adapter error
TNS-00515: Connect failed because target host or object does not exist
Linux Error: 99: Cannot assign requested address
修改文件 /opt/oracle/102/network/admin/listener.ora , 在用sqldeveloper链接,出现一下报错:
Status: Failure-Test failed:Listener refused the connection with the following error:ORA-12505, TNS:listener does not currently know;
修改:$ORACLE_HOME/network/admin/listener.ora文件
网上别人的帖子如下:
# listener.ora Network Configuration File:/u01/app/ora11g/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
ADR_BASE_LISTENER = /u01/app/ora11g
其中红色粗体为需修改的地方,要修改成你机器的主机名,或者你机器的IP
修改后并没有解决自己的问题。
在启动监听的时候出现一下错误:TNS-01150: The address of the specified listener name is incorrect
网络上查到帖子,将listener.ora 改为以下内容,再启动监听成功
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /oracle/product/10.2.0/db_1)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)