Shrinking Database File After Removing Data

Apr 20, 2007

Hi there,

I have a large (420GB) database that has never had data archived off before. I taken a backup to a test server and run a script supplied by the product vendor which has removed a large ammount of old data no longer required.

I have checked within enterprise manager that this data has now gone, however the actual file itself has not shrunk in size. Is there a further step I need to take to get back the space.

Kind Regards

View 2 Replies


ADVERTISEMENT

Problem Shrinking Data File

Dec 3, 2007

(SQL 2005) I have a few databases that are currently hovering at around 150GB. (The following only concerns the .mdf) Of this total size, only about 90GB is real data. The other 60-70 is data from unecessary audit tables. Recently, we've been having some space issues on a 1.7TB server. We've decided that deleting these audit tables and reclaiming the 60-70GB per database is the route we're going to take.

What we did: DELETE <table> (per audit table). Now, it shows that the database size is ~90GB and there is the 60-70GB of unallocated space.

Then, we ran a DBCC SHRINKDATABASE (db_name) overnight. Checked space the next morning and only about 10GB had been reclaimed. We've tried a number of other alternatives of which, none have been successful.

(DBCC SHRINKFILE(file, space), drop and recreate tables, etc.)

Can anyone think of any reason why these commands would not be working? If I can provide any additional information, please let me know.

Thank you in advance for any input!

View 5 Replies View Related

DBCC Shrinkfile Not Shrinking Data File

Jan 31, 2002

On a SQL Server 7.0 database I support, I've been unsuccessful trying to shrink a data file using dbcc shrinkfile (datafile_logical_name, 0). This worked fine for shrinking the log, but of the 4 datafiles that were created 2 shrank successfully and 2 remain unchanged. Unless the information on the General Tab on Enterprise Manager is incorrect, of the 15000MB allocated for one of the files, only 700 MB are used.

View 1 Replies View Related

Will Database Shrinking Affect The Data?

Aug 6, 2004

Hi all,

does the shrinking of the database affect the data in the database, such as will it change the data, or deleting the data away?

Thanx

View 1 Replies View Related

Removing Data From A Sqlserver Database.

Sep 10, 2007

I would like to remove data from a sqlserver database but keep the structure the the db. How would I do this?

View 9 Replies View Related

Shrinking The Log File

Apr 25, 2002

I have a 13 Gig Log File with only 121 Mgs of space used. I have run the DBCCSHRINKFILE command and it has shrunk it by about 100 Mgs. Why can't I get it to shrink to a reasonable size.

View 2 Replies View Related

Shrinking Db File

Sep 18, 2001

Have a 6G data file in a single filegroup.

Using dbcc shrinkfile to shrink.

Does not have any effect.

Any ideas?

View 1 Replies View Related

Shrinking The Log File

Sep 15, 2000

Hi, is there any other way to shrink the log file other than truncating every time it gets bigger... I have a 800MGs database and the log is getting as big as 11Gigs... any suggestions other than truncating it? Is there a way to set it off?

View 1 Replies View Related

Shrinking Log File

Nov 29, 2000

I'm trying to shrink the log file. I have used the suggestions that I have seen posted previously. This is the script I've been using.

DECLARE @DB VARCHAR(40)

SELECT @DB = 'PBDSSTEST'

CHECKPOINT

EXEC('DBCC SHRINKFILE ('+@DB+'_log, 1, NOTRUNCATE)')

EXEC('DBCC SHRINKFILE ('+@DB+'_log, 1, TRUNCATEONLY)')

CREATE TABLE t2 (char1 char(4000))

DECLARE @i int SELECT @i = 0 WHILE (@i < 300) begin INSERT t2 values ('a') SELECT @i = @i +1 END DROP TABLE t2

BACKUP LOG PBDSSTEST TO PBDSSTESTLOGBACKUP

Before I ran this the used portion of the log was 1795.12 MB, the free was 1570.50 MB for a total of 3365.62 MB.

After completing this the used portion was 25.62 MB, the free space was 3263.50 for a total of 3289.12 MB. It only srhunk about 26 MB. Why won't it shrink it anymore. There was plenty of data in the used at the time of the shrinkfile command so I would have thought it would have shrunk it a lot more.
Please help. I don't understand why it won't shrink it anymore than it did.

View 4 Replies View Related

Shrinking Log File

