Solved

Filestream index randomly changing filegroup

Posted on 2014-01-23
3
355 Views
Last Modified: 2014-01-24
I have a table with a filestream column holding about 2000 photographs. When I created it I set the primary key to the unique identifier column (probably an unnecessary step). I checked table properties and it was assigned to the filestream filegroup. Everything OK for a couple of weeks, repopulating the table many times without incident. Just now I have discovered that the index has moved itself from the filestream filegroup to the default secondary (user data) filegroup. After repopulating the table I got the message:

Could not allocate space for object 'dbo.T_AllPhotos' in database 'myDB' because the 'FG_UserData' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.

By way of confirmation I checked the table's filegroup in table properties and queried sys.filegroups/sys.indexes, and it has indeed moved. I've now dropped the primary key on this table (there are no other indexes), but am still stuck with this table being in the wrong filegroup. The only thing that changed recently was that I added a new varchar column to the table, not indexed. Can this really be responsible for filegroup changing?
0
Comment
Question by:TimHudspith
  • 2
3 Comments
 
LVL 18

Expert Comment

by:x-men
Comment Utility
create a clustered index on the filestream filegroup.
0
 

Author Comment

by:TimHudspith
Comment Utility
Can you guide me on the synatax? The following gives me the error 'invalid filegroup specified'.

CREATE UNIQUE CLUSTERED INDEX ux_AllPhotos_Filename
ON dbo.T_AllPhotos(Filename)
ON [FG_Filestream]

Open in new window

0
 
LVL 18

Accepted Solution

by:
x-men earned 500 total points
Comment Utility
for table :
                                           
CREATE TABLE dbo.T_AllPhotos
      (
      EmployeeId int
      ,[filename] varbinary(max) FILESTREAM NULL
      ,MyRowGuidColumn uniqueidentifier NOT NULL ROWGUIDCOL
          UNIQUE DEFAULT NEWID()
      );



CREATE UNIQUE CLUSTERED INDEX [ClusteredIndex-20140124-094404] ON [dbo].[T_AllPhotos]
(
      [EmployeeId] ASC
) FILESTREAM_ON [FG_Filestream]
0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now