我正在尝试在centos服务器中还原mssql文件。 .bak文件已经放置在服务器内部,并且使用户成为mssql。
[![在此处输入图片描述] [1]] [1]
这是我运行此命令进行还原时的错误。
sqlcmd -S localhost -U SA -Q "BACKUP DATABASE [DataDB] TO DISK = N'/var/opt/mssql/data/DataDB.bak' WITH NOFORMAT, NOINIT, NAME = 'demodb-full', SKIP, NOREWIND, NOUNLOAD, STATS = 10"
输入此命令后,它将显示此错误。 [![在此处输入图片描述] [2]] [2]
对于这种问题,我如何通过centos更改扇区大小?或必须使用SQL资源管理器管理。
[root@RAC data]# sqlcmd -S localhost -U SA -Q "RESTORE DATABASE [DataDB] FROM DISK = N'/var/opt/mssql/data/DataDB.bak' WITH FILE = 1, NOUNLOAD, REPLACE, NORECOVERY, STATS = 5"
Password:
Msg 5133, Level 16, State 1, Server RAC, Line 1
Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\DataDB.mdf" failed with the operating system error 2(The system cannot find the file specified.).
Msg 3156, Level 16, State 3, Server RAC, Line 1
File 'DataDB' cannot be restored to 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\DataDB.mdf'. Use WITH MOVE to identify a valid location for the file.
Msg 5133, Level 16, State 1, Server RAC, Line 1
Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\DataDB_log.ldf" failed with the operating system error 2(The system cannot find the file specified.).
Msg 3156, Level 16, State 3, Server RAC, Line 1
File 'DataDB_log' cannot be restored to 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\DataDB_log.ldf'. Use WITH MOVE to identify a valid location for the file.
Msg 3119, Level 16, State 1, Server RAC, Line 1
Problems were identified while planning for the RESTORE statement. Previous messages provide details.
Msg 3013, Level 16, State 1, Server RAC, Line 1
RESTORE DATABASE is terminating abnormally.
答案 0 :(得分:0)
我不是为什么要在备份时先将备份的副本放到服务器上;这是没有意义的。如果您确实尝试RESTORE
数据库,但是您正在执行BACKUP
。考虑到问题在于您要覆盖的文件具有不同的扇区格式,我建议先删除该文件,然后再备份:
rm /var/opt/mssql/data/DataDB.bak && sqlcmd -S localhost -U SA -Q "BACKUP DATABASE [DataDB] TO DISK = N'/var/opt/mssql/data/DataDB.bak' WITH NOFORMAT, NOINIT, NAME = 'demodb-full', SKIP, NOREWIND, NOUNLOAD, STATS = 10"
答案 1 :(得分:0)
仅还原文件列表 从磁盘= N'/ var / opt / mssql / data / DataDB.bak'WITH FILE = 1
您需要验证备份列表。
还原数据库dbane 从磁盘='/var/opt/mssql/data/DataDB.bak'' 与 将“逻辑名称”移动到“ linuxth \ dbname.mdf”, 将'逻辑名称'移动到' linuxth \ DEMO_Winmedicare.ldf',恢复;