Error using installing MSSQL Server2014 using chef - sql-server

I have window 2012 R2 based two VM machines.
One is using for Chef-workstation and other is for Chef-client.
I am trying to install MSSQL Server 2014 using chef-cmd from chef-workstation on chef-client.
Sometimes I am getting below error on chef-client while installing MSSQL Server.
check for instance name, got: 'MSSQLSERVER' Error: Action
"Microsoft.SqlServer.Configuration.SetupExtension.FinalCalculateSettingsAction"
threw an exception during execution.
Microsoft.SqlServer.Setup.Chainer.Workflow.ActionExecutionException:
There was an error generating the XML document. --->
Microsoft.SqlServer.Chainer.Infrastructure.ChainerInfrastructureException:
There was an error generating the XML document. --->
System.InvalidOperationException: There was an error generating the
XML document. --->
System.Security.Cryptography.CryptographicException: Access is denied.
at System.Security.Cryptography.ProtectedData.Protect(Byte[] userData,
Byte[] optionalEntropy, DataProtectionScope scope) at
Microsoft.SqlServer.Common.SqlSecureString.WriteXml(XmlWriter writer)
at
System.Xml.Serialization.XmlSerializationWriter.WriteSerializable(IXmlSerializable
serializable, String name, String ns, Boolean isNullable, Boolean
wrapped) at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterAgentConfigurationPublic.Write6_AgentConfigurationPublic(String
n, String ns, AgentConfigurationPublic o, Boolean isNullable, Boolean
needType) at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterAgentConfigurationPublic.Write7_AgentConfigurationPublic(Object
o) at
Microsoft.SqlServer.Setup.Chainer.Workflow.ActionEngine.RunActionQueue()
Error: Action
"Microsoft.SqlServer.Configuration.BootstrapExtension.ExecuteWorkflowAction"
threw an exception during execution.
Microsoft.SqlServer.Setup.Chainer.Workflow.ActionExecutionException:
There was an error generating the XML document. --->
Microsoft.SqlServer.Chainer.Infrastructure.ChainerInfrastructureException:
There was an error generating the XML document. --->
System.InvalidOperationException: There was an error generating the
XML document. --->
System.Security.Cryptography.CryptographicException: Access is denied.
at System.Security.Cryptography.ProtectedData.Protect(Byte[] userData,
Byte[] optionalEntropy, DataProtectionScope scope) at
Microsoft.SqlServer.Common.SqlSecureString.WriteXml(XmlWriter writer)
For more information:
https://discourse.chef.io/t/error-action-microsoft-sqlserver-configuration-setupextension-finalcalculatesettingsaction-threw-an-exception-during-execution/13778

Related

Error Importing flat files into Microsoft SQL Server Management Studio 18 -- "System Out of Memory"

