How to make data(.mdf) to equal size slices!

  • In my prod I have 50gb data file,

    Now,

    I need to divide it into 5 equal sizes(i.e 10GB each) without loosing data and less downtime

    Can I do this?

    [font="Tahoma"]
    --SQLFRNDZ[/url]
    [/font]

  • :ermm: Yeah, you caaaannnn.... but why would you want an additional 4 .ndf files with no other purpose to them? Just splitting the files without a purpose for filegroups and spindle control doesn't gain you anything.

    Well, except on TempDB, but that's a different discussion altogether from what you're asking.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Yes exactly its a contention on my datafile SGAM pages

    But not in tempdb its on user db.

    How I do this in prod.

    Dividing into equal no of files and into different file groups if possible.

    [font="Tahoma"]
    --SQLFRNDZ[/url]
    [/font]

  • pavan_srirangam (11/17/2010)


    Yes exactly its a contention on my datafile SGAM pages

    But not in tempdb its on user db.

    How I do this in prod.

    Dividing into equal no of files and into different file groups if possible.

    :blink: How many schema changes are you making per second?! DAAaaang. Alrighty then. The technique is simple enough, but it will require some time. You must have some incredibly serious allocation contention though before this is worthwhile, and you're not doing physical spindle splits...

    In general, you do:

    ALTER DATABASE <db> ADD FILE (name = <db>2, filename = <path/filename>2.ndf, size = 10485760kb, maxsize = 10485760KB, FILEGROWTH = 0KB), (name = <db>3, filename = <path/filename>3.ndf, size = 10485760kb, maxsize = 10485760KB, FILEGROWTH = 0KB), ... (repeat as necessary) ... to filegroup [PRIMARY]

    Please note you have no control without filegroups to what ends up in which file. SQL Server will eventually level them out for you across the files, if memory serves correctly.

    I still don't recommend this. I cannot emphasize this enough even though I'm showing you the methodology, you're the only one who can see your actual server and know your local politics. The only reason for a single filegroup like this is on tempdb where the concurrency for create/drop/alters hits a per procedure call level and you can hit contention in allocation. Under incredibly rare to never circumstances should procedures be creating actual local physical tables, nevermind at the volume needed to cause this.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • I agree with Craig. I think you might be misinterpreting what is happening here.

    Filegroups will let you control the objects, and if you have enterprise editions, you can move tables w/o blobs in them online.

  • pavan_srirangam (11/17/2010)


    Yes exactly its a contention on my datafile SGAM pages

    In a user database?

    What's the wait type you're predominantly seeing? What's the wait resource? What has led you to the conclusion that you have contention on the SGAM in your user database?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • @Gila

    Wait type is pagelatch_up and wait resource is 5:1:3

    5 is my database id 1 is the file group and 3 is the page id

    when you see in sys.dm_os_buffer_descriptors it says SGAM Page and there are lot of waits

    [font="Tahoma"]
    --SQLFRNDZ[/url]
    [/font]

  • What kind of DDL are you doing in that DB (table create/drop) that has that kind of effect on the allocation pages?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • @Craig

    Yes there is scenario where local physical tables were creating and dropping in the user database not in temp db.

    There are lot waits with wait types pagelatch_up

    and the wait resource is 5:1:3(db_id:FG:pageid)

    page id 3 is SGAM I went through most of the stuff

    including adding files and enabling trace flag 1118 globally.

    I don't want move files to other drives because all of them are raid 5 drives so not helpful.

    Recommend suggetions

    and also get e script to divide the .mdf to equal no.of .ndf files.

    Right now .mdf(50GB) ---existing and FG 1

    .ndf(5GB)----I created and FG 1

    .ndf(5GB)---I craeted and FG2

    [font="Tahoma"]
    --SQLFRNDZ[/url]
    [/font]

  • the DDL is select * into table and then drop table commands

    But there are several queries like that

    [font="Tahoma"]
    --SQLFRNDZ[/url]
    [/font]

  • pavan_srirangam (11/18/2010)


    the DDL is select * into table and then drop table commands

    But there are several queries like that

    Long term, I'd be looking at changing those to temp tables or removing the need to select into totally.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • But managers are not willing to change the the design now.

    When I enabled trace flag 1118 is good for two days and there is no waits at all but after it

    gave resource_semophore memory waits

    so I turned off the trace flag.. then I see pagelatch_up .

    Recommend what else to do.

    [font="Tahoma"]
    --SQLFRNDZ[/url]
    [/font]

  • have you ever come across this problem

    If so let me now what you did ?

    [font="Tahoma"]
    --SQLFRNDZ[/url]
    [/font]

  • Gila and Craig Fareel

    Help Me ! Dudes with your knowledge.

    [font="Tahoma"]
    --SQLFRNDZ[/url]
    [/font]

  • pavan_srirangam (11/18/2010)


    have you ever come across this problem

    If so let me now what you did ?

    I came across a tragedy like this only once. I forced a redesign to use all the select INTO table to be SELECT INTO #table, to remove the issue.

    As I said, there should never be that much DDL churn outside of tempdb. There are hacks and workarounds to keep it going while you get it fixed, but the end goal should be full removal of the methodology.

    Pagelatch_up is a buffer level lock that basically holds the page in place for a second while the system does something. They're lightweight and are typically very quick, and don't last the entirety of a transaction, and are completely memory driven.

    As per http://www.dbtuna.com/article.asp?id=45 (First serious google hit, on first page)

    RESOURCE_SEMAPHORE waits occurs when a query memory request cannot be granted immediately due to other concurrent queries. High waits and wait times may indicate excessive number of concurrent queries, or excessive memory request amounts.

    These are both memory pressure items. These are not, specifically, caused by allocation issues.

    You need to google up 'MSSQL memory pressure' and start doing major research into perfmon and traces. You've got some significant problems going on. This isn't something that I can troubleshoot over the internet easily. Maybe someone else will have some luck.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

Viewing 15 posts - 1 through 15 (of 20 total)

You must be logged in to reply to this topic. Login to reply