SQL 2012 :: DBCC Shrinkfile Empty File Not Distributing Data Evenly In Primary File Group With Multiple Files

Apr 29, 2014

Why shrinkfile empty file does not redistribute data evenly in the primary file group with multiple files:

Please run the script attached to see what the end result is.

This is what I set up last night on my test machine.

1) Create database [FGTest] size 200MB
2) Create table called TEST on primary
3) Insert 40MB of data into test
4) Create another file group called temp in primary size 200MB
5) Shrinkfile('FGTest',emptyfile) so that all data is transfered from FGTest into temp file group.
6) Add another 2 files called DATA2 and DATA3. Both are 200MB.
7) We now have 3 empty files that I want data distributed evenly on. FGTest, DATA2 & DATA3
8) Shrinkfile('temp',emptyfile) to move all the data from temp over the 3 file groups evenly

I would expect at this stage to have the following:

FGTest = 13MB,
DATA2 = 13MB,
DATA3 = 13MB

(40MB of data over 3 files should be about 13 MBish in each file)

What I actually end up with is this:

FGTest = 20MB
DATA1 = 10MB
DATA2 = 10MB

It looks as though SQL Server is allocating 50% of all data to the original file and then 50% evenly over
the remaining files in PRIMARY.

View 3 Replies


ADVERTISEMENT

SQL Server Admin 2014 :: Re-balancing Blob And Lob Data In Multiple Files On Primary File Group

May 7, 2014

A little background on what I am trying to achieve first. We are moving to Azure virtual machines and we will have 8 disks on the SQL Server box. I am adding more files to the primary file group and each file will go on its own drive. I am then rebalancing data across these files by rebuilding all of the indexes on the tables which is working fine. No problems so far all is good.

I now have an additional problem. If there is a lob or blob column on the table, rebuilding the clustered index and all the non clustered indexes doesn't rebalance the blob or lob data across the disks such as it does with in row data.

I cannot find any articles on rebalancing lob or blob data because all the articles say to move to a new file group. I do not want a new file group, I just want to use the primary file group where the data already resides, and just redistribute it evenly in the same way that I can in row data which is working fine.

One solution I thought about was to BCP data out of the table, truncate the table and then BCP back into the table which I imagine would have the desired effect of distributing the data evenly over the files.

View 2 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

Primary Data File Group Is Full

Dec 19, 2007

I got below error :

Could not find allocate space for object 'tablename' in DB, because the primary file group is full

Upon investigation I found :

datafile is reached it's maximum size
DB Size space allowcated 197 MB, space free 20.69 MB
DB mdf 194880 KB, ndf 6272 KB

It's production server, please let me know how to proceed now?

View 6 Replies View Related

DB Design :: Partition With Single File Group Or Multiple File Group?

May 19, 2015

partition with single file group or multiple file group which one best.

we have some report running from partition table, few reports don't have any partition Key and after creating 400  partition  with 400 file group it is slow.what is best practices to crate  400 file group or single file group.

View 9 Replies View Related

Split The Existing MDF File Into Mutliple Files As A File Group?

Jul 30, 2007

I have a huge MDF File - 120 GB File (Had setup as 1 MDF initially) -- Did not anticipate that the DB would grow to that size!!

Anyways.. I heard that the general performance woul grow if i had them as "File Groups"..

Is there anyway - to split the existing MDF file into Mutliple files as a File Group?

Where should i start? Can someone please direct me..

View 1 Replies View Related

Shrink File Tool From EM Took All The Empty Space Allocated To Data File

Jul 20, 2005

I've production sql server 7 sp3 on windows NT. I had a 8GB data file ofwhich 5GB were used and 3GB were unused. I wanted to take back the unused3GB.So I did the following with EM GUI:1. I tried to "truncate fre space from end of the file". Didn't truncatethe file. I believe there was no empty space at the end of the file.2. Next I chose the option to "shrink file to 5GB". And to my horror thedata file instead of taking just 5GB took the empty spaces also and the sizeof the used data file went to 8GB.Any idea what's going on?TIA,SP

View 2 Replies View Related

Integration Services :: Move Multiple Files Based On File Names Listed In A Spreadsheet / File?

May 27, 2015

