locked
Master database - restore to its initial state RRS feed

  • Question

  • Hi,

    I generated a script to create objects in a database using SSMS ... all went smooth until I didn't realize that the objects were release on Master database... Yes!

    Is there a way to restore master db to it is initial state? 

    Can I delete all the user defined objects under master?

    Thanks

    S

    Wednesday, May 23, 2018 10:54 AM

Answers

  • Hello,

    If you have a good backup of "master" database, then you can restore it, but it's requires some more efforts then restoring a user database: Restore the master Database (Transact-SQL)

    Yes, you can also simply delete all user object in System database "master".


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    • Marked as answer by StSingh Wednesday, May 23, 2018 1:42 PM
    Wednesday, May 23, 2018 11:10 AM

All replies

  • Hello,

    If you have a good backup of "master" database, then you can restore it, but it's requires some more efforts then restoring a user database: Restore the master Database (Transact-SQL)

    Yes, you can also simply delete all user object in System database "master".


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    • Marked as answer by StSingh Wednesday, May 23, 2018 1:42 PM
    Wednesday, May 23, 2018 11:10 AM
  • Can I delete all the user defined objects under master?

    Thanks

    S

    Just to answer this question you cannot delete anything from master database because they actually views or system tables which you do not have access to, or simply put you cannot delete anything from master database which MS has created.

    If you want to take master database in initial state just rebuild it


    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

    Wednesday, May 23, 2018 1:53 PM
  • Just to answer this question you cannot delete anything from master database because they actually views or system tables which you do not have access to,

    The question was explicitly about user-defined tables, and of course you can delete data from these tables and drop all user-defined objects. Use the flag sys.objects.is_ms_shipped = 0 to make sure you don't drop anything that comes with the product.

    Wednesday, May 23, 2018 9:55 PM