I have my user defined objects created on the PRIMARY filegroup.
I have a secondary filegroup existing for the database.
How can I move all my user objects to the secondary filegroup from the
primary filegroup.
Info on this is appreciated.
I have created a new filegroup and would like to move my indices there. Do I need to create a file for each index or can I just specify the filegroup in Enterprise Manager?
I need to know if it is possible to move ONE table from an existing filegroup to another existing filegroup. The answer I received to use ALTER database only modifies the file/filegroup name or changes the default filegroup. Any assistance will be greatly appreciated.
I have a big table (heap)... well, not so big, I have a small serverand I want to spread access to it across several new disks dedicatedonly to that table.I known its possible to do that creating a clustered index with "ONfilegroup" option but I want to maintain it as a heap, is there anyway to do this without dropping indexes/references - bulk unload -create table - bulk load - create indexes?.
OK, I know this is out there all over and yes I did a search for this topic; however, I am confused about tables with an image data type and with moving text file group to another filegroup.
Here is what I have:
I have a table storing imaged documents and has become very large. I want to move the table to another filegroup. The table is created like this:
USE [PD51_Data] GO /****** Object: Table [dbo].[SCANNEDDOCUMENTS] Script Date: 05/13/2008 14:52:40 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[SCANNEDDOCUMENTS]( [DocID] [int] IDENTITY(1,1) NOT NULL, [CaseID] [int] NOT NULL, [DocName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [Doc] [image] NOT NULL, [DocLocation] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [DocNotes] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [TopicID] [int] NULL, [ScannedDocumentsCheckSum] [varchar](128) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,PRIMARY KEY CLUSTERED ( [DocID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO SET ANSI_PADDING OFF GO ALTER TABLE [dbo].[SCANNEDDOCUMENTS] WITH NOCHECK ADD CONSTRAINT [ISCANNEDDOCUMENTS2] FOREIGN KEY([TopicID]) REFERENCES [dbo].[TOPICS] ([TopicID]) GO ALTER TABLE [dbo].[SCANNEDDOCUMENTS] CHECK CONSTRAINT [ISCANNEDDOCUMENTS2]
On a test DB, I moved the clustered and nonclustered indexes to a secondary filegroup no problem, but it still shows to be stored in the primary filegroup. I read an article about having to create a new table in the secondary in order to move the images and text file group. Has anyone come across this?
Do I need to drop the clustered index and FK to move to a secondary filegroup?
Or
Do I create a new table into the secondary filegroup and then add the Clustered index and constraints?
I have a partitioned table in which one of the partitions is on the Primary filegroup. I want to move the data off of that Primary filegroup, and and on to a new filegroup named RTFG6.
Scheme and function currently defined as:
CREATE PARTITION SCHEME [PS1_Left_id] AS PARTITION [PF1_Left_id] TO ([RTFG1], [RTFG2], [RTFG3], [RTFG4], [RTFG5], [PRIMARY])
CREATE PARTITION FUNCTION [PF1_Left_id](int) AS RANGE LEFT FOR VALUES (10, 15, 35, 48, 53)
I've tried split and merge, and for whatever reason, always end up with the Primary filegroup holding data.
How do i get it off of Primary completely, and onto RTFG1 to RTFG6?
I don't want to export to a holding table and re-create the table if i can avoid it, due to identity columns and relationships with multiple tables.
I am using SQL Server 2000, SP3.I created an updatable partitioned view awhile ago and it has beenrunning smoothly for some time. The partition is on a DATETIME columnand it is partitioned by month. Each month a stored procedure isscheduled that creates the new month's table, and alters the view toinclude it. Again... working like a charm for quite some time.This past weekend I moved some of the first tables onto a new filegroup. I did this through Enterprise Manager, by going into designmode for the table, then going into the properties for the table andchanging the file group there as well as in all of the indexes. Nowthe partitioned view is no longer updatable. It gives the errormessage: "UNION ALL view '<view name>' is not updatable because apartitioning column was not found."I have extracted the DDL for all of the partition tables and comparedthem and they all look the same. I checked and then double-checked theCHECK constraints to make sure that they were all valid and they are.If I remove the tables that I moved to the new file group from theview, then it is once again updatable, but when I put them back in itfails again.Any ideas? If you would like samples of the code then I can send italong, but it's rather large, so I have not included it here.Thanks!Thomas R. Hummel
I have been creating databases in SQL 2008 with a primary filegroup for the system objects and a secondary, marked Default, for the data.
We are preparing a migration to SQL 2014, and the administrator is complaining he won't adopt this structure on the new servers because 'there is no benefit' and 'a backup cannot be restored (!?)'.
please help newbieI need to create a lot of objects the same type (let's say: schemas)I wish to use paramerized block in loop to do so.- how to put names of my objects to such control-flow?belss you for help
passing serialised objects to a stored procedure for the purpose of data inserts. I see this as being a way to handle multiple row inserts efficiently.
However, in my limited use of XML data I am not so sure how to link the data when I have a dependency on another "object" within the serialised XML.
Below is a code snippet showing what I have so far.
The first insert statement works fine - but how to retrieve the identifier created by the DB - I want to use an SQL statement that finds the record in the table based on the XML representation (of the PluginInfo), allowing me to insert the ConfigurationInfo with the correct reference to the PluginInfo
DECLARE @Config NVARCHAR(MAX) DECLARE @Handle AS INT DECLARE @TransactionCount AS INT SELECT @Config = ' <ConfigurationDirectory > <ConfigurationInfo groupKey="Notifications" sectionKey="App.Customization.PluginInfo"
I trying to get the moving total (juts as moving average). It always sum up the current record plus previous two records as well and grouped by EmpId.For example, attaching a image of excel calculation.
hello, ihave atablelike this - z uniqueidentifier a varchar(40) b varchar(40) c varchar(40) d varchar(40) e varchar(40) f text g image
I am asked to split this table into 2 filegroups and move text and images on to one and other stuff on one. I am new to MS-SQL 7.0. Can anyone suggest me how to go for it. Thanking you.
i understand that the filegroup for a table can be specified in the CREATE Table statement. just out of curiosity, is there any way to move a table to a different filegroup, that too, if the table contains data.
Hi, There is a table which is about 50GB is size. I am thinking of placing the database of this table into a separate .ndf on a separate drive on the server. Is it possible to place this particular table into a searate drive to increase the performance even more? Basically my question is: is it possible to place tables into separate .ndf files? Thanks
Hi, I have created a database with two filegroups called FG_GroupData, FG_GroupHistory. FG_GroupData is set as default. FG_GroupData contains two secondary data files i.e. GroupData1.ndf and GroupData2.ndf I can create a table so that it is stored in FG_GroupHistory. i.e. CREATE TABLE dbo.OrdersHistory ( OrderID int NOT NULL, ProductID int NOT NULL, CustomerID int NOT NULL, UnitPrice money NOT NULL, OrderQty smallint NOT NULL ) ON FG_GroupHistory Questions: 1) How do I add tables to each .ndf file inside a group i.e. FG_GroupData For example, how do I add a table to GroupData1.ndf and one to GroupData2.ndf ? 2) I guess there is no need to place the file name i.e. .ndf inside the select query Thanks
What is the advantage of having two secondary files inside a filegroup. For example, I can create a table and place it inside a filegroup which obviously will use the secondary files. Not sure why some DBAs create just one but otherscreate more than one secondar files in a filegroup. I have read the booksonline but can not figure out the advantages. Thanks
Can anyone show me in SQL7 how to obtain Available Space on a particular filegroup in a database (not the database or datafile). I am trying to include this in a script to monitor my database which uses Filegroups and I have every other info that I need (from the sysfiles table) except the available space. Thanks in advance!
1. from Transcender ..... One file for each filegroup is sufficient because creating multiple files for the same filegroup on the same disk does not provide any performance gain
2. from bol .... Therefore, creating more files per filegroup can help increase performance because a separate thread is used to scan each file in parallel
Hi , I am restoring a VLDB from a Standby server which has just .mdf and .ldf to my production server which has .mdf and a file group with a single .ndf file, i want to restore the databse on to the Secondary file(is this possible) i checked the BOl but could not figure out of what command is to be given
Is it possible to back up one filegroup independently from the second when tables in one group have foreign key relationships with tables in the second group?
A few days ago one our database's default filegroup filled up. To solve the problem one of my colleagues created a new filegroup. This didn't solve the problem as no objects were placed on this filegroup and the initial one is still full. The idea was to expand the original filegroup over a new physical disk, not to create a new filegroup on that disk. Unfortunately, this is what happened. To solve this I want to delete the new filegroup, but when I issue the command 'alter database PvgOmcsOds remove filegroup ternary' I get the message 'Server: Msg 5042, Level 16, State 7, Line 1 The filegroup 'ternary' cannot be removed because it is not empty.' Yet there're no objects placed on this filegroup. How can I get rid of this filegroup?
I am managing 120 gb SQL7 database. The 120 GB is in a RAID5 (Hardware RAID). At begining, I think I should create a user defined filegroup besides Primary filegroup, as BOL suggested.
After I read some discussions here, It appears I cannot gain any performance by adding second filegroups. Now I want to drop the filegroup I created. The Question is How?. If I do alter database, move all files from userdefined filegroup, does this mean my userdefined filegroup has gone?
I have 2 test database identical in size and table structure, only one resides on filegroups and one resides on a single file. From everything I have heard filegroups are suppose to improve performance. I stop and start the server before each test to clean out cache. When I run the filegroup test initially the first run averages 20 seconds slower then the database sitting on the single file. However on consective runs there is a significant improvement in performance with filegroups verses single files. I have the indexes sitting on a separate filegroup and 2 additional filegroups to spread the tables across. Does any one know what would be causing the performance to degrade on the initial run of the test. (The test by the way is a stored procedure that runs a select statement against each table).
I am trying to remove one of the filegroups in the development database to shrink its size down. I started with emptying and removing its files and ran: dbcc shrinkfile (pubs_data_1,emptyfile) go
and it ran fine, with 'DBCC execution completed' message
but when I tried :
alter database pubs remove file pubs_data_1 go
I got 'pubs_data_1 cannot be removed because it is not empty'. I even tried to go to each of the tables and delete from them first which didn't work, then drop all tables in that filegroup (I knew which tables are located on that filegroup), that didn't work either.
Any ideas? Is there a way to check what else sits on that filegroup?
We have sql 2000 server at a remote site that log ships to a standby server at the site, and back here to corporate. For performance we are adding a new RAID array to the remote servers along with a new file group for indexes. The server back here is older and we can't add this RAID. For log shipping purposes, what if anything might happen to this server when the filegroup is added. We are going to be using this filegroup for indexes
Hi, I am running out of space on one of the local drive, and I would like to move a filegroup from one drive to another. Does anyone know how to do it?
Are there any general recommendations concerning filegroups? My personal point of view is to place large tables in their own filegroups and group smaller, more static, tables in a single filegroup. Is it also good practice to group small and large index in two separate filegroups or should each large index have their own filegroup? Are there any useful links out there concerning filegroups and configuration?
Is there a way to rename a Filegroup "FG1" to "FG2"?
For those interested, I'm trying to script a sliding window procedure for my partitioned table and rather than use dynamic SQL I'd like to always refer to the same Filegroup name (ie. "FG1").
WHERE DO I FOUND THE FILEGROUP? WHEN THIS ERROR OCCURED
Could not allocate space for object '<temporary system object: 431024047390720>' in database 'tempdb' because the 'PRIMARY' 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.
Greetings All, I was hoping that someone might be able to shed somelight on this issue. I am trying to add a FileGroup/Datafile to anexisting SQL database. The code below compile and it runs in .NETStudio, however nothing happens? The form closes, no error messagesare thrown, there is no sign of any type of error taking place. Theend result (assuming the code is correct) is tha there should be a newFileGroup with a datafile in it, here is the code:************************************************** ******************private void AddFileGroup(frmMyForm f){SQLMy.SQLServer MySQLServerName = new SQLMy.SQLServer();SQLMy.Database MyDBDbName = new SQLMy.Database();SQLMy.FileGroup MyDBDataGroup = new SQLMy.FileGroup();SQLMy.DBFile MyDBDataFile = new SQLMy.DBFile();try{MySQLServerName.ConnectmyGetConfigData.OlapServerName*,myGetConfigData.Ol apUserLogin*,myGetConfigData.OlapUserPassw*ord);MyDBDbName.Name =myConnectionData.OlapDatabaseN*ame.ToString().Trim ();MyDBDataGroup.Name = "DBDataGroup";MyDBDbName.FileGroups.Add (MyDBDataGroup);MyDBDataFile.Name = "DBData";MyDBDataFile.PhysicalName =myConnectionData.OlapDBDataPat*h.ToString().Trim() + @"DBData.ndf";MyDBDataFile.Size = 50;MyDBDataFile.MaximumSize = -1;MyDBDataFile.FileGrowth = 5;MyDBDataFile.FileGrowthType = 0;MyDBDataFile.PrimaryFile = false;MyDBDbName.FileGroups.Item("DB*DataGroup").DBFiles.Ad (MyDBDataFile);this.Close();MySQLServerName.DisConnect();}catch (Exception e){MessageBox.Show(e.Message);}finally{MySQLServerName.DisConnect();}}************************************************** ******************Note: myGetConfigData: This is a class that reads in the values for thedb connection from an XML file. This class has been tested extensivelyand the data values are being populated into the variables.I would appreciate any help that anyone might be able to provide to me.Regards, TFD.