I need to move specific files from a server to another server on a monthly basis.  There are hundreds of files that are in the source directory and I need to move approximately 40 of those to the destination server.  I would like to easily add or delete the file list as needed.  I have seen where several variables were created for for each file name (and one for the path) and the ForEach Loop would go through them.  With 40 or more I was thinking that I could make a connection to an Excel spreadsheet or text file with a record for each file name and read in and and move to the next record and make that value become the content of a "FileName" variable.  Then if I wanted to add another file name I could just add another record to spreadsheet/text file or remove and the package would handle automatically....

View 10 Replies View Related

Physical Setup: 1 Data File Vs Multiple Smaller Data Files

Jul 20, 2005

Hello all. Before my arrival at my current employer, our consultantsphysically set up our MSSQL 7 server as follows:drive c: contains the mssql enginedrive d: contains the transaction logdrive e: contains the data filesNo filegroups were set up and the data files consist of only 1 largephysical file. Currently, our data file is >10GB. When I was trained onthe physical aspects of sqlserver, I was told to never create physical files[color=blue]> 2048MB each. If I did, I could expect inefficient physical storage of[/color]data and slower performance (due to the OS).Our server has 2 RAID-5 arrays. Drive c: and e: are located on the firstarray and drive d: on the second. We're running Windows 4.0 NT Server SP6with NTFS.Can someone comment on the use of 1 single large data file vs. more smallerdata files?

View 2 Replies View Related

Primary File Group Full

Apr 26, 2005

Weird.  I have an Agent job that populates some warehouse data every night.  It's been working fine for over a year.  Then it fails with a message that thePRIMARY file group is full.  The database is set to Simple recovery, automatic, unrestricted growth by 10% for both the log file and the data file.  The drive it's on has 96GB free.  The data file is 1.5GB and the log is 2MB and there's not very much fluctuation in the amoutn of data going into it.
Anybody have an idea why that would happen?
Thanks for any insight,Pete

View 3 Replies View Related

Primary File Group Is Full

Jan 7, 2008

Primary file group is full for one user db
This is production server
Total db size is 132186 MB
data file is 12000 MB, set automatically grow
and restrict file growth is 121024 MB

Now there is 30 GB space on drive

I have added space to file 3 times(1GB, 10GB, 3 GB) and incresed restrict file growth also(5GB). database is in simple recovery mode.

stille I am getting above error, pleasee let me know how to proceed now?

View 3 Replies View Related

PRIMARY File Group Is Full

Jul 20, 2005

Hi there,I've just run some DTS packages on my test sqlserver (Which has limitedhard disk space and memory) and all the tasks have failed, due to'PRIMARY' file group is fullIs there a query or script I can run to resolve this problem??M3ckon*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!

View 1 Replies View Related

Primary File Group Is Full

Jan 8, 2008

Primary file group is full for one user db
This is production server
Total db size is 132186 MB
data file is 12000 MB, set automatically grow
and restrict file growth is 121024 MB

Now there is 30 GB space on drive

I have added space to file 3 times(1GB, 10GB, 3 GB) and incresed restrict file growth also(5GB). database is in simple recovery mode.

stille I am getting above error, pleasee let me know how to proceed now?


View 3 Replies View Related

Primary File Group Is Full

Dec 20, 2007



I got below error :

Could not find allocate space for object 'tablename' in DB, because the primary file group is full

Upon investigation I found :

datafile is reached it's maximum size
DB Size space allowcated 197 MB, space free 20.69 MB
DB mdf 194880 KB, ndf 6272 KB

It's production server, please let me know how to proceed now?

View 4 Replies View Related

SQL 2012 :: How Server Fills Empty Spaces In Data Files

Oct 1, 2015

I understand that we shouldn't shrink data files as it might cause heavy fragmentation along with log usage, high IO/CPU etc.

In a DB in which lot of DML transaction occur, there will be empty spaces whenever deletions occur.

Will SQL Server fill that part with data when new insertions occur ?.

View 4 Replies View Related

SQL Server Admin 2014 :: Creating Additional Data File For A Particular File Group?

Jul 6, 2015

For a database, we have 4 data files in a particular file group and the file sizes are almost 70 GB each.

Do I come across any performance issues if I create/pre-allocate an additional data file in the same file group so that the existing files don't grow too much?

View 5 Replies View Related

SQL Server Admin 2014 :: Can Delete A Data-file Or File-group

Apr 27, 2015

