This project is read-only.

Getting unhanded exceptions

Jan 27, 2015 at 5:57 AM
Edited Jan 27, 2015 at 5:59 AM
When using SQL server dump 1.4 I get Unhandled exceptions.

I tried simply using:
sqlserverdump --all-databases --result-file=sqldump.txt

Is there a way to tell it to ignore when it cannot retrieve something?


Unhandled Exception: Microsoft.SqlServer.Management.Smo.FailedOperationException
: Script failed for StoredProcedure 'dbo.up_upd_laskusuoritukset'. ---> Microso
ft.SqlServer.Management.Smo.PropertyCannotBeRetrievedException: Property TextHea
der is not available for StoredProcedure '[dbo].[up_upd_laskusuoritukset]'. This
property may not exist for this object, or may not be retrievable due to insuff
icient access rights. The text is encrypted.
at Microsoft.SqlServer.Management.Smo.ScriptNameObjectBase.GetTextProperty(St
ring requestingProperty, ScriptingOptions so, Boolean bThrowIfCreating)
at Microsoft.SqlServer.Management.Smo.ScriptNameObjectBase.BuildText(Scriptin
gOptions so)
at Microsoft.SqlServer.Management.Smo.ScriptNameObjectBase.GetTextForScript(S
criptingOptions so, Boolean forCreate, String[] expectedObjectTypes, Boolean for
ceCheckNameAndManipulateIfRequired)
at Microsoft.SqlServer.Management.Smo.StoredProcedure.ScriptInternal(StringCo
llection queries, ScriptingOptions so, Boolean bForCreate)
at Microsoft.SqlServer.Management.Smo.StoredProcedure.ScriptSP(StringCollecti
on queries, ScriptingOptions so, Boolean bForCreate)
at Microsoft.SqlServer.Management.Smo.StoredProcedure.ScriptCreate(StringColl
ection queries, ScriptingOptions so)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.ScriptCreateInternal(Strin
gCollection query, ScriptingOptions so)
at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithListWorker(Dependenc
yCollection depList, SqlSmoObject[] objects)
at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(DependencyColle
ction depList, SqlSmoObject[] objects)
--- End of inner exception stack trace ---
at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(DependencyColle
ction depList, SqlSmoObject[] objects)
at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(Urn[] urns, Sql
SmoObject[] objects)
at Microsoft.SqlServer.Management.Smo.Scripter.Script(Urn[] urns, SqlSmoObjec
t[] objects)
at Microsoft.SqlServer.Management.Smo.Scripter.EnumScript(Urn[] urns)
at Helvartis.SQLServerDump.Program.Output(NamedSmoObject obj, TextWriter tw,
Scripter scrp, LinkedList1 outputAtEnd, String& header)
at Helvartis.SQLServerDump.Program.Output(SmoCollectionBase coll, TextWriter
tw, Scripter scrp, String header)
at Helvartis.SQLServerDump.Program.run(String[] args)
at Helvartis.SQLServerDump.Program.Main(String[] args)


And when running without stored procedures I get the same for some views


Unhandled Exception: Microsoft.SqlServer.Management.Smo.FailedOperationException
: Script failed for View 'dbo.v_alennukSET'. ---> Microsoft.SqlServer.Managemen
t.Smo.PropertyCannotBeRetrievedException: Property TextHeader is not available f
or View '[dbo].[v_alennukSET]'. This property may not exist for this object, or
may not be retrievable due to insufficient access rights. The text is encrypted
.
at Microsoft.SqlServer.Management.Smo.ScriptNameObjectBase.GetTextProperty(St
ring requestingProperty, ScriptingOptions so, Boolean bThrowIfCreating)
at Microsoft.SqlServer.Management.Smo.ScriptNameObjectBase.BuildText(Scriptin
gOptions so)
at Microsoft.SqlServer.Management.Smo.ScriptNameObjectBase.GetTextForScript(S
criptingOptions so, Boolean forCreate, String[] expectedObjectTypes, Boolean for
ceCheckNameAndManipulateIfRequired)
at Microsoft.SqlServer.Management.Smo.View.GetDDL(StringCollection queries, S
criptingOptions so, Boolean bCreate)
at Microsoft.SqlServer.Management.Smo.View.ScriptCreate(StringCollection quer
ies, ScriptingOptions so)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.ScriptCreateInternal(Strin
gCollection query, ScriptingOptions so)
at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithListWorker(Dependenc
yCollection depList, SqlSmoObject[] objects)
at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(DependencyColle
ction depList, SqlSmoObject[] objects)
--- End of inner exception stack trace ---
at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(DependencyColle
ction depList, SqlSmoObject[] objects)
at Microsoft.SqlServer.Management.Smo.Scripter.ScriptWithList(Urn[] urns, Sql
SmoObject[] objects)
at Microsoft.SqlServer.Management.Smo.Scripter.Script(Urn[] urns, SqlSmoObjec
t[] objects)
at Microsoft.SqlServer.Management.Smo.Scripter.EnumScript(Urn[] urns)
at Helvartis.SQLServerDump.Program.Output(NamedSmoObject obj, TextWriter tw,
Scripter scrp, LinkedList`1 outputAtEnd, String& header)
at Helvartis.SQLServerDump.Program.Output(SmoCollectionBase coll, TextWriter
tw, Scripter scrp, String header)
at Helvartis.SQLServerDump.Program.run(String[] args)
at Helvartis.SQLServerDump.Program.Main(String[] args)
Apr 29, 2015 at 1:29 PM
I hadn't seen your post earlier, but as it might help someone else too, I figured I'd answer anyway...

There is currently no way to tell it to ignore when it cannot retrieve something. But it is likely that it's a permission issue which you could solve by granting the VIEW DEFINITION permission on the database.