Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql 7.0 model database

Status
Not open for further replies.

porter

Technical User
Aug 31, 2001
15
0
0
US
I backed up the master database from one server after I had detached the model database. I then restored this master backup to a new server and now I do not have a model database referenced in master on this new server. I have the .mdf and .ldf files for the model database and I have tried creating a model database on the new server using these files with the create database and for attach statements, but I keep getting an error saying I can't do this because I don't have an exclusive lock on the Model database. How can I get the model database attached on this new server? (I am trying to avoid rebuilding then restoring master).

Any help is appreciated. Thanks.
 

Use sp_attach_db. Execute it from Query Analyzer. Change the file paths as needed.

EXEC sp_attach_db @dbname = N'model',
@filename1 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\model.mdf',
@filename2 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\model_log.ldf' Terry L. Broadbent
faq183-874 contains some tips and ideas for posting questions in these forums. Please review it and comment if you have time.
NOTE: Reference to the FAQ is part of my signature and is not directed at any individual.
 
thanks for the advice, but I already tried that and that is when I get the error saying that I do not have an exclusive lock on database MODEL. I know I can't have an exclusive lock on a database that doesn't exist according to the master database, so I am looking for a to attach the model files I have. Somebody else suggested starting sqlserver in single user mode and then doing the attach, but I thought you only needed to have sql in single user mode to restore master. do you have any other suggestions? thanks very much for your time.
 
Check the article at
It explains how to move the model database and discusses the need for trace flag 3608. Terry L. Broadbent
faq183-874 contains some tips and ideas for posting questions in these forums. Please review it and comment if you have time.
NOTE: Reference to the FAQ is part of my signature and is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top