SQL Server 2008日志大小管理问题
我试图缩小数据库的日志并将恢复设置为简单,但无论我尝试什么,总是会出现错误。
USE 4_o5;
GO
ALTER DATABASE 4_o5
SET RECOVERY SIMPLE;
GO
DBCC SHRINKFILE (4_o5_log, 10);
GO
sp_helpfile 的输出表明日志文件位于(托管解决方案)下:
I:\dataroot\4_o5_log.LDF
请帮助我执行此操作,因为导入大量数据时日志文件变得很大,现在不再需要此信息,从那时起就有多个(很多)备份。
执行上述查询时,确切的错误消息是:
incorrect syntax near '4'.
RECOVERY is not a recognized SET option.
incorrect syntax near _5_log'.
我正在使用 Visual Studio 2010(还本地安装了 SQL Server Express,在提供商处正确安装了 SQL Server 2008(共享)),
非常感谢
I'm trying to shrink the log of a database AND set the recovery to simple, but always there is an error, whatever i try.
USE 4_o5;
GO
ALTER DATABASE 4_o5
SET RECOVERY SIMPLE;
GO
DBCC SHRINKFILE (4_o5_log, 10);
GO
the output of sp_helpfile says that log file is located under (hosted solution):
I:\dataroot\4_o5_log.LDF
please help me perform this operation as the log file got large when importing a lot of data and now this info is no longer needed, have multiple (lots of) backups since then.
the exact error message when performing the query above is:
incorrect syntax near '4'.
RECOVERY is not a recognized SET option.
incorrect syntax near _5_log'.
I am using Visual Studio 2010 (also have SQL Server Express installed locally, SQL Server 2008 proper installed at provider (shared))
thnx a lot
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需执行
DBCC 也获取内部文件 ID 号,我就明白了在分离逻辑文件名和物理文件名时遇到问题...这让我假设您没有多个日志文件或 NDF 等,并且日志文件将始终为 2
但是,为什么 你还是想缩小吗?
要更改恢复模式:
ALTER DATABASE [4_o5] SET RECOVERY SIMPLE
Just do
DBCC also takes the internal file id number and I see you're having problems separating logical and physical file names... which leads me to assume you don't have multiple log files or NDFs etc and the log file will always be 2
However, why do you want to shrink anyway?
To change recovery model:
ALTER DATABASE [4_o5] SET RECOVERY SIMPLE
试试这个:
以数值开头的数据库名称有点不寻常 - 尝试将其放在方括号中。
更新:对于
DBCC SHRINKFILE
,您需要日志文件的逻辑名称 - 这是来自的name
属性sp_helpfile
调用。您还需要将其放在方括号中:Try this:
Your database name starting with a numeric value is a bit unusual - try putting it in square brackets.
UPDATE: for the
DBCC SHRINKFILE
, you need the logical name of the log file - that's thename
property from thesp_helpfile
call. And you also need to put it in square brackets: