Two databases with same logical name

  • Greetings,

    I am programatically creating a copy of a database (backing up original, restoring to a new name) that so users can have a 'work' area as part of our product.

    The logical name(s) of the original database are Real_dat and Real_log for the data and trans log.

    When I restore the backup I make the physical name RealSales but the logical name remains what it was.

    Now, this has been working fine for some months but now I'm getting some odd occurances where querys ran once return some data and then ocassionally return something else.

    n00bie question of the day I guess then is: Does the logical name matter when you are accessing a database, either in query analyzer or from ADO connectivity?

    I may be off base and it could be that the user is just making changes in the wrong database and either not knowing or not admitting to it but since the logical name issue is the only one I can come up with other than calling the customer a liar I'm really sorta hoping its just me.

    regards,

    Chris

  • Logical names don't matter other than for restore. The right way (to me anyway) to make a copy is to run the backup, then restore using the 'with move' to change the file names and/or placement in the file system. You could also detach/copy/change names/reattach both, but it makes taking the db out of service. As far as data access, the only thing that matters is the dbname.

    Andy

    http://qa.sqlservercentral.com/columnists/awarren/

  • Thanks! I actually did go back thru and alter my proc to change the name, just for sanitys sake if nothing else.

    Guess I'm still left with trying to solve the underlying problem though... Thanks for the info.

    Chris

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

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