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

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.

Related

SQL server Job error while running SSIS solution

I have tested a SSIS solution with kingswaysoft in SSDT, and it is fine but when this to be run through SQL Server, it throwing error like-
Value cannot be null.
Parameter-Identityprovider
at ttn.jxp(Object abl,String abm)
at tvi'1.jnc(ttr air)
at tvi'1.jmw(ttr aih)
at tvi'1.jnt(ClientCredentials ajo)
at tzh.pgr(Boolean cvz,Nullable'1 cwa)
at tzh.fyh.cjr()
at tpo.yia[cb](Func'1 ed,Int32 ee,Func'2 ef,Func'2 eg,Func'1 eh,PipelineComponent ei)

Create non clustered index times out

While creating a non-clustered index on a table using SSMS, I get this message. I tried changing the timeout setting on the database thus, but it doesn't help:
USE Options ;
GO
EXEC sp_configure 'remote query timeout', 0 ;
GO
RECONFIGURE ;
GO
The sql server error:
===================================
Create failed for Index 'NonClusteredIndex-20200121-151256'. (Microsoft.SqlServer.Smo)
------------------------------
For help, click: https://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=15.0.18142.0+((SSMS_Rel).190722-0816)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+Index&LinkId=20476
------------------------------
Program Location:
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.CreateImpl()
at Microsoft.SqlServer.Management.Smo.Index.Create()
at Microsoft.SqlServer.Management.Smo.IndexExtender.IndexExtenderHelper.Execute(IndexAction action)
at Microsoft.SqlServer.Management.RelationalEngineTasks.IndexTaskFormComponent.PerformTask(ITaskExecutionContext context)
at Microsoft.SqlServer.Management.RelationalEngineTasks.IndexTaskFormComponent.Microsoft.SqlServer.Management.ITask.Perform(ITaskExecutionContext )
at Microsoft.SqlServer.Management.TaskForms.TaskExecutionManager.ExecuteTaskSequence(ISfcScriptCollector collector)
===================================
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
Program Location:
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType, Boolean retry)
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType, Boolean retry)
at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(StringCollection queries, Boolean retry)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.ExecuteNonQuery(StringCollection queries, Boolean includeDbContext, Boolean executeForAlter)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.CreateImplFinish(StringCollection createQuery, ScriptingPreferences sp)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.CreateImpl()
===================================
**Execution Timeout Expired.** The timeout period elapsed prior to completion of the operation or the server is not responding. (.Net SqlClient Data Provider)
------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=-2&LinkId=20476
------------------------------
Server Name: DELLR410
Error Number: -2
Severity: 11
State: 0
------------------------------
Program Location:
When working with large (millions of records) tables it is advised not to use the built-in functionality of SSMS to do this but via a script. Personally I always use a remote session on the server itself when I run these scripts on large tables, to protect the execution of the script as much as I can (SSMS on my laptop might crash or the network connection gets interrupted etc).

xp_regread() returned error 5, 'Access is denied.'