Oct 12, 2004

When I try to shrink the log file for my databases I am getting following message.

Cannot shrink log file 2 (cm_archive_mp_Log) because all logical log files are in use.
what should I do to successfully shrink the log file.
Thanks.

View 1 Replies View Related

Log File Shrinking

Nov 8, 2006

how can we shrink the log file to the required size without affecting the live database .....

Thanks in advance

View 2 Replies View Related

Shrinking Log File

Aug 29, 2007


I have a problem with shrinking a log file on SQL 2000. The log file has grown to 25gb (the db is 30gb) . The DB was in simple recover mode but I have changed it to full so that the log file can be backed up. I have run the dbcc shrinkfile on the log file several times (plus log file backups) and it has increased the logfile size. Each time I have run shrinkfile I get €˜Cannot shrink log file 2 (db_Log) because all logical log files are in use€™ message. I have used the dbcc loginfo command and this shows that all the virtual log files are in use. The db also publishes 4 snapshot replications. Any suggestion for how I can easily shrink the log file?


thanks

Simon

View 5 Replies View Related

Shrinking 2000 Log File

Aug 13, 2001

I have a database that was loaded with large amounts of data before today. I backup up the db and trans log. presently the DB file is 328 while the trans log show 428 meg with only 28 meg being used. If I try to shrink either the database or the log files, the log file wil not shrink.. It tells me to set it to a minimum of 28 meg but still not shirnk. I realize this was a problem in 7, any quick fixes, in a hurry. Running SQL 2000 SP1

View 1 Replies View Related

Automatic Log File Shrinking

Oct 16, 2007

I'd like to create a stored procedure to automatically shrink the transaction log file on a certain database monthly. As I am not the DB admin (it's a web-based db on a remote server), I'd like to put together a script to create the procedure so I can just send it to the DB admin to run. It seems like it should be pretty easy, but I'm still pretty new to SQL server. Is anyone able to give me some pointers?

View 1 Replies View Related

Shrinking A Log File Every Night

Dec 13, 2007



I have a relatively high usage 2005 database whose transaction log grows every day.

Untill now I have been manually shrinking the log files .. but I would like to automate this process.

In the maintenance schedule that runs every night

1 Do a full backup to disk
2. Do a transaction log backup to disk
3. run the following TSQL

USE [MyDB];
GO
ALTER DATABASE MyDB
SET RECOVERY SIMPLE;
GO
DBCC SHRINKFILE (MyDB_log, 3000)
GO
ALTER DATABASE MyDB
SET RECOVERY FULL;
GO

4. Backup disk files to tape.

however it doesn't work !! the TLOG file does not shrink, even though its the same as the manual job that I run?

There is nothing in the SQL logs .. but in the event log I get

Event Type: Error
Event Source: SQLISPackage
Event Category: None
Event ID: 12291
Date: 13/12/2007
Time: 00:50:10
User: NT AUTHORITYSYSTEM
Computer: ALGSQL1
Description:
Package "MyDB_FULL_BACKUP" failed.
For more information, see Help and Support Center

any ideas ?

View 8 Replies View Related

Difference Between Shrinking A DB And A FILE

Jun 14, 2006

Hi,

What is the difference between shrinking a DB with that of a file.

When you select a DB to shrink will it not shrink all the files in it.

Because when I select Files to shrink it does not prompt me with
a specific file.

So I am confused as to why SQL server 2K5 asks if you need to shrink DB or FILE

Tnx

View 1 Replies View Related

Shrinking The Log File On A DB That Is Mirrored

Nov 17, 2006



Hello,

I'm having couple of DB that are mirrored.

my concerne is regarding the Log file size.

I'm running the following steps:

BACKUP DATABASE [DBName] TO DISK = N'Backup_File' WITH NOFORMAT, INIT, SKIP, NOREWIND, NOUNLOAD, STATS = 10

then

BACKUP LOG [DBName] TO DISK = N'Backup_File' WITH NOFORMAT, NOINIT, SKIP, NOREWIND, NOUNLOAD, STATS = 10

if I try to run a SHRINKFILE (DBName_log, 20)

I receive the following info:

Cannot shrink log file 2 (DBName_log) because all logical log files are in use

I'n a bit tense using a

BACKUP LOG [DBName] WITH TRUNCATE_ONLY

as it's part of a mirroring.

