HOWTO: UNABLE TO OPENSCMANAGER: ERR=5

http://www.liberidu.com/blog/2015/12/07/howto-unable-to-openscmanager-err5/

Fiddling around with new software on my Windows 8 machine, I tried to start the listener service but got the following response in a command window:

c:\> lsnrctl start

LSNRCTL for 64-bit Windows: Version 12.1.0.2.0 – Production on 07-DEC-2015 10:29:14

Copyright (c) 1991, 2014, Oracle. All rights reserved.

Starting tnslsnr: please wait..

Unable to OpenSCManager: err=5
TNS-12560: TNS:protocol adapter error
TNS-00530: Protocol adapter error

The workaround for this, and/or the cause, is that your not the owner for the Oracle Windows software. Because the new software install magically removed my Listener Windows Service, I also couldn’t start the Listener process via the Windows Service Manager program. To get it back, that is start the listener and create the appropriate correct Listener service where the ownership matches the oracle software (& database instances), you will have to create a command (.cmd) or batch (.bat) file with something along the lines of…

lsnrctl start

pause

After executing this file via “Run as Administrator“, you will be asked the password for the user that owns the software, in my case “oracledb”

C:\Windows\system32>lsnrctl start

LSNRCTL for 64-bit Windows: Version 12.1.0.2.0 – Production on 07-DEC-2015 10:34:01

Copyright (c) 1991, 2014, Oracle. All rights reserved.

Starting tnslsnr: please wait…

Enter oracledb’s password :

TNSLSNR for 64-bit Windows: Version 12.1.0.2.0 – Production
Log messages written to C:\Oracle\database\diag\tnslsnr\8s98y52\listener\alert\log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=8s98y52)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 12.1.0.2.0 – Production
Start Date 07-DEC-2015 10:34:13
Uptime 0 days 0 hr. 0 min. 8 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File C:\Oracle\database\diag\tnslsnr\8s98y52\listener\alert\log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=8s98y52)(PORT=1521)))
The listener supports no services
The command completed successfully

C:\Windows\system32>pause
Press any key to continue . . .

If you check, the listener service will be created.

Advertisements

One to One mapping in hibernate

<hibernate-mapping package=”gar.entity”>

<class name=”RTPRequest” table=”rtp_request”>
<id name=”id” type=”long”>
<column name=”id” />
<generator class=”sequence”>
<param name=”sequence”>seq_rtp_request</param>
<param name=”allocationSize”>1</param>
<param name=”initialValue”>1</param>
</generator>
</id>

<one-to-one name=”garnishment” class=”Garnishment” cascade=”all”></one-to-one>

</class>

</hibernate-mapping>

 

===================================================

<hibernate-mapping package=”gar.entity”>

<class name=”Garnishment” table=”garnishment”>

<id name=”id” type=”long”>
<column name=”id”/>
<generator class=”foreign”>
<param name=”property”>rtpRequest</param>
</generator>
</id>

<one-to-one name=”rtpRequest” class=”RTPRequest” constrained=”true”></one-to-one>

</class>

</hibernate-mapping>