|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Creating a new database using an existing as templateI basically want an identical database, but with a new name and new datafiles. Right now, I have copied the template db's mdf/ldf files to new ones, and issued the following statements: sp_attach_db @dbname = 'newdb', @filename1='c:\Program\Microsoft SQL Server\MSSQL\Data\newdb.mdf', @filename2='c:\Program\Microsoft SQL Server\MSSQL\Data\newdb_log.ldf' But when I look at the newdb properties in EM, "Data Files" tab, although the locations are correct, the "File Name" is still the template db's. Doesn't seem safe to ignore that. I have tried a 2nd approach also: Restoring a backup of the template db into a new db, but then I got errors saying "logical file is not part of database". Cheers, Johan Sjöström MSc, MCAD >> But when I look at the newdb properties in EM, "Data Files" tab,although the locations are correct, the "File Name" is still the template db's. Doesn't seem safe to ignore that. >> Do you mean the logical file name, like "mydb_data", "mydb_log"? If so, I wouldn't fret about it, as these are used for very little (and they do not need to be unique on your server, only within the set of files for a single database). Anyway, you can use ALTER DATABASE after the fact to rename the individual files. A Yes, exactly. Thanks! ALTER DATABASE worked nicely also.
/Johan Aaron Bertrand [SQL Server MVP] wrote: Show quote > >> > But when I look at the newdb properties in EM, "Data Files" tab, > although the locations are correct, the "File Name" is still the > template db's. Doesn't seem safe to ignore that. > >> > > Do you mean the logical file name, like "mydb_data", "mydb_log"? If so, I > wouldn't fret about it, as these are used for very little (and they do not > need to be unique on your server, only within the set of files for a single > database). Anyway, you can use ALTER DATABASE after the fact to rename the > individual files. > > A |
|||||||||||||||||||||||