but I need to reduce the size of the log file.

thank four your suggestions

Eric

View 10 Replies View Related

Shrinking .ldf File And .mdf File In Sql Server

Jan 27, 2008



please advice me what does .ldf file consist of and can i shrink the .ldf , is it adviceble to shrink after the backup and how frequently it can be done on a production db



please advice me ,can i shrink the .mdf , it is adviceble to shrink after the backup and how frequently it can be done on a production db


Thanks

View 4 Replies View Related

Shrinking 27GB LDF File (solved)

Jan 8, 2007

Hi,

I have an interesting problem here. I am running SQL Server 2005 and have a large database. After running some scalability tests over the weekend my MDF file size went up to 25GB and LDF file size went up to 27GB filling up all available disk space. I didn't do any backups, so it is understandable why the LDF file size is so large.

Now I am trying to shrink the LDF file. However, DBCC LOGINFO indicated that all LVFs within the LDF are active (Status = 2). I detached the database to make sure no active connections exist and ran CHECKPOINT, but still DBCC LOGINFO lists all LVFs with status 2. Since all LVFs are up to date I can't shrink my LDF file.

Why are all LVFs still active after detach/attach and checkpoint?
How can I shrink the LDF file?

Thanks.

Alec

View 1 Replies View Related

Ex Post Shrinking File Sizes

Jul 20, 2005

Is there a fairly quick and dirty way to shrink the file size allowedfor a DB on SQL server after the DB is in use?Our old DBA allowed 3 gb for log files and we don't need nearly thatmuch. However, the space is still being used and reserved. Can Ishrink that "maximum" and clear up the space?I don't want to just copy all the tables and primary keys and open anew one with the new data, though that is plan A right now.I cant just change sysfiles, it yells at me.

View 1 Replies View Related

Shrinking Log File In Conjuction With Log Shipping

Apr 19, 2007

I've been searching and reading for best practices on how to maintain a reasonable log file size while engaging in Log Shipping. I have found plenty of information on these subjects on their own, but not on how best to shrink your log size without breaking your log shipping integrity.



I apprecaite your help.

View 1 Replies View Related

Shrinking Unreasonably Large Transaction Log File.

Oct 12, 2002

Gurus,

