{"id":27,"date":"2021-01-27T11:29:11","date_gmt":"2021-01-27T14:29:11","guid":{"rendered":"http:\/\/belavista.net.br\/?p=27"},"modified":"2021-01-27T11:49:13","modified_gmt":"2021-01-27T14:49:13","slug":"corrigindo-erros-nas-tabelas-sql","status":"publish","type":"post","link":"https:\/\/belavista.net.br\/?p=27","title":{"rendered":"Corrigindo erros nas tabelas SQL"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">&nbsp;<code>DEVE-SE FAZER BACKUP DO BANCO DE DADOS PARA RODAR OS COMANDOS ABAIXO !<\/code>&nbsp;<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Listar erros<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>USE NOMEDOBANCO\nGO\nALTER DATABASE NOMEDOBANCO SET SINGLE_USER; \n\/* Coloca o banco em modo single user para executar os comandos abaixo *\/ \nDBCC CHECKDB ('NOMEDOBANCO ') WITH TABLOCK, ALL_ERRORMSGS, NO_INFOMSGS; \nALTER DATABASE NOMEDOBANCO SET MULTI_USER;\n\/* Volta o banco em modo multi user *\/\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Depois de listar, execute este comando (informe o c\u00f3digo do erro no lugar do XXXXXX)<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>USE NOMEDOBANCO\nGO    \nALTER DATABASE NOMEDOBANCO SET SINGLE_USER;     \nDBCC CHECKTABLE(XXXXXX,REPAIR_ALLOW_DATA_LOSS);\nALTER DATABASE NOMEDOBANCO SET MULTI_USER;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Recupera o banco com status &#8220;SINGLE USER&#8221;&nbsp;<code>(usu\u00e1rio \u00fanico)<\/code><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ALTER DATABASE NOMEDOBANCO SET MULTI_USER;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><strong>Recupera o banco com status &#8220;SUSPECT&#8221;\u00a0<code>(suspeito)<\/code><\/strong><\/strong><br>Caso o banco esteja em &#8220;Suspect&#8221;, execute os comandos abaixo. Mais informa\u00e7\u00f5es em <a href=\"http:\/\/belavista.net.br\/index.php\/2021\/01\/27\/como-reparar-um-banco-de-dados-suspeito-em-mssql\/\">Link<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>EXEC sp_resetstatus NOMEDOBANCO\nALTER DATABASE NOMEDOBANCO SET EMERGENCY\nDBCC checkdb(NOMEDOBANCO )\nALTER DATABASE NOMEDOBANCO SET SINGLE_USER WITH ROLLBACK IMMEDIATE\nDBCC CheckDB (NOMEDOBANCO , REPAIR_ALLOW_DATA_LOSS)\nALTER DATABASE NOMEDOBANCO SET MULTI_USER<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Quando o banco estiver em modo &#8220;EMERGENCY&#8221;&nbsp;<code>(Emergencia)<\/code><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ALTER DATABASE NOMEDOBANCO SET SINGLE_USER WITH ROLLBACK IMMEDIATE\nDBCC CheckDB (NOMEDOBANCO , REPAIR_ALLOW_DATA_LOSS)\nALTER DATABASE NOMEDOBANCO SET MULTI_USER<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Quando o banco estiver em modo &#8220;RESTAURAR&#8221;&nbsp;<code>(recupera\u00e7\u00e3o pendente)<\/code><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ALTER DATABASE NOMEDOBANCO SET EMERGENCY;\nGO\nALTER DATABASE NOMEDOBANCO set single_user\nGO\nDBCC CHECKDB (NOMEDOBANCO, REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS;\nGO \nALTER DATABASE NOMEDOBANCO set multi_user\nGO <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Recuperar o banco todo<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">N\u00e3o \u00e9 muito aconselh\u00e1vel rodar isso sem antes dar um&nbsp;<em>checkdb<\/em>&nbsp;pra ver os erros, pois \u00e9 importante que o banco conhe\u00e7a os erros antes.<br>Veja mais aqui:&nbsp;<a href=\"http:\/\/belavista.net.br\/index.php\/2021\/01\/27\/socorro-meu-banco-de-dados-esta-corrompido-o-que-agora\/\">Link<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>DBCC CHECKDB(NOMEDOBANCO, REPAIR_ALLOW_DATA_LOSS);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;DEVE-SE FAZER BACKUP DO BANCO DE DADOS PARA RODAR OS COMANDOS ABAIXO !&nbsp; Listar erros Depois de listar, execute este comando (informe o c\u00f3digo do erro no lugar do XXXXXX) Recupera o banco com status &#8220;SINGLE USER&#8221;&nbsp;(usu\u00e1rio \u00fanico) Recupera o banco com status &#8220;SUSPECT&#8221;\u00a0(suspeito)Caso o banco esteja em &#8220;Suspect&#8221;, execute os comandos abaixo. Mais informa\u00e7\u00f5es [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-27","post","type-post","status-publish","format-standard","hentry","category-sem-categoria"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Corrigindo erros nas tabelas SQL - Bela Vista NET<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/belavista.net.br\/?p=27\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Corrigindo erros nas tabelas SQL - Bela Vista NET\" \/>\n<meta property=\"og:description\" content=\"&nbsp;DEVE-SE FAZER BACKUP DO BANCO DE DADOS PARA RODAR OS COMANDOS ABAIXO !&nbsp; Listar erros Depois de listar, execute este comando (informe o c\u00f3digo do erro no lugar do XXXXXX) Recupera o banco com status &#8220;SINGLE USER&#8221;&nbsp;(usu\u00e1rio \u00fanico) Recupera o banco com status &#8220;SUSPECT&#8221;\u00a0(suspeito)Caso o banco esteja em &#8220;Suspect&#8221;, execute os comandos abaixo. Mais informa\u00e7\u00f5es [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/belavista.net.br\/?p=27\" \/>\n<meta property=\"og:site_name\" content=\"Bela Vista NET\" \/>\n<meta property=\"article:published_time\" content=\"2021-01-27T14:29:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-01-27T14:49:13+00:00\" \/>\n<meta name=\"author\" content=\"M\u00e1rcio Alc\u00e2ntara\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"M\u00e1rcio Alc\u00e2ntara\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. tempo de leitura\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minuto\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/belavista.net.br\\\/?p=27#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/belavista.net.br\\\/?p=27\"},\"author\":{\"name\":\"M\u00e1rcio Alc\u00e2ntara\",\"@id\":\"https:\\\/\\\/belavista.net.br\\\/#\\\/schema\\\/person\\\/ffafd9c528cac7c249b89c41cdb674e3\"},\"headline\":\"Corrigindo erros nas tabelas SQL\",\"datePublished\":\"2021-01-27T14:29:11+00:00\",\"dateModified\":\"2021-01-27T14:49:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/belavista.net.br\\\/?p=27\"},\"wordCount\":107,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/belavista.net.br\\\/#organization\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/belavista.net.br\\\/?p=27#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/belavista.net.br\\\/?p=27\",\"url\":\"https:\\\/\\\/belavista.net.br\\\/?p=27\",\"name\":\"Corrigindo erros nas tabelas SQL - Bela Vista NET\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/belavista.net.br\\\/#website\"},\"datePublished\":\"2021-01-27T14:29:11+00:00\",\"dateModified\":\"2021-01-27T14:49:13+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/belavista.net.br\\\/?p=27#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/belavista.net.br\\\/?p=27\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/belavista.net.br\\\/?p=27#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"In\u00edcio\",\"item\":\"https:\\\/\\\/belavista.net.br\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Corrigindo erros nas tabelas SQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/belavista.net.br\\\/#website\",\"url\":\"https:\\\/\\\/belavista.net.br\\\/\",\"name\":\"Bela Vista Net\",\"description\":\"Sistemas de Gest\u00e3o para o Varejo\",\"publisher\":{\"@id\":\"https:\\\/\\\/belavista.net.br\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/belavista.net.br\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/belavista.net.br\\\/#organization\",\"name\":\"Bela Vista Net\",\"url\":\"https:\\\/\\\/belavista.net.br\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\\\/\\\/belavista.net.br\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/belavista.net.br\\\/wp-content\\\/uploads\\\/2021\\\/10\\\/logo-horizontal-site.png\",\"contentUrl\":\"https:\\\/\\\/belavista.net.br\\\/wp-content\\\/uploads\\\/2021\\\/10\\\/logo-horizontal-site.png\",\"width\":1000,\"height\":180,\"caption\":\"Bela Vista Net\"},\"image\":{\"@id\":\"https:\\\/\\\/belavista.net.br\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/belavista.net.br\\\/#\\\/schema\\\/person\\\/ffafd9c528cac7c249b89c41cdb674e3\",\"name\":\"M\u00e1rcio Alc\u00e2ntara\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/56d54d98ebd9ccaf49dbbe80d593087863a7b88fe522b1039ab5bbf8076bba4d?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/56d54d98ebd9ccaf49dbbe80d593087863a7b88fe522b1039ab5bbf8076bba4d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/56d54d98ebd9ccaf49dbbe80d593087863a7b88fe522b1039ab5bbf8076bba4d?s=96&d=mm&r=g\",\"caption\":\"M\u00e1rcio Alc\u00e2ntara\"},\"sameAs\":[\"http:\\\/\\\/belavista.net.br\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Corrigindo erros nas tabelas SQL - Bela Vista NET","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:\/\/belavista.net.br\/?p=27","og_locale":"pt_BR","og_type":"article","og_title":"Corrigindo erros nas tabelas SQL - Bela Vista NET","og_description":"&nbsp;DEVE-SE FAZER BACKUP DO BANCO DE DADOS PARA RODAR OS COMANDOS ABAIXO !&nbsp; Listar erros Depois de listar, execute este comando (informe o c\u00f3digo do erro no lugar do XXXXXX) Recupera o banco com status &#8220;SINGLE USER&#8221;&nbsp;(usu\u00e1rio \u00fanico) Recupera o banco com status &#8220;SUSPECT&#8221;\u00a0(suspeito)Caso o banco esteja em &#8220;Suspect&#8221;, execute os comandos abaixo. Mais informa\u00e7\u00f5es [&hellip;]","og_url":"https:\/\/belavista.net.br\/?p=27","og_site_name":"Bela Vista NET","article_published_time":"2021-01-27T14:29:11+00:00","article_modified_time":"2021-01-27T14:49:13+00:00","author":"M\u00e1rcio Alc\u00e2ntara","twitter_card":"summary_large_image","twitter_misc":{"Escrito por":"M\u00e1rcio Alc\u00e2ntara","Est. tempo de leitura":"1 minuto"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/belavista.net.br\/?p=27#article","isPartOf":{"@id":"https:\/\/belavista.net.br\/?p=27"},"author":{"name":"M\u00e1rcio Alc\u00e2ntara","@id":"https:\/\/belavista.net.br\/#\/schema\/person\/ffafd9c528cac7c249b89c41cdb674e3"},"headline":"Corrigindo erros nas tabelas SQL","datePublished":"2021-01-27T14:29:11+00:00","dateModified":"2021-01-27T14:49:13+00:00","mainEntityOfPage":{"@id":"https:\/\/belavista.net.br\/?p=27"},"wordCount":107,"commentCount":0,"publisher":{"@id":"https:\/\/belavista.net.br\/#organization"},"inLanguage":"pt-BR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/belavista.net.br\/?p=27#respond"]}]},{"@type":"WebPage","@id":"https:\/\/belavista.net.br\/?p=27","url":"https:\/\/belavista.net.br\/?p=27","name":"Corrigindo erros nas tabelas SQL - Bela Vista NET","isPartOf":{"@id":"https:\/\/belavista.net.br\/#website"},"datePublished":"2021-01-27T14:29:11+00:00","dateModified":"2021-01-27T14:49:13+00:00","breadcrumb":{"@id":"https:\/\/belavista.net.br\/?p=27#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/belavista.net.br\/?p=27"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/belavista.net.br\/?p=27#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"In\u00edcio","item":"https:\/\/belavista.net.br\/"},{"@type":"ListItem","position":2,"name":"Corrigindo erros nas tabelas SQL"}]},{"@type":"WebSite","@id":"https:\/\/belavista.net.br\/#website","url":"https:\/\/belavista.net.br\/","name":"Bela Vista Net","description":"Sistemas de Gest\u00e3o para o Varejo","publisher":{"@id":"https:\/\/belavista.net.br\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/belavista.net.br\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pt-BR"},{"@type":"Organization","@id":"https:\/\/belavista.net.br\/#organization","name":"Bela Vista Net","url":"https:\/\/belavista.net.br\/","logo":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/belavista.net.br\/#\/schema\/logo\/image\/","url":"https:\/\/belavista.net.br\/wp-content\/uploads\/2021\/10\/logo-horizontal-site.png","contentUrl":"https:\/\/belavista.net.br\/wp-content\/uploads\/2021\/10\/logo-horizontal-site.png","width":1000,"height":180,"caption":"Bela Vista Net"},"image":{"@id":"https:\/\/belavista.net.br\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/belavista.net.br\/#\/schema\/person\/ffafd9c528cac7c249b89c41cdb674e3","name":"M\u00e1rcio Alc\u00e2ntara","image":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/secure.gravatar.com\/avatar\/56d54d98ebd9ccaf49dbbe80d593087863a7b88fe522b1039ab5bbf8076bba4d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/56d54d98ebd9ccaf49dbbe80d593087863a7b88fe522b1039ab5bbf8076bba4d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/56d54d98ebd9ccaf49dbbe80d593087863a7b88fe522b1039ab5bbf8076bba4d?s=96&d=mm&r=g","caption":"M\u00e1rcio Alc\u00e2ntara"},"sameAs":["http:\/\/belavista.net.br"]}]}},"_links":{"self":[{"href":"https:\/\/belavista.net.br\/index.php?rest_route=\/wp\/v2\/posts\/27","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/belavista.net.br\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/belavista.net.br\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/belavista.net.br\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/belavista.net.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=27"}],"version-history":[{"count":5,"href":"https:\/\/belavista.net.br\/index.php?rest_route=\/wp\/v2\/posts\/27\/revisions"}],"predecessor-version":[{"id":38,"href":"https:\/\/belavista.net.br\/index.php?rest_route=\/wp\/v2\/posts\/27\/revisions\/38"}],"wp:attachment":[{"href":"https:\/\/belavista.net.br\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=27"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/belavista.net.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=27"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/belavista.net.br\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=27"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}