Restore db from network location

  • Hi

    By default SQL do not detect network location. U can use below command to restore DB from the network location:

    DBCC TRACEON (1807)

    RESTORE DATABASE MyDb

    FROM Disk = '\\server\f\SQL Backup\ABCD.bak'

    WITH RECOVERY,REPLACE,

    MOVE 'Test_Data' TO '\\server\f\MyDb.MDF', 

    MOVE 'Test_LOG' TO '\\server\f\MyDb.LDF'

    u can ignore MOVE clause if u want to continue with the existing logical file.

    Hope it'll work for u.

    Amit

  • Mapped network shares are not visible to SQL when running on Windows 2003.  To restore from the network have to be done using UNC like Amit showed above.

  • Be very carefull !!

     

    DBCC TRACEON (1807) : Allows you to configure SQL Server with network-based database files. Not recommended because it’s difficult to guarantee IO at the network device !

     

    This is not what you meanth !

    You just wanted to restrore a db from a bak-file residing on a network drive.

    Amit Kumar's example also puts the db-files on a network drive !

     

    What you want is :

    Restore database DDBAStatisticsJOBI

      from disk='\\yourserver\yourshare\Fullbackup.BAK'

     with MOVE N'db_Data' TO N'd:\MSSQL\data\DB_Data.mdf'

     , MOVE N'db_Log' TO N'E:\MSSQL\DB_log.ldf'

    -- , replace -- if needed !!

     , recovery

    Your SQLServer service account (or sqlagent service account ) needs access to the unc-file !

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data and code to get the best help

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution πŸ˜€

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

Viewing 3 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply