Ошибка 9003 sql server

Fix Microsoft SQL Server Error 9003 an Easy Way

sql server error 9003

Table of Content

  • Introduction to the Error
  • Reason for this SQL Error
  • Solution to Fix Error 9003
  • Suspect Mode Rectification
  • Bringing It All Together

What is SQL Server Model Database Error 9003?

Model database issue or the Microsoft SQL Server error 9003 is a special type of technical message that appears in SQL. These error messages are a result of a wrong sequence or when an unacceptable event ID is tracked for a specific database by the log manager. When these types of error messages appear and crash the system, error messages appear as in the below-mentioned form.

SQL Error 9003

Why SQL Server Error Code 9003 Appears?

Error 9003 of SQL server is generally triggered because of data corruption issues, replication issues among MDF and LDF files, inconsistency, etc. sometimes, this issue is also a result of misconfigured system files or the registry issue of files.

software

Download Now Purchase Now

Fix SQL Server Model Database Error 9003

To bring database to Normal Mode and to fix model database error, the following resolutions can be implemented. Though there are no straightforward solutions available for rectifying this SQL error yet these techniques are beneficial if properly executed.

Restore from Backup:

Just try deleting the related information or contents, if the model database error appears due to the issue of replication of the data components. After this step, make sure to take restoration of the database from the available archive or backup. This is indeed a good option to backup server database of SQL because it greatly helps in restoring entire data in some really critical situations.

SQL Server Re-installation:

If user has encountered error 9003 then uninstall the present SQL Server program and then try reinstalling it on the system. This will b e great step towards elimination of error in SQL server. Also, it is advised to take a backup of all MDF components like triggers, indexes, database tables, stored procedures, etc. before actually uninstalling the program. Restore all the components back to the database after the files are reinstalled.

DBCC Implementation:

Run DBCC CHECKDB after reinstalling the program so as to check the physical, logical errors and inconsistencies in that particular database components. By using the DBCC CHECKDB command, check the consistency of MDF files i.e, of primary database. Alternatively, user may detach model database by renaming database files and attaching it further. This may prevent SQL error 9003 from appearing.

Also Read: Solution to Fix SQL Server Error 1105 Smartly

Rectification of Suspect Mode

SQL database items are marked as SUSPECT if they are affected by server error 9003. To find out which database has undergone SUSPECT mode and to troubleshoot this erroneous situation, follow the procedure given below.

  • By executing DBCC CHECKDB, detect reasons for SUSPECT database.
  • Now to detect the actual cause, open the SQL error log.
  • After this, just bring the database to ‘Emergency Mode

NOTE: In SUSPECT mode, it is impossible to connect to database that is why it is important to turn it to Emergency Mode.

  • To check inconsistencies among database objects, run DBCC.
  • After this, just turn on ‘Single Mode’ in the database.
  • Using ‘REPAIR_ALLOW_DATA_LOSS’, recover database.
  • Now, turn on ‘Multi-user Mode’ in database by performing suitable SQL command.

NOTE: The resolution methods mentioned-above may cause the withdrawal of SQL error 9003 from the database. Database is then brought to the normal mode when processed in an accurate way however if some mistakes are committed while executing these steps then, loss of data may occur.

Alternate Solution:

If all the above manual solutions fail to fix 9003 error code, then it is best recommended to opt for a third party software like SQL Recovery Software to overcome this issue and resolve 9003 SQL error.

Also Read: Know How to Make SQL Server Faster?

Conclusion

We have thrown lights on SQL Server database error 9003 in this post. Manual methods have been given to resolve 9003 error from MDF and NDF data files. If all the above manual solutions fail to fix 9003 error code, then it is best recommended to opt for a third party SQL MDF Recovery tool to overcome this issue and resolve 9003 SQL error.

Permalink

Cannot retrieve contributors at this time

title description author ms.author ms.date ms.service ms.subservice ms.topic helpviewer_keywords

MSSQLSERVER_9003

MSSQLSERVER_9003

MashaMSFT

mathoma

04/04/2017

sql

supportability

reference

9003 (Database Engine error)

MSSQLSERVER_9003

[!INCLUDE SQL Server]

Details

Attribute Value
Product Name SQL Server
Event ID 9003
Event Source MSSQLSERVER
Component SQLEngine
Symbolic Name LOG_INVALID_LSN
Message Text The log scan number %S_LSN passed to log scan in database ‘%.*ls’ is not valid. This error may indicate data corruption or that the log file (.ldf) does not match the data file (.mdf). If this error occurred during replication, re-create the publication. Otherwise, restore from backup if the problem results in a failure during startup.

Explanation

A component passed an invalid log sequence number to the log manager for the database. This could be replication, corruption, or an inconsistency between the primary data file and the log.

User Action

If this occurred during replication, recreate the publication. Otherwise, restore from backup.

Summary:
The error 9003 in SQL Server can occur due to corruption in the database file. There are various reasons that can lead to corruption in a database file. In this post, we will discuss different solutions to resolve the SQL error 9003. We will also mention a third-party SQL database repair tool that can help fix the error by repairing the corrupt database.

Free Download for Windows

Contents

  • Why does the SQL Error 9003 Occur?
  • How to Fix the Error 9003 in SQL?
  • Restore the Database
  • Use the DBCC CHECKDB Command
  • Alternate Solution

When attaching a database in SQL Server, you may get the error 9003. The complete error message looks like this:

Msg 9003, Level 20, State 1, Line 1

The LSN (1:1134:1) passed to log scan in the database Stellar is invalid. This error may indicate data corruption or that the log file (.ldf) does not match the data file (.mdf). If this error occurred during replication, re-create the publication. Otherwise, restore from backup if the problem results in a failure during startup.

As you can see, this error has level 20, State 1, and line 1. Let’s understand these numbers:

  • Msg 9003 is the error number.
  • Level 20 means itis a fatal error with a high impact because the database does not work at all.
  • State 1 means it is a general error.
  • Line 1 is the line of SQL code that fails.

Why does the SQL Error 9003 Occur?

This error occurs when the database is corrupt. The database can get corrupted for different reasons. The following are some common reasons:

  1. Problems with the anti-virus. Sometimes, the anti-virus program by mistake blocks the transaction file thinking that it is a malicious file.
  2. The disk is full. Sometimes, the DBA and the system administrators do not get the alerts when the disk is almost full. Then, the log file cannot grow and it produces an error.
  3. Due to some problems with the file system or the registry keys, the transaction log becomes accessible.
  4. The hard disk is failing due to problems with the electric motor, extreme heat, power failures, etc.

How to Fix the Error 9003 in SQL?

As the error is related to corruption in the database, you can follow the ways mentioned below to fix the problem.

Restore the Database

If you have a backup, then the easiest way to solve the problem is to restore the database from the most recent backup.

The following T-SQL code shows how to back up a database, named stellar, to the c:backupstellar.bak device:

BACKUP DATABASE stellar TO DISK = ‘c:backupstellar.bak’

The following T-SQL code shows how to restore the database (stellar) from the c:backupstellar.bak device:

RESTORE DATABASE stellar FROM DISK = ‘c:backupstellar.bak’

If you’re not comfortable with the T-SQL commands, you can use the SQL Server Management Studio (SSMS). Here’s how:

  • Open SSMS.
  • In the Object Explorer, right-click the Databases node and select the Restore Database option.

Restore Database Option

  • Select the Device option, press the browse button, and select the path where the backup is located.

Restore Database from Device

  • Finally, press OK.

Use the DBCC CHECKDB Command

If you do not have a current backup, you can use the DBCC CHECKDB command to repair the database. You need to set the database in Emergency mode first.

ALTER DATABASE stellar SET EMERGENCY;

Next, you need to set the database in single-user mode.

ALTER DATABASE stellar SET SINGLE_USER WITH ROLLBACK IMMEDIATE;

Now, you need to repair the database.

DBCC CHECKDB (stellar, REPAIR_REBUILD) WITH NO_INFOMSGS, ALL_ERRORMSGS;

After that, change the database from single-user mode to multi-user mode using the ALTER DATABASE command.

ALTER DATABASE stellar SET MULTI_USER;

Alternate Solution

What happens if the backup is corrupt or does not contain some recent and crucial information? Also, what happens if the DBCC CHECKDB command fails to fix the issue?

In such cases, you can rely on a third-party SQL database repair software like Stellar Repair for MS SQL. This software can fix damaged or corrupted databases, thus fixing error 9003.

This software is easy-to-use. It requires you to have the database offline. Otherwise, it will send a message saying that the database is in use. You can set the database OFFLINE by right-clicking the database in the Object Explorer in SSMS and selecting the Task > Take Offline option.

Take back Offline

Once offline, copy the database file and work with the copy.

Open the Stellar Repair for MS SQL software and use the Find button to find the data file (for example, the stellar.mdf) if you do not know where it is stored.

Find MDF file from Database

Alternatively, browse and select the data file. After selecting the file, press the Repair button to repair the database. You can also select the Include Deleted Records option, if necessary.

Click on Repair option

After repairing, press the Save icon to save the data. You can save it in a New Database, current Live Database, or in other formats, like CSV, Excel, and HTML.

Saving Database Option

Conclusion

Above, we have discussed the SQL Server error 9003 and the reasons that may lead to this error. We have also mentioned some possible solutions to resolve this SQL error. You can restore the database from the backup using the RESTORE command or use the DBCC CHECKDB command to repair the database. If none of the solutions works, you can use Stellar Repair for MS SQL to repair the corrupt database, thus resolving the SQL error 9003.

About The Author

Bharat Bhushan

Bharat Bhushan is an experienced technical Marketer working at Stellar Data Recovery — expertise in data care. He is skilled in Microsoft Exchange Database, MSSQL Database troubleshooting & data warehousing. He is a Management Post Graduate having a strong grip in Technology & certified in SAP-SD, Oracle 10g & Informatica Powercenter 9.1.

When we launch our AD Terminal Server (Win2003) the event log shows several events starting with

Event ID 17055
17053 MS SQL Server 2000 — 8.00.760 (IntelX86) ….. Desktop Engine …. Build 3790 Service Pack 2
17104 Server Process ID is 1996
Event ID 17176 This instance of SQL server last reported using a process id of 1036 at 27/06/2016 22:51 (local)
17162 SQL Server is starting at priority class ‘normal’
17124 SQL configured to thread mode processing
17125 Using dynamic local allocation [500] Lock Blocks
18052 Error 9003 Severity 20 State 1
17052 Cannot recover the master database exiting

All this means nothing to me apart from indicating that initially everything is being loaded up correctly and then, bang, the thing stops; I thought having read notes on this site that rebuilding the database might be the answer but rebuildm.exe does not
exist on the server.  I also looked in the installation disks but could find it there (maybe I didn’t look in the correct place). 

Actually the machine appears to work and allows people to log in normally but performance is sluggish whic hmay have nothing to do with this anyway.  Two questions:

1. What does all this mean and how can I download the logs without having to type them all out (Copy and Paste didn’t work of course).

2. Where is rebuildm.exe anyway?

I am happy to experiment and learn as I take a full disk image backup first but I cannot even get to first base.

Thanks for any guidance.

Jean

Easy Way to Fix Microsoft SQL Server Error 9003

What is SQL Server Model Database Error 9003?

Model database error or the Microsoft SQL Server error 9003 is a special type of error message that appears in SQL. These error messages are a result of wrong sequence or when an unacceptable event ID is tracked for a specific database by the log manager. When these types of error message appear and crash the system, error messages appear as in the below-mentioned form.

SQL Error 9003

Why SQL Server Error Code 9003 Appears?

Error 9003 of SQL server is generally triggered because of data corruption issues, replication issues among MDF and LDF files, inconsistency, etc. sometimes, this error is also a result of misconfigured system files or the registry issue of files.

Fix SQL Server Model Database Error 9003

To bring database to Normal Mode and to fix model database error, the following resolutions can be implemented. Though there are no straightforward solutions available for rectifying this SQL error yet these techniques are beneficial if properly executed.

Restore from Backup:

Just try deleting the related information or contents, if the model database error appears due to the issue of replication of the data components. After this step, make sure to take restoration of the database from the available archive or backup. This is indeed a good option to backup server database of SQL because it greatly helps in restoring entire data in some really critical situations.

SQL Server Re-installation:

If user has encountered error 9003 then uninstall the present SQL Server program and then try reinstalling it on the system. This will b e great step towards elimination of error in SQL server. Also, it is advised to take a backup of all MDF components like triggers, indexes, database tables, stored procedures, etc. before actually uninstalling the program. Restore all the components back to the database after the files are reinstalled.

DBCC Implementation:

Run DBCC CHECKDB after reinstalling the program so as to check the physical, logical errors and inconsistencies in that particular database components. By using the DBCC CHECKDB command, check the consistency of MDF files i.e, of primary database. Alternatively, user may detach model database by renaming database files and attaching it further. This may prevent SQL error 9003 from appearing.

Rectification of Suspect Mode

SQL database items are marked as SUSPECT if they are affected by server error 9003. To find out which database has undergone SUSPECT mode and to troubleshoot this erroneous situation, follow the procedure given below.

  • By executing DBCC CHECKDB, detect reasons for SUSPECT database.
  • Now to detect the actual cause, open the SQL error log.
  • After this, just bring the database to ‘Emergency Mode

NOTE: In SUSPECT mode, it is impossible to connect to database that is why it is important to turn it to Emergency Mode.

  • To check inconsistencies among database objects, run DBCC.
  • After this, just turn on ‘Single Mode’ in the database.
  • Using ‘REPAIR_ALLOW_DATA_LOSS’, recover database.
  • Now, turn on ‘Multi-user Mode’ in database by performing suitable SQL command.

NOTE: The resolution methods mentioned-above may cause the withdrawal of SQL error 9003 from the database. Database is then brought to the normal mode when processed in an accurate way however if some mistakes are committed while executing these steps then, loss of data may occur.

Alternate Solution:

If all the above manual solutions fail to fix 9003 error code, then it is best recommended to opt for a third party software like SQL Recovery Software to overcome this issue and resolve 9003 SQL error.

Conclusion

We have thrown lights on SQL Server database error 9003 in this post. Manual methods have been given to resolve 9003 error from MDF and NDF data files. If all the above manual solutions fail to fix 9003 error code, then it is best recommended to opt for a third party SQL MDF Recovery tool to overcome this issue and resolve 9003 SQL error.

Содержание

  1. Основные сведения об ошибках компонента Database Engine
  2. KB3051521 — FIX: «Database ‘model’ cannot be opened» error when you restart SQL Server after tail-log backup for model database
  3. Symptoms
  4. Cause
  5. Resolution
  6. Service pack information
  7. Workaround
  8. Status
  9. Blogging About SQL Tips & Tricks
  10. Fix SQL Server Model Database Error 9003
  11. What is Error 9003 in SQL Server Database?
  12. Reasons of SQL Server Error Code 9003
  13. Methods to Fix Microsoft SQL Server Error 9003
  14. Conclusion
  15. Moving Model database error?
  16. SQL Journey
  17. Journey of SQL Server & Microsoft Business Intelligence
  18. Categories
  19. Archives
  20. SQL Journey
  21. Top Rated
  22. Blogroll
  23. Community
  24. Design Center
  25. Bookmarks
  26. Blog Stats
  27. Get a Freelancer
  28. Fixing Error Message 1807 could not obtain exclusive lock on database ‘model’ in SQL Server

Основные сведения об ошибках компонента Database Engine

Применимо к: SQL Server (все поддерживаемые версии) Azure SQL database Управляемый экземпляр SQL Azure Azure Synapse Analytics Analytics Platform System (PDW)

Ошибки, возникшие в компоненте Microsoft Компонент SQL Server Database Engine, имеют атрибуты, описанные в следующей таблице.

attribute Описание
Номер ошибки Каждое сообщение имеет уникальный номер ошибки.
Строка сообщения об ошибке Сообщение об ошибке содержит диагностические сведения о причине ошибки. Многие сообщения об ошибках имеют подстановочные переменные, в которые заносятся сведения, например имя объекта, вызвавшего ошибку.
Severity Степень серьезности ошибки указывает, насколько она значительна. Ошибки с низкой степенью серьезности, например 1 или 2, являются информационными сообщениями или предупреждениями низкого уровня. Ошибки с высокой степенью серьезности указывают на проблемы, которые должны быть решены как можно быстрее. Дополнительные сведения о степенях серьезности см. в разделе Степени серьезности ошибок компонента Database Engine.
Состояние Некоторые сообщения об ошибках могут возникнуть в нескольких точках кода компонента Компонент Database Engine. Например, ошибка 1105 может возникнуть при различных условиях. Каждое условие, которое вызывает ошибку, присваивает уникальный код состояния.

При просмотре баз данных со сведениями об известных неполадках, таких как база знаний Microsoft , можно использовать номер состояния, чтобы определить, является ли записанная неполадка возникшей ошибкой. Например, если статья базы знаний описывает ошибку 1105 с состоянием 2, а получена ошибка 1105 с состоянием 3, ошибка, вероятно, возникла не по той причине, которая описана в статье.

Инженер поддержки Microsoft также может использовать код состояния, содержащийся в сообщении об ошибке, чтобы найти место в исходном коде, где эта ошибка возникла. Эти данные могут предоставить дополнительные сведения для диагностики проблемы.

Имя процедуры Имя хранимой процедуры или триггера, в которых произошла ошибка.
Номер строки Указывает на инструкцию в пакете, хранимой процедуре, триггере или функции, которая сформировала ошибку.

Все системные и пользовательские сообщения об ошибках в экземпляре компонента Компонент Database Engine содержатся в представлении каталога sys.messages . Инструкцию RAISERROR можно использовать для возвращения пользовательских ошибок приложению.

Все API-интерфейсы базы данных, например пространство имен Microsoft .NET Framework SQLClient, ActiveX Data Objects (ADO), OLE DB и Open Database Connectivity (ODBC), сообщают основные атрибуты ошибки. Эти сведения включают номер ошибки и строку сообщения. Однако не все API-интерфейсы сообщают остальные атрибуты ошибки.

Сведения об ошибке, возникающей в области блока TRY try try. Конструкцию CATCH можно получить в коде Transact-SQL с помощью таких функций, как ERROR_LINE, ERROR_MESSAGE, ERROR_NUMBER, ERROR_PROCEDURE, ERROR_SEVERITY и ERROR_STATE в области связанного блока CATCH. Дополнительные сведения см. в разделе TRY. CATCH (Transact-SQL).

Источник

KB3051521 — FIX: «Database ‘model’ cannot be opened» error when you restart SQL Server after tail-log backup for model database

Symptoms

Assume that you back up the tail of the log for the model database that uses norecovery option in Microsoft SQL Server 2014 or SQL Server 2012, and the database is put into restoring state. When the backup is complete, you cannot restart the SQL Server service, and you receive the following error message in SQL Server error log:

Date> Time> spid10s The database ‘model’ is marked RESTORING and is in a state that does not allow recovery to be run.
Date> Time> spid10s Error: 927, Severity: 14, State: 2.
Date> Time> spid10s Database ‘model’ cannot be opened. It is in the middle of a restore.
Date> Time> spid10s Could not create tempdb. You may not have enough disk space available. Free additional disk space by deleting other files on the tempdb drive and then restart SQL Server. Check for additional errors in the event log that may indicate why the tempdb files could not be initialized.
Date> Time> spid10s SQL Trace was stopped due to server shutdown. Trace . This is an informational message only; no user action is required.

Cause

This issue occurs because the model database is used as the template for all databases that are created on an instance of SQL Server. If the model database is marked as not allowing for recovery status, tempdb cannot be created, and the SQL Server service cannot start.

Resolution

Service pack information

To resolve this issue, obtain Service Pack 1 for SQL Server 2014.

For more information about SQL Server 2014 Service Pack 1 (SP1), see bugs that are fixed in SQL Server 2014 Service Pack 1.

Workaround

To work around this issue, use the following method:

Prevent all connections from the application to SQL Server

Start the SQL Server service together with trace flag 3608

Execute the «restore database Model with recovery» command

Remove trace flag 3608, and restart SQL Server

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the «Applies to» section.

Источник

Blogging About SQL Tips & Tricks

Fix SQL Server Model Database Error 9003

What is Error 9003 in SQL Server Database?

Microsoft SQL Server error 9003 is also known as model database error. When this problem occurs then an error message comes, «An error has occurred while establishing a connection to the server». This error contains following errors like, SQL Server model database may be corrupt, or the model database log files does not match the data file model.mdf. The error message appears only when a wrong sequence or unacceptable event ID is recorded by the log manager for a particular database.

Reasons of SQL Server Error Code 9003

The procreation of the error 9003 may be caused due to inconsistency, corruption, or replication issues taking place between the MDF files and the LDF files. The error message might also occurred due to misconfigured system files or registry issues of files.

Methods to Fix Microsoft SQL Server Error 9003

The following section shows steps used to overcome from this issue.

    Restore the Database from Backup:

If the error 9003 comes due to replication, then you should try to restore the database from its backup. So it is recommended that a healthy backup should be maintained to overcome from a critical situation like this.

Reinstall the SQL Server:

To overcome from this issue you should try to uninstall the working SQL Server application and reinstall on the same machine. If you are thinking about the reinstalling the SQL Server application, then it is recommended that you keep a healthy backup of the MDF file components. After uninstallation and reinstallation, you can restore all the components back to the database

Run DBCC CHECKDB: After installing the application, it is recommended that you should run the DBCC CHECKDB command to ensure that there is no physical or logical errors are in the database components.

If the above manual methods are unable to fix the issue, then you can go for a third party SQL data recovery tool to overcome this problem.

The affected database with the SQL Server error code 9003 may also be marked as a suspected. So it is recommended that, you should check that the database is not in suspect mode.

Conclusion

In this article we have discussed about SQL Server model database error 9003. Here, we discussed the reasons that are responsible for this issue and how to fix the error using different methods.

Источник

Moving Model database error?

June 21, 2008 at 12:20 pm

Iam trying to move Model database from the C drive to D drive.

I created a DATA n Log folder in D drive n I executed alter database commands. Then Stopped the sql server n Restarted but sql server is not starting. I found the following error in event viewer

FCB::Open failed: Could not open file D:Datamodel.mdf for file number 1. OS error: 2(The system cannot find the file specified.)

FileMgr::StartLogFiles: Operating system error 2(The system cannot find the file specified.) occurred while creating or opening file ‘D:Logmodellog.ldf’. Diagnose and correct the operating system error, and retry the operation.

How can I start the sql server now?

June 21, 2008 at 2:07 pm

Since you didn’t mention it in the original post. did you physically move the actual files to the new directory?

Joshua Jones
Director, Global Database Services
PGi

June 21, 2008 at 2:16 pm

June 21, 2008 at 5:25 pm

It worked after moving the data files to new location.

moving the physical files mean copying the model n modellog from default location to new location? is that right?

I did not moved physical data flles for tempdb,But its worked fine. So there is no need move physical files(i.e copying tempdb n templog from default location to new location) for tempdb?

June 21, 2008 at 10:18 pm

For tempdb you don’t need to move the physical files since tempdb will be created each time when SQL services gets restarted hence execute ALTER DATABASE command for tempdb.

Model and Msdb databases physical files should be moved to the new location, then start sql service in single user mode, detach model & msdb then attach both the databases pointing to the new location.

For master database just stop sql service, move physical files, update startup parameters and start sql service.

For more refer the link below

August 26, 2008 at 2:27 pm

Just a note of encouragement:

Problem: Kept getting «Cannot detach an opened database when the server is in minimally configured mode» when i tried sp_detach_db ‘model’

Solution: after setting the startup parameters but before cycling the server: close all queries in SMS, open a new query and set your default db connection (Query|Options) to «Master», then close it and close the object browser. Stop Reporting services (maybe Analysis and Integration too). Then cycle the SQL service and you should be able to sp_detach_db ‘model’.

August 26, 2008 at 2:35 pm

SQL Server 2005 and SQL Server 2000

In SQL Server 2005 and in SQL Server 2000, you cannot detach system databases by using the sp_detach_db stored procedure. When you try to run the sp_detach_db ‘model’ statement, you receive the following error message:

Server: Msg 7940, Level 16, State 1, Line 1

System databases master, model, msdb, and tempdb cannot be detached.

To move the model database, you must start SQL Server together with the -c option, the -m option, and trace flag 3608. Trace flag 3608 prevents SQL Server from recovering any database except the master database.

Note You will not be able to access any user databases after you do this. You must not perform any operations, other than the following steps, while you use this trace flag. To add trace flag 3608 as a SQL Server startup parameter, follow these steps:

1.In SQL Server Enterprise Manager, right-click the server name, and then click Properties.

2.On the General tab, click Startup Parameters.

3.Add the following new parameter:

If you are using SQL Server 2005, you can use SQL Server Configuration Manager to change the startup parameters of the SQL Server service. For more information about how to change the startup parameters, visit the following Microsoft Developer Network (MSDN) Web site:

After you add the -c option, the -m option, and trace flag 3608, follow these steps:

1.Stop and then restart SQL Server.

2.Detach the model database by using the following commands:

3.Move the Model.mdf and Modellog.ldf files from the D:Mssql7Data folder to the E:Sqldata folder.

4.Reattach the model database by using the following commands:

5.Remove -c -m -T3608 from the startup parameters in SQL Server Enterprise Manager or in SQL Server Configuration Manager.

6.Stop and then restart SQL Server. You can verify the change in file locations by using the sp_helpfile stored procedure. For example, use the following command:

Источник

SQL Journey

Journey of SQL Server & Microsoft Business Intelligence

Categories

Archives

  • May 2013 (3)
  • February 2013 (2)
  • January 2013 (2)
  • December 2012 (3)
  • June 2011 (1)
  • August 2010 (2)
  • July 2010 (4)
  • June 2010 (13)

SQL Journey

Top Rated

Blogroll

Design Center

Bookmarks

Blog Stats

Get a Freelancer

Fixing Error Message 1807 could not obtain exclusive lock on database ‘model’ in SQL Server

Posted by Prashant on June 15, 2010

Some days back I got this question from one of my friend, when he was trying to create a New Database, he is getting the below error message.

The Situation:

He was trying to create table on Model database first then he tried to create a New Database. As Model database is used as a template for a database being created, SQL Server tries to obtain an Exclusive Lock on Model database. So if one session is using model database SQL Server can’t obtain exclusive lock on model.

If you are using SQL Server Management Studio try these steps:

Step1: Open a New Query (say SQL Query1.sql) and select “model” from database dropdown box.

Step2: Now in another Query (say SQL Query2.sql) run the below query:

Observation: You will find result like below.

(Click on the image to enlarge)

This indicates Shared Lock has been Granted on resource_database_id = 3 (database_id: 3 is for model)

Step3: Now try to create database either from Object Explorer of SQL Server Management Studio or by CREATE DATABASE statement.

Step4: This time run query in step-3 and observe the result.

(Click on the image to enlarge)

This indicates an Exclusive lock on model database but has not been granted yet (it’s in WAIT state).

Solution:

Make sure to disconnect all the sessions which uses model database then CREATE DATABASE statement later. If this problem still remains, restart management studio and try again.

This is tested in SQL Server 2008, also leave your suggestions.

Источник

Понравилась статья? Поделить с друзьями:
  • Ошибка 9002 серьезность 17 состояние 4
  • Ошибка 9002 мерседес w211
  • Ошибка 90011 alicia online
  • Ошибка 9001 мерседес w164
  • Ошибка 9001 мерседес 221