Recover SQL Server database from SUSPECT mode

Hi Expert DBAs,
As I know the database should be restored from backup and logs reapplied. That’s the first and generally recommended approach any time a DB is suspect, whether it’s from log or data file corruption.
But if I have no backups then we follow below steps ( after Googling I found these steps on most of the websites ):
1.EXEC sp_resetstatus ‘yourDBname’;
2.ALTER DATABASE yourDBname SET EMERGENCY
3.DBCC checkdb(’yourDBname’)
4.ALTER DATABASE yourDBname SET SINGLE_USER WITH ROLLBACK IMMEDIATE
5.DBCC CheckDB (’yourDBname’, REPAIR_ALLOW_DATA_LOSS)
6.ALTER DATABASE yourDBname SET MULTI_USER
Now my question is, 
1. If after executing DBCC CHECKDB at 3rd step, it shows inconsistency.Then I will execute SET SINGLE USER WITH ROLLBACK & if after executing DBCC CHECKDB at 3rd step, no errors found. Then what will be the steps?
2. When we execute DBCC CHECKDB (' DBNAME ', REPAIR_ALLOW_DATA_LOSS) how can we recover lost data during process.As far as I know some data will loss and if it will happen then business will get suffered.
3. Why run DBCC CHECKDB() WITH REPAIR_ALLOW_DATA_LOSS if there are no consistency errors in the database?
I am stucked in these questions....
Regards,
Yashwant Vishwakarma | SQLOcean.com
Yashwant Vishwakarma | www.sqlocean.com

There is no easy or same steps, it all depends on what error and what caused suspect. 
Example is below:
http://www.sql-server-performance.com/2015/recovery-sql-server-suspect-mode/
2) Straight answer would be no you cant recover if no backup. Again it all depends what error checkdb returns and some things can be tried as explained earlier but no guarantee.
The REPAIR_ALLOW_DATA_LOSS option is not the best option for bringing a database to a physically consistent state. If successful, the REPAIR_ALLOW_DATA_LOSS option may result in some data loss. In fact, it may result in more data lost than if a user were to
restore the database from the last known good backup. Microsoft always recommends a user restore from the last known good backup as the primary method to recover from errors reported by DBCC CHECKDB. The REPAIR_ALLOW_DATA_LOSS option is not an alternative
for restoring from a known good backup. It is an emergency “last resort” option recommended for use only if restoring from a backup is not possible.
Certain errors, that can only be repaired using the REPAIR_ALLOW_DATA_LOSS option, may involve deallocating a row, page, or series of pages to clear the errors. Any deallocated data is no longer accessible or recoverable for the user, and the exact contents
of the deallocated data cannot be determined. Therefore, referential integrity may not be accurate after any rows or pages are deallocated because foreign key constraints are not checked or maintained as part of this repair operation. The user must inspect
the referential integrity of their database (using DBCC CHECKCONSTRAINTS) after using the REPAIR_ALLOW_DATA_LOSS option.
https://msdn.microsoft.com/en-us/library/ms176064.aspx

