sâmbătă, 4 mai 2013

The OracleOraDb11g_home1TNSListener service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs

Sometime, we are forced to use the Windows version of Oracle Database. After installed the binaries, the best approach is to create the listener (netca command). Well, if you already have another Oracle home wherever on you disk, maybe the ORACLE_HOME environment variable is already set to a value that cannot be accomodated with the newly created listener. In this case, the lsnrctl start will lead to an error code  0. Obvious, the frustrating telling nothing oracle errors. So, i am sure you will rush to the Services, so that to start the listener service. Well, the error will show more complicated and more frustrating:

The OracleOraDb11g_home1TNSListener service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs.

Useless to say, it's pretty tough to decrypt the situation. Well, the problem is a simple one, you should set all the appropriate environment variable and all of the problem will vanish.Remember the environment variables, at minimum:
set ORACLE_BASE=d:\oracle
set ORACLE_HOME=%ORACLE_BASE%\db1
set PATH=%ORACLE_HOME%\bin;%PATH%
set ORACLE_SID=db
set TNS_ADMIN=%ORACLE_HOME%\network\admin
You should set these variables through the Advanced System Settings -> Environment Variables, not using a command window.

Anyway, if you don't create and start the listener and you will proceed straight to the creation of the database, there will be another errors shortly after the propper start of the db creation.