马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的好朋友们!在CentOS6.3下装置完Oracle10gR2,重开机以后,你会发明Oracle没有自行启动,这是正常的,由于在Linux下装置Oracle切实其实不会自行启动,必需要自行设定相干参数,起首先引见普通而言若何启动oracle。
1、在Linux下启动Oracle
登录到CentOS,切换到oracle用户权限
#suCoracle
接着输出:
$sqlplus"/assysdba"
本来的画面会变成
SQL>
接着请输出
SQL>startup
就能够正常的启动数据库了。
别的停滞数据库的指令以下:
SQL>shutdownimmediate
2、检讨OracleDB监听器能否正常
回到终端机形式,输出:
$lsnrctlstatus
检讨看看监听器能否有启动
假如没有启动,可以输出:
$lsnrctlstart
启动监听器
SQL>connsys@orclassysdba
然后输出暗码,sys以sysdba身份登入数据库。
3、启动emctl
别的也能够发明http://localhost.localdomain:1158/em今朝是没有反响的,这边要别的启动,启动的指令以下:
$emctlstartdbconsole
这个指令运转时光较长,履行完的画面以下:
手动启动Oracle数据库终了,上面创立体系自行启动Oracle的剧本。
4、Oracle启动&停滞剧本
1.修正Oracle体系设置装备摆设文件:/etc/oratab,只要如许,Oracle自带的dbstart和dbshut能力够施展感化。
#vi/etc/oratab
orcl:/opt/oracle/102:Y
#Entriesareoftheform:
#$ORACLE_SID:$ORACLE_HOME:<N|Y>:
2.在/etc/init.d/下创立文件oracle,内容以下:- #!/bin/sh#chkconfig:358010#description:Oracleautostart-stopscript.##SetORA_HOMEtobeequivalenttothe$ORACLE_HOME#fromwhichyouwishtoexecutedbstartanddbshut;##SetORA_OWNERtotheuseridoftheownerofthe#OracledatabaseinORA_HOME.ORA_HOME=/opt/oracle/102ORA_OWNER=oracleif[!-f$ORA_HOME/bin/dbstart]thenecho"Oraclestartup:cannotstart"exitficase"$1"instart)#StarttheOracledatabases:echo"StartingOracleDatabases..."echo"-------------------------------------------------">>/var/log/oracledate+"%T%a%D:StartingOracleDatabasesaspartofsystemup.">>/var/log/oracleecho"-------------------------------------------------">>/var/log/oraclesu-$ORA_OWNER-c"$ORA_HOME/bin/dbstart">>/var/log/oracleecho"Done"#StarttheListener:echo"StartingOracleListeners..."echo"-------------------------------------------------">>/var/log/oracledate+"%T%a%D:StartingOracleListenersaspartofsystemup.">>/var/log/oracleecho"-------------------------------------------------">>/var/log/oraclesu-$ORA_OWNER-c"$ORA_HOME/bin/lsnrctlstart">>/var/log/oracleecho"Done."echo"-------------------------------------------------">>/var/log/oracledate+"%T%a%D:Finished.">>/var/log/oracleecho"-------------------------------------------------">>/var/log/oracletouch/var/lock/subsys/oracle;;stop)#StoptheOracleListener:echo"StopingOracleListeners..."echo"-------------------------------------------------">>/var/log/oracledate+"%T%a%D:StopingOracleListeneraspartofsystemdown.">>/var/log/oracleecho"-------------------------------------------------">>/var/log/oraclesu-$ORA_OWNER-c"$ORA_HOME/bin/lsnrctlstop">>/var/log/oracleecho"Done."rm-f/var/lock/subsys/oracle#StoptheOracleDatabase:echo"StopingOracleDatabases..."echo"-------------------------------------------------">>/var/log/oracledate+"%T%a%D:StopingOracleDatabasesaspartofsystemdown.">>/var/log/oracleecho"-------------------------------------------------">>/var/log/oraclesu-$ORA_OWNER-c"$ORA_HOME/bin/dbshut">>/var/log/oracleecho"Done."echo""echo"-------------------------------------------------">>/var/log/oracledate+"%T%a%D:Finished.">>/var/log/oracleecho"-------------------------------------------------">>/var/log/oracle;;restart)$0stop$0start;;esac
复制代码
3.转变文件权限
#chmod755/etc/init.d/oracle
4.添加办事
#chkconfig--level35oracleon
5.须要在关机或重启机械之前停滞数据库,做一下操作
#ln-s/etc/init.d/oracle/etc/rc0.d/K01oracle//关机
#ln-s/etc/init.d/oracle/etc/rc6.d/K01oracle//重启
6.应用办法
#serviceoraclestart//启动oracle
#serviceoraclestop//封闭oracle
#serviceoraclerestart//重启oracle
7.测试
a.开机自启动
- Lastlogin:MonNov2619:57:062012from10.0.0.145[root@ORS~]#su-oracle[oracle@ORS~]$sqlplus"/assysdba"SQL*Plus:Release10.2.0.1.0-ProductiononMonNov2620:07:332012Copyright(c)1982,2005,Oracle.Allrightsreserved.Connectedto:OracleDatabase10gEnterpriseEditionRelease10.2.0.1.0-ProductionWiththePartitioning,OLAPandDataMiningoptionsSQL>setlinesize300;SQL>setpagesize30;SQL>select*fromscott.emp;EMPNOENAMEJOBMGRHIREDATESALCOMMDEPTNO------------------------------------------------------------------------------7369SMITHCLERK790217-DEC-80800207499ALLENSALESMAN769820-FEB-811600300307521WARDSALESMAN769822-FEB-811250500307566JONESMANAGER783902-APR-812975207654MARTINSALESMAN769828-SEP-8112501400307698BLAKEMANAGER783901-MAY-812850307782CLARKMANAGER783909-JUN-812450107788SCOTTANALYST756619-APR-873000207839KINGPRESIDENT17-NOV-815000107844TURNERSALESMAN769808-SEP-8115000307876ADAMSCLERK778823-MAY-871100207900JAMESCLERK769803-DEC-81950307902FORDANALYST756603-DEC-813000207934MILLERCLERK778223-JAN-8213001014rowsselected.SQL>
复制代码
b.serviceoraclestop
- SQL>DisconnectedfromOracleDatabase10gEnterpriseEditionRelease10.2.0.1.0-ProductionWiththePartitioning,OLAPandDataMiningoptions[oracle@ORS~]$logout[root@ORS~]#serviceoraclestopStopingOracleListeners...Done.StopingOracleDatabases...Done.[root@ORS~]#su-oracle[oracle@ORS~]$sqlplus"/assysdba"SQL*Plus:Release10.2.0.1.0-ProductiononMonNov2620:17:202012Copyright(c)1982,2005,Oracle.Allrightsreserved.Connectedtoanidleinstance.SQL>setlinesize300;SQL>setpagesize30;SQL>select*fromscott.emp;select*fromscott.emp*ERRORatline1:ORA-01034:ORACLEnotavailableSQL>
复制代码
c.serviceoraclestart
- SQL>Disconnected[oracle@ORS~]$logout[root@ORS~]#serviceoraclestartStartingOracleDatabases...DoneStartingOracleListeners...Done.[root@ORS~]#
复制代码
d.serviceoraclerestart
- [root@ORS~]#serviceoraclerestartStopingOracleListeners...Done.StopingOracleDatabases...Done.StartingOracleDatabases...DoneStartingOracleListeners...Done.[root@ORS~]#
复制代码
至此,Oracle办事启动&停滞剧本与开机自启动设置终了。
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的好朋友们! |