{"id":46531,"date":"2019-11-05T06:54:49","date_gmt":"2019-11-05T06:54:49","guid":{"rendered":"https:\/\/www.stellarinfo.com\/blog\/?p=46531"},"modified":"2025-08-01T03:40:26","modified_gmt":"2025-08-01T03:40:26","slug":"restore-sql-server-database-from-command-line","status":"publish","type":"post","link":"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/","title":{"rendered":"How to Restore SQL Server Database from Command Line"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><?xml encoding=\"utf-8\" ?><h2 class=\"wp-block-heading\" id=\"introduction:\"><strong>Introduction:<\/strong><\/h2><p>In this article, we will study how we can restore our SQL Server databases using the command line. For this, we need to install MS SQL Server and after this, we need sqlcmd. We don&rsquo;t need anything else for restoring the database, because we know here, we can use the command line. Command-line is a built-in program in windows. On the other hand, we will also show what to do if the database backup is corrupt and how to recover it. The software Stellar Repair for MS SQL Technician also helps us to restore the database from backup files and from corrupt .mdf files. In the Stellar Technician, we recover and <a href=\"https:\/\/www.stellarinfo.com\/restore-sql-database.php\">restore MS SQL database<\/a> with the help of some clicks.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/cloud.stellarinfo.com\/StellarRepairforMSSQLTechnician-B.exe\"><img loading=\"lazy\" decoding=\"async\" width=\"252\" height=\"72\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2022\/11\/free-download-1.webp\" alt=\"Free Download For Windows\" class=\"wp-image-114489 apply-gradient-on-post-images\"><\/a><\/figure>\n<\/div><h2 class=\"wp-block-heading\" id=\"requirements:\"><strong>Requirements:<\/strong><\/h2><ul class=\"wp-block-list\">\n<li>MS SQL Server.<\/li>\n\n\n\n<li>SQL Server Management Studio.<\/li>\n\n\n\n<li>Stellar Repair for MS SQL Technician.<\/li>\n<\/ul><p>Let&rsquo;s explore the solutions to restore SQL database using the command line:<\/p><h2 class=\"wp-block-heading\" id=\"using-command-line-(without-script)-\"><strong>Using Command-line (without script) <\/strong><\/h2><p>The first thing is we will run Command-Line from pressing a shortcut key window (windows button) +R. <\/p><figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"521\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/7.jpg\" alt=\"windows button +R\" class=\"wp-image-46599 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/7.jpg 800w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/7-300x195.jpg 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/7-768x500.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure><p>Here we see a window look like below.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"411\" height=\"216\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/1.png\" alt=\"cmd command\" class=\"wp-image-46532 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/1.png 411w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/1-300x158.png 300w\" sizes=\"auto, (max-width: 411px) 100vw, 411px\" \/><\/figure>\n<\/div><p>Write cmd in the edit field and press the &ldquo;OK&rdquo; button. You will see a window<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"979\" height=\"543\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/2.png\" alt=\"Command Prompt\" class=\"wp-image-46533 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/2.png 979w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/2-300x166.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/2-768x426.png 768w\" sizes=\"auto, (max-width: 979px) 100vw, 979px\" \/><\/figure>\n<\/div><p>Here we will write a command:<\/p><pre class=\"wp-block-code command_container\"><code>sqlcmd -q \"BACKUP DATABASE testdb TO DISK = 'c:\\sql\\test.bak'\"<\/code><\/pre><figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"746\" height=\"103\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/3.png\" alt=\"DATABASE BACKUP Command\" class=\"wp-image-46535 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/3.png 746w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/3-300x41.png 300w\" sizes=\"auto, (max-width: 746px) 100vw, 746px\" \/><\/figure><p>This command will invoke the sqlcmd and backup the\ndatabase named testdb in the test.bak file.<\/p><p>For more information about the different arguments of the sqlcmd command line refer to this link: <a href=\"http:\/\/docs.microsoft.com\/en-us\/sql\/tools\/sqlcmd-utility?view=sql-server-ver15\">sqlcmd Utility<\/a><\/p><p>By default, it is using Trusted authentication (Windows Authentication). Optionally you can use the -E like this:<\/p><pre class=\"wp-block-code command_container\"><code>sqlcmd -q \"BACKUP DATABASE testdb TO DISK = 'c:\\sql\\test.bak'\" -E<\/code><\/pre><p>In order to recover the database, you can use the following command:<\/p><pre class=\"wp-block-code command_container\"><code>sqlcmd -q \" sqlcmd -q \"RESTORE DATABASE TESTDB&nbsp; FROM DISK=N'c:\\sql\\test.bak'\" <\/code><\/pre><h2 class=\"wp-block-heading\" id=\"using-the-command-line-with-scripts\"><strong>Using the command line with scripts<\/strong><\/h2><p>If you do not like the command line, but you need to use it, I recommend to create the Restore or backup T-SQL Sentences in a .sql file:<\/p><pre class=\"wp-block-code command_container\"><code>Restore.sql<br>USE Master<br>GO<br>RESTORE DATABASE TESTDB&nbsp; FROM DISK=N'c:\\sql\\test.bak<\/code><\/pre><p><strong>You can always generate the T-SQL script using the SSMS:<\/strong><\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"861\" height=\"378\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/4.png\" alt=\"Restore Database\" class=\"wp-image-46538 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/4.png 861w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/4-300x132.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/4-768x337.png 768w\" sizes=\"auto, (max-width: 861px) 100vw, 861px\" \/><\/figure>\n<\/div><p>And then you can use the sqlcmd to invoke the script to recover the database:<\/p><pre class=\"wp-block-code command_container\"><code>Sqlcmd -i &ldquo;c:\\sql\\recover.sql&rdquo; -E -o &ldquo;c:\\sql\\result.txt&rdquo;<\/code><\/pre><p>The command is invoking the recover.sql that contains the T-SQL sentences to restore and the sql\\results.txt stores the errors or successful output messages.<\/p><h2 class=\"wp-block-heading\" id=\"stellar-repair-for-ms-sql-technician-&ndash;-alternative-solution-\"><strong>Stellar Repair for MS SQL Technician &ndash; Alternative Solution <\/strong><\/h2><p>If for some reason, the command line fails due to backup corruption, it is possible to restore the backup file.<\/p><p><a href=\"https:\/\/www.stellarinfo.com\/restore-sql-database.php\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Stellar Repair for MS SQL Technician<\/strong><\/a> helps to recover and restore from corrupted backup and .mdf files. Here I show you how you can use this software and it will recover your databases. First, we need to install the software on our machine.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/cloud.stellarinfo.com\/StellarRepairforMSSQLTechnician.exe\"><img loading=\"lazy\" decoding=\"async\" width=\"229\" height=\"60\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/07\/image-26.png\" alt=\"free download\" class=\"wp-image-43193 apply-gradient-on-post-images\"><\/a><\/figure>\n<\/div><p>After the successful installation of the software run the Stellar Technician and you will see a window look like below.<\/p><figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"915\" height=\"568\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/08\/Stellar-Toolkit-for-MS-SQL.jpg\" alt=\"Stellar Toolkit for MS SQL - Options\" class=\"wp-image-43708 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/08\/Stellar-Toolkit-for-MS-SQL.jpg 915w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/08\/Stellar-Toolkit-for-MS-SQL-300x186.jpg 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/08\/Stellar-Toolkit-for-MS-SQL-768x477.jpg 768w\" sizes=\"auto, (max-width: 915px) 100vw, 915px\" \/><\/figure><p>In\nthis window here we see three options.<\/p><ol class=\"wp-block-list\">\n<li>Repair MS SQL Database.<\/li>\n\n\n\n<li>Recover MS SQL Password.<\/li>\n\n\n\n<li>Extract from MS SQL Backup<\/li>\n<\/ol><p>Select option #1 and you will see a new window.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"547\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/6-1024x547.png\" alt=\"Stellar Toolkit for MS SQL\" class=\"wp-image-46544 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/6-1024x547.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/6-300x160.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/6-768x410.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/6.png 1366w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div><p>In the last window, you saw a message from software. This message tells us if the MS SQL Server is running then stop the MS SQL Server or close the SQL Management Studio. Otherwise, if MS SQL Server is already closed then copy the database and past it to a different location. Press the &ldquo;OK&rdquo; button.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"471\" height=\"165\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/7.png\" alt=\"Stellar Toolkit for MS SQL - Instruction\" class=\"wp-image-46545 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/7.png 471w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/7-300x105.png 300w\" sizes=\"auto, (max-width: 471px) 100vw, 471px\" \/><\/figure>\n<\/div><p>Now, you need to select the corrupt database<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"517\" height=\"358\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/8.png\" alt=\"Stellar Toolkit for MS SQL - Select Database\" class=\"wp-image-46546 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/8.png 517w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/8-300x208.png 300w\" sizes=\"auto, (max-width: 517px) 100vw, 517px\" \/><\/figure>\n<\/div><p>In this section, we will press the &ldquo;Browse&rdquo; button. Here we will see a window in which we select us .mdf file.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"668\" height=\"472\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/9.png\" alt=\"Stellar Toolkit for MS SQL - browse MDF File\" class=\"wp-image-46547 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/9.png 668w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/9-300x212.png 300w\" sizes=\"auto, (max-width: 668px) 100vw, 668px\" \/><\/figure>\n<\/div><p>After selecting the file, we will press the &ldquo;OPEN&rdquo; button. We will transfer to the previous window.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"519\" height=\"359\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/10.png\" alt=\"Stellar Toolkit for MS SQL - select MDF File\" class=\"wp-image-46548 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/10.png 519w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/10-300x208.png 300w\" sizes=\"auto, (max-width: 519px) 100vw, 519px\" \/><\/figure>\n<\/div><p> In the address bar, we see a .mdf file address. Now press the &ldquo;Repair&rdquo; button. <\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"546\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/11-1024x546.png\" alt=\"Stellar Toolkit for MS SQL - Repair Database\" class=\"wp-image-46550 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/11-1024x546.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/11-300x160.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/11-768x409.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/11.png 1366w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div><p> It will take some seconds if the database size is large maybe it will take some minutes. In the previous window which I showed, we see our selected MS SQL Database is repaired successfully. Press the &ldquo;OK&rdquo; button in the instruction dialog window. <\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"547\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/12-1024x547.png\" alt=\"Stellar Toolkit for MS SQL - repaired database\" class=\"wp-image-46554 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/12-1024x547.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/12-300x160.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/12-768x410.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/12.png 1366w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div><p>Now press the&rdquo; Save&rdquo; button which I highlighted in the red section. We will see a new window look like below.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"480\" height=\"403\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/13.png\" alt=\"Stellar Toolkit for MS SQL - save repaired database\" class=\"wp-image-46555 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/13.png 480w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/13-300x252.png 300w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><\/figure>\n<\/div><p>Here we see a functionality of the Stellar Technician that allows us to save our recovered or repaired database in multiple extensions. Stellar Technician provides us four types of extensions.<\/p><ol class=\"wp-block-list\">\n<li>MDF<\/li>\n\n\n\n<li>CSV<\/li>\n\n\n\n<li>HTML<\/li>\n\n\n\n<li>XLS<\/li>\n<\/ol><p>In\nthe section of Saving Option, we will save our database in the current file and\nnew file.<\/p><p>In the Server Name\/Instance Name Select the server name and, in the Authentication, section selects the authentication type and save your database. After selecting those options, the software allows you to save the file as Default SQL or you can select the &ldquo;New&rdquo; checkbox. It will allow you to save your file as a new file. Now the &ldquo;Browse&rdquo; button is visible if the &ldquo;New&rdquo; section is selected. When you press the browse button you will see a window look like below.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"320\" height=\"320\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/14.png\" alt=\"Select the server name\" class=\"wp-image-46556 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/14.png 320w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/14-150x150.png 150w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/14-300x300.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/14-200x200.png 200w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/14-80x80.png 80w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><\/figure>\n<\/div><p> In this window, you can select the location where you want to save your repaired database. Press the &ldquo;OK&rdquo; button. Your location is selected press the &ldquo;SAVE&rdquo; button. Here you can see a progress bar is running in the below of the window. It will take a while. <\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"547\" src=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/15-1024x547.png\" alt=\"Stellar Toolkit for MS SQL - SQL Database is successfully saved\" class=\"wp-image-46557 apply-gradient-on-post-images\" srcset=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/15-1024x547.png 1024w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/15-300x160.png 300w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/15-768x410.png 768w, https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/15.png 1366w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div><p>After successfully save the file you will see an instruction window that tells you your SQL Database is successfully saved.<\/p><h2 class=\"wp-block-heading\" id=\"conclusion\"><strong>Conclusion<\/strong><\/h2><p>In this section, we studied how we can repair our database using the command line. In this process, we didn&rsquo;t need any of this software. On another hand, if our files are not recovered because it is corrupt, You can use the software called Stellar Repair for MS SQL Technician. This software is very easy to use and provides us with more functionalities.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: In this article, we will study how we can restore our&hellip; <a class=\"more-link\" href=\"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/\">Continue reading <span class=\"screen-reader-text\">How to Restore SQL Server Database from Command Line<\/span><\/a><\/p>\n","protected":false},"author":82,"featured_media":46651,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[10],"tags":[],"class_list":["post-46531","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-database-recovery","entry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Restore SQL Server Database from Command Line?<\/title>\n<meta name=\"description\" content=\"Restore SQL Server databases fast using command line. Get your data back quickly. Try it now!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Restore SQL Server Database from Command Line?\" \/>\n<meta property=\"og:description\" content=\"Restore SQL Server databases fast using command line. Get your data back quickly. Try it now!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/\" \/>\n<meta property=\"og:site_name\" content=\"Stellar Data Recovery Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-11-05T06:54:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-01T03:40:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/cropped-How-to-Restore-SQL-Server-Database-from-Command-Line.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"562\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Monika Dadool\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Monika Dadool\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/\"},\"author\":{\"name\":\"Monika Dadool\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/02a465e9b5b4912eafedd1ae248558fd\"},\"headline\":\"How to Restore SQL Server Database from Command Line\",\"datePublished\":\"2019-11-05T06:54:49+00:00\",\"dateModified\":\"2025-08-01T03:40:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/\"},\"wordCount\":931,\"commentCount\":1,\"image\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/cropped-How-to-Restore-SQL-Server-Database-from-Command-Line.jpg\",\"articleSection\":[\"SQL Database Repair\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/\",\"url\":\"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/\",\"name\":\"How to Restore SQL Server Database from Command Line?\",\"isPartOf\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/cropped-How-to-Restore-SQL-Server-Database-from-Command-Line.jpg\",\"datePublished\":\"2019-11-05T06:54:49+00:00\",\"dateModified\":\"2025-08-01T03:40:26+00:00\",\"author\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/02a465e9b5b4912eafedd1ae248558fd\"},\"description\":\"Restore SQL Server databases fast using command line. Get your data back quickly. Try it now!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/#primaryimage\",\"url\":\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/cropped-How-to-Restore-SQL-Server-Database-from-Command-Line.jpg\",\"contentUrl\":\"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/cropped-How-to-Restore-SQL-Server-Database-from-Command-Line.jpg\",\"width\":1000,\"height\":562},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.stellarinfo.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Restore SQL Server Database from Command Line\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#website\",\"url\":\"https:\/\/www.stellarinfo.com\/blog\/\",\"name\":\"Stellar Data Recovery Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.stellarinfo.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/02a465e9b5b4912eafedd1ae248558fd\",\"name\":\"Monika Dadool\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7d22d2cc256776033dcf284e9c6b96fcf19473429aa25ea91b3f7561ae5e8b7a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7d22d2cc256776033dcf284e9c6b96fcf19473429aa25ea91b3f7561ae5e8b7a?s=96&d=mm&r=g\",\"caption\":\"Monika Dadool\"},\"description\":\"Monika Dadool is a Senior Content Writer at Stellar with over 5 years of experience in technical writing. She is a tech enthusiast and expert who specializes in writing about SQL Server, MySQL Server, MariaDB Server, Microsoft Access, Active Directory, email recovery, Microsoft 365, pattern recognition, machine learning, data recovery, file repair, and operating systems like Linux, Windows, and Mac. She also writes about accounting software such as QuickBooks and Sage 50, as well as web-scripting languages like HTML, JavaScript, Python, PHP, Visual Basic, ASP.NET, and AJAX. Monika is passionate about researching and exploring new technologies, and she enjoys developing engaging technical blogs that help organizations and database administrators resolve various issues. When she's not creating content, you can find her on social media, watching web series, reading books, or exploring new food recipes.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/monika-dadool-105a87163\/\"],\"url\":\"https:\/\/www.stellarinfo.com\/blog\/author\/monika\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Restore SQL Server Database from Command Line?","description":"Restore SQL Server databases fast using command line. Get your data back quickly. Try it now!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/","og_locale":"en_US","og_type":"article","og_title":"How to Restore SQL Server Database from Command Line?","og_description":"Restore SQL Server databases fast using command line. Get your data back quickly. Try it now!","og_url":"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/","og_site_name":"Stellar Data Recovery Blog","article_published_time":"2019-11-05T06:54:49+00:00","article_modified_time":"2025-08-01T03:40:26+00:00","og_image":[{"width":1000,"height":562,"url":"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/cropped-How-to-Restore-SQL-Server-Database-from-Command-Line.jpg","type":"image\/jpeg"}],"author":"Monika Dadool","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Monika Dadool","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/#article","isPartOf":{"@id":"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/"},"author":{"name":"Monika Dadool","@id":"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/02a465e9b5b4912eafedd1ae248558fd"},"headline":"How to Restore SQL Server Database from Command Line","datePublished":"2019-11-05T06:54:49+00:00","dateModified":"2025-08-01T03:40:26+00:00","mainEntityOfPage":{"@id":"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/"},"wordCount":931,"commentCount":1,"image":{"@id":"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/#primaryimage"},"thumbnailUrl":"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/cropped-How-to-Restore-SQL-Server-Database-from-Command-Line.jpg","articleSection":["SQL Database Repair"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/","url":"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/","name":"How to Restore SQL Server Database from Command Line?","isPartOf":{"@id":"https:\/\/www.stellarinfo.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/#primaryimage"},"image":{"@id":"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/#primaryimage"},"thumbnailUrl":"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/cropped-How-to-Restore-SQL-Server-Database-from-Command-Line.jpg","datePublished":"2019-11-05T06:54:49+00:00","dateModified":"2025-08-01T03:40:26+00:00","author":{"@id":"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/02a465e9b5b4912eafedd1ae248558fd"},"description":"Restore SQL Server databases fast using command line. Get your data back quickly. Try it now!","breadcrumb":{"@id":"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/#primaryimage","url":"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/cropped-How-to-Restore-SQL-Server-Database-from-Command-Line.jpg","contentUrl":"https:\/\/www.stellarinfo.com\/blog\/wp-content\/uploads\/2019\/11\/cropped-How-to-Restore-SQL-Server-Database-from-Command-Line.jpg","width":1000,"height":562},{"@type":"BreadcrumbList","@id":"https:\/\/www.stellarinfo.com\/blog\/restore-sql-server-database-from-command-line\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.stellarinfo.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Restore SQL Server Database from Command Line"}]},{"@type":"WebSite","@id":"https:\/\/www.stellarinfo.com\/blog\/#website","url":"https:\/\/www.stellarinfo.com\/blog\/","name":"Stellar Data Recovery Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.stellarinfo.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/02a465e9b5b4912eafedd1ae248558fd","name":"Monika Dadool","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.stellarinfo.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7d22d2cc256776033dcf284e9c6b96fcf19473429aa25ea91b3f7561ae5e8b7a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7d22d2cc256776033dcf284e9c6b96fcf19473429aa25ea91b3f7561ae5e8b7a?s=96&d=mm&r=g","caption":"Monika Dadool"},"description":"Monika Dadool is a Senior Content Writer at Stellar with over 5 years of experience in technical writing. She is a tech enthusiast and expert who specializes in writing about SQL Server, MySQL Server, MariaDB Server, Microsoft Access, Active Directory, email recovery, Microsoft 365, pattern recognition, machine learning, data recovery, file repair, and operating systems like Linux, Windows, and Mac. She also writes about accounting software such as QuickBooks and Sage 50, as well as web-scripting languages like HTML, JavaScript, Python, PHP, Visual Basic, ASP.NET, and AJAX. Monika is passionate about researching and exploring new technologies, and she enjoys developing engaging technical blogs that help organizations and database administrators resolve various issues. When she's not creating content, you can find her on social media, watching web series, reading books, or exploring new food recipes.","sameAs":["https:\/\/www.linkedin.com\/in\/monika-dadool-105a87163\/"],"url":"https:\/\/www.stellarinfo.com\/blog\/author\/monika\/"}]}},"_links":{"self":[{"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/posts\/46531","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/users\/82"}],"replies":[{"embeddable":true,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/comments?post=46531"}],"version-history":[{"count":27,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/posts\/46531\/revisions"}],"predecessor-version":[{"id":184479,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/posts\/46531\/revisions\/184479"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/media\/46651"}],"wp:attachment":[{"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/media?parent=46531"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/categories?post=46531"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.stellarinfo.com\/blog\/wp-json\/wp\/v2\/tags?post=46531"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}