Automatic Startup of Oracle 11gR2 on CentOS 6.3
Bah. Figured it out right after posting it...
The whole issue was that I had created the "oracle" file on a PC and uploaded it. So it had the wrong line-endings. Rebuilt the file and everything works fine.
Related videos on Youtube
![Chris K](https://i.stack.imgur.com/aFsJA.png?s=256&g=1)
Chris K
Updated on September 18, 2022Comments
-
Chris K almost 2 years
I've setup a handful of CentOS 5.6 servers with Oracle 11gR2 and not run into this particular problem, but I have hit a wall with CentOS 6.3 and auto-starting Oracle. Not sure if this is related to the newer release of CentOS or me having a PEBKAC moment, but I need a hand.
I've got a working install of Oracle 11gR2 on CentOS 6.3. It runs and is functional. Now I just want it to start with the server. To that end, I've done the following things I usually do:
Created /etc/init.d/oracle:
#!/bin/bash # # oracle Init file for starting and stopping # Oracle Database. Script is valid for 10g and 11g versions. # chkconfig: 35 80 30 # description: Oracle Database startup script # Source function library. . /etc/init.d/functions ORACLE_OWNER="oracle" ORACLE_HOME="/opt/app/oracle/product/11.2.0/db_1" case "$1" in start) su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME" ;; stop) su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME" ;; *) echo $"Usage: $0 {start|stop}" esac
Than ran the following two commands:
chmod 750 /etc/init.d/oracle chkconfig --add oracle --level 0356
When I try a
service oracle start
, (as root) however, I get this error:env: /etc/init.d/oracle: No such file or directory
Not sure how to figure out what file we're looking for.
If I run that script's actual start command with the variables expanded the database starts with no errors.
su - oracle -c "/opt/app/oracle/product/11.2.0/db_1/bin/dbstart /opt/app/oracle/product/11.2.0/db_1"
So... what am I missing here? Some casual web searching makes me feel like this approach should still work.