I'm running the SQL Server Copy Database Wizard.
Of note is that the Operator is NT AUTHORITY\SYSTEM, which I thought should have the authority to run whatever it wants.
How can we grant sufficient privileges to NT AUTHORITY\SYSTEM? I have already tried:
GRANT EXECUTE ON xp_regread TO public
GRANT EXECUTE ON xp_regread TO [NT AUTHORITY\SYSTEM]
And running the following shows that it worked.
SELECT
grantee_principal.name AS [Grantee]
, prmssn.permission_name
FROM
sys.all_objects AS xproc
INNER JOIN sys.database_permissions AS prmssn ON prmssn.major_id=xproc.object_id AND prmssn.minor_id=0 AND prmssn.class=1
INNER JOIN sys.database_principals AS grantee_principal ON grantee_principal.principal_id = prmssn.grantee_principal_id
WHERE
(xproc.type='X')and(xproc.name=N'xp_regread' and SCHEMA_NAME(xproc.schema_id)=N'sys')
Output:
Grantee permission_name
public EXECUTE
NT AUTHORITY\SYSTEM EXECUTE
The following error occurs:
Event Name: OnError
Message: An exception occurred while executing a Transact-SQL statement or batch.
StackTrace: 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.SqlServer.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.Smo.ExecutionManager.GetEnumeratorDataReader(Request req)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.GetInitDataReader(String[] fields, OrderBy[] orderby)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.ImplInitialize(String[] fields, OrderBy[] orderby)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.Initialize(Boolean allProperties)
at Microsoft.SqlServer.Management.Smo.SqlSmoObject.OnPropertyMissing(String propname, Boolean useDefaultValue)
at Microsoft.SqlServer.Management.Smo.PropertyCollection.RetrieveProperty(Int32 index, Boolean useDefaultOnMissingValue)
at Microsoft.SqlServer.Management.Smo.PropertyCollection.GetValueWithNullReplacement(String propertyName, Boolean throwOnNullValue, Boolean useDefaultOnMissingValue)
at Microsoft.SqlServer.Management.Smo.Server.get_InstanceName()
at Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.MappedLogin.RefreshData()
at Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.MappedLogin.CheckDirty()
at Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.GetDatabaseLogins()
at Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.UpdateObjectsToCopy()
InnerException-->xp_regread() returned error 5, 'Access is denied.'
xp_regread() returned error 5, 'Access is denied.'
xp_regread() returned error 5, 'Access is denied.'
StackTrace: at Microsoft.SqlServer.Management.Common.ConnectionManager.ExecuteTSql(ExecuteTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchException)
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteReader(String sqlCommand, SqlCommand& command)
Operator: NT AUTHORITY\SYSTEM
Source Name: SQLSERVER2008R2_Transfer Objects Task
Source ID: {9D0562F4-FCC9-498D-A2A9-FC9E5F3B681B}
Execution ID: {23FF505D-00D3-4F84-8B9D-D9EC962C78D2}
Start Time: 2015-04-17 7:23:24 PM
End Time: 2015-04-17 7:23:24 PM
Data Code: 0
This is the tool we need to use, because we don't have access to the remote server, and because the Import-Export Wizard failed.
You might need to add the account to the sysadmin server role, which allows a member to perform every activity.
For 2008r2, execute this command:
EXEC sp_addsrvrolemember 'NT AUTHORITY\SYSTEM', 'sysadmin';
This is a common error encountered when attempting to update the registry from SQL Server, and there are some weird and non-obvious pathing issues in newer versions such as SQL Server 2017.
The error is not due to security within SQL Server, but instead Windows security related to the permissions on the registry keys as relates to the users under which specific SQL Server processes are running.
For instance, to execute MSSQL related registry commands from SQL Server, the system group NETWORKSERVICE needs full control on the relevant registry path. This is because SQL Agent (by default) runs as a user in that system group.
For SQL Server settings, the Registry path is:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server
As an example, the command in SQL Server to set the log file size limit to be 1024 KB is as follows:
USE [master]
GO
EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE',
N'SOFTWARE\Microsoft\Microsoft SQL Server\MSSQLServer',
N'ErrorLogSizeInKb', REG_DWORD, 1024
GO
Also note the truncated path above. The actual full registry path (for SQL2017) is as follows:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQLServer
The xp_instance_regwrite SQL Server command automatically injects the version key into the path. For SQL Server 2017 that key is MSSQL14.MSSQLSERVER.

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.

SQL Studio 2008 r2 - Copy Wizard (MO Method) Invalid column name (what object?)

Hi I am using the copy wizard in studio 2008 r2.
I am using the Management Objects method, as I cannot take the database offline.
The copy fails with the follwing error :
Event Name: OnError Message: ERROR : errorCode=0
description=Invalid column name 'Organisation'. helpFile=
helpContext=0
idofInterfaceWithError={C81DFC5A-3B22-4DA3-BD3B-10BF861A7F9C}
StackTrace: at
Microsoft.SqlServer.Management.Dts.DtsTransferProvider.ExecuteTransfer()
at Microsoft.SqlServer.Management.Smo.Transfer.TransferData() at
Microsoft.SqlServer.Dts.Tasks.TransferObjectsTask.TransferObjectsTask.TransferDatabasesUsingSMOTransfer()
Operator: NT AUTHORITY\SYSTEM Source Name: CDW_SQL_SQL_5 Source ID:
{8EF4C2A1-3B69-4729-8569-091F9B4863CB} Execution ID:
{61878ECA-D8C4-441A-9988-53ECC75D9283} Start Time: 25/09/2012
15:53:34 End Time: 25/09/2012 15:53:34 Data Code: 0
However it does not tell me what object the Column is on. What is the most reasonable way for me to locate this column based on the error output?

Resources