Error: Object reference not set to an instance of an object.

JackLockeJackLocke Posts: 25
edited March 2, 2013 12:14PM in SQL Packager Previous Versions
Hi All,
I am currently evaluating SQL Packager for my company. And one of the feature we are interested in is to have ability to call SQL Packager via CLI and integrate it in our installer.

Currently I am trying to generate exe for update database by comparing two versions of database. I am using following command,

"C:\Program Files (x86)\Red Gate\SQL Packager 6\SQLPackag
er.exe" /database1:NEW /database2:OLD /location:"C:\Users\Administrator\Desktop
\test" /name:TestPKG /makeexe

And following is output of that command, (excluding database object details)

SQL Packager Command Line V6.4.0.8
==============================================================================
Copyright c Red Gate Software Ltd 1999-2008

TRIAL STATUS: You have 13 days left in your trial.
Serial Number:

Registering data sources
Creating mappings
Comparing
Applying Command Line Items
Creating SQL

Summary Information
==============================================================================
DB1 = (local).NEW
DB2 = (local).OLD

Object type Name DB1 DB2
<includes db objects>
.......
.......
.......
.......
.......
.......
.......
.......
.......
Registering databases
Mapping
Comparing databases
Error: Object reference not set to an instance of an object.

I dont understand why I am getting object reference error here. It is local instance and user is administrator of that instance.

Thanks,
Jack

Comments

  • Please can you confirm the version of SQL Server that you are attempting to use the tool with?
  • chrisk5 wrote:
    Please can you confirm the version of SQL Server that you are attempting to use the tool with?
    I am using SQL Server 2008R2 Std edition on Windows Server 2008 R2
  • The "Object reference not set to an instance of an object." error message is rather generic error message, so I think we need some more information to decide what has gone wrong.

    Would it be possible for you to try running a comparison in SQL Compare with the same two databases. I would like to know whether you encounter the same error message or if the comparison goes through. If you are able to recreate the same error message, please can you follow these steps.

    - enable error logging, as described in this document:
    http://www.red-gate.com/SupportCenter/C ... _log_files
    - recreate the error message one more time.
    - disable error logging, as described in the above document (the file can grow very quickly so please try not to leave this running too long).
    - locate the log file and send to support@red-gate.com quoting the support ticket number F0061318.

    If you have any problems, then please let me know (either by email or posting back here).
  • chrisk5 wrote:
    The "Object reference not set to an instance of an object." error message is rather generic error message, so I think we need some more information to decide what has gone wrong.

    Would it be possible for you to try running a comparison in SQL Compare with the same two databases. I would like to know whether you encounter the same error message or if the comparison goes through. If you are able to recreate the same error message, please can you follow these steps.

    - enable error logging, as described in this document:
    http://www.red-gate.com/SupportCenter/C ... _log_files
    - recreate the error message one more time.
    - disable error logging, as described in the above document (the file can grow very quickly so please try not to leave this running too long).
    - locate the log file and send to support@red-gate.com quoting the support ticket number F0061318.

    If you have any problems, then please let me know (either by email or posting back here).

    Hi,
    I can generate exe,C# app or .sql script if I use GUI for same databases and log doesn't show any error. But if I try to do this via CLI, and enable logging for execution by including /verbose switch in command. So my new command looks like this,
    "C:\Program Files (x86)\Red Gate\SQL Packager 6\SQLPackager.exe" /database1:NEW /u1:sa /p1:superpassword /database2:OLD /u2:sa /p2:superpassword /location:"C:\Users\Administrator\Desktop\test" /name:TestPKG /makeexe /verbose

    This will display whole sql script generated by packager based on comparison. But this doesn't show me anything extra for error. I understand that this error is very generic and it is difficult to pin point actual issue. But as you can see my original post this error comes right after

    Comparing database (local).NEW with database (local).OLD...
    Registering databases
    Mapping
    Comparing databases

    And I think it might give you a clue about what could be wrong here.

    Thanks,
    Jack
  • DGappDGapp Posts: 2 Bronze 1
    I get this error fairly frequently myself, and it almost always happens when there are newer table(s) and stored procs, and most often when the newer table(s) have no data on them. Usually I can exclude them and move on and some point later it works fine. I haven't been able to exactly pin it down, but it's almost always the "build" process when new tables are included or the very next one after they were introduced. It's quite frustrating
  • DGapp wrote:
    I get this error fairly frequently myself, and it almost always happens when there are newer table(s) and stored procs, and most often when the newer table(s) have no data on them. Usually I can exclude them and move on and some point later it works fine. I haven't been able to exactly pin it down, but it's almost always the "build" process when new tables are included or the very next one after they were introduced. It's quite frustrating

    It is indeed very frustrating issue. And strangest most thing is if I do exactly same thing in UI, it works just fine ! But I don't want to use UI, we want to automate this thing using CLI.

    And say if it solves my issue by excluding new updates then what's point of even using this sofware because that's the whole point of having this product, no ?

    By looking at their current response, I wonder how is RedGate's after sales support ...

    Thanks anyway. I am glad to see that I am not the only one with similar issue.

    Jack
  • DGappDGapp Posts: 2 Bronze 1
    Well, to be honest, they've been very good to me overall. For some reason, SQLPackager has always been a thorn in my side and is solely used for automation purposes which makes it even worse when it doesn't work with such "generic" errors...but the UI components work fine.

    Previously, I was able to encounter similar or the same errors using the UI components (SQL Compare and SQL Data Compare), but no longer. I'm hoping it's just related to using older comparison libraries and that we'll see a new SQL Packager using new comparison libraries, or automation of the individual actual products.

    But, like I said overall RedGate has been really good to me and I couldn't do a lot of things without them or their tools; in case that helps ease your concern at all.
  • I'm getting the same issue with SQL Packager. I've experienced the same problems with SQL Data Compare and it seems to happen when it's doing the mapping portion.

    C:\Program Files (x86)\Red Gate\SQL Packager 6>sqlpackager.exe /db1:WAP-Official /n:WAPOfficialPackage /exe /options:d,idn,k

    Registering databases
    Mapping
    Error: Object reference not set to an instance of an object.

    Is anyone at Red-Gate working on this problem?
Sign In or Register to comment.