{"id":1629,"date":"2021-12-28T09:37:02","date_gmt":"2021-12-28T01:37:02","guid":{"rendered":"https:\/\/www.zeroheart.xyz\/wordpress\/?p=1629"},"modified":"2021-12-28T14:22:59","modified_gmt":"2021-12-28T06:22:59","slug":"docker-sqlserver%e6%81%a2%e5%a4%8d%e5%a4%87%e4%bb%bd","status":"publish","type":"post","link":"https:\/\/www.zeroheart.xyz\/wordpress\/?p=1629","title":{"rendered":"docker sqlserver\u6062\u590d\u5907\u4efd"},"content":{"rendered":"\n<p>1.docker exec -it mssql mkdir \/var\/opt\/mssql\/backup<\/p>\n\n\n\n<p>2.docker cp xx.bak <meta charset=\"utf-8\">mssql:\/var\/opt\/mssql\/backup<\/p>\n\n\n\n<p>3.\u5728\u5bb9\u5668\u4e2d\u8fd0\u884c sqlcmd\uff0c\u5217\u51fa\u5907\u4efd\u4e2d\u7684\u903b\u8f91\u6587\u4ef6\u540d\u548c\u8def\u5f84\u3002 \u8fd9\u662f\u901a\u8fc7\u201cRESTORE FILELISTONLY\u201dTransact-SQL \u8bed\u53e5\u5b9e\u73b0\u7684\u3002<\/p>\n\n\n\n<p>docker exec -it mssql \/opt\/mssql-tools\/bin\/sqlcmd -S localhost \\<br>-U SA -P &#8216;Pass@w0rd&#8217; \\<br>-Q &#8216;RESTORE FILELISTONLY FROM DISK = &#8220;\/var\/opt\/mssql\/backup\/myexcel_top20.bak&#8221;&#8216; \\<br>| tr -s &#8216; &#8216; | cut -d &#8216; &#8216; -f 1-2<\/p>\n\n\n\n<p>\u8fd4\u56de<br>myexcel_top20 C:\\Program<br>myexcel_top20_log C:\\Program<\/p>\n\n\n\n<p>4.\u8c03\u7528 RESTORE DATABASE \u547d\u4ee4\uff0c\u8fd8\u539f\u5bb9\u5668\u4e2d\u7684\u6570\u636e\u5e93\u3002 \u4e3a\u4e0a\u4e00\u6b65\u4e2d\u7684\u6bcf\u4e2a\u6587\u4ef6\u6307\u5b9a\u65b0\u8def\u5f84\u3002<\/p>\n\n\n\n<p>docker exec -it mssql \/opt\/mssql-tools\/bin\/sqlcmd \\<br>-S localhost -U SA -P &#8216;Pass@w0rd&#8217; \\<br>-Q &#8216;RESTORE DATABASE myexcel FROM DISK = &#8220;\/var\/opt\/mssql\/backup\/myexcel_top20.bak&#8221; WITH MOVE &#8220;myexcel_top20&#8221; TO &#8220;\/var\/opt\/mssql\/data\/myexcel_top20.mdf&#8221;, MOVE &#8220;myexcel_top20_log&#8221; TO &#8220;\/var\/opt\/mssql\/data\/myexcel_top20_log.ldf&#8221;&#8216;<\/p>\n\n\n\n<p>\u8fd9\u4e00\u6b65\u62a5\u9519\u4e86\u3002\u3002\u6ca1\u641e\u5b9a<\/p>\n\n\n\n<p>Msg 3132, Level 16, State 1, Server mssql, Line 1<\/p>\n\n\n\n<p>The media set has 2 media families but only 1 are provided. All members must be provided.<\/p>\n\n\n\n<p>Msg 3013, Level 16, State 1, Server mssql, Line 1<\/p>\n\n\n\n<p>RESTORE DATABASE is terminating abnormally.<\/p>\n\n\n\n<p>5.\u8fd8\u53ef\u4ee5\u901a\u8fc7\u4e0b\u8f7d\u4e00\u4e2a\u5de5\u5177\u6062\u590d\uff0c\u5c1d\u8bd5\u4e00\u4e0bSSMS<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"237\" src=\"https:\/\/www.zeroheart.xyz\/wordpress\/wp-content\/uploads\/2021\/12\/image-12-1024x237.png\" alt=\"\" class=\"wp-image-1647\" srcset=\"https:\/\/www.zeroheart.xyz\/wordpress\/wp-content\/uploads\/2021\/12\/image-12-1024x237.png 1024w, https:\/\/www.zeroheart.xyz\/wordpress\/wp-content\/uploads\/2021\/12\/image-12-300x70.png 300w, https:\/\/www.zeroheart.xyz\/wordpress\/wp-content\/uploads\/2021\/12\/image-12-768x178.png 768w, https:\/\/www.zeroheart.xyz\/wordpress\/wp-content\/uploads\/2021\/12\/image-12-1536x356.png 1536w, https:\/\/www.zeroheart.xyz\/wordpress\/wp-content\/uploads\/2021\/12\/image-12-1200x278.png 1200w, https:\/\/www.zeroheart.xyz\/wordpress\/wp-content\/uploads\/2021\/12\/image-12.png 1778w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u611f\u89c9\u5e94\u8be5\u662f\u6587\u4ef6\u7684\u95ee\u9898\u5427<\/p>\n\n\n\n<p><a href=\"https:\/\/download.microsoft.com\/download\/d\/9\/7\/d9789173-aaa7-4f5b-91b0-a2a01f4ba3a6\/SSMS-Setup-CHS.exe\">https:\/\/download.microsoft.com\/download\/d\/9\/7\/d9789173-aaa7-4f5b-91b0-a2a01f4ba3a6\/SSMS-Setup-CHS.exe<\/a><\/p>\n\n\n\n<p>\u53c2\u8003\uff1a<a href=\"https:\/\/blog.csdn.net\/gzt19881123\/article\/details\/107858206\">(23\u6761\u6d88\u606f) Docker\u73af\u5883\u4e0bSqlServer\u6570\u636e\u5e93\u4f7f\u7528bak\u6587\u4ef6\u8fd8\u539f_gzt19881123\u7684\u4e13\u680f-CSDN\u535a\u5ba2_docker sqlserver \u8fd8\u539f<\/a><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.docker exec -it mssql mkdir \/var\/opt\/mssql\/backup 2.d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[108,124],"tags":[],"_links":{"self":[{"href":"https:\/\/www.zeroheart.xyz\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1629"}],"collection":[{"href":"https:\/\/www.zeroheart.xyz\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zeroheart.xyz\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zeroheart.xyz\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zeroheart.xyz\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1629"}],"version-history":[{"count":20,"href":"https:\/\/www.zeroheart.xyz\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1629\/revisions"}],"predecessor-version":[{"id":1656,"href":"https:\/\/www.zeroheart.xyz\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1629\/revisions\/1656"}],"wp:attachment":[{"href":"https:\/\/www.zeroheart.xyz\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1629"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zeroheart.xyz\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1629"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zeroheart.xyz\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1629"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}