Msg 3159 The tail of the log for the database "" has not been backedup
2013-02-05 09:44
651 查看
还原数据库文件组的时候出现下面的错误:
Msg 3159, Level 16, State 1, Line 1
The tail of the log for the database "testfile" has not been backedup. Use BACKUP LOG WITH NORECOVERY to backup the log if it contains work you donot want to lose. Use the WITH REPLACE or WITH STOPAT clause of the RESTOREstatement to just overwrite the contents
of the log.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
解决这个问题有两个方法:
1. 备份尾日志:如果数据库遇到问题,并且确定尾部日志有一些需要的信息,这时备份尾部日志非常有用。
--backup primaryfilegroup
backup database [testfile] FILEGROUP=
N'PRIMARY' TO
DISK =N'd:\Primary.bak'
--backupsecondary filegroup
backup database [testfile] FILEGROUP=
N'test1' TO
DISK =N'd:\secondeary.bak'
--backup log
backup log [testfile]to
disk ='d:\log.trn'
--backup taillog
backup log [testfile]to
disk ='d:\log1.trn'
withnorecovery
--restoreprimary filegroup
restore database testfile filegroup='PRIMARY'
from DISK
=N'd:\Primary.bak'
withnorecovery
--restoresecondary filegroup
restore database testfile filegroup='test1'
from DISK
=N'd:\secondeary.bak'withnorecovery
--restore firstlog with norecovery
RESTORE LOG [testfile]FROM
DISK =
N'd:\log.trn' WITH FILE
= 1, norecovery,
NOUNLOAD,
STATS= 10
--restore taillog with recovery
RESTORE LOG [testfile]FROM
DISK =
N'd:\log1.trn' WITH FILE
= 1, recovery,
NOUNLOAD,
STATS= 10
2. 如果不能备份日志尾部,则使用 RESTORE语句中的WITH STOPAT
或 WITH REPLACE子句。
--backup primaryfilegroup
backup database [testfile] FILEGROUP=
N'PRIMARY' TO
DISK =N'd:\Primary.bak'
--backupsecondary filegroup
backup database [testfile] FILEGROUP=
N'test1' TO
DISK =N'd:\secondeary.bak'
--backup log
backup log [testfile]to
disk ='d:\log.trn'
--restoreprimary filegroup
restore database testfile filegroup='PRIMARY'
from DISK
=N'd:\Primary.bak'
withreplace,norecovery
--restoresecondary filegroup
restore database testfile filegroup='test1'
from DISK
=N'd:\secondeary.bak'withnorecovery
--restore firstlog with norecovery
RESTORE LOG [testfile]FROM
DISK =
N'd:\log.trn' WITH FILE
= 1, recovery,
NOUNLOAD,
STATS= 10
更多信息参考:MSSQLSERVER_3159http://msdn.microsoft.com/en-us/library/bb283410.aspx
Msg 3159, Level 16, State 1, Line 1
The tail of the log for the database "testfile" has not been backedup. Use BACKUP LOG WITH NORECOVERY to backup the log if it contains work you donot want to lose. Use the WITH REPLACE or WITH STOPAT clause of the RESTOREstatement to just overwrite the contents
of the log.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
解决这个问题有两个方法:
1. 备份尾日志:如果数据库遇到问题,并且确定尾部日志有一些需要的信息,这时备份尾部日志非常有用。
--backup primaryfilegroup
backup database [testfile] FILEGROUP=
N'PRIMARY' TO
DISK =N'd:\Primary.bak'
--backupsecondary filegroup
backup database [testfile] FILEGROUP=
N'test1' TO
DISK =N'd:\secondeary.bak'
--backup log
backup log [testfile]to
disk ='d:\log.trn'
--backup taillog
backup log [testfile]to
disk ='d:\log1.trn'
withnorecovery
--restoreprimary filegroup
restore database testfile filegroup='PRIMARY'
from DISK
=N'd:\Primary.bak'
withnorecovery
--restoresecondary filegroup
restore database testfile filegroup='test1'
from DISK
=N'd:\secondeary.bak'withnorecovery
--restore firstlog with norecovery
RESTORE LOG [testfile]FROM
DISK =
N'd:\log.trn' WITH FILE
= 1, norecovery,
NOUNLOAD,
STATS= 10
--restore taillog with recovery
RESTORE LOG [testfile]FROM
DISK =
N'd:\log1.trn' WITH FILE
= 1, recovery,
NOUNLOAD,
STATS= 10
2. 如果不能备份日志尾部,则使用 RESTORE语句中的WITH STOPAT
或 WITH REPLACE子句。
--backup primaryfilegroup
backup database [testfile] FILEGROUP=
N'PRIMARY' TO
DISK =N'd:\Primary.bak'
--backupsecondary filegroup
backup database [testfile] FILEGROUP=
N'test1' TO
DISK =N'd:\secondeary.bak'
--backup log
backup log [testfile]to
disk ='d:\log.trn'
--restoreprimary filegroup
restore database testfile filegroup='PRIMARY'
from DISK
=N'd:\Primary.bak'
withreplace,norecovery
--restoresecondary filegroup
restore database testfile filegroup='test1'
from DISK
=N'd:\secondeary.bak'withnorecovery
--restore firstlog with norecovery
RESTORE LOG [testfile]FROM
DISK =
N'd:\log.trn' WITH FILE
= 1, recovery,
NOUNLOAD,
STATS= 10
更多信息参考:MSSQLSERVER_3159http://msdn.microsoft.com/en-us/library/bb283410.aspx
相关文章推荐
- Restore SQL Server 2005 error : "The tail of the log for the database "TEST1" has not been backed up."
- The concurrent snapshot for publication 'xxx' is not available because it has not been fully generated or the Log Reader Agent is not running to activate it
- “Location of the Android SDK has not been set up in the preferences”问题的解决
- Registration has not been run for all of the FEAT directories
- “Location of the Android SDK has not been set up in the preferences”问题的解决
- [TroubleShooting] The remote copy of database xx has not been rolled forward to a point in time
- 关于Location of the Android SDK has not been setup in the preferences的解决方法
- [TroubleShooting] The remote copy of database xx has not been rolled forward to a point in time
- 打开eclipse的opens the android sdk and avd manager提示错误:error:location of the android sdk has not been
- The maximum number of apps for free development profiles has been reached
- Unity 中常见错误之一UnassignedReferenceException: The variable button of CityScript has not been assigned.
- "Copy" did not complete normally. Please see the log for more information
- android 关于Location of the Android SDK has not been setup in the preferences的解决方法
- Solve VS2010 Error "Exceptions has been thrown by the target of an invocation"
- "Copy" did not complete normally. Please see the log for more information.
- The connection pool for database '/data/data/....db' has been unable to grant a connection to thread
- 处理rdlc “A data source instance has not been supplied for the data source”
- Cannot complete the request.This installation has not been configured properly for Software Updates.
- Model compatibility cannot be checked because the database does not contain model metadata. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions