none
sys.fn_trace_gettable cause master database grow,

    Question

  • https://docs.microsoft.com/en-us/sql/relational-databases/system-functions/sys-fn-trace-gettable-transact-sql?view=sql-server-2017 

    the BOL didn't say anything about the temporarily requirement the space inside master database,  while I am running load trace file to a user db, the master db size increase dramatically to 50GB. did I miss anything?

    use TempTraceDB
    go
     insert dbo.Trace20180613
     select *
    from fn_trace_gettable('h:\trace\20180613_0059\trace.trc',20);
    go

    Wednesday, June 13, 2018 2:24 PM

All replies

  • fn_trace_gettable should not cause the master database to grow. It simply reads the trace file in a tabular format. Have you tried looking into what accounted for the size increase in master DB? are there are huge tables etc.?

    You can use this script to see the size of the DB objects.

    You can use this script to see the current DB size and the free size.

    Hope this helps.


    Please remember to click "Mark as Answer" if my response answered your question or click "Vote as helpful" if it helped you in any way.

    Wednesday, June 13, 2018 2:59 PM
  • I never noticed this. How large are the trace tables you are loading, are they in the 50gb range?

    … but I never built a single trace table anywhere near that large.

    Josh

    Wednesday, June 13, 2018 3:24 PM
  • I never noticed this. How large are the trace tables you are loading, are they in the 50gb range?

    … but I never built a single trace table anywhere near that large.

    Josh

    Looks like OP has saved the trace output to a trace file on the file system (as opposed to saving to a table) and is merely loading the trace contents to a table in a different user DB. 

    So far, from the limited information, I am not convinced that fn_trace_gettable filled up Master DB.


    Please remember to click "Mark as Answer" if my response answered your question or click "Vote as helpful" if it helped you in any way.

    Wednesday, June 13, 2018 3:31 PM
  • Did you made sure you created the table dbo.trace20180613 in user database and not in master database, can you double check. Check is same object exists in both user and master database

    Cheers,

    Shashank

    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it

    My TechNet Wiki Articles

    MVP

    Tuesday, June 19, 2018 1:21 PM
    Moderator