adzm / mssqlPipe

SQL Server command line backup and restore through pipes using stdin and stdout
GNU General Public License v3.0
13 stars 6 forks source link

Failed to cocreate device set: 80040111 #1

Open tabletrtd opened 8 years ago

tabletrtd commented 8 years ago

Hello. Does not work mssqlPipe. Please help.

Launching from cmd: c:\temp\mssqlPipe.exe 127.0.0.1 as sa:111 backup TMP

And returned: mssqlPipe 1.2.1 Failed to cocreate device set: 80040111

SQL Server is working, password is right.

DBMS: Microsoft SQL Server 2005 - 9.00.5324.00 (X64) Aug 24 2012 18:28:47 Copyright (c) 1988-2005 Microsoft Corporation Developer Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1)

OS: Microsoft Windows Server 2008 R2 Standard 6.1.7601 Service Pack 1 сборка 7601

adamwalling commented 7 years ago

The error 0x80040111 basically means that the application requested a COM object but the class factory could not create it. This is usually a permissions issue. There has been an update to mssqlPipe to automatically elevate the process if it runs into issues with not running as admin, which may be the case here.

edo1 commented 7 years ago

I have the same issue with current EXE file. I run it from elevated poweshell console so it shouldn't be a permission issue. No such issue with sqlpipe and MSSQLCompressedBackup

adamwalling commented 7 years ago

Hm, both sqlpipe and this should be creating the instance with CLSID_MSSQL_ClientVirtualDeviceSet -- I'll take a look into the _com_ptr_t implementation this weekend to see if something different is occurring behind the scenes that might be causing trouble. Only thing I can think of is that _com_ptr_t is using CLSCTX_ALL versus using CLSCTX_INPROC_SERVER explicitly, but might be worth a shot (since if the other ones are used, then _com_ptr_t does the whole OleRun thing)

martin-schiel commented 7 years ago

Any news on this? I'm having a similar problem:

mssqlPipe sql2008 backup database to database.bak

Failed to create device set: 80770007

adamwalling commented 7 years ago

The command you included does not included a database name, which might be problematic. This does appear to be a somewhat different error though. The instance name is SQL2008 on that local machine right?

martin-schiel commented 7 years ago

Thanks for your quick reply. Yes "sql2008" is the instance name. I have also tried to run as admin. I used the first example from the README to try, but i have now modified the command like this, but with the same result:

`mssqlPipe sql2008 backup database DBName to DBName.bak

mssqlPipe 1.2.1

Failed to create device set: 80770007`

adamwalling commented 7 years ago

0x80770007 is defined as VD_E_INSTANCE_NAME though your instance name is correct. This is failing at a relatively simple part of the application, unfortunately.

The website http://www.sqlbackuprestore.com/vdierrors.htm actually has a lot of useful info about the VDI interface to sql server, and actually calls out this error code as an example of registration issues of the VDI COM interface - http://www.sqlbackuprestore.com/vdiversions.htm for example. This might be the culprit. I'm curious if anything stands out or mismatches.

This might explain the original 0x80040111 error as well.

martin-schiel commented 7 years ago

I didn't think about looking into the event logs. There was the error:

SQLVDI: Loc=IdentifySQLServer. Desc=MSSQL$sql2008. ErrorCode=(1060)The specified service does not exist as an installed service.

The solution was to omit the instance name for the default instance. Found the hint here: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/791cfd06-37a0-457d-9c5d-ba0ecec41124/sqlvdi-error-code-1060-when-backing-up-mssql-using-vdi-on-default-instance?forum=sqldatabaseengine

This was the command that worked then: mssqlPipe as sa:thepassword backup database DBName to DBName.bak

Thanks for your help!

adamwalling commented 7 years ago

Wow thanks for letting me know what happened! I'll have to turn this into a better error message and update docs.

SQLSourcerer commented 6 years ago

The tool is working great for me on some servers, but not on others. When it doesn't work, I too am getting error 80040111. I'm invoking it with an account that has local admin on the server, and with an elevated command prompt. The account also has sysadmin on the SQL Server instance. I'm connecting to the default instance and omitting the instance name on the command line. Here's the command I'm trying to run:

mssqlpipe pipe from vdi1 | mssqlpipe pipe to vdi2

Unfortunately, I see no error messages in the event logs related to SQLVDI.

basti122303 commented 4 years ago

hello, i get the same error 80040111. I have try to run it in a cmd with and without admin privilegs. mssqlpipe backup as sa:passwd does also fail. I can connect as administrator and windows login to mssql management tool.

adzm commented 4 years ago

I believe this issue is due to the COM object that is used to talk to sql to create the virtual device etc is only installed on the actual machine running SQL server; so unfortunately it does not work from other machines. Are you encountering this issue on the same machine running SQL?

basti122303 commented 4 years ago

I run it on the machine where SQL is running. At the moment I use https://github.com/duncansmart/sqlpipe it work as expected.

adzm commented 4 years ago

Interesting, both utils should be using the same coclasses and interfaces and all that. I'll check to see where I differ. Can you paste the entire error output?