<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alikaravi.ir/index.php?action=history&amp;feed=atom&amp;title=Sql_Shrink</id>
	<title>Sql Shrink - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alikaravi.ir/index.php?action=history&amp;feed=atom&amp;title=Sql_Shrink"/>
	<link rel="alternate" type="text/html" href="https://wiki.alikaravi.ir/index.php?title=Sql_Shrink&amp;action=history"/>
	<updated>2026-06-22T13:48:49Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.40.1</generator>
	<entry>
		<id>https://wiki.alikaravi.ir/index.php?title=Sql_Shrink&amp;diff=93&amp;oldid=prev</id>
		<title>Karavi: Created page with &quot;/*Script to shrink all databases*/   declare @db varchar(255)  declare c cursor for  select name from sys.databases where is_read_only=0 and state=0   and name not in (&#039;master&#039;,&#039;model&#039;,&#039;tempdb&#039;,&#039;msdb&#039;)  open c  fetch c into @db  while @@fetch_status=0  begin   exec SP_dboption @db,&#039;trunc. log on chkpt.&#039;,&#039;true&#039;    DBCC shrinkdatabase (@db,10)   fetch next from c into @db  end  close c  deallocate c&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.alikaravi.ir/index.php?title=Sql_Shrink&amp;diff=93&amp;oldid=prev"/>
		<updated>2025-01-11T10:43:24Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Script to shrink all databases: &lt;/span&gt;   declare @db varchar(255)  declare c cursor for  select name from sys.databases where is_read_only=0 and state=0   and name not in (&amp;#039;master&amp;#039;,&amp;#039;model&amp;#039;,&amp;#039;tempdb&amp;#039;,&amp;#039;msdb&amp;#039;)  open c  fetch c into @db  while @@fetch_status=0  begin   exec SP_dboption @db,&amp;#039;trunc. log on chkpt.&amp;#039;,&amp;#039;true&amp;#039;    DBCC shrinkdatabase (@db,10)   fetch next from c into @db  end  close c  deallocate c&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;/*Script to shrink all databases*/&lt;br /&gt;
&lt;br /&gt;
 declare @db varchar(255)&lt;br /&gt;
 declare c cursor for&lt;br /&gt;
 select name from sys.databases where is_read_only=0 and state=0&lt;br /&gt;
  and name not in (&amp;#039;master&amp;#039;,&amp;#039;model&amp;#039;,&amp;#039;tempdb&amp;#039;,&amp;#039;msdb&amp;#039;)&lt;br /&gt;
 open c&lt;br /&gt;
 fetch c into @db&lt;br /&gt;
 while @@fetch_status=0&lt;br /&gt;
 begin&lt;br /&gt;
  exec SP_dboption @db,&amp;#039;trunc. log on chkpt.&amp;#039;,&amp;#039;true&amp;#039; &lt;br /&gt;
  DBCC shrinkdatabase (@db,10)&lt;br /&gt;
  fetch next from c into @db&lt;br /&gt;
 end&lt;br /&gt;
 close c&lt;br /&gt;
 deallocate c&lt;/div&gt;</summary>
		<author><name>Karavi</name></author>
	</entry>
</feed>