I have inherited a SQL 2000 database ( (I am new to SQL DBA) and I found this when I was checking the db properites . The transaction log has grown bigger than the actual data file, I thought transaction log backups would truncate the inactive portion of the log file and shrink the transaction log, but it was not the case it seems, may be it was truncating the inactive portion of the log, but not shrinking it. This site does not have a job for truncating the data/log files periodically. What is the best method to deal this situation, how can I shrink the Transaction log quickly?,

All your suggestions are welcome.

TIA,
-Jay

View 2 Replies View Related

Shrinking LDF File - Query Running Indefinitely

Jul 7, 2004

My intention is to include a sql job to schedule for shrinking log files to half of its original log file size (if half of their original size is greater than 5MB)

The code is below. But while executing the code it is keeps on running indefinitely. can somebody throw some light what cause it to go into an indefinite loop.

Thanks
Babu

code:
====
DECLARE db_file_name CURSOR FOR
SELECT name , ceiling(size/128.0) * 0.5
FROM master..sysaltfiles
Where rtrim(lower(filename)) like '%.ldf'

DECLARE @f_name varchar(128), @new_f_size int

OPEN db_file_name
FETCH NEXT FROM db_file_name INTO @f_name,@new_f_size
WHILE @@FETCH_STATUS = 0
BEGIN
If ( @new_f_size > 5)
BEGIN
DBCC SHRINKFILE ( @f_name, @new_f_size )
FETCH NEXT FROM db_file_name INTO @f_name,@new_f_size
END
END
CLOSE db_file_name
deallocate db_file_name

View 6 Replies View Related

SQL 2012 :: VLF And Log File Shrinking With Logshipping Configuration?

Aug 23, 2015

We are using Sql server 2012. One of our production database has hight no of vlfs. We are planning to shrink the logfile to reduce the no of VLFs but the database is configured for logshipping.

What is the effect of logshipping when you shrink the logfile?

View 3 Replies View Related

Shrinking Mdf File After Implementing New Filegroups - SS2005

Feb 18, 2008

Hi!
I have a database where I add some new Filegroups and moved some Gb's of
tables and indexes to new file groups.
Now I would like to shrink the source of these tables/indexes: the mdf file.
This means there should be much empty space now in the mdf file.

I tried to use dbcc shrinkfile, but it run for more than one day.
Are there some good strategies about shrinking the mdf file?
I had to restart the instanse because got problem using the db while dbcc runned...

Thank you for help

View 2 Replies View Related

SQL 2012 :: Reclaim Disk Space By Shrinking Log File After TLOG Backup

Feb 25, 2015

I have a SQL Server 2012 DB in Full recovery mode that has never had a TLOG backup. the log is huge 200+GB.

I tried doing a transaction log backup but there is not enough space on the Disk.

How can I reclaim this log space in SQL Server 2012?

View 6 Replies View Related

Shrinking Database

Apr 13, 2008

Hi all,I've deleted a lot of albums but the size of personal.mdf isn't shrinking - how do i go about acheiving this? I've tried to shrink it in sql management express but the file is read only..
please help!
thanks

View 5 Replies View Related

Shrinking Database

Jan 8, 2001

I have a 1.2 gig db which has truncate checkpoint set and over 850 meg of free
space. WHen I shrink it through either DBCC or EM I see no change. ANy
ideas?
Thanks

View 2 Replies View Related

Shrinking Of Database

Dec 30, 1999

i havae a database size of 1000mb with used as 507.50 and unused as 492.50. i tried with commands like dbcc shrink file and dbcc shrink database but i could not get the result as what i need. I need to shrink in such a way that it should have 25% of the used space as free space. could any one help

View 4 Replies View Related

Help For Shrinking Database

Jun 20, 2006

Hi guys.I have a huge database file. When I run sp_spaceused this are theresults:db_size 1337,31 Mbunallocated 14,62 Mbreserved 1088456 Kbdata 258992 Kbindex_size 6224 Kbunused 823240 KbNow, when I run dbcc shrinkfile(database_name, 50) or whatever value ofpercent, it says there is not enough free space in db.Please advice how to shrink the size of that file and why is it so big?Thanks in advanceZvonko

View 3 Replies View Related

Notification After Shrinking Database

Mar 26, 2001

Hi All,

I am working on a client product that shrinks the database in MS SqlServer. After shrinking the database files, it does not send any email notification to the users.

My question is: Is there any way in SqlServer to sense that the database has been shrunk and send a notification to the users (may be through an Alert or a Job or something). Please let me know the steps to do that.

Thanks
Sri

View 1 Replies View Related

Shrinking Database Problem

Jun 4, 2003

I have a SQL 2000 database that I would like to shrink.

Recovery Model = Simple
Data file space allocated = 78 Gig
Space free = 41 Gig

Similar problems with Trans logs sometimes

As I understand it, I can't shrink the database below the allocated size. How do I get that space back ?

Any extra insights and explanations about this topic in general would be appreciated .... Thanks in advance.

View 3 Replies View Related

Error While Shrinking Database

Oct 13, 2005

Hi,

When I am trying to shrink a database, I got the following error.

Executed as user: NT AUTHORITYSYSTEM. ...he PageId in the page header = (0:0). [SQLSTATE 42000] (Error 8909) Table error: Object ID 0, index ID 0, page ID (1:491894). The PageId in the page header = (0:0). [SQLSTATE 42000] (Error 8909) Table error: Object ID 0, index ID 0, page ID (1:491893). The PageId in the page header = (0:0). [SQLSTATE 42000] (Error 8909) Table error: Object ID 0, index ID 0, page ID (1:491892). The PageId in the page header = (0:0). [SQLSTATE 42000] (Error 8909) Table error: Object ID 0, index ID 0, page ID (1:491891). The PageId in the page header = (0:0). [SQLSTATE 42000] (Error 8909) Table error: Object ID 0, index ID 0, page ID (1:491890). The PageId in the page header = (0:0). [SQLSTATE 42000] (Error 8909) Table error: Object ID 0, index ID 0, page ID (1:491889). The PageId in the page header = (0:0). [SQLSTATE 42000] (Error 8909) Table error: Object ID 0, index ID 0, page ID (1:490615). The PageId in the page header = (0:0). [SQLSTATE 42000] (Error 8...

Please help me to resolve this issue

Thanks & Regards,
Eldho Abraham

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved