Solved

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

Posted on 2011-03-10
12
273 Views
Last Modified: 2012-06-27
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
0
Comment
Question by:anushahanna
  • 5
  • 3
  • 3
  • +1
12 Comments
 
LVL 32

Accepted Solution

by:
ewangoya earned 84 total points
ID: 35101249

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
 
LVL 9

Assisted Solution

by:AriMc
AriMc earned 83 total points
ID: 35101255
0
 
LVL 21

Assisted Solution

by:Jason Yousef, MS
Jason Yousef, MS earned 333 total points
ID: 35101579
I'm not really adding much but I've a screen shot that I would share.
 shrink
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 6

Author Comment

by:anushahanna
ID: 35103054
ok - great. why backup before shrink? does it help the shrink process better?
0
 
LVL 21

Assisted Solution

by:Jason Yousef, MS
Jason Yousef, MS earned 333 total points
ID: 35103148
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
 
LVL 32

Expert Comment

by:ewangoya
ID: 35103254


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
 
LVL 21

Assisted Solution

by:Jason Yousef, MS
Jason Yousef, MS earned 333 total points
ID: 35103316
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
 
LVL 32

Expert Comment

by:ewangoya
ID: 35103596

My misquote
No offense taken, log is truncated when you backup the transaction log
0
 
LVL 21

Expert Comment

by:Jason Yousef, MS
ID: 35103677

@ewangoya: Cool :)

@anushahanna: if your question has been answered please award 'ewangoya' the points, he actually answered your question first.
0
 
LVL 6

Author Comment

by:anushahanna
ID: 35103780
Shrink->Database affects only the data files, right? not log files?
0
 
LVL 21

Assisted Solution

by:Jason Yousef, MS
Jason Yousef, MS earned 333 total points
ID: 35103876
Yep, when you need to shrink the LOG, you select "files" and then change it to LOG
loggg.jpg
0
 
LVL 6

Author Comment

by:anushahanna
ID: 35143766
thanks a lot for the pictures and explanations.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how the fundamental information of how to create a table.

822 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question