Similar Messages

  • How to create a .mdf SQL Server database from a Data-Tier Application file that has data?

    This is a noob question, though I do use SQL Server databases all the time with Entity Framework when I code in C# using Visual Studio 2013.  The development environment is found below at [A].  I am trying to make a clone of a SQL Server 2008 R2
    database (.mdf)  that exists online.  I can read, connect and work with this database in Visual Studio 2013, but I wish to make a local copy of the database, as an .MDF file.  Somewhere in my notes I have a way of creating a local copy from
    an online database when using Visual Studio but I forgot how (it seems, reviewing my notes, that it deals with ADO.NET which is deprecated in Visual Studio 2013 these days, or so it seems).  So I'm looking for another way.  What I did was create
    (or export) a "Data-Tier Application File" from the online SQL Server database, with data, and it seems to have worked in that this Data-Tier Application file exists on my hard drive and seems to have data in it ("SQL Server Replication Snapshot"
    is the format it seems).  It contains skeleton code to create a database, but when I tried to execute it with SQL Server 2014 Management Studio, I got a bunch of errors.
    So my question is:
    1) Can I somehow create a .MDF SQL Server Database from an Data-Tier Application file that has data?  What tool do I use?  I saw this link, http://social.technet.microsoft.com/wiki/contents/articles/2639.how-to-use-data-tier-application-import-and-export-with-a-windows-azure-sql-database.aspx 
    and it relates to Azure, but is there a tool for C#Visual Studio 2013, standalone?
    2) If there's an easy way to create a .mdf SQL Server Database file from an online file, within SQL Server Management Studio?  I don't think so, since it would require Administrator permissions on the online server, which I don't have. I have permission
    to read, update, delete the online database file, but strangely not to download it (the service I use has a tool for backup, but not for download).
    3) same question as 2), but for Visual Studio 2013?  I don't think so, since I notice none of the templates even mentions ADO.NET anymore, but instead they go with Entity Framework.  Using EF I can of course do anything I want with the online database
    (CRUD), but it remains online.  Maybe there's a switch to make a local copy?  I guess I could write a short program to suck all the data out of the online database and put it into a new, duplicate database having the same tables, that I create on
    my localhost, but my question here is if there's an easier way than this, maybe a tool or command I can run from inside Visual Studio?
    Any advice on any of the above questions is appreciated.
    Thank you,
    Paul
    [A] Microsoft Visual Studio Professional 2013
    Version 12.0.21005.1 REL
    Microsoft .NET Framework
    Version 4.5.51641
    Microsoft Web Developer Tools 2013   2.0.40926.0
    SQL Server Data Tools   12.0.30919.1
    Microsoft SQL Server Data Tools
    Windows Azure Mobile Services Tools   1.0
    Windows Azure Mobile Services Tools

    Thanks but these links are too general to help.
    "2. what do you mean by online file?" - I mean the SQL Server database file is on a remote web server that I rent from, but I am not the administrator of.  I can access my database using SQL Server Authentication, but nothing more.
    Paul
    What do you mean by too general? It explains on how you can use data tier application to create and deploy databases
    May be this will help you to understand better
    http://www.databasejournal.com/features/mssql/article.php/3911041/Creating-Data-Tier-Applications--in-SQL-Server-2008-R2.htm
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • I want to query sql server database from oracle

    i want to query sql server database from oracle
    can anyone help me in this regard

    First of all - you are in the wrong forum.
    Look either for the Database general or search for Transparant / Heterogenous Gateways.
    cu
    Andreas

  • SQL Server database (read-only mode) in Oracle SQL Developer

    Hello,
    I connected SQL server database with Oracle SQL Developer 3.2.10.09, everything looks good except i can only browse data, i cannot change data in tables cannot insert new or delete rows. Query is also disabled (i got message: Query Builder is not supported for this connection type.) I used Third Party JDBC Drivers - jtds-1.2.6.jar as my connection to SQL server. Is there a way to change data in tables?
    Thank you.

    AFAIK editing table data in the grid is only possible with an Oracle database. On MS SQL you'll have to use update statements in the worksheet.
    Hope that helps,
    dhalek

  • How do I connect to an SQL Server Database from CR XI?

    Hello All,
    I posted previously to this forum but did not get any response. There surely must be a way to connect to SQL Server from CR XI? My problem is that I keep on getting prompted for a PW or get a message saying "Logon Failed"
    Please see my earlier post, with code sample, on Page 4 (or now 5 or 6 .....)
    "How to log on to SQL 2000 programmatically using VB6 RDC and CR XI "
    I would really appreciate a response from someone as I need to get some pressing work finished for a client.
    Thanks so much in advance
    Peter Tyler

    This shoul dbe posted to the Legacy Development forums

  • Error while Viewing SQL Server data from Oracle

    Dear Friends,
    I am using Oracle10g XE.
    I have made a connection to view or insert data in SQL Server Database from Oracle.
    I  have done all the things with the help of below link.
    http://www.databasejournal.com/features/oracle/article.php/3442661/Making-a-Connection-from-Oracle-to-SQL-Server.htm
    Everything worked fine. but when i run below query
    select "EmployeeNo" from hrtattendance@mysqlserverdsn
    it gives an error which is mentioned below
    ERROR at line 1:
    ora-28545: error diagnosed by Net8 when connecting to an agent
    Unable to reteieve text of  NETWORK/NCR MESSAGE 65535
    ORA-02063: preceding 2 lines from MYSQLSERVERDSN
    Please help. I will be thankful.
    Regards,

    Dear Klaus,
    Here u go.
    C:\>C:\oraclexe\app\oracle\product\10.2.0\server\bin\hsodbc
    Oracle Corporation --- TUESDAY   JUN 24 2014 16:28:20.146
    Heterogeneous Agent Release 10.2.0.1.0 - Production  Built with
       Driver for ODBC
    C:\>C:\oraclexe\app\oracle\product\10.2.0\server\bin\tnsping MYSQLSERVERDSN
    TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 24-JUN-2
    014 16:28:33
    Copyright (c) 1997, 2005, Oracle.  All rights reserved.
    Used parameter files:
    C:\oraclexe\app\oracle\product\10.2.0\server\network\admin\sqlnet.ora
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT
    =1522)) (CONNECT_DATA=(SID=MYSQLSERVERDSN)) (HS=OK))
    TNS-12541: TNS:no listener
    C:\>C:\oraclexe\app\oracle\product\10.2.0\server\bin\lsnrctl status LISTENERMYSQLSERVERDSN
    LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 24-JUN-2014 16:28
    :48
    Copyright (c) 1991, 2005, Oracle.  All rights reserved.
    Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1522))
    TNS-12541: TNS:no listener
    TNS-12560: TNS:protocol adapter error
      TNS-00511: No listener
       32-bit Windows Error: 61: Unknown error
    Connecting to (ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY))
    TNS-12541: TNS:no listener
    TNS-12560: TNS:protocol adapter error
      TNS-00511: No listener
       32-bit Windows Error: 2: No such file or directory
    C:\>
    Regards,

  • Cannot connect to SQL Server databases

    All of a sudden I can't connect to SQL server databases from
    my local machine. The databases are on a web server. It just
    started happening, and I never had a problem with it before. I
    can't connect to them in the coldfusion administrator, and I can't
    connect to them using ODBC DSN's either. Has anyone ever run into
    this before? I didn't change anything in the cf admin, and I
    certainly didn't change any logins or passwords in SQL
    Server.

    I've been experiencing a similar problem. Everything was fine
    but I had to reboot CF 8.01.
    After the reboot all the datasources are very slow to respond
    and we get lots of errors of the form :
    Timed out trying to establish connection
    A non-SQL error occurred while requesting a connection from
    blah
    Timed out trying to establish connection
    A non-SQL error occurred while requesting a connection from
    blah
    Everything is working but very slow on database queries. This
    happened a couple of months ago when we last
    rebooted and then it went away.
    Going to have a look for a new JDBC driver from adobe and see
    if that helps ....

  • Accessing MS SQL Server DB from Oracle10g

    HI !
    I am running MS SQL server 2000 in Windows 2003
    and Oracle 10.2 in windows XP professional
    and i want to access SQL server database from oracle using Oracle Enterprise Manager
    what am i suppose to do
    Thanks & Regard.

    Sanghai wrote:
    HI !
    I am running MS SQL server 2000 in Windows 2003
    and Oracle 10.2 in windows XP professional
    and i want to access SQL server database from oracle using Oracle Enterprise Manager
    what am i suppose to doSQL Server Database from EM? Now that's too much to ask , don't you think so? If you want to manage SQL Server, you should use the tools given by MS for it, Oracle EM would manage only Oracle db which it is made to do.
    HTH
    Aman....

  • Database in Suspect Mode in SQL Server 2000 Log Shipping Environment

    Hi All
    We have movement of SQL Server 2000 at physical level. We have disable jobs and stop Agent and SQL Server services.
    After moved the server we have started the server and then start SQL Server 2000 services.
    All of databases in SUSPECT mode. Files are in correct folders as were before shutdown the server
    What shall I do e.g. why databases come up in SUSPECT mode? what to check and how to get database live?
    Pls help it is critical...
    Thanks in Advance

    All of databases in SUSPECT mode. Files are in correct folders as were before shutdown the server
    What shall I do e.g. why databases come up in SUSPECT mode? what to check and how to get database live?
    Pls help it is critical...
    Thanks in Advance
    Hello,
    Did you made sure no transactions like restore logs  were running when you stopped SQL server service or agent .I have seen in SQL 2000 an abrupt stop of SQL Server agent when its doing a process can sometimes force database in suspect mode.
    I would like you to get your disk analyzed by vendor ASAP for any fault in disk at first go it seems to me an underlying hardware issue.
    Please can you check errorlog and event viewer to find out any possible cause for database going into suspect mode
    I always suggest to use Backup and restore method of recovery to get out from suspect database problem.If you dont have then you can move with DBCC Checkdb and various repair options but be sure
    DATA LOSS might be possible when you use repair allow data loss and repair_rebuild removes constraints.
    hope this helps
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • Is it possible to have different authentication mode for SQL Server Database Engine and corresponding SQL Server instance?

    Hi,
    I have installed the x64 SQL Server 2008 R2 Express with default settings and run MBSA 2.3 (using default settings too). It shows three SQL Server instances: MSSQL10_50.SQLEXPRESS, SQLEXPRESS and SQLEXPRESS (32-bit). For the first, authentication
    mode is Windows, for the rest two - mixed. Here https://social.msdn.microsoft.com/Forums/sqlserver/en-US/03e470dc-874d-476d-849b-c805acf5b24d/sql-mbsa-question-on-folder-permission?forum=sqlsecurity question
    about such multiple instances was asked and the answer is that "MSSQL10.TEST_DB
    is the instance ID for the SQL Server Database Engine of the instance, TEST_DB", so in my case, it seems that MSSQL10_50.SQLEXPRESS is the instance ID for SQL Server Database Engine  of the SQLEXPRESS instance.
    I have two questions:
    1) How can it be that SQL Server DB Engine instance has different authentication mode than corresponding SQL Server Instance?
    2) Why 32-bit instance reported although I installed only 64-bit version?
    Also, this https://social.technet.microsoft.com/Forums/security/en-US/6b12c019-eaf0-402c-ab40-51d31dce968f/mbsa-23-reporting-sql-32bt-instance-is-running-in-mixed-mode-when-it-is-set-to-integrated?forum=MBSA question seems to be related to this
    issue, but there is no answer :(.
    Upd: Tried on clean Windows 8 installation and Windows 7 with the same result.

      Because I DO NOT want the three people who will be having access to the production SQL Server to also have access to the primary host ProductionA.  Since I have to allow them to RDC into the box to manage the SQL Server, I figure why not create
    a separate VM for each one of them and they can RDC into those instead.
    Does this make any sense?
    Any tips are greatly appreciated.  The main reason for doing this is because the three people who will be accessing the box, I need to isolate each one of them and at the same time keep them off of the primary ProductionA.
    Thanks for your help.
    M
    Hello M,
    Since you dont want the 3 guys to have access to Production machine A.You can install SQL Server client .By client i mean SQL server management studio(SSMS) on there local desktop and then create login for them in SQL Server.Open port on which your SQL server
    is running for three of the machines so that they can connct.Now with SSMS installed on each machine each can connect to SQL server from there own machine.
    I would also like you to be cautious with giving Sysadmin privilege to all three of them ,first please note down what task they would do and then decide what rights to be provided.
    Your option will also work but you need to create 3 VM for that .Which is more tedious task.
    Hope this helps
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • How can I get the data array from SQL Server Database?

    Hi,
    I can write a data array(2D)into a table of my SQL Server Database. The data array was writen to a column with image type. I know a data array is transformed a binary string when writing into database, but I dont know how to get the data array when I fetch the binary string from database.
    My question is:
    How to transform the binary string into data array? which vi's should I use? I have tried unflatten from string but failed.
    Any response is appriciated.
    Red

    happyxh0518 wrote:
    > I can write a data array(2D)into a table of my SQL Server Database.
    > The data array was writen to a column with image type. I know a data
    > array is transformed a binary string when writing into database, but I
    > dont know how to get the data array when I fetch the binary string
    > from database.
    >
    > My question is:
    > How to transform the binary string into data array? which vi's should
    > I use? I have tried unflatten from string but failed.
    In order to use Unflatten from string you first need to Flatten it
    before writing it. Also depending on the database driver, the returned
    data may actually not be binary but Hexadecimal encoded ASCII which you
    would first have to decode to binray.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Exporting data from SQL Server database to Oracle database

    Hello All,
    We need to replicate a table's data of SQL Server database to Oracle database.
    Can this task be accomplished using Import/Export wizard or Linked servers?
    Can help me regarding which Oracle data access components should i download to do this?
    I am using SQL Server 2012.
    And i have Oracle 11g release 2 client installed in my system.
    Thanks in Advance.
    Thanks and Regards, Readers please vote for my posts if the questions i asked are helpful.

    Yes you can definitely transfer data from SQL server to Oracle Have a look at below links
    Export SQL server data to Oracle Using SSIS
    Use OLEDB data provider to transfer data from SQL server to Oracle
    Using Import Export Wizard
    Similar thread
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it.
    My TechNet Wiki Articles

  • Create a visual web part which get data from excel sheet and import it into sql server database in sharepoint 2010 (development)

    Hi,
    I want to create a visual webpart which will read data from excel sheet and import it in to sql server database.(using sharepoint development)
    I want to do it using visual webpart.
    Please help to solve the issue.
    Thanks in advance!
    Regards
    Rajni

    Hi  Rajni,
    Microsoft.Office.Interop.Excel assembly provides class to read excel file data, in your web part solution, reference the assembly, and following blog contains samples about how to read the excel file data,
    and import it to SQL  database.
    1.Create a Visual Web Part Project:Create
    Visual Web Parts in SharePoint 2010
    2.Read the excel workbook by using SPFile class:
    http://alancejacob.blogspot.in/2012/06/read-data-from-excel-file-and-insert-in.html
    http://stackoverflow.com/questions/14496608/read-excel-file-stored-in-sharepoint-document-library
    3.Export the excel workbook to SQL Server:
    http://www.c-sharpcorner.com/UploadFile/99bb20/import-excel-data-to-sql-server-in-Asp-Net/
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • JAVA, sqlserver - Need to load an image from the sql server database

    hi,
    I need to load an image from the sql server database using java. I have connected to the database and getting all other records except the records for a photo (datatype = LONGVARBINARY) and Remarks (datatype = LONGVARCHAR).
    I am using java and sql server db. The photo and remarks are stored in the db. and i need to show the image and the remarks fetching them from there.
    I get the error :
    Thread-9 org.hibernate.MappingException: No Dialect mapping for JDBC type: -1
    How can I achieve this?
    Thanks,
    Gargi

    Exactly. And are you using MySQL?
    No. You are using Microsoft SQL server if I have to believe your initial post. A quick google tells me that the dialect class to use is:
    org.hibernate.dialect.SQLServerDialect

  • Using SQL Server in Window Authentification mode from Coldfusion

    I've received the following private message and don't know
    how to answer. Can anyone else help?
    quote:
    Is there any some simple way to use the sql server in windows
    authentication mode from coldfusion??? Other the creating the ODBC
    Socket.

    Hi Colum,
    get these quite often, which is why I turn PM off most of the
    time.
    Just send them to the right forum:
    http://www.adobe.com/cfusion/webforums/forum/index.cfm?forumid=1
    Cheers
    Craig

Maybe you are looking for