但是如果用old还原old数据库(即不用改逻辑文件和物理文件名字)的情况就不会出错,分分钟搞定。
郁闷中!!麻烦各位高手指点!!!!!!!先谢谢了!!!
5 个解决方案
#1
--采用强制还原试试!
RESTORE DATABASE test FROM DISK = '备份的路径' with replace,
move 'db1_Data' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\db2_data.mdf',
move 'db1_Log' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\db2_log.ldf'
RESTORE DATABASE test FROM DISK = '备份的路径' with replace,
move 'db1_Data' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\db2_data.mdf',
move 'db1_Log' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\db2_log.ldf'
#2
--示例
--对test数据库进行备份
backup database test to disk='c:\test_full.bak'
--创建test1数据库
create database test1
--直接还原test1数据库会出错
--restore database test1 from disk='c:\test_full.bak'
--取得备份文件里边的逻辑文件名称
restore filelistonly from disk='c:\test_full.bak'
--强制还原,并更改还原的路径
restore database test1 from disk='c:\test_full.bak'
with replace,
move 'test' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\test1.mdf',
move 'test_log' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\test1_log.LDF'
--删除测试数据库
drop database test1
--对test数据库进行备份
backup database test to disk='c:\test_full.bak'
--创建test1数据库
create database test1
--直接还原test1数据库会出错
--restore database test1 from disk='c:\test_full.bak'
--取得备份文件里边的逻辑文件名称
restore filelistonly from disk='c:\test_full.bak'
--强制还原,并更改还原的路径
restore database test1 from disk='c:\test_full.bak'
with replace,
move 'test' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\test1.mdf',
move 'test_log' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\test1_log.LDF'
--删除测试数据库
drop database test1
#3
谢谢楼上的朋友,但是我的还原文件old本来就是个数据库的备份文件,没有old_data和old_log,那该杂整呢?!!!
#4
强制还原 前面打勾!试试
#5
1。restore filelistonly from 设备---就可以查看你old_data和old_log
2。然后
RESTORE DATABASE test FROM DISK = '备份的路径' with replace,
move 'db1_Data' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\db2_data.mdf',
move 'db1_Log' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\db2_log.ldf'
2。然后
RESTORE DATABASE test FROM DISK = '备份的路径' with replace,
move 'db1_Data' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\db2_data.mdf',
move 'db1_Log' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\db2_log.ldf'
#1
--采用强制还原试试!
RESTORE DATABASE test FROM DISK = '备份的路径' with replace,
move 'db1_Data' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\db2_data.mdf',
move 'db1_Log' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\db2_log.ldf'
RESTORE DATABASE test FROM DISK = '备份的路径' with replace,
move 'db1_Data' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\db2_data.mdf',
move 'db1_Log' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\db2_log.ldf'
#2
--示例
--对test数据库进行备份
backup database test to disk='c:\test_full.bak'
--创建test1数据库
create database test1
--直接还原test1数据库会出错
--restore database test1 from disk='c:\test_full.bak'
--取得备份文件里边的逻辑文件名称
restore filelistonly from disk='c:\test_full.bak'
--强制还原,并更改还原的路径
restore database test1 from disk='c:\test_full.bak'
with replace,
move 'test' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\test1.mdf',
move 'test_log' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\test1_log.LDF'
--删除测试数据库
drop database test1
--对test数据库进行备份
backup database test to disk='c:\test_full.bak'
--创建test1数据库
create database test1
--直接还原test1数据库会出错
--restore database test1 from disk='c:\test_full.bak'
--取得备份文件里边的逻辑文件名称
restore filelistonly from disk='c:\test_full.bak'
--强制还原,并更改还原的路径
restore database test1 from disk='c:\test_full.bak'
with replace,
move 'test' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\test1.mdf',
move 'test_log' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\test1_log.LDF'
--删除测试数据库
drop database test1
#3
谢谢楼上的朋友,但是我的还原文件old本来就是个数据库的备份文件,没有old_data和old_log,那该杂整呢?!!!
#4
强制还原 前面打勾!试试
#5
1。restore filelistonly from 设备---就可以查看你old_data和old_log
2。然后
RESTORE DATABASE test FROM DISK = '备份的路径' with replace,
move 'db1_Data' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\db2_data.mdf',
move 'db1_Log' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\db2_log.ldf'
2。然后
RESTORE DATABASE test FROM DISK = '备份的路径' with replace,
move 'db1_Data' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\db2_data.mdf',
move 'db1_Log' to 'C:\Program Files\Microsoft SQL Server\MSSQL\data\db2_log.ldf'