Results 1 to 5 of 5

Thread: [ms sql 2000] Backup problem

  1. #1

    Thread Starter
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    [ms sql 2000] Backup problem

    Hi guys good day. I have this problem in backuping a database. I use SP to this task. Here's the code.
    Code:
    backup database sample to disk = 'c:\program files\backup.bak'
    Backup thingy was successful the problem I don't understand was that when I restore the database using the backup.bak file, it seems it will not update the database the data that populated in database were the data when I first backup the database and not the latest one. What could be the problem here?

    Thanks in advance guys.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [ms sql 2000] Backup problem

    How are you restoring? Is it a complete restore?

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

    Re: [ms sql 2000] Backup problem

    If you backup several times into the same .BAK file you will have several backups within that .BAK file. RESTORING will restore the first one.

    This is from an old post I made:

    Code:
    BACKUP DATABASE Acctfiles 
       TO DISK = 'c:\ACS DESKTOP\Acctfiles_D18.bak'
    -- this does a backup
    
    RESTORE FILELISTONLY 
       FROM DISK = 'c:\ACS DESKTOP\Acctfiles_D18.bak'
    -- this displays the "files" in the backup
    
    RESTORE DATABASE Acctfiles_D18
       FROM DISK = 'c:\ACS DESKTOP\Acctfiles_D18.bak'
       WITH MOVE 'Acctfiles_data' TO 'c:\Program Files\Microsoft SQL Server\MSSQL\DATA\Acctfiles_D18.mdf',
       MOVE 'Acctfiles_log' TO 'c:\Program Files\Microsoft SQL Server\MSSQL\DATA\Acctfiles_D18.ldf'
    -- this actually does a restore - you can restore to a different DB
    -- name and specify the data and log locations
    GO
    Note that the second query - the FILELISTONLY - will display the contents of a .BAK file...

    *** 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

  4. #4

    Thread Starter
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: [ms sql 2000] Backup problem

    Thanks.
    What if I restore the file using the enterprise manager and not using SP in restoring it? Right click on the database->all tast->restore. What option should I use in order to populate the latest data in the database. As of now I can only populate the first data when I do the first back up.

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

    Re: [ms sql 2000] Backup problem

    I just did a test...

    In query analyzer I did a BACKUP...to...'C:\Test.Bak'

    I did that command twice - putting two backups in TEST.BAK.

    The first one reported in the MESSAGES pane that it processed into file 1.

    The second one reported in the MESSAGES pane that it processed into file 2.

    I did the RESTORE FILELISTONLY FROM DISK='C:\Test.Bak' with File=1

    and also with FILE=2. I can see both backup sets in the .BAK file.

    If you leave off the WITH FILE= it defaults to the first backup set in the backup file.

    Now when I go into ENTERPRISE MANAGER and do all tasks->restore I notice that it really wants to RESTORE a backup made with the BACKUP in ENTERPRISE MANAGER. Those backups are made to a unique filename...

    But I am able to change the RESTORE to come "from device (radio button)" and then "SELECT DEVICES...(command button)" and browse out to the .BAK file that I made.

    Then back to the GENERAL tab I see that it's got a BACKUP NUMBER of 1 appearing in a text box - I can change that to 2 if I want. I can also click the "VIEW CONTENTS...(command button)" and see the two backup sets in this backup file. It's got a check box next to either file - I can select either 1 or 2 to restore from...

    So it appears that EM will allow processing of a .BAK file with more than one backup set in it. Remember that all that EM is doing is running the same "t-sql scripts" that I showed you from that GUI - it's just hiding the syntax from you - but apparently all the same capability is there.

    *** 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

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