SQL Server 2008, restore.back sin Management studio
I explain a little, I have an application that I install on the client machines together with the sql express (without management stdudio), the dilemma is that I have restore a backup, but I do not know how to do it without the Management studio, does anyone know how I can do it? maybe some .exe that exists out there free or something, everything serves.
3 answers
Let's go in parts,
To make a backup:
On windows, enter as administrator, run the CMD as administrator and give it the following command:
SqlCmd -E -S Server_Name –Q “BACKUP DATABASE [Name_of_Database] TO DISK=’X:PathToBackupLocation[Name_of_Database].bak'”
These examples might be useful:
Default SQL Server instance:
SqlCmd -E -S MyServer –Q “BACKUP DATABASE [MyDB] TO DISK=’D:BackupsMyDB.bak'”
Named SQL Server instance:
SqlCmd -E -S MyServerMyInstance –Q “BACKUP DATABASE [MyDB] TO DISK=’D:BackupsMyDB.bak'”
Restore a database from command line:
To restore a database from a backup file, use the Command:
SqlCmd -E -S Server_Name –Q “RESTORE DATABASE [Name_of_Database] FROM DISK=’X:PathToBackupFile[File_Name].bak'”
For example:
SqlCmd -E -S MyServer –Q “RESTORE DATABASE [MyDB] FROM DISK=’D:BackupsMyDB.bak'”
Reference: http://www.howtogeek.com/50295/backup-your-sql-server-database-from-the-command-line /
Vote against accept In this link I found the answer:
Https://msdn.microsoft.com/es-es/library/ms190679 (V = sql.120).aspx
As you can see it does otherwise by opening the instance and then entering the codes.
Greetings.
The best recommendation I can give you to be able to do this is the execution of the restoration or backup of the database from the cmd then I leave you a link which will redirect you to a page with syntax and examples of the requested: http://www.howtogeek.com/50295/backup-your-sql-server-database-from-the-command-line /