bring a database size down (there is no data anymore)

for business reasons, data from a database was totally truncated, but size was not altered. They want to just keep the schema for quick reference without data. How can I shrink the whole database size back down, since there is no more space required for data and index. So, basically, not wanting to drop the DB, but want to reclaim the space on disk, and satisfying only with the schema.

thanks
LVL 6
anushahannaAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Ephraim WangoyaConnect With a Mentor Commented:

Do a backup of the database which should now be fast

From Management Studio, right click on database, go to Tasks->Shrink->Database

Taht should do the trick
0
 
Jason Yousef, MSConnect With a Mentor Sr. BI  DeveloperCommented:
I'm not really adding much but I've a screen shot that I would share.
 shrink
0
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

 
anushahannaAuthor Commented:
ok - great. why backup before shrink? does it help the shrink process better?
0
 
Jason Yousef, MSConnect With a Mentor Sr. BI  DeveloperCommented:
A full backup doesn't truncate or shrink. Only a transaction log backup will truncate the log and allow shrinkage.

In full and bulk-logged recovery you need log backups to mark log space as reusable. In simple recovery a checkpoint is sufficient (which run automatically)
0
 
Ephraim WangoyaCommented:


Full backup will truncate the log, This  marks the virtual logs as inactive that do not hold any part of the logical log.
A shrink operation will then remove the inactive virtual logs
0
 
Jason Yousef, MSConnect With a Mentor Sr. BI  DeveloperCommented:
Ewangoya: in respect to you and your Rank  and with no offense at all, we're all here to help and gain more knowledge.

but to what I know. Neither Full or Differential backups truncate the transaction log. During these backups enough of the log is backed up to provide a consistant backup. Transaction Log backups are the only backups that truncate the transaction log of commited transactions.

If you have the database using the Full Recovery model to allow for point in time recovery, you also need to implement transaction log backups between your full and/or differential backups.

http://technet.microsoft.com/en-us/library/ms189085.aspx
0
 
Ephraim WangoyaCommented:

My misquote
No offense taken, log is truncated when you backup the transaction log
0
 
Jason Yousef, MSSr. BI  DeveloperCommented:

@ewangoya: Cool :)

@anushahanna: if your question has been answered please award 'ewangoya' the points, he actually answered your question first.
0
 
anushahannaAuthor Commented:
Shrink->Database affects only the data files, right? not log files?
0
 
Jason Yousef, MSConnect With a Mentor Sr. BI  DeveloperCommented:
Yep, when you need to shrink the LOG, you select "files" and then change it to LOG
loggg.jpg
0
 
anushahannaAuthor Commented:
thanks a lot for the pictures and explanations.
0
All Courses

From novice to tech pro — start learning today.