Tuesday, 14 August 2012

ERROR ORA-12154 TNS: installing ODAC 11.2

Solution as its progresses

Step 1:

Source of solution 1

SYMPTOM
Receive the error message, "ORA-12154 TNS: could not resolve the connect identifier specified."


Error while installing ODAC 11.2 Release 4 and Oracle Developer Tools for Visual Studio (11.2.0.3.0) in Microsoft Transaction Server

Error:

Value = NumberOfInstalls
INFO: Query Returned: 1
INFO: Setting variable 'n_numInstalls' to '1'. Received the value from a code block.
INFO: Calling Query w32RegQueries10.2.0.1.0  RegGetStringValue
Key = HKEY_LOCAL_MACHINE
SubKey = software\oracle\OracleMTSRecoveryService\Setup\All Versions\1
Value = Home
INFO:
Query Exception: GetValueKeyNotFoundException
Query Exception Class: class oracle.sysman.oii.oiil.OiilQueryException
INFO: *** Cancel Dialog: Specified key not found ***
INFO: User Selected: Stop installation of all products.



 

Solution:

You will need to update registry. Follow steps below

 
Setting up keys in registry:
1, Key = HKEY_LOCAL_MACHINE
SubKey = software\oracle\OracleMTSRecoveryService\Setup\All Versions\1
Value = Home
value: C:\oracle\product\10.2.0\client_1\



select new > String value




2, Key = HKEY_LOCAL_MACHINE
SubKey = software\oracle\OracleMTSRecoveryService\Setup\Current Version\
value: C:\oracle\product\10.2.0\client_1\
this value will get overwritten with installer value, but the key has to be present.








Monday, 13 August 2012

Oracle cheat sheet


Display existing tables in oracle db



Code:

SELECT owner, table_name
  FROM dba_tables
 
if you need only user tables:  
 
SELECT table_name
  FROM user_tables
 
  
 

Sunday, 5 August 2012

NLog config targets -Database, Text File, EventLog

Example of NLog Targets



<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">




  <variable name="applicationName" value="Application" />
 
 
  <!-- do not change -->
  <variable name="eventLogTaget" value="ProjectName" />
 
  <targets>
    <!-- NLogViewer logger -->
    <!-- Text file logger -->
   
    <target name="logFile" xsi:type="File"
            layout="${longdate} ${level} ${message}"
            fileName="${basedir}/${shortdate}.log" />


   
   
    <target name="log" xsi:type="EventLog"
            layout="${logger}: ${message} ${exception:format=ToString}"
            log="${eventLogTaget}" source="${applicationName}" />


    <target name="logdb" type="Database">
      <dbprovider>mssql</dbprovider>
      <dbhost>SERVER2</dbhost>
      <dbdatabase>NLogDatabase</dbdatabase>
      <dbusername>temp</dbusername>
      <dbpassword>temp</dbpassword>


      <commandText>
        INSERT INTO dbo.LogTable([level]
        ,[logger]
        ,[message]
        ,[exception])
        VALUES( @level, @logger, @message, @exception);
      </commandText>
     
      <parameter name="@level" layout="${level}" />
      <parameter name="@logger" layout="${logger}" />
      <parameter name="@message" layout="${message}" />
      <parameter name="@exception" layout=" ${exception:format=ToString}" />
    </target>
   
  </targets>
  <rules>
    <!--<logger name="*" levels="Trace, Info, Debug, Warn, Error, Fatal" writeTo="eventlog"/>-->
    <logger name="*" levels="Trace, Info, Debug, Warn, Error, Fatal" writeTo="log, logdb, logFile"/>
  </rules>
</nlog>

Sunday, 8 July 2012

Usefull Tools

Data Tables

Before I went to razor 3 and even after I sometime need some nice table displaying tool.
This is really nice tool for getting data displayed fast.

Data tables


Data generation

Dummy data generation is very useful tool when you need context, or any text that is used to populate data in your software. In C# I have been using NBULDER to populate my object

nbuilder
nbuilder documentation


more will follow

Wednesday, 4 July 2012

ORACLE query samples

Here you can find examples of sql queries.




Select all distinct (unique) rows from table for field:

SELECT UNIQUE (Field)  FROM Shema.TableName