Monday, March 19, 2012

Msg 5133, Level 16, State 1, Line 1

Hi all,
I am try to restore a database from external hard drive and I am get the
errors below. Do you have any ideas how to resolve these errors?. Thank you
in advance.
Errors:
Msg 5133, Level 16, State 1, Line 1
Directory lookup for the file "E:\Microsoft SQL
Server\MSSQL.1\MSSQL\DATA\SCData_prosum.mdf" failed with the operating system
error 3(The system cannot find the path specified.).
Msg 3156, Level 16, State 3, Line 1
File 'SCData_prosum' cannot be restored to 'E:\Microsoft SQL
Server\MSSQL.1\MSSQL\DATA\SCData_prosum.mdf'. Use WITH MOVE to identify a
valid location for the file.
Msg 3119, Level 16, State 1, Line 1
Problems were identified while planning for the RESTORE statement. Previous
messages provide details.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
-- Create databse file under: c:\mssql\data\...
c\msssql\Log\....
-- Here is my script try to restore the database.
EXECute Master.dbo.sp_dboption 'SCData_prosum', 'Single', True
GO
PRINT 'Begin restore SCData_prosum database, please wait...'
RESTORE DATABASE SCData_prosum
FROM DISK = 'C:\MSSQL\Backup\SCData_Prosum\SCData_prosum_backup_200709061759.bak'
WITH REPLACE,
RECOVERY,
STATS = 10
GO
EXECute Master.dbo.sp_dboption 'SCData_prosum', 'Single', False
GOHi
Does the directory "E:\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\" exist?
If not you will need to change the location of where the database file will
be placed
e.g. ( be careful if this wraps around)
RESTORE DATABASE SCData_prosum
FROM DISK ='C:\MSSQL\Backup\SCData_Prosum\SCData_prosum_backup_200709061759.bak'
WITH MOVE 'SCData_prosum_Data' TO 'C:\Microsoft SQL
Server\MSSQL.1\MSSQL\DATA\SCData_prosum.mdf',
MOVE 'SCData_prosum_Log' TO ''C:\Microsoft SQL
Server\MSSQL.1\MSSQL\DATA\SCData_prosum.ldf';
GO
To get the name of the logical files and where it expects to put them you
can use
RESTORE FILELISTONLY SCData_prosum
FROM DISK ='C:\MSSQL\Backup\SCData_Prosum\SCData_prosum_backup_200709061759.bak'
GO
If the directory does exist then it may be a permissions issue.
John
"Lam Nguyen" wrote:
> Hi all,
> I am try to restore a database from external hard drive and I am get the
> errors below. Do you have any ideas how to resolve these errors?. Thank you
> in advance.
> Errors:
> Msg 5133, Level 16, State 1, Line 1
> Directory lookup for the file "E:\Microsoft SQL
> Server\MSSQL.1\MSSQL\DATA\SCData_prosum.mdf" failed with the operating system
> error 3(The system cannot find the path specified.).
> Msg 3156, Level 16, State 3, Line 1
> File 'SCData_prosum' cannot be restored to 'E:\Microsoft SQL
> Server\MSSQL.1\MSSQL\DATA\SCData_prosum.mdf'. Use WITH MOVE to identify a
> valid location for the file.
> Msg 3119, Level 16, State 1, Line 1
> Problems were identified while planning for the RESTORE statement. Previous
> messages provide details.
> Msg 3013, Level 16, State 1, Line 1
> RESTORE DATABASE is terminating abnormally.
> -- Create databse file under: c:\mssql\data\...
> c\msssql\Log\....
> -- Here is my script try to restore the database.
> EXECute Master.dbo.sp_dboption 'SCData_prosum', 'Single', True
> GO
> PRINT 'Begin restore SCData_prosum database, please wait...'
> RESTORE DATABASE SCData_prosum
> FROM DISK => 'C:\MSSQL\Backup\SCData_Prosum\SCData_prosum_backup_200709061759.bak'
> WITH REPLACE,
> RECOVERY,
> STATS = 10
> GO
> EXECute Master.dbo.sp_dboption 'SCData_prosum', 'Single', False
> GO
>|||You are trying to replace your backup as John mentions.
If you are using SSMS to restore your backup then in the Restore Database
window click to Options from the left panel and check out "Restore the
database files as:" in the list view, you will see 3 columns. One of them is
Original File Name and the other is Restore As.
Both columns' values must be the same in your situation and they both must
be "E:\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\SCData_prosum.mdf" so your
restore operation fails.
Change the values in the Restore As column. So you will be able to restore
your backup successfully.
--
Ekrem Ã?nsoy
"Lam Nguyen" <LamNguyen@.discussions.microsoft.com> wrote in message
news:DE41AA77-9CA3-427A-888C-F759BA1AFD07@.microsoft.com...
> Hi all,
> I am try to restore a database from external hard drive and I am get the
> errors below. Do you have any ideas how to resolve these errors?. Thank
> you
> in advance.
> Errors:
> Msg 5133, Level 16, State 1, Line 1
> Directory lookup for the file "E:\Microsoft SQL
> Server\MSSQL.1\MSSQL\DATA\SCData_prosum.mdf" failed with the operating
> system
> error 3(The system cannot find the path specified.).
> Msg 3156, Level 16, State 3, Line 1
> File 'SCData_prosum' cannot be restored to 'E:\Microsoft SQL
> Server\MSSQL.1\MSSQL\DATA\SCData_prosum.mdf'. Use WITH MOVE to identify a
> valid location for the file.
> Msg 3119, Level 16, State 1, Line 1
> Problems were identified while planning for the RESTORE statement.
> Previous
> messages provide details.
> Msg 3013, Level 16, State 1, Line 1
> RESTORE DATABASE is terminating abnormally.
> -- Create databse file under: c:\mssql\data\...
> c\msssql\Log\....
> -- Here is my script try to restore the database.
> EXECute Master.dbo.sp_dboption 'SCData_prosum', 'Single', True
> GO
> PRINT 'Begin restore SCData_prosum database, please wait...'
> RESTORE DATABASE SCData_prosum
> FROM DISK => 'C:\MSSQL\Backup\SCData_Prosum\SCData_prosum_backup_200709061759.bak'
> WITH REPLACE,
> RECOVERY,
> STATS = 10
> GO
> EXECute Master.dbo.sp_dboption 'SCData_prosum', 'Single', False
> GO
>

No comments:

Post a Comment