首页 > 数据库 > Oracle > Oracle单机怎么设置开机自启?
Oracle 在 $ORACLE_HOME/bin 下提供许多对数据库进行操作的脚本,其中 dbstart 和 dbshut 可分别用来启动和关闭数据库。注意,这两个脚本已包含监听器的启动或关闭,但并未对 EM 进行相关的操作。使用如下命令:
|
|
以上命令要成功启动数据库实例还得打开 Oracle 设置的一个关卡: vi /etc/oratab ,修改行:
|
这时候用命令启动会报 ORACLE_HOME_LISTNER 没有设置
|
1
2 |
[oracle@
primary
bin]$ /oracle/product/11.2.0/db_1/bin/dbstart /oracle/product/11.2.0/db_1ORACLE_HOME_LISTNER
is
not
SET
, unable
to
auto-start Oracle Net Listener |
修改 dbstart 和 dbshut
|
同理 dbshut 也做相应修改
在启动了 Linux 系统之后,转到 /etc/init.d 目录下;
|
1 |
[root@oracle ~]# cd /etc/init.d |
使用 vi 命令,新建一个以 oracle 命名的文件(并将以下代码复制至文件中)
|
1 |
[root@oracle init.d]# vi oracle |
|
赋予执行权限
|
1 |
[root@oracle init.d]# chmod 750 /etc/init.d/oracle |
做一个链接 :
|
1
2
3 |
[root@oracle init.d]# ln -s /etc/init.d/oracle /etc/rc1.d/K61oracle [root@oracle init.d]# ln -s /etc/init.d/oracle /etc/rc3.d/S61oracle |
执行以下命令 :
|
1
2
3 |
[root@oracle init.d]# chkconfig
--level 345 oracle on [root@oracle init.d]# chkconfig
--add oracle //添加到服务里
|
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70013625/viewspace-3086421/ ,如需转载,请注明出处,否则将追究法律责任。