Quantcast
Channel: DEEPAK SHARMA » SQL
Viewing all articles
Browse latest Browse all 10

SQL Server – Restore database from Command Prompt using sqlcmd command

0
0

Introduction

Here, I will explain how to restore an SQL Server database from Command Prompt using sqlcmd utility.  We will use RESTORE DATABASE command to restore the database from a backup (.bak) taken using BACKUP DATABASE command. Click here for Backup Database from Command Prompt.

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

sqlcmd command

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

Step 2: Type your password and press enter

SQLCMD Command

Step 3: Type RESTORE DATABASE Galaxy FROM DISK=’D:\Data\Galaxy.bak’ and press enter. Here we are restoring a full database from a backup.

SQLCMD

Step 4: Type GO and press enter

SQLCMD RESTORE DATABASEFor more information and examples about RESTORE DATABASE command please visit http://msdn.microsoft.com/en-us/library/ms186858.aspx


Filed under: SQL

Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images