o​r​a​c​l​e启动方式--centos

来源:互联网 发布:jsp和javascript的功能 编辑:程序博客网 时间:2024/05/21 03:25

启动完成测试: https://IP:1158/em 登录查看所有状态都正常   或者终端查看进程  ps -ef|grep ora

方式一:

>  root/huangjia      ---切换到root账户

>  su - oracle           ---切换到oracle账户

>  /u01/app/oracle/product/11.2.0/db_1/bin/lsnrctl start  --启动监听器 (自己目录的监听器位置)
> sqlplus  /nolog              ---登录到sqlplus
>connect   /as  sysdba;   ---切换到dba权限
>  startup                        ---启动
>  exit                                            ---退出


方式二:采用dbshut/dbstart启动关闭

配置:

1)终端修改:vi /u01/app/oracle/producte/11.1.0.6/bin/dbshut

   把ORACLE_HOME_LISTNER=$1 改成 ORACLE_HOME_LISTNER=$ORACLE_HOME

2)终端修改: vi /u01/app/oracle/producte/11.1.0.6/bin/dbstart

  把ORACLE_HOME_LISTNER=$1 改成 ORACLE_HOME_LISTNER=$ORACLE_HOME

3)终端修改:vi /etc/oratab

  把sales:/u01/app/oracle/product/11.1.0.6:N  改成 sales:/u01/app/oracle/product/11.1.0.6:Y

配置完了,直接用dbshut、dbstart就可以启动关闭了。

>  su - oracle           ---切换到oracle账户
> /u01/app/oracle/product/11.2.0/db_1/bin/lsnrctl start  --启动监听器 (自己目录的监听器位置)

>dbstart


方式三 开机启动:

1:修改$ORACLE_HOME/bin/dbstart和$ORACLE_HOME/bin/dbshut文件:

$vi $ORACLE_HOME/bin/dbstart

$vi $ORACLE_HOME/bin/dbshut

找到ORACLE_HOME_LISTNER=$1,修改为ORACLE_HOME_LISTNER=$ORACLE_HOME


 2:修改/etc/oratab文件:


$ vi /etc/oratab

找到最后一行:

orcl:/home/oracle_11/app/product/11.2/db_home:N

最后设置的是“N”(此环境只有一个实例,所以只有一行配置语句),需要把“N”修改成“Y”。保存退出。


 3:测试命令是否可以启动oracle服务:

$cd $ORACLE_HOME/bin  //进入oracle产品安装目录的bin目录

$./emctl start dbconsole  //开启EM控制台

$./lsnrctl start  //开启监听程序

$./dbstart  //开启数据库实例


4:修改/etc/rc.local文件

把emctl start dbconsole 、lsnrctl start和dbstart添加到rc.local文件中,命令如下:

#vi /etc/rc.local

添加:

su oracle -lc  "home/oracle_11/app/product/11.2.0/dbhome_1/bin/emctl start dbconsole"   

su oracle -lc  " home/oracle_11/app/product/11.2.0/dbhome_1/bin/lsnrctl start " 

su oracle -lc   ”home/oracle_11/app/product/11.2.0/dbhome_1/bin/dbstart“

注意:命令有空格,要用引号










0 0