Results 1 to 5 of 5

Thread: Database Restore

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Location
    Dhaka, Bangladesh
    Posts
    102

    Database Restore

    Friends,

    Can I restore my SQL Server 2000 database only by data file. Actually my log file is lost.

    What can I do now.

    Rajib
    Please Rate every reply if it is useful to u

  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Database Restore

    Does this mean you have a .BAK file of the database? That would be a full backup...

    Please explain further what you have.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Location
    Dhaka, Bangladesh
    Posts
    102

    Re: Database Restore

    Thanks for ur quick response.

    I don't have any backup.

    I just have the data file that is generated when database is created. And also the log file is damaged.

    Is it possible to reload the database only by the data file of the database?

    -Rajib
    Please Rate every reply if it is useful to u

  4. #4
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Database Restore

    I believe you can attach the DB without the log in Enterprise Manager - it will create a new and empty log.

    Hopefully the damaged log didn't have any unwritten cached data in it.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  5. #5
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Database Restore

    Actually, you can't from Enterprise Manager....
    BUT you CAN from Query analyzer..... first delete the log file. Make sure it is NOT the data file.

    Then from Query Analyzer, connect to the server.... and issue this command:
    sp_attach_single_file_db 'dbname' , 'physical_name'

    Here's the entry from BOL
    Quote Originally Posted by SQL Books Online
    Syntax
    sp_attach_single_file_db [ @dbname = ] 'dbname'
    , [ @physname = ] 'physical_name'

    Arguments
    [@dbname =] 'dbname'

    Is the name of the database to be attached to the server. dbname is sysname, with a default of NULL.

    [@physname =] 'phsyical_name'

    Is the physical name, including path, of the database file. physical_name is nvarchar(260), with a default of NULL.

    Return Code Values
    0 (success) or 1 (failure)

    Result Sets
    None

    Remarks
    When sp_attach_single_file_db attaches the database to the server, it builds a new log file and performs additional cleanup work to remove replication from the newly attached database.

    Used sp_attach_single_file_db only on databases that were previously detached from the server using an explicit sp_detach_db operation.

    Permissions
    Only members of the sysadmin and dbcreator fixed server roles can execute this procedure.

    Examples
    This example detaches pubs and then attaches one file from pubs to the current server.

    EXEC sp_detach_db @dbname = 'pubs'
    EXEC sp_attach_single_file_db @dbname = 'pubs',
    @physname = 'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf'

    You should get a message that state the Log file couldn't be found, so a new one was created. THat's good.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width