我尝试使用以下方法备份我的主文件组(还有其他3个我不需要还原的文件组)和日志文件:
BACKUP DATABASE [dblive]
FILEGROUP = N'PRIMARY',
TO DISK = N'C:\SQL_Backups\test2_primary.bak'
WITH NOFORMAT, NOINIT,
NAME = N'dblive-Full Filegroup Backup',
SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
BACKUP LOG [dblive] TO DISK = N'C:\SQL_Backups\test2_log.bak'
WITH NOFORMAT, NOINIT,
NAME = N'dblive-Transaction Log Database Backup',
SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
我从客户站点(完全恢复模式下的db)压缩文件并在内部还原。 当我运行还原时:
RESTORE DATABASE [CustomerDB]
FROM DISK = N'C:\backups\CustomerDB\test2_primary.bak'
WITH recovery,
MOVE N'AwardsBA_DB' TO N'C:\Databases\CustomerDB\CustomerDB.mdf',
MOVE N'AwardsBA_DB_log' TO N'C:\Databases\CustomerDB\CustomerDB.ldf',
NOUNLOAD, REPLACE, STATS = 10
RESTORE LOG CustomerDB FROM DISK = 'C:\backups\CustomerDB\test2_log.bak'
WITH RECOVERY;
我收到此错误消息
“无法还原此日志,因为日志链中的空白是 已创建”
关于如何备份该主文件组并进行日志记录并在内部将其还原的任何想法?
答案 0 :(得分:0)
您将无法还原该日志,因此必须创建一个新日志。
RESTORE DATABASE [CustomerDB]
FROM DISK = N'C:\backups\CustomerDB\test2_primary.bak'
WITH recovery,
MOVE N'AwardsBA_DB' TO N'C:\Databases\CustomerDB\CustomerDB.mdf',
MOVE N'AwardsBA_DB_log' TO N'C:\Databases\CustomerDB\CustomerDB.ldf',
NOUNLOAD, REPLACE, STATS = 10
ALTER DATABASE [CustomerDB] SET EMERGENCY, SINGLE_USER
ALTER DATABASE [CustomerDB] REBUILD LOG ON (NAME= AwardsBA_DB_log, FILENAME='C:\Databases\CustomerDB\CustomerDB_1.ldf')
ALTER DATABASE CNBILL SET ONLINE, MULTI_USER