快捷搜索:  as  2018  FtCWSyGV  С˵  test  xxx  Ψһ  w3viyKQx

澳门新葡亰平台官网址_龟发之家论坛



在CentOS 6.3下安装完Oracle 10g R2,重开机之后,你会发明Oracle没有自行启动,这是正常的,由于在Linux下安装Oracle切实着实不会自行启动,必须要自行设定相关参数,起起首先容一样平常而言若何启动oracle。

一、在Linux下启动Oracle

登录到CentOS,切换到oracle用户权限

# su – oracle

接着输入:

$ sqlplus "/as sysdba"

蓝本的画面会变为

SQL>

接着请输入

SQL> startup

就可以正常的启动数据库了。

别的竣事数据库的指令如下:

SQL> shutdown immediate

二、反省Oracle DB监听器是否正常

回到终端机模式,输入:

$ lsnrctl status

反省看看监听器是否有启动

假如没有启动,可以输入:

$ lsnrctl start

启动监听器

SQL> conn sys@orcl as sysdba

然后输入密码,sys以sysdba身份登入数据库。

三、启动emctl

别的也可以发明http://localhost.localdomain:1158/em 今朝是没有反映的,这边要别的启动,启动的指令如下:

$ emctl start dbconsole

这个指令运行光阴较长,履行完的画面如下:

手动启动Oracle数据库完毕,下面创建系统自行启动Oracle的脚本。

四、Oracle启动&竣事脚本

1. 改动Oracle系统设置设置设备摆设摆设文件:/etc/oratab,只有这样,Oracle 自带的dbstart和dbshut才能够发挥感化。

# vi /etc/oratab

orcl:/opt/oracle/102:Y

# Entries are of the form:

#$ORACLE_SID:$ORACLE_HOME::

2. 在 /etc/init.d/ 下创建文件oracle,内容如下:

#!/bin/sh

# chkconfig: 35 80 10# description: Oracle auto start-stop script.

#

# Set ORA_HOME to be equivalent to the $ORACLE_HOME# from which you wish to execute dbstart and dbshut;

## Set ORA_OWNER to the user id of the owner of the

# Oracle database in ORA_HOME.ORA_HOME=/opt/oracle/102

ORA_OWNER=oracle if [ ! -f $ORA_HOME/bin/dbstart ]

thenecho "Oracle startup: cannot start"

exitfi

case "$1" in'start')

# Start the Oracle databases:echo "Starting Oracle Databases ... "

echo "-------------------------------------------------" >> /var/log/oracledate +" %T %a %D : Starting Oracle Databases as part of system up." >> /var/log/oracle

echo "-------------------------------------------------" >> /var/log/oraclesu - $ORA_OWNER -c "$ORA_HOME/bin/dbstart" >>/var/log/oracle

echo "Done"

# Start the Listener:e澳门新葡亰平台官网址cho "Starting Oracle Listeners ... "

echo "-------------------------------------------------" >> /var/log/oracledate +" %T %a %D : Starting Oracle Listeners as part of system up." >> /var/log/oracle

echo "---------澳门新葡亰平台官网址----------------------------------------" >> /var/log/oraclesu - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start" >>/v澳门新葡亰平台官网址ar/log/oracle

echo "Done."echo "-------------------------------------------------" >> /var/log/oracle

date +" %T %a %D : Finished." >> /var/log/oracleecho "-------------------------------------------------" >> /var/log/oracle

touch /var/lock/subsys/oracle;;

'stop')

# Stop the Oracle Listener:echo "Stoping Oracle Listeners ... "

echo "-------------------------------------------------" >> /var/log/oracledate +" %T %a %D : Stoping Oracle Listener as part of system down." >> /var/log/oracle

echo "-------------------------------------------------" >> /var/log/oraclesu - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop" >>/var/log/oracle

echo "Done."rm -f /var/lock/subsys/oracle

# Stop the Oracle Database:

echo "Stoping Oracle Databases ... "echo "-------------------------------------------------" >> /var/log/oracle

date +" %T %a %D : Stoping Oracle Databases as part of system down." >> /var/log/oracleecho "-------------------------------------------------" >> /var/log/oracle

su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut" >>/var/log/oracleecho "Done."

echo ""澳门新葡亰平台官网址echo "-------------------------------------------------" >> /var/log/oracle

date +" %T %a %D : Finished." >> /var/log/oracleecho "-------------------------------------------------" >> /var/log/oracle

;;

'restart')$0 stop

$0 start;;

esac

3. 改变文件权限

# chmod 755 /etc/init.d/oracle

4. 添加办事

# chkconfig --level 35 oracle on

5. 必要在关机或重启机械之前竣事数据库,做一下操作

# ln -s /etc/init.d/oracle /etc/rc0.d/K01oracle//关机

# ln -s /etc/init.d/oracle /etc/rc6.d/K01oracle//重启

6. 应用措施

# service oracle start//启动oracle

# service oracle stop//关闭oracle

# service oracle restart//重启oracle

7. 测试

a. 开机自启动

Last login: Mon Nov 26 19:57:06 2012 from 10.0.0.145

[root@ORS ~]# su - oracle[oracle@ORS ~]$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Nov 26 20:07:33 2012

Copyright (c) 1982, 2005, Oracle.All rights reserved.

Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> set linesize 300;SQL> set pagesize 30;

SQL> select * from scott.emp;

EMPNO ENAMEJOBMGR HIREDATESALCOMMDEPTNO---------- ---------- --------- ---------- --------- ---------- ---------- ----------

SMITHCLERK7902 17-DEC-8080020ALLENSALESMAN7698 20-FEB-81160030030

WARDSALESMAN7698 22-FEB-81125050030JONESMANAGER7839 02-APR-81297520

MARTINSALESMAN7698 28-SEP-811250140030BLAKEMANAGER7839 01-MAY-81285030

CLARKMANAGER7839 09-JUN-81245010SCOTTANALYST7566 19-APR-87300020

KINGPRESIDENT17-NOV-81500010TURNERSALESMAN7698 08-SEP-811500030

ADAMSCLERK7788 23-MAY-87110020JAMESCLERK7698 03-DEC-8195030

FORDANALYST7566 03-DEC-81300020MILLERCLERK7782 23-JAN-82130010

rows selected.

SQL>

b. service oracle stop

SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options[oracle@ORS ~]$ logout

[root@ORS ~]# service oracle stopStoping Oracle Listeners ...

Done.Stoping Oracle Databases ...

Done.

[root@ORS ~]# su - oracle[oracle@ORS ~]$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Nov 26 20:17:20 2012

Copyright (c) 1982, 2005, Oracle.All rights reserved.

Connected to an idle instance.

SQL> set linesize 300;

SQL> set pagesize 30;SQL> select * from scott.emp;

select * from scott.emp*

ERROR at line 1:ORA-01034: ORAC澳门新葡亰平台官网址LE not available

SQL>

c. service oracle start

SQL> Disconnected

[oracle@ORS ~]$ logout[root@ORS ~]# service oracle start

Starting Oracle Databases ...Done

Starting Oracle Listeners ...Done.

[root@ORS ~]#

d. service oracle restart

[root@ORS ~]# service oracle restart

Stoping Oracle Listeners ...Done.

Stoping Oracle Databases ...Done.

Starting Oracle Databases ...

DoneStarting Oracle Listeners ...

Done.[root@ORS ~]#

至此,Oracle办事启动&竣事脚本与开机自启动设置完毕。

您可能还会对下面的文章感兴趣: