Quantcast
Viewing all articles
Browse latest Browse all 10

SQL Server – Backup database from Command Prompt using sqlcmd command

Introduction

Here, I will explain how to backup an SQL Server database from Command Prompt using sqlcmd utility

Step 1: Open Command Prompt and type sqlcmd -S localhost\SQLServer2014 -U sa , then press enter. Here localhost\SQLServer2014 is server name and sa is username.

Image may be NSFW.
Clik here to view.
sqlcmd command

Note : To backup database using Windows Authentication, type sqlcmd -S localhost\SQLServer2014 -E and press enter and skip Step 2

Step 2: Type your password and press enter

Image may be NSFW.
Clik here to view.
SQLCMD Command

Step 3: Type BACKUP DATABASE Galaxy TO DISK=’D:\data\Galaxy.bak’ and press enter.

Image may be NSFW.
Clik here to view.
SQLCMD

Step 4: Type GO and press enter

Image may be NSFW.
Clik here to view.
SQLCMD

Some common parameters of sqlcmd

Command Description
-S Server name
-U User name
-P Password
-E Use trusted connection
-i Input file
-o Output file
-q Command line query
-Q Command line query and exit

For more information about sqlcmd command please visit http://msdn.microsoft.com/en-us/library/ms162773.aspx


Filed under: SQL Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 10

Trending Articles