I am trying to import a dump file which is in binary format to SQL Server using sqlcmd command. After running the import command, I am getting this error, Msg 2812, Level 16, State 62
I'm suspecting that it is because the file is in binary format. Is there a way to directly import binary dump file to SQL Server? I tried using the -u flag but I'm getting the same error.
Sorry, forgot to mention, I am using SQL Server 2017 on Ubuntu 16.04
Command: sqlcmd -S localhost -d TestDB -U SA -u -i /home/user1/Downloads/myspecialpresentforyou
Error Message: Msg 2812, Level 16, State 62, Server user1, Line 1
Could not find stored procedure 'TAPE'.
Best Answer
The problem of tango ward is that he tries to pass
full backup file
e as ascript
file tosqlcmd
. I understood it as he wrote the error isThe first bytes of a backup file even if it's disk file are 'TAPE':
To make a simplest
restore
from thebak
file without restoring it to another database and moving the files you still can use sqlcmd, but you should pass your file as abackup file location
, i.e. use this command:Here is simple example of doing it in
sqlcmd
:sqlcmd
(without parameters I'll connect to my default instance with win authentication, but you should use yoursa
user and password as you did)sqlcmd
you'll see1>
it's a prompt to enter your command, now enter there RESTORE...(the whole command, see above) and after entering it (press ENTER) you'll see 2>Here is how I restored my database
abc
from full backupZ:\Anna\backups\default\abc_full.bak
If you restore to another database you should first know logical file names using
restore filelistonly
and then move the files to new destination.If it's your case you'd better use SSMS to see these files as sqlcmd output can be combersome if your db has many files.
Here the example in SSMS: