Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««123

compressing read only file groups Expand / Collapse
Author
Message
Posted Thursday, February 27, 2014 3:47 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 7:48 AM
Points: 36,759, Visits: 31,214
muthyala_51 (2/27/2014)
i am not making the database into single user mode. I just leave the latest partition to read write and change the rest of the filegroups to read only. As paritions are based on date column, all new rows will be inserted into the latest file group.


That part of what I'm talking about. Last I heard, you had to set a database to "Single User" in order to be able to set a related file group to Read Only unless, of course, you're the only one in the database to begin with. Yeah... you can change it back Multi-User but I was just wondering how you set file groups to read only only without going through a pass through "SINGLE_USER".

Shifting gears back to your partitioning problem... it sounds like your table is actually a type of audit table table because you're setting partitions to Read Only based on a date. Is the date column, by any chance, a part of your PK?


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1546156
Posted Thursday, February 27, 2014 4:15 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 5:53 PM
Points: 33,063, Visits: 15,179
You don't write a trigger based on a range or partition. You write it based on the table.

If the read only groups are 3 months old, then your trigger just has something like

if datePKcolumn < dateadd( mm, -3, getdate()) then
rollback









Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1546163
Posted Thursday, February 27, 2014 5:49 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, July 24, 2014 11:26 AM
Points: 381, Visits: 1,857
Jeff Moden (2/27/2014)
muthyala_51 (2/27/2014)
i am not making the database into single user mode. I just leave the latest partition to read write and change the rest of the filegroups to read only. As paritions are based on date column, all new rows will be inserted into the latest file group.


That part of what I'm talking about. Last I heard, you had to set a database to "Single User" in order to be able to set a related file group to Read Only unless, of course, you're the only one in the database to begin with. Yeah... you can change it back Multi-User but I was just wondering how you set file groups to read only only without going through a pass through "SINGLE_USER".

Shifting gears back to your partitioning problem... it sounds like your table is actually a type of audit table table because you're setting partitions to Read Only based on a date. Is the date column, by any chance, a part of your PK?


Yes, that's kind of an audit table with datetime part of PK. I was only the one who was accessing the database at the time of converting filegroups to read only mode, so it was easy for me to convert them without any errors.
Post #1546173
« Prev Topic | Next Topic »

Add to briefcase «««123

Permissions Expand / Collapse