집 >데이터 베이스 >MySQL 튜토리얼 >SQLSERVER手动增长日志文件和数据文件
SQLSERVER 手动 增长 日志 文件 和 数据 文件 手动 增长 日志 文件 ,实际上就是修改 日志 文件 的大小 size 的单位是MB 下面设置 日志 文件 大小是2048MB ALTER DATABASE [ GPOSDB ] MODIFY FILE (name = GPOSDB_Log,size = 2048 ) EXEC sys.[sp_helpdb] @d
手动增长日志文件,实际上就是修改日志文件的大小 size 的单位是MB
下面设置日志文件大小是2048MB
<span>ALTER</span> <span>DATABASE</span> <span>[</span><span>GPOSDB</span><span>]</span> MODIFY <span>FILE</span>(name<span>=</span>GPOSDB_Log,size<span>=</span><span>2048</span>)
EXEC sys.[sp_helpdb] @dbname = [GPOSDB] -- sysname
<span>--</span><span>收缩<strong>日志</strong><strong><strong>文件</strong></strong> </span> <span>USE</span> <span>[</span><span>GPOSDB</span><span>]</span> <span>GO</span> <span>ALTER</span> <span>DATABASE</span> <span>[</span><span>GPOSDB</span><span>]</span> <span>SET</span><span> RECOVERY SIMPLE; </span><span>GO</span> <span>--</span><span>设置简单恢复模式 </span> <span>DBCC</span> SHRINKFILE (GPOSDB_Log, <span>1</span><span>); </span><span>GO</span> <span>--</span><span>恢复为原模式</span> <span>ALTER</span> <span>DATABASE</span> <span>[</span><span>GPOSDB</span><span>]</span> <span>SET</span> RECOVERY <span>FULL</span><span>; </span><span>GO</span>
-----------------------------------------------------------------
--手动增长数据文件,实际上就是修改数据文件的大小 size 的单位是MB 下面设置日志文件大小是2048MB
<span>ALTER</span> <span>DATABASE</span> <span>[</span><span>GPOSDB</span><span>]</span> MODIFY <span>FILE</span>(name<span>=</span>GPOSDB_Data,size<span>=</span><span>2048</span>)
EXEC sys.[sp_helpdb] @dbname = [GPOSDB] -- sysname
--收缩数据文件 收缩为2MB
<span>USE</span> <span>[</span><span>GPOSDB</span><span>]</span> <span>GO</span> <span>DBCC</span> SHRINKFILE (N<span>'</span><span>GPOSDB_Data</span><span>'</span> , <span>2</span><span>) </span><span>GO</span>
如有不对的地方,欢迎大家拍砖o(∩_∩)o