In a server we had File Growth,And then We had to Add New Hard Drive And New File On It.And Now We have New server with a Huge Hard Drive.But all files remaind.Can I Reduce This files to One data file or not ?

View 3 Replies View Related

PRIMARY File Group Is Full EMERGENCY!

Apr 24, 2002

Customer site has detached their database and deleted the .ldf file and reattached because they want to decrease the log file size. They set their log size to restricted file growth and 5mb. After about 20 minutes they started getting "Transaction log is full" so I had them up the transaction log to 50mb. After about another 20 mins everyone on the network started getting errors saying that data cannot be added because the PRIMARY file group was full ("Could not allocate space for object TrussLumber in Database ATP because the primary file group is full").

There is plenty of disk space so I know thats not the problem. And they can add data to other databases, so I cant imagine what could possibly be causing this....Can anyone help me out?

Thanks!
Craig

View 1 Replies View Related

How To Move A Table From A File Group(primary) To Another

Oct 8, 2007

Hi,

I´m trying to move one table to another filegroup, the actual table is created in the primary group, so I´m trying to do this:

ALTER DATABASE hemsa_dev
ADD FILEGROUP Bitacora



- .- add mi file group
ALTER DATABASE hemsa_dev
ADD FILE
(
NAME = hemsa_devBitacora,
FILENAME = 'C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDatahemsa_devBitacora.ndf',
SIZE = 500MB,
MAXSIZE = Unlimited,
FILEGROWTH = 10%
) TO FILEGROUP Bitacora




-- And I want to add my table in my new filegroup

-- Im trying with:
ALTER TABLE BitacoraPeso ON bitacora
- - or
ALTER TABLE BitacoraPeso MOVE TO bitacora

But It doesnt work....


Any Idea??


Regards

View 14 Replies View Related

SQL 2012 :: Deadlock XDL File Remains Empty Even During Deadlocks

Mar 13, 2015

In order to troubleshoot some deadlocking that I am seeing on SQL Server, I am trying to capture the Deadlock XML by enabling the Events Extraction Settings option 'Save Deadlock XML events separately' and specifying a Deadlock XML results file.

Meanwhile, I am also tracing the Deadlock graph, Lock:Deadlock, and Lock:Deadlock Chain events. Yet the xdl file remains empty even though I am getting hits on the events themselves in the SQL Profiler trace.

Also, I have the following trace flag settings enabled.

TraceFlagStatusGlobalSession
1204110
1222110

Why the xdl file remains empty even though (I think) it should contain some XML for deadlocks that are actually happening?

View 4 Replies View Related

SQL 2012 :: Why Does SHRINKFILE Page Latch On A Page In Different File

Sep 28, 2015

I am running a DBCC SHRINKFILE on "FILE1" of a database (it has fileid = 1)...intent is to remove 70GB of file space:

DBCC SHRINKFILE (N'FILE1' , 400000).

For the SPID that's doing the shrink, In activity monitor you can see:

Waittype: PAGEIOLATCH_EX on resource: 9:3:15411328
(the DB is dbid=9)

But why does it need a page from fileid=3? Are there page dependencies between files that prevent moving a page within a given file? Does it need that fileid3 page to come along?

Its just sitting there in the SUSPENDED state for the last hour....I am going to leave it another 5 hours or so before cancelling.

The dm_exec_requests has an estimated percent complete at 83% and holding....not sure if I can believe that.

View 6 Replies View Related

DB Design :: Need To Recreate All Indexes From Primary To Secondary File Group

Jul 14, 2015

I have a database around 500 GB. right now the database have only one data file and one log, it has only one filegroup also.all the indexes and table are placed in Primary Filegroup . we are going to separate them. the planing is to move all the indexes to Secondary filegroup and all the table will be in Primary filegroup.But there will be a problem while implementing it because there are around 600 tables and each table have at least 2 non-clustered index , so is there any way to move all the index to Secondary Filegroup.

View 3 Replies View Related

SQL 2012 :: DBCC CheckDB Output File With Date Stamp

Jul 8, 2015

I would like to know if it is possible to date stamp the output file for the DBCC integrity check?

The following cmd works fine however I tried different ways to date stamp the output file with no luck.

sqlcmd -U backup -P Password -S Server -Q"DBCC CHECKDB('DatabaseName') WITH ALL_ERRORMSGS" -o"G:LOGSDBCCResults.txt"

View 5 Replies View Related

Failed Hotfix - One Or More Files Do Not Match The Primary File Of The Database

Apr 29, 2008

I've just applied CU7 to a set of SQL2005 SP2 servers with no problems, except on one server.
I've now fixed the problem, but couldn't find description of it elsewhere so post it here in case it helps anyone else with the same problem.


Here's the problem I had. The server is Windows 2003 with two instances of SQL 2005 SP2 (9.00.3186)
1) Ran the patch (SQLServer2005-KB949095-x86-ENU.exe)
2) C: drive ran out of space whilst patch was running against instance A
3) Cleared down space on C: drive
4) Patch had hung, after 45 minutes of no activity I killed it
5) Re-ran patch, it reported instance A as upgraded already and just upgraded instance B
6) After reboot instance A failed to start. Instance B started with no problem.

The service was failing to start with the following recorded in the log:
Server Microsoft SQL Server 2005 - 9.00.3239.00 (Intel X86)
[€¦]
spid5s The resource database build version is 9.00.3186. This is an informational message only. No user action is required.
spid5s Error: 5173, Severity: 16, State: 1.
spid5s One or more files do not match the primary file of the database. If you are attempting to attach a database, retry the operation with the correct files. If this is an existing database, the file may be corrupted and should be restored from a backup.
spid5s Error: 5173, Severity: 16, State: 1.
spid5s One or more files do not match the primary file of the database. If you are attempting to attach a database, retry the operation with the correct files. If this is an existing database, the file may be corrupted and should be restored from a backup.
spid5s Log file 'C:Program FilesMicrosoft SQL ServerMSSQL.2MSSQLDATAmssqlsystemresource.ldf' does not match the primary file. It may be from a different database or the log may have been rebuilt previously.
spid5s The log cannot be rebuilt when the primary file is read-only.
spid5s Error: 945, Severity: 14, State: 2.
spid5s Database 'mssqlsystemresource' cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server errorlog for details.



I think that the patch must have got part-way through instance A, enough to mark it as being patched, but not far enough to patch the mssqlsystemresource system database (note the version numbers in the log above - 9.00.3239 vs 9.00.3186).
The hotfix log records an error opening the registry, but the detailed log was overwritten by the subsequent (successful) run of the hotfix so there€™s no more detail available.

To fix this I copied in the mssqlsystemresource mdf and ldf files from instance B (which wasn€™t patched the first time round, and was subsequently patched successfully). From what I understand mssqlsystemresource is read-only and holds copies of system sprocs etc, so a copy will suffice. Plus I am assuming the SQL Server is clever enough to complain if it€™s not happy with the instance of the file.

Note that the problem recorded elsewhere for this error, where mssqlsystemresource or other system DBs have been moved from their original installation folders, was not the cause here.
Not sure if this is the 'correct' fix, but it got Instance A up and running. Obviously YMMV

View 2 Replies View Related

Split Data File Into Multiple File Groups..!

Dec 18, 2006

I have one of our production Accounting Databases starting from 2 GBnow grown into a 20 GB Database over the period of a few years...I have been getting timeouts when transactions are trying to updatedifferent tables in the database.. Most of the error I get are I/Orequests to the data file (Data file of the production dbAccounting_Data.MDF).I would like to implement the following to this Accounting database.I need to split the Data file into multiple files by placing some ofthe tables in different file groups. I have the server upgraded to beable to have different drives in different channels. I can place thesedata and log files in different drives so it will be less I/Oconflicts..I would like to have the following file groups..FileGroup 1 - which will have all database definitions (DDL).FileGroup 2 - I will have the AR Module tables under here..FileGroup 3 - I will have the GL module tables under here..FileGroup 4 - I will have the rest of the tables under hereFileGroup 5 - I will like to place the indexes under here....Also where will the associated transaction files go?I would like to get some help doing this. Is there any articles / helpavailable that I can refer to. Any suggestions / corrections/criticisms to what I have mentioned above is much appreciated...!Thanks in advance....

View 1 Replies View Related

SQL 2012 :: Cannot Stop File Growth On Data File

Apr 22, 2014

We have a large 'History' database that is currently about 4.5TB, with most of that in a datafile that is 4.2TB. We wanted to stop growth on the one large data file and have SQL Server allocate new data to the other data files, but this throws an error when we attempt to change the MAXSIZE settings:

ALTER failed for Database 'History'
MODIFY FILE failed. Specified size is less than or equal to current size.

The SQL Server is saying we can have a max size of 2TB, and anything over that is blocked. Since this is being blocked, the file continues to grow.

Is there any way to cap the growth of the 4.2TB file and not allow any more data to be written to it?

View 1 Replies View Related

Flat File Connector Stops Processing File On Empty Row And Generates Fatal Error

Dec 27, 2007

Here's a really annoying problem. Let's say you have a text file with 2 million rows.Delimiters all look good and rows are previewed well but the file has a missing row at say lin 1234567 - way deep in the file. When SSIS encounters the blank row, an error is raised and processing on the file STOPS! I verified this in by checking the SSIS log and have even developed an error routine to notify me via email when the error occurs (really cool if I do say so myself ). The main problem still remains - how to resume processing from the point of failure in the file? Any help is appreciated. Thanks.

View 13 Replies View Related

SQL 2012 :: Restoring Only One File Group?

Feb 27, 2014

I have created the file group for my database.First i took backup of individual file group(mdf and ndf) then I tried to restore only secondary(ndf) file group.I got error like

Restore failed for Server 'pcnameSQLEXPRESS'. (Microsoft.SqlServer.SmoExtended)
File 'regSQL_dat' was not backed up in file 1 on device 'D:vtndf.bak'. The file cannot be restored from this backup set.
RESTORE DATABASE is terminating abnormally. (Microsoft SQL Server, Error: 3144)

When i tried to restore only primary file group i got the same error.

Can i restore individual file group? I

For the purpose of data archiveng,i have taken back up of ndf file (it contains very old data) & i have removed this file from database.Now my customer asking these file data.Now i have to again attach/restore this ndf file.how to attach/restore.

View 1 Replies View Related

SQL 2012 :: Not Able To Drop File Group

Dec 11, 2014

I am not able to to drop few file groups that has been created to add partition range.

Steps taken so far:

--Empty files started
DBCC ShrinkFile(YEAR2015_FG,EmptyFile);
GO
--Removing files

Alter DATABASE ETL_MART REMOVE FILEGROUP YEAR2015_FG;
GO
-- Remove parition scheme depednecy

[code]...

View 2 Replies View Related

Combine Multiple RDL Files Into One RDL File

Aug 31, 2007



Hello,
I need to generate a report, which should display 4 reports. Two tables and some charts. I have all these reports (I mean the .RDL files) individually. I can render the reports separately. But, now the need is to combine these reports in the one RDL file. Is this possible? If yes, how?

Also, I tried to create a stored procedure, which would call all these 4 SP inturn and provide 4 result sets. I thought of have an RDL by calling only this SP which would give 4 result sets. But infortunately, it gave only the first SP's result set. So, I have to combine the 4 RDL files into one to show on the Reporting Console. Can anyone please help me in this? Help would be grately appreciated.

Thanks a lot. Let me know if the question is not clear.

Mannu.

View 5 Replies View Related

File Will Not Attach To SQL Reason File Is Not Primary File

May 10, 2007

I have a customer they are running raid 5 on a windows 2000 server one of the drives went bad. The customer replaced the drive and raid rebuilt the drive, every thing seamed to be fine but there is one database file that cannot be attached to SQL. The file is 15G so I know there is information the error states that the file is not a Primary file. Any clue on how to fix this?

mdf file size 5,738,944 KB
ldf file size 10,176 KB

View 4 Replies View Related

Can I Split A Long .sql File Into Multiple Files?

May 9, 2008

 I have one really long .sql file I'm working on.  It's actually a data conversion type script.  It's gotten really cumbersome to work on as long as it is.  I would like to split up various logical parts of script into their own .sql file.How can I have one file .bat, .sql or whatever call each .sql file in the order I specify? Hoping this is easy. Thanks 

View 3 Replies View Related

SQL 2012 :: Blank (Empty String) In Primary Key

Apr 29, 2014

Can we have blank value in Primary key field? Two fields are chosen as Primary Key for this table but the issue is at any given time one value will be blank when other is populated. Does sql server still order the records based on these keys? (Clustered index). Or should I just go about adding ID (identity)?

View 1 Replies View Related







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