Results 1 to 9 of 9

Thread: Restore Log looking for Log path...

  1. #1
    Join Date
    May 2007
    Posts
    3

    Restore Log looking for Log path...

    I am having difficulty restoring a database (DB_1) consists of 2 datafiles and one log file, DB Structure is as following:

    Filegroup PRIMARY with file name 'fnm_data' with physical file name and location D:\db\file_1.mdf,
    Filegroup 'FG1' with file name 'fgnm1_data1' with physical file name and location F:\db\file_FG1.mdf,
    One log file with file name 'fnm_log' with physical file name and location (E:\log\log_db.ldf)

    {Note} Logfile resides on E drive whereas Datafiles reside on several other drives.

    I need to restore the DB on another machine. And I need to move the log file to a drive other than E.In this case it is K drive. Hence I have used the following code,

    restore log DB_1 from disk='M:\bkupc\cciclog.txt'

    WITH RESTRICTED_USER , MOVE 'fnm_log'

    TO 'K:\DB\log_db.ldf', recovery, replace,RESTART

    go



    When I try to restore from backup files, I keep error message saying "Physical file name E:\log\log_db.ldf may be incorrect." 'fnm_log' cannot be restored. Use Move command to identify a valid location for the file.

    Even though I am using Move command to move the log file.


    Then I found that if I create a drive with E: and a folder named 'log' then restore program runs alright. That is, when E:\log exists then code does run smoothly. All the restore code is looking for the presence of path of the log file from where it is been backed up. In this case it is E:\log folder. Once the database is restored I could kill that directory and nothing happens. Also log file has been restored on K:\DB only.

    Why the restore code is looking for the initial drive letter and path even though I have used Move command? Is there an issue in my code?

    Any help will be highly appreciated.

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    You have to put move statement for data files as well.

    restore log DB_1 from disk='M:\bkupc\cciclog.txt'
    WITH RESTRICTED_USER ,
    MOVE 'fnm_data' TO 'D:\db\file_1.mdf',
    MOVE 'fnm_data' TO 'F:\db\file_FG1.mdf',
    MOVE 'fnm_log' TO 'K:\DB\log_db.ldf',
    recovery, replace,RESTART

    go

  3. #3
    Join Date
    May 2007
    Posts
    3

    well of course I have move command for the data files

    Move command for the data files are present, I did not write in my mail to reduce number of words....
    Any other thoughts? this thing is killing me? Anyone from Microsoft? Is the path of the log file need to be present to restore data files and log files even though I am trying to move the files?
    Last edited by paulfl; 05-11-2007 at 03:31 PM.

  4. #4
    Join Date
    Sep 2002
    Posts
    5,938
    You mean the db you want to restore to doesn't have log file? Is e:\ a local drive on the server?

  5. #5
    Join Date
    May 2007
    Posts
    3

    Question The process

    Maybe If I write in details that might help:
    Every month we take a backup of one DB ( i.e. DB_1). Then we restore that DB in 3 other machines in different geographic locations.
    Source machine from where I am taking backup consists of 2 data files residing on two drives (D and F) and log file is residing on E drive. Backup is done is using this script onto a drive H;

    backp database DB_1
    file='fgnm1_data1',
    filegroup = 'Fg1'
    to disk = 'H:\bkupc\bk1.txt'
    with restart
    go

    backp database DB_1
    file='fnm_data' ,
    filegroup = 'PRIMARY'
    to disk = 'H:\bkupc\bk2.txt'
    with restart
    go

    backup log DB_1
    to disk = 'H:\bkupc\DB_1log.txt'
    with restart
    go


    I am using following script on the other two machines.

    RESTORE DATABASE DB_1
    file ='fnm_data',
    filegroup='PRIMARY'
    FROM disk= 'M:\bkupc\bk2.txt'
    WITH RESTRICTED_USER , MOVE 'fnm_data' TO 'D:\database\file_1.mdf',NORECOVERY ,replace,RESTART
    go

    RESTORE DATABASE DB_1
    file ='fgnm1_data1',
    filegroup='FG1'
    FROM disk= 'M:\bkupc\bk1.txt'
    WITH RESTRICTED_USER , MOVE 'fnm_data' TO 'D:\database\file_FG1.mdf',NORECOVERY ,replace,RESTART
    go

    restore log DB_1
    from disk='M:\bkupc\DB_1log.txt'
    WITH RESTRICTED_USER , MOVE 'fnm_log' TO 'K:\log\log_db.ldf', replace,RESTART
    go

    When I try to restore from backup files, I keep error message saying "Physical file name E:\log\log_db.ldf may be incorrect." 'fnm_log' cannot be restored. Use Move command to identify a valid location for the file.

    Even though I am using Move command to move the log file.

    If I create a path with E:\log on the machines where I am trying to restore DB_1, everything runs smoothly. Otherwise I get the error message. Funny thing is same code does run on one of the machines but would not run on two other machines... ANY THOUGHTS will be highly appreciated????

  6. #6
    Join Date
    Dec 2004
    Posts
    502
    Try eliminating the "REPLACE" command?

  7. #7
    Join Date
    Sep 2002
    Posts
    5,938
    All target servers have k:\ drive? Sql service account has permission on it? All of them have same version and sp level?

  8. #8
    Join Date
    May 2007
    Posts
    3

    tried removing Relace

    Tried running the code removing Replace part, still get the error msg.
    Target servers do have K drive and SQL does have permission to write on it. Server do have the same SP and pathches...REally really puzzled...

  9. #9
    Join Date
    Sep 2002
    Posts
    5,938
    Enough free space on it? Check space required with 'restore filelistonly'.

Posting Permissions

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