Proper use of master System Database

  • I am a SQL newbie.

    I have inherited a project that has a SQL Server 2008 R2 backend.

    In SSMS (Microsoft SQL Server Management Studio) I see that in

    'Databases' => 'System Databases' => 'master' => 'Tables'

    the previous developer(s) put all of the applications data tables!!

    I have created a new database in

    'Databases' => 'mynewapp'

    and am creating tables in there as required.

    Why would you put an applications tables in

    'Databases' => 'System Databases' => 'master' => 'Tables'

    as this seems contrary to what I read about the 'master' database? These tables have no data rows.

    I know they had a test and production environment most of which seems to no longer exist. Could this have been used to somehow keep a test and production environment synchronized?

    GadgetGuy

    GadgetGuy

  • GadgetGuy (1/19/2015)


    I am a SQL newbie.

    I have inherited a project that has a SQL Server 2008 R2 backend.

    In SSMS (Microsoft SQL Server Management Studio) I see that in

    'Databases' => 'System Databases' => 'master' => 'Tables'

    the previous developer(s) put all of the applications data tables!!

    I have created a new database in

    'Databases' => 'mynewapp'

    and am creating tables in there as required.

    Why would you put an applications tables in

    'Databases' => 'System Databases' => 'master' => 'Tables'

    as this seems contrary to what I read about the 'master' database? These tables have no data rows.

    I know they had a test and production environment most of which seems to no longer exist. Could this have been used to somehow keep a test and production environment synchronized?

    GadgetGuy

    As a general rule, I never (deliberately) create any objects in the master database. Occasionally, I will create a new query window and not notice that it is pointing at the Master database and create objects...when I notice this, I delete them. Perhaps your predecessor did something like this and failed to notice.

    As for using this to keep test and production synchronized - I would hope that this is not the case. If, for some reason, these 2 environments are on the same server, they should be in different user databases.

  • The previous developer(s) were developing offsite and bringing in updates so certainly were developing on a different machine.

    GadgetGuy

  • The previous developer probably made a mistake and left out the USE statement when he deployed once. User tables should not be created in master in general, definitely not tables that an application uses.

    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

Viewing 4 posts - 1 through 3 (of 3 total)

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