SQL Server 2012 Migración de datos espaciales a través de un servidor vinculado, ¿tiempo de espera de consulta?

We are doing a migration from our old system (sql server 2008) to the new system (SQL server 2012) , the data sources we are using are Remote so we have it configured as a servidores vinculados , the data in the source we are migrating have special data (Geography type) , we are migrating the data per customer , so some customers have more data that the others, we batch the data and we are using OPENQUERY to pull the Spatial data across. For the customers with less data the migration goes smoothly and it completes successfully , but for customers with more than couple million records in one table the migration stops and gives mainly 2 errors:

This how the error comes like :

OLE DB provider "yyy" for linked server "xxx" returned message "Query timeout expired". Msg 7399, Level 16, State 1, Server nnn, Line 1 The OLE DB provider "yyy" for linked server "xxx" reported an error. Execution terminated by the provider because a resource limit was reached. Msg 7320, Level 16, State 2, Server ttt , Line 1 Cannot execute the query "

select top (200000)            
        [row] = row_number () over ( order by t.[x]) 
    , .....
    , [Spatial] = cast(ts.[Spatial] as varbinary(max))
from [..].[..].[..] t
    join [...].[..].[… ] s
        on t.[..] = s.[...]
where (t.[x] > '00000000-0000-0000-0000-000000000000')
        and v.[x] = x
order by t.[x]

" against OLE DB provider "yyy" for linked server "xxx".Build step 'Execute Windows batch command' marked build as failure

also this problem happened with one other table that doesn't have a spatial data in it.

The approaches we tried to follow, We have increased the timeout of the query, We have dropped the batch size to 200,000 per batch The Provider is “ in process mode” we only have couple linked servers so the buffer size is more than acceptable , We tried to run the migration using an admin role to make sure it’s not a permissions problem We are thinking this might be a network problem but it’s not a Load Balancer issue. maybe its something else,

The other error that comes frequently is

HResult 0x40, Level 16, State 1 TCP Provider: The specified network name is no longer available.

Any idea's for what could be a reason will be so much appreciated



preguntado el 12 de junio de 12 a las 19:06

This doesn't answer your question of "why", but I would do this using good ol' BCP OUT with native mode. That would copy the records into a flat file and then you can import them on the other side with BCP IN. Tends to be faster than OpenQuery and obviates many of the timeout issues. -

1 Respuestas

I would say the "The specified network name is no longer available." error indicates no response from the remote server. Since SQL Server hasn't "heard" from the remote server in a while, it gives up. I would cut down the batch size to something really small and increase with success (rather than the other way around). That way you'll find a batch size that works. Also, this may vary between "customers" depending on your connection to them (i.e., type and size of line, traffic on the line, etc.).

Personally, I like the BCP OUT/BCP IN option as well because I know it works however, you still have to consider the transfer method of the data from the remote server. If you have a robust enterprise MFT over a dedicated T1 or better, you probably won't have an issue.

SSIS offers more of a direct transfer but I imagine you'll run into the same network issues you're having now. That said, you can create a general BCP solution within SSIS.

Respondido el 16 de junio de 12 a las 18:06

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.