VM虚拟机下在LINUX上安装ORACLE 11G单实例数据库(五)

2014-11-24 09:08:59 · 作者: · 浏览: 2
ecution of the script is complete.
[root@oel-01 Server]# sh/u01/app/oracle/product/11.2.0/dbhome_1/root.sh
Running Oracle 11g root.sh script...
The following environment variables are setas:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/11.2.0/dbhome_1
Enter the full pathname of the local bindirectory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratabfile as needed by
Database Configuration Assistant when adatabase is created
Finished running generic part of root.shscript.
Now product-specific root actions will beperformed.
Finished product-specific root actions.
8.安装完成后续工作
1.防火墙开放1521端口
[root@oel-01 ~]# iptables-I INPUT 1 -p tcp --dport 1521 -j ACCEPT
[root@oel-01 ~]# /etc/rc.d/init.d/iptablessave
Saving firewall rules to/etc/sysconfig/iptables: [ OK ]
[root@oel-01 ~]# services iptables restart
-bash: services: command not found
[root@oel-01 ~]# service iptablesrestart
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT:filter [ OK ]
Unloading iptables modules: [ OK ]
Applying iptables firewall rules: [ OK ]
Loading additional iptables modules: ip_conntrack_netbios_ns
2.配置LISTENER---如安装过程中已经正常配置完成可以不做。
安装完成后,启动LISTENER
[oracle@oel-01 admin]$ lsnrctl start
输出的最后两句:
The listener supports no services
The command completed successfully
这样启动后远程连接会报错:
oracle ORA-12514:TNS:listener does notcurrently know of service requested in connect descriptor
原因:数据库实例没注册到listener
在listener.ora里面添加了如下内容:--配置为静态监听。
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(SID_NAME = orcl)
)
)
注:里面的orcl根据你安装的数据库实例名确定,我用此法解决了这个报错。
解决方法二:这个网上看的,我自己没使用,使用第一种就解决了。
这种应该是解决非动态注册问题的,要手动注册实例到listener
登录数据库:
$sqlplus / as sysdba
显示服务名:
SQL>show parameter service_names
强制注册服务:
SQL>alter system register;
查看监听状态:
$lsnrctl status
9.配置数据库开机自启动
安装好Oracle数据库后:执行 dbstart和dbshut会提示:
[oracle@oracle11g ~]$ dbstart
ORACLE_HOME_LISTNER is not SET, unable toauto-start Oracle Net Listener
Usage:/u01/app/oracle/oracle/product/10.2.0/db_1/bin/dbstart ORACLE_HOME
错误原因是:dbstart和dbshut脚本文件中ORACLE_HOME_LISTNER的设置有问题,
分别打开两个文件找到:ORACLE_HOME_LISTNER=$1,(在文件开头,比较好找)修改为
ORACLE_HOME_LISTNER=$ORACLE_HOME
修改后保存退出,问题已解决;
测试:
1.SQLPLUS能否启动,如不能,检查.bash_profile中环境变量 ORACLE_HOME PATH等,按我的方法做就可以。
2.使用SQLPLUS登陆测试
sqlplus / as sysdba
需要解锁SCOTT用户,并配置/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
[oracle@oel-01 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
BYS001 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.212)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = bys001)
)
)
sqlplus scott/tiger@bys001
sqlplusscott/tiger@1