I have an approximately 10 GB Excel CSV that I am trying to import into a SQL Database. When I use the import flat file option / wizard the file starts to import for about 10-15 seconds before running into a System Out of Memory Exception Error. The follow is the error output and screenshots.
Any information is greatly appreciated!
Detailed Error Output:
Error inserting data into table. (Microsoft.SqlServer.Import.Wizard)
------------------------------
Program Location:
at Microsoft.SqlServer.Import.Wizard.InsertData.ResultCheck(Result result)
at Microsoft.SqlServer.Import.Wizard.InsertData.DoWork()
at Microsoft.SqlServer.Management.TaskForms.SimpleWorkItem.Run()
===================================
Error inserting data into table. (Microsoft.SqlServer.Prose.Import.SDS)
------------------------------
Program Location:
at Microsoft.SqlServer.Prose.Import.BcpTextSynthesis.InsertIntoDB(String inputFilePath, String tableName, String schemaName, IReadOnlyList`1 columnInfo, SqlConnection connection, Int32 batchSize, SqlTransaction transaction, IList`1 allFinalTransformations, IList`1 allFinalTransformationColumns, IList`1 allFinalColNames)
at Microsoft.SqlServer.Prose.Import.BcpProcess.CreateTableAndInsertDataIntoDb(String connectionString, Int32 batchSize, String azureAccessToken)
===================================
Exception of type 'System.OutOfMemoryException' was thrown. (mscorlib)
------------------------------
Program Location:
at System.Text.StringBuilder.ToString()
at Microsoft.ProgramSynthesis.Read.FlatFile.Semantics.Semantics.<SplitLines>d__17.MoveNext()
at Microsoft.ProgramSynthesis.Read.FlatFile.Semantics.Semantics.<Csv>d__9.MoveNext()
at System.Linq.Enumerable.<SkipIterator>d__31`1.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Microsoft.SqlServer.Prose.Import.BcpTextSynthesis.InsertIntoDB(String inputFilePath, String tableName, String schemaName, IReadOnlyList`1 columnInfo, SqlConnection connection, Int32 batchSize, SqlTransaction transaction, IList`1 allFinalTransformations, IList`1 allFinalTransformationColumns, IList`1 allFinalColNames)
[Image of Import Wizard][1]
[Error Image 'System.OutOfMemoryException' was thrown][2]
For large files like that, look into using Bulk Insert.
I used the Bulk insert command as per below and please make sure that the files to be load is on the SQL server and not on your local/remote machine.
BULK INSERT dbo.TABLE
FROM 'E:\YOUR_FILES.csv'
WITH ( FORMAT = 'CSV',
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n' );

SSMS Collation conflict when expand Tables

some strange SSMS behaviour annoyed me for the last few days.
I'm using EF Core 5 Code First and trying to create a test database with EnsureCreated(). The code runs fine and database appears on my local server. But when I try to expand Tables in SSMS I get following error:
I'm using mssql docker container which is configured for German language (MSSQL_LCID: 1031).
Also, we have production database dumps that I can restore on my local machine and get everything work fine.
Here are default server and database collation which I found in properties:
server: SQL_Latin1_General_CP1_CI_AS
database from dump: Latin1_General_CI_AS
database from EnsureCreated(): Latin1_General_CI_AS
So as you see collations for each databases are the same. But I don't get conflict on restored one!
UPDATE:
Here are some details of error (retrieved by clicking Show details button)
===================================
Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
------------------------------
For help, click: https://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&LinkId=20476
------------------------------
Program Location:
at Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.Process(Object connectionInfo, Request request)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.NavigableItemBuilderDataReader.RunQuery()
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.NavigableItemBuilderDataReader.Process()
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.NavigableItemBuilderDataReader.get_PropertyNames()
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.BuildDynamicItemWithQuery(IList`1 nodes, INodeInformation source, INavigableItem sourceItem, String urnQuery, Boolean registerBuilder, Boolean registerBuiltItems)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.BuildDynamicItem(IList`1 nodes, INodeInformation source, INavigableItem sourceItem, IFilterProvider filter)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.Build(IList`1 nodes, INodeInformation source, INavigableItem sourceItem, IFilterProvider filter)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NonContextFilterNavigableItemBuilder.Build(IList`1 targetList, INodeInformation source, INavigableItem sourceItem, IFilterProvider filter)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItem.RequestChildren(IGetChildrenRequest request)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ExplorerHierarchyNode.BuildChildren(WaitHandle quitEvent)
===================================
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
Program Location:
at Microsoft.SqlServer.Management.Common.ServerConnection.GetExecuteReader(SqlCommand command)
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(String sqlCommand, SqlCommand& command)
at Microsoft.SqlServer.Management.Smo.ExecuteSql.GetDataReader(String query, SqlCommand& command)
at Microsoft.SqlServer.Management.Smo.DataProvider.SetConnectionAndQuery(ExecuteSql execSql, String query)
at Microsoft.SqlServer.Management.Smo.ExecuteSql.GetDataProvider(StringCollection query, Object con, StatementBuilder sb, RetriveMode rm)
at Microsoft.SqlServer.Management.Smo.SqlObjectBase.FillData(ResultType resultType, StringCollection sql, Object connectionInfo, StatementBuilder sb)
at Microsoft.SqlServer.Management.Smo.SqlObjectBase.FillDataWithUseFailure(SqlEnumResult sqlresult, ResultType resultType)
at Microsoft.SqlServer.Management.Smo.SqlObjectBase.BuildResult(EnumResult result)
at Microsoft.SqlServer.Management.Smo.SqlObjectBase.GetData(EnumResult erParent)
at Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetData()
at Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetData(Request req, Object ci)
at Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.GetData(Object connectionInfo, Request request)
at Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.Process(Object connectionInfo, Request request)
===================================
Ein Sortierungskonflikt zwischen "Latin1_General_CI_AS" und "SQL_Latin1_General_CP1_CI_AS" im UNION ALL-Operator, der in der 2-Spalte der SELECT-Anweisung auftritt, kann nicht aufgelöst werden.
Die Sicht oder Funktion "sys.all_columns" konnte aufgrund von Bindungsfehlern nicht verwendet werden. (.Net SqlClient Data Provider)
------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=14.00.3411&EvtSrc=MSSQLServer&EvtID=451&LinkId=20476
------------------------------
Server Name: localhost
Error Number: 451
Severity: 16
State: 1
Procedure: all_columns
Line Number: 2
------------------------------
Program Location:
at Microsoft.SqlServer.Management.Common.ConnectionManager.ExecuteTSql(ExecuteTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchException)
at Microsoft.SqlServer.Management.Common.ServerConnection.GetExecuteReader(SqlCommand command)
Seems like it comes from view all_columns. I also can't do any select from this system view nor event see its columns.

MSSQL 2016 Package execution failed | SSIS error: Index was out of range

I've made a copy job with Copy Database Wizard using SMO(leave DB online). The DB is to be copied to the same SQL instance. This fails with
The package execution failed. The step failed.
If I execute the SSIS package it has created, the following occurs:
Event Name: OnError Message: Index was out of range. Must be
non-negative and less than the size of the collection. Parameter name:
index StackTrace: at System.Collections.BitArray.Set(Int32 index,
Boolean value) at
Microsoft.SqlServer.Management.Smo.PermissionWorker.GetPermissionSetBase(PermissionEnumKind
kind, Int32 i) at
Microsoft.SqlServer.Management.Smo.SqlSmoObject.GetPermissionsFromCache(PermissionEnumKind
kind) at
Microsoft.SqlServer.Management.Smo.SqlSmoObject.AddScriptPermissions(StringCollection
sc, PermissionEnumKind kind, ScriptingPreferences sp) at
Microsoft.SqlServer.Management.Smo.Database.AddScriptPermission(StringCollection
query, ScriptingPreferences sp) at
Microsoft.SqlServer.Management.Smo.ScriptMaker.ScriptCreateSpecialUrn(Urn
urn, ScriptingPreferences sp, ObjectScriptingType& scriptType) at
Microsoft.SqlServer.Management.Smo.ScriptMaker.ScriptCreate(Urn urn,
ScriptingPreferences sp, ObjectScriptingType& scriptType) at
Microsoft.SqlServer.Management.Smo.ScriptMaker.ScriptCreateObjects(IEnumerable1
urns) at
Microsoft.SqlServer.Management.Smo.ScriptMaker.ScriptUrns(List1
orderedUrns) at
Microsoft.SqlServer.Management.Smo.ScriptMaker.DiscoverOrderScript(IEnumerable1
urns) at
Microsoft.SqlServer.Management.Smo.ScriptMaker.ScriptWorker(List1
urns, ISmoScriptWriter writer) at
Microsoft.SqlServer.Management.Smo.ScriptMaker.Script(UrnCollection
list, ISmoScriptWriter writer) at
Microsoft.SqlServer.Management.Smo.DataTransferBase.GetScriptLoadedTransferWriter()
at Microsoft.SqlServer.Management.Smo.Transfer.TransferData() at
Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.TransferDatabasesUsingSMOTransfer()
I have tried starting the job from SQLCMD as well. Same results.
I have tried Detach/Attach method as well. That went through fine, however, that is not a desired option as it leaves the DB offline for the transfer's duration.
I have admin rights on the server(Windows) and the instance as well.
Executing the package(.dtsx file using Package Execution Utility) outside SSMS gives the same error.
I have created an empty database with only one table in it. Same error happens.
Please help..
OS: Windows Server 2012
MSSQL: 2016 SP1
This has been resolved with applying the January 2018 CU, even though this fix is NOT documented there.

SQL Server : .mdf upload error (somee.com)

I'm using somee.com for publish webservices and db. But when I try to upload my .mdf file, I get that error.
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.IO.IOException: The process cannot access the file 'c:\dzsqls\appointmentsystemdb.mdf' because it is being used by another process. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.File.InternalDelete(String path, Boolean checkHost) at System.IO.File.Delete(String path) at DZWebSvc.DZWebAgent.AttachNewUserDBDataFileOnly(String DBName, String LoginName, String OriginalDBFileName, String OriginalLogFileName, String NewDBFileName, Int32 MaxDataFileSizeMB, Int32 MaxLogFileSizeMB, String ConnectionString, Boolean ChangeDefaultSchemaToDbo, String tk) in c:\Projects\Doka\Zin1_branch\DZWebSvc\DZWebAgent.asmx.cs:line 2232 --- End of inner exception stack trace ---
What does this error mean? What is the solution?
First check if names of databases are similar (name of your Database in Somee and name of your database in Local Db.
If the problem is not solved, then first delete your Database in Somee and create a new one with the same name if necessary. then in your SQL manager studio generate a script of your database.enter image description here
Remove Master from start and end enter image description here
then go to somee and click on Run-TSQL > then open T-SQL console and paste your script there, then click "RUN as T-SQL BATCH" and see if it works.

Generate SQL scripts from Azure SQL Database

When I tried to Generate scripts in SQL Server Management Studio 2012 from my Azure database. I received following error:
Microsoft.SqlServer.Management.SqlScriptPublish.SqlScriptPublishException:
An error occurred while scripting the objects. --->
Microsoft.SqlServer.Management.Sdk.Sfc.EnumeratorException: Failed to
retrieve data for this request. --->
Microsoft.SqlServer.Management.Sdk.Sfc.InvalidVersionEnumeratorException:
Operation not supported on version 11.0 SqlAzureDatabase. at
Microsoft.SqlServer.Management.Smo.XmlReadDoc.LoadFile(Assembly a,
String strFile) at
Microsoft.SqlServer.Management.Smo.SqlObject.LoadInitData(String file,
ServerVersion ver, DatabaseEngineType databaseEngineType) at
Microsoft.SqlServer.Management.Sdk.Sfc.ObjectCache.LoadElement(ObjectLoadInfo
oli, ServerVersion ver, DatabaseEngineType databaseEngineType) at
Microsoft.SqlServer.Management.Sdk.Sfc.ObjectCache.GetElement(ObjectLoadInfo
oli, ServerVersion ver, DatabaseEngineType databaseEngineType) at
Microsoft.SqlServer.Management.Sdk.Sfc.ObjectCache.GetAllElements(Urn
urn, ServerVersion ver, DatabaseEngineType databaseEngineType, Object
ci) at
Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetObjectsFromCache(Urn
urn, Object ci) at
Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetData(Request
req, Object ci) at
Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.GetData(Object
connectionInfo, Request request) at
Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.Process(Object
connectionInfo, Request request) --- End of inner exception stack
trace --- at
Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.Process(Object
connectionInfo, Request request) at
Microsoft.SqlServer.Management.Smo.ExecutionManager.GetEnumeratorData(Request
req) at
Microsoft.SqlServer.Management.Smo.Server.GetLCIDCollation(String
collationName) at
Microsoft.SqlServer.Management.Smo.SqlSmoObject.GetComparerFromCollation(String
collationName) at
Microsoft.SqlServer.Management.Smo.SqlSmoObject.GetDbComparer(Boolean
inServer) at
Microsoft.SqlServer.Management.Smo.SqlSmoObject.InitializeStringComparer()
at Microsoft.SqlServer.Management.Smo.Database.PreInitChildLevel() at
Microsoft.SqlServer.Management.Smo.SqlSmoObject.InitChildLevel(Urn
levelFilter, ScriptingPreferences sp, Boolean forScripting) at
Microsoft.SqlServer.Management.Smo.DatabasePrefetchBase.InitializeObjectCollection(String
type) at
Microsoft.SqlServer.Management.Smo.DatabasePrefetchBase.d__1.MoveNext()
at
Microsoft.SqlServer.Management.Smo.SmoDependencyDiscoverer.SfcChildrenDiscovery(HashSet1
discoveredUrns) at
Microsoft.SqlServer.Management.Smo.SmoDependencyDiscoverer.Discover(IEnumerable1
urns) at
Microsoft.SqlServer.Management.Smo.ScriptMaker.Discover(IEnumerable1
urns) at
Microsoft.SqlServer.Management.Smo.ScriptMaker.DiscoverOrderScript(IEnumerable1
urns) at
Microsoft.SqlServer.Management.Smo.ScriptMaker.ScriptWorker(List`1
urns, ISmoScriptWriter writer) at
Microsoft.SqlServer.Management.Smo.ScriptMaker.Script(Urn[] urns,
ISmoScriptWriter writer) at
Microsoft.SqlServer.Management.SqlScriptPublish.SqlScriptGenerator.DoScript(ScriptOutputOptions
outputOptions) --- End of inner exception stack trace --- at
Microsoft.SqlServer.Management.SqlScriptPublish.GeneratePublishPage.worker_DoWork(Object
sender, DoWorkEventArgs e) at
System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e) at
System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object
argument)
I found this thread: Failed to generate scripts for Sql Azure database: "Getting the list of objects from : failed"
but I cannot use: http://cloudservices.red-gate.com/
Try using third party tools for SQL Server that are able to work with Azure. I think SQL Compare from Red-Gate had the ability to work with SQL Azure but I’m not 100% sure. You can always use it in trial mode to get the job done…
SQL Azure Migration wizard might be an option for you as well.
http://sqlazuremw.codeplex.com/

Resources