{"id":1220,"date":"2018-08-02T19:57:55","date_gmt":"2018-08-02T19:57:55","guid":{"rendered":"http:\/\/dbtut.com\/?p=1220"},"modified":"2018-11-09T13:17:02","modified_gmt":"2018-11-09T13:17:02","slug":"how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods","status":"publish","type":"post","link":"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/","title":{"rendered":"How To Change The Disk Of Database Files On SQL Server(Detach Attach &#038; Backup Restore Methods)"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>In some cases, there may not be enough space on the disks where the database files are located.<\/p>\n<p>For this reason, you may need to transfer some or all of the database files to other disks.<\/p>\n<p>There are several ways to do this.<\/p>\n<p>We will talk about the two most commonly used ways in this article.<\/p>\n<p>&nbsp;<\/p>\n<h3>First Method:<\/h3>\n<p>To save where the database files are located before detaching, you must save the result of the following script.<\/p>\n<pre class=\"lang:default decode:true\">select * from sys.sysaltfiles where dbid=DB_ID()<\/pre>\n<p>or<\/p>\n<pre class=\"lang:default decode:true\">select * from sys.master_files where database_id=DB_ID()<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"\" src=\"http:\/\/dbtut.com\/wp-content\/uploads\/2018\/08\/965.png\" width=\"535\" height=\"148\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>As shown in the following figure, we must first detach the database from the sql server by right-clicking on the database and selecting detach from the task tab.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"\" src=\"http:\/\/dbtut.com\/wp-content\/uploads\/2018\/08\/691.png\" width=\"512\" height=\"388\" \/><\/p>\n<p>&nbsp;<\/p>\n<p lang=\"en-US\">If we click on the detach tab and there is a connection on the database, we need to select Drop Connections as below so that these connections are terminated before detach.<\/p>\n<p lang=\"en-US\"><img loading=\"lazy\" decoding=\"async\" class=\"\" src=\"http:\/\/dbtut.com\/wp-content\/uploads\/2018\/08\/145.png\" width=\"563\" height=\"500\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span lang=\"en-US\">If detach <\/span><span lang=\"tr\">operation <\/span><span lang=\"en-US\">is not <\/span><span lang=\"tr\">performed <\/span><span lang=\"en-US\">again, you should click on the Script in the above picture.<\/span><\/p>\n<p lang=\"en-US\">You should add the following script to the top of the resulting script and run it.<\/p>\n<pre class=\"lang:default decode:true \">ALTER DATABASE [AdventureWorks2012] SET SINGLE_USER WITH ROLLBACK IMMEDIATE<\/pre>\n<p>&nbsp;<\/p>\n<p><span lang=\"en-US\">Before detach, you need to make sure that there are no requests <\/span><span lang=\"tr\">on <\/span><span lang=\"en-US\">the application.<\/span><\/p>\n<p><span lang=\"en-US\">The best way to be sure of this is to contact the application developer<\/span><span lang=\"tr\">s<\/span><span lang=\"en-US\"> and ask them to stop <\/span><span lang=\"tr\">application <\/span><span lang=\"en-US\">and then disable Login.<\/span><\/p>\n<p>Through SQL Server Management Studio, we come to Security-&gt; Logins tab respectively.<\/p>\n<p>Right click on login and select properties.<\/p>\n<p>Then we select Disabled from the Status tab and press OK as shown below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"\" src=\"http:\/\/dbtut.com\/wp-content\/uploads\/2018\/08\/390.png\" width=\"595\" height=\"531\" \/><\/p>\n<p>&nbsp;<\/p>\n<p lang=\"en-US\">After the detach process is finished, you need to move the database files from the windows to the desired disk using copy paste method.<\/p>\n<p lang=\"en-US\">After copying is finished, we select Attach by right clicking on Databases via SSMS as shown below.<\/p>\n<p lang=\"en-US\"><img loading=\"lazy\" decoding=\"async\" class=\"\" src=\"http:\/\/dbtut.com\/wp-content\/uploads\/2018\/08\/878.png\" width=\"340\" height=\"106\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>We click on Add and find the path where the mdf file is located and double-click the mdf file.<\/p>\n<p>After selecting the Mdf file, SQL Server will automatically list the other files to display the old path.<\/p>\n<p>From the CurrentFilePath tab, we select the new path to which we copied the files and click OK.<\/p>\n<p>And then, by enabling login, we&#8217;re done.<\/p>\n<p>Although this method seems simple, it is not preferable because it will increase the downtime in large databases.<\/p>\n<p>&nbsp;<\/p>\n<h3>Second Method:<\/h3>\n<p>In this method, the downtime time is very small.<\/p>\n<p>First, we get a full backup of the database to a disk with enough space as below.<\/p>\n<p>Right-click on the database and click Tasks-&gt; backup.<\/p>\n<p>In the Destination section, we will click the add button and specify the path and the backup name.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"\" src=\"http:\/\/dbtut.com\/wp-content\/uploads\/2018\/08\/637.png\" width=\"394\" height=\"127\" \/><\/p>\n<p>&nbsp;<\/p>\n<p lang=\"en-US\">If you click Verify when backup finished in the Media options, Backup will perform a backup restoreability test after the backup is complete.<\/p>\n<p><span lang=\"en-US\">Also, if you select Compress Backup in Backup Options, Compress Backup will compress your backup and reduce the<\/span><span lang=\"tr\"> backup<\/span><span lang=\"en-US\"> size.<\/span><\/p>\n<p>After the backup is finished, right-click on the Databases tab and select Restore Databases.<\/p>\n<p>Select Device and click on the 3-point button on the right side of the Device.<\/p>\n<p>In the tab that pops up we click Add and go to the path where we get the backup.<\/p>\n<p>Double-click on the backup file and finaly ok.<\/p>\n<p lang=\"en-US\">SQL Server reads the backup file to see if it can be restored.<\/p>\n<p lang=\"en-US\">And in the &#8220;Backup sets to Restore&#8221; section, the backup information is listed.<\/p>\n<p lang=\"en-US\">The database name automatically appears in Destination.<\/p>\n<p lang=\"en-US\">But you have to change it.<\/p>\n<p lang=\"en-US\">For example, you can add a word at the end as shown in the picture below.<\/p>\n<p lang=\"en-US\"><img loading=\"lazy\" decoding=\"async\" class=\"\" src=\"http:\/\/dbtut.com\/wp-content\/uploads\/2018\/08\/916.png\" width=\"574\" height=\"475\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>In the next step you are going to the Files tab in the image above.<\/p>\n<p>You should go to the &#8220;Restore as&#8221; section and type the disk path you want to move the database files to.<\/p>\n<p>Then, in the options tab, select &#8220;restore with norecovery&#8221; in the &#8220;recovery state&#8221; section and click OK.<\/p>\n<p>You can click OK when you are working on small databases, but you must not click OK on SSMS when doing anything on large databases.<\/p>\n<p>When you press the Script key you will create the entire script for that process and then you can run that script.<\/p>\n<p>The important point here is: Restore with no recovery.<\/p>\n<p>We have not turned on the database by selecting this option.<\/p>\n<p>While the database is in recovery mode, we can recover the differential backups on it.<\/p>\n<p>In the next step, we right-click on Database and select Task-&gt; Backup.<\/p>\n<p>This time we select &#8220;TransactionLog&#8221; from the Backup Type and we get log backup by repeating the other operations that we did while taking the full backup.<\/p>\n<p>Differently, the extension of the backup file is .BAK in full backup and its .trn in Log backup.<\/p>\n<p>We disable the login as described in the first method.<\/p>\n<p><span lang=\"en-US\">We right-click on the database in which we added &#8220;<\/span><span lang=\"tr\">Yeni<\/span><span lang=\"en-US\">&#8221; and in restoring mode, and select Task-&gt; Restore-&gt; TransactionLog.<\/span><\/p>\n<p lang=\"en-US\">From the drop-down menu, select &#8220;From device&#8221; and click on the right side &#8230; and select the log backup we received.<\/p>\n<p lang=\"en-US\">Then we select the box under Restore and press OK.<\/p>\n<p lang=\"en-US\">If there was another log backup file to restore, we need to restore the log file by selecting restore with norecovery from the options tab.<\/p>\n<p lang=\"en-US\">We only perform restore with recovery in the restore of the last log file.<\/p>\n<p lang=\"en-US\">In this process, we will restore only one logbackup file, so we did this without selecting anything.<\/p>\n<p lang=\"en-US\">We performed Backup-Restore operations.<\/p>\n<p lang=\"en-US\">But we still have the old database.<\/p>\n<p><span lang=\"en-US\">The database we are restoring has a <\/span><span lang=\"tr\">&#8220;Yeni&#8221; <\/span><span lang=\"en-US\">word at the end of the name.<\/span><\/p>\n<p><span lang=\"en-US\">We use the following script to change the names of the restored <\/span><span lang=\"tr\">and the old <\/span><span lang=\"en-US\">databases.<\/span><\/p>\n<pre class=\"lang:default decode:true\">ALTER DATABASE AdventureWorks2014 SET SINGLE_USER WITH ROLLBACK IMMEDIATE\r\nGO\r\nsp_renamedb 'AdventureWorks2014','AdventureWorks2014Eski'\r\nGO\r\nALTER DATABASE AdventureWorks2014Eski SET MULTI_USER WITH ROLLBACK IMMEDIATE\r\nGO\r\nALTER DATABASE AdventureWorks2014Eski SET READ_ONLY<\/pre>\n<pre class=\"lang:default decode:true\">ALTER DATABASE AdventureWorks2014Yeni SET SINGLE_USER WITH ROLLBACK IMMEDIATE\r\nGO\r\nsp_renamedb 'AdventureWorks2014Yeni','AdventureWorks2014'\r\nGO\r\nALTER DATABASE AdventureWorks2014 SET MULTI_USER WITH ROLLBACK IMMEDIATE<\/pre>\n<p>&nbsp;<\/p>\n<p lang=\"en-US\">And after running the script we delete the old database and re-enable Login.<\/p>\n<p lang=\"en-US\">With this method, we can change the disk of our database with a very short interruption no matter how big the database is.<\/p>\n<p lang=\"en-US\">\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_1220\" class=\"pvc_stats all  \" data-element-id=\"1220\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/dbtut.com\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; In some cases, there may not be enough space on the disks where the database files are located. For this reason, you may need to transfer some or all of the database files to other disks. There are several ways to do this. We will talk about the two most commonly used ways in &hellip;<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_1220\" class=\"pvc_stats all  \" data-element-id=\"1220\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/dbtut.com\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[3],"tags":[1272,1278,20,1276,1280,1290,1287,1294,1271,1279,1277,1291,1289,1295,1285,1273,1286,1275,1274,1281,1282,1284,1283,1292,1293,1288],"class_list":["post-1220","post","type-post","status-publish","format-standard","","category-mssql","tag-attach","tag-attach-database","tag-backup","tag-backup-database","tag-backup-restore","tag-backup-sets-to-restore","tag-compress-backup","tag-database-files-to-other-disk","tag-detach","tag-detach-attach","tag-detach-database","tag-drop-connections","tag-media-options","tag-move-database-files-to-other-disk","tag-recovery-state","tag-restore","tag-restore-as","tag-restore-database","tag-restore-transaction-log","tag-restore-with-no-recovery","tag-restore-with-recovery","tag-set-multi_user-with-rollback-immediate","tag-set-single_user-with-rollback-immediate","tag-sys-master_files","tag-sys-sysaltfiles","tag-verify-when-backup-finished"],"aioseo_notices":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How To Change The Disk Of Database Files On SQL Server(Detach Attach &amp; Backup Restore Methods) - Database Tutorials<\/title>\n<meta name=\"description\" content=\"How To Change The Disk Of Database Files On SQL Server(Detach Attach &amp; Backup Restore Methods)\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Change The Disk Of Database Files On SQL Server(Detach Attach &amp; Backup Restore Methods) - Database Tutorials\" \/>\n<meta property=\"og:description\" content=\"How To Change The Disk Of Database Files On SQL Server(Detach Attach &amp; Backup Restore Methods)\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/\" \/>\n<meta property=\"og:site_name\" content=\"Database Tutorials\" \/>\n<meta property=\"article:published_time\" content=\"2018-08-02T19:57:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-11-09T13:17:02+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/dbtut.com\/wp-content\/uploads\/2018\/08\/965.png\" \/>\n<meta name=\"author\" content=\"dbtut\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"dbtut\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/\"},\"author\":{\"name\":\"dbtut\",\"@id\":\"https:\/\/dbtut.com\/#\/schema\/person\/fc047c39e1e53dce28fc4253529ea408\"},\"headline\":\"How To Change The Disk Of Database Files On SQL Server(Detach Attach &#038; Backup Restore Methods)\",\"datePublished\":\"2018-08-02T19:57:55+00:00\",\"dateModified\":\"2018-11-09T13:17:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/\"},\"wordCount\":993,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/dbtut.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/dbtut.com\/wp-content\/uploads\/2018\/08\/965.png\",\"keywords\":[\"Attach\",\"Attach Database\",\"Backup\",\"Backup Database\",\"Backup Restore\",\"Backup sets to Restore\",\"Compress Backup\",\"database files to other disk\",\"Detach\",\"Detach Attach\",\"Detach Database\",\"Drop Connections\",\"Media options\",\"move database files to other disk\",\"recovery state\",\"Restore\",\"Restore as\",\"Restore Database\",\"Restore Transaction Log\",\"Restore With No recovery\",\"Restore With Recovery\",\"SET MULTI_USER WITH ROLLBACK IMMEDIATE\",\"SET SINGLE_USER WITH ROLLBACK IMMEDIATE\",\"sys.master_files\",\"sys.sysaltfiles\",\"Verify when backup finished\"],\"articleSection\":[\"MSSQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/\",\"url\":\"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/\",\"name\":\"How To Change The Disk Of Database Files On SQL Server(Detach Attach & Backup Restore Methods) - Database Tutorials\",\"isPartOf\":{\"@id\":\"https:\/\/dbtut.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/dbtut.com\/wp-content\/uploads\/2018\/08\/965.png\",\"datePublished\":\"2018-08-02T19:57:55+00:00\",\"dateModified\":\"2018-11-09T13:17:02+00:00\",\"description\":\"How To Change The Disk Of Database Files On SQL Server(Detach Attach & Backup Restore Methods)\",\"breadcrumb\":{\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/#primaryimage\",\"url\":\"http:\/\/dbtut.com\/wp-content\/uploads\/2018\/08\/965.png\",\"contentUrl\":\"http:\/\/dbtut.com\/wp-content\/uploads\/2018\/08\/965.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/dbtut.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Change The Disk Of Database Files On SQL Server(Detach Attach &#038; Backup Restore Methods)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/dbtut.com\/#website\",\"url\":\"https:\/\/dbtut.com\/\",\"name\":\"Database Tutorials\",\"description\":\"MSSQL, Oracle, PostgreSQL, MySQL, MariaDB, DB2, Sybase, Teradata, Big Data, NOSQL, MongoDB, Couchbase, Cassandra, Windows, Linux\",\"publisher\":{\"@id\":\"https:\/\/dbtut.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/dbtut.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/dbtut.com\/#organization\",\"name\":\"dbtut\",\"url\":\"https:\/\/dbtut.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/dbtut.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/dbtut.com\/wp-content\/uploads\/2021\/02\/dbtutlogo.jpg\",\"contentUrl\":\"https:\/\/dbtut.com\/wp-content\/uploads\/2021\/02\/dbtutlogo.jpg\",\"width\":223,\"height\":36,\"caption\":\"dbtut\"},\"image\":{\"@id\":\"https:\/\/dbtut.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/dbtut.com\/#\/schema\/person\/fc047c39e1e53dce28fc4253529ea408\",\"name\":\"dbtut\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/dbtut.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c322c32021bf651d9e103b183963c479a9c9791ead0715f4348203496c39aa54?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c322c32021bf651d9e103b183963c479a9c9791ead0715f4348203496c39aa54?s=96&d=mm&r=g\",\"caption\":\"dbtut\"},\"description\":\"We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.\",\"sameAs\":[\"http:\/\/NurullahCAKIR\"],\"url\":\"https:\/\/dbtut.com\/index.php\/author\/dbtut\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Change The Disk Of Database Files On SQL Server(Detach Attach & Backup Restore Methods) - Database Tutorials","description":"How To Change The Disk Of Database Files On SQL Server(Detach Attach & Backup Restore Methods)","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:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/","og_locale":"en_US","og_type":"article","og_title":"How To Change The Disk Of Database Files On SQL Server(Detach Attach & Backup Restore Methods) - Database Tutorials","og_description":"How To Change The Disk Of Database Files On SQL Server(Detach Attach & Backup Restore Methods)","og_url":"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/","og_site_name":"Database Tutorials","article_published_time":"2018-08-02T19:57:55+00:00","article_modified_time":"2018-11-09T13:17:02+00:00","og_image":[{"url":"http:\/\/dbtut.com\/wp-content\/uploads\/2018\/08\/965.png","type":"","width":"","height":""}],"author":"dbtut","twitter_card":"summary_large_image","twitter_misc":{"Written by":"dbtut","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/#article","isPartOf":{"@id":"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/"},"author":{"name":"dbtut","@id":"https:\/\/dbtut.com\/#\/schema\/person\/fc047c39e1e53dce28fc4253529ea408"},"headline":"How To Change The Disk Of Database Files On SQL Server(Detach Attach &#038; Backup Restore Methods)","datePublished":"2018-08-02T19:57:55+00:00","dateModified":"2018-11-09T13:17:02+00:00","mainEntityOfPage":{"@id":"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/"},"wordCount":993,"commentCount":0,"publisher":{"@id":"https:\/\/dbtut.com\/#organization"},"image":{"@id":"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/#primaryimage"},"thumbnailUrl":"http:\/\/dbtut.com\/wp-content\/uploads\/2018\/08\/965.png","keywords":["Attach","Attach Database","Backup","Backup Database","Backup Restore","Backup sets to Restore","Compress Backup","database files to other disk","Detach","Detach Attach","Detach Database","Drop Connections","Media options","move database files to other disk","recovery state","Restore","Restore as","Restore Database","Restore Transaction Log","Restore With No recovery","Restore With Recovery","SET MULTI_USER WITH ROLLBACK IMMEDIATE","SET SINGLE_USER WITH ROLLBACK IMMEDIATE","sys.master_files","sys.sysaltfiles","Verify when backup finished"],"articleSection":["MSSQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/","url":"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/","name":"How To Change The Disk Of Database Files On SQL Server(Detach Attach & Backup Restore Methods) - Database Tutorials","isPartOf":{"@id":"https:\/\/dbtut.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/#primaryimage"},"image":{"@id":"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/#primaryimage"},"thumbnailUrl":"http:\/\/dbtut.com\/wp-content\/uploads\/2018\/08\/965.png","datePublished":"2018-08-02T19:57:55+00:00","dateModified":"2018-11-09T13:17:02+00:00","description":"How To Change The Disk Of Database Files On SQL Server(Detach Attach & Backup Restore Methods)","breadcrumb":{"@id":"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/#primaryimage","url":"http:\/\/dbtut.com\/wp-content\/uploads\/2018\/08\/965.png","contentUrl":"http:\/\/dbtut.com\/wp-content\/uploads\/2018\/08\/965.png"},{"@type":"BreadcrumbList","@id":"https:\/\/dbtut.com\/index.php\/2018\/08\/02\/how-to-change-the-disk-of-database-files-on-sql-serverdetach-attach-backup-restore-methods\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/dbtut.com\/"},{"@type":"ListItem","position":2,"name":"How To Change The Disk Of Database Files On SQL Server(Detach Attach &#038; Backup Restore Methods)"}]},{"@type":"WebSite","@id":"https:\/\/dbtut.com\/#website","url":"https:\/\/dbtut.com\/","name":"Database Tutorials","description":"MSSQL, Oracle, PostgreSQL, MySQL, MariaDB, DB2, Sybase, Teradata, Big Data, NOSQL, MongoDB, Couchbase, Cassandra, Windows, Linux","publisher":{"@id":"https:\/\/dbtut.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dbtut.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/dbtut.com\/#organization","name":"dbtut","url":"https:\/\/dbtut.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/dbtut.com\/#\/schema\/logo\/image\/","url":"https:\/\/dbtut.com\/wp-content\/uploads\/2021\/02\/dbtutlogo.jpg","contentUrl":"https:\/\/dbtut.com\/wp-content\/uploads\/2021\/02\/dbtutlogo.jpg","width":223,"height":36,"caption":"dbtut"},"image":{"@id":"https:\/\/dbtut.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/dbtut.com\/#\/schema\/person\/fc047c39e1e53dce28fc4253529ea408","name":"dbtut","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/dbtut.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c322c32021bf651d9e103b183963c479a9c9791ead0715f4348203496c39aa54?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c322c32021bf651d9e103b183963c479a9c9791ead0715f4348203496c39aa54?s=96&d=mm&r=g","caption":"dbtut"},"description":"We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.","sameAs":["http:\/\/NurullahCAKIR"],"url":"https:\/\/dbtut.com\/index.php\/author\/dbtut\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/posts\/1220","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/comments?post=1220"}],"version-history":[{"count":0,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/posts\/1220\/revisions"}],"wp:attachment":[{"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/media?parent=1220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/categories?post=1220"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/tags?post=1220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}