Search code examples
vb.netsql-server-2005processshared-memorysqlexception

Error on Transportlayer (No process on the other end of pipe)


Situation:

I have a lot of Microsoft SQL Backup files. The application should restore each backup-file with

RESTORE DATABASE {0} FROM DISK = '{1}' WITH REPLACE

Then I fill another database with some data from the restored database and drop the restored database with

DROP DATABASE {0}

If I only restore one backup-file, no problems. The data from this backup is in the new database and the restored database is dropped. But if i use more than 1 backup-file, i get this error:

German: Fehler auf Übertragungsebene beim Senden der Anforderung an den Server. (provider: Shared Memory-Provider, error: 0 - Kein Prozess ist am anderen Ende der Pipe.)

English (something like): Error on transportlayer while sending the request to the server. (provider. Shared Memory-Prover, error: 0 - No process on the other end of pipe.)


Solution

  • Include the below code just after restoring the database:

    SqlConnection scon = new SqlConnection(ConnectionString);
    SqlConnection.ClearPool(scon);