Ms sql server ошибка 5030

I am trying to delete an existing database in SQL Server 2005. My first attempt produced the following error:

5030: The database could not be exclusively
locked to perform the operation.

I have since killed all processes that are accessing the database. I have also removed the replication subscription that it had previously been involved in.

Any thoughts on what else that could be holding the lock on it besides SQL Server processes and replication?

Update: I restarted the server, and that fixed it. I was trying to avoid that, since this is a production server, but hey what can you do?

Petter Friberg's user avatar

asked Feb 8, 2009 at 5:14

jeremcc's user avatar

A production server in which so many connections use the database yet you want to drop it? :)

None the less, how to kick out everybody from the database:

USE [dbname];
ALTER DATABASE [dbname] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;

Then drop the database:

USE [master];
DROP DATABASE [dbname];

There is still a very small window of opportunity between the USE [master]; and DROP DATABASE ... where some other connection can grab the 1 single allowed lock on the database, but it usually not worth working around that.

answered Nov 23, 2009 at 20:05

Remus Rusanu's user avatar

Remus RusanuRemus Rusanu

287k40 gold badges437 silver badges567 bronze badges

3

I hate to say it, but a quick solution is to restart the system, make sure the sql server server service is not started, then you should be able to delete.

Also, is IIS stopped if you db is connected to a web ap?

answered Feb 8, 2009 at 5:19

Chris Ballance's user avatar

Chris BallanceChris Ballance

33.6k26 gold badges103 silver badges151 bronze badges

2

You don’t happen to know if anyone left a transaction in an uncompleted rollback state (or otherwise uncompleted)? Might as well check the locks list, too.

answered Feb 8, 2009 at 5:34

dkretz's user avatar

dkretzdkretz

37.3k13 gold badges80 silver badges138 bronze badges

1

In the management studio, goto Management->Activity Monitor (right click) -> View Processes. That will give you a full list of everything running, you can sort the list by Database to see what is still attached, and you can also kill any connections. It’s easy to end up with orphaned connections that will prevent you from getting the exclusive access that you need.

answered Feb 8, 2009 at 5:19

MrTelly's user avatar

MrTellyMrTelly

14.6k1 gold badge48 silver badges81 bronze badges

2

No One else should be using the DB, including yourself.

answered Feb 8, 2009 at 5:19

1

Why would we make a deleted DB to multi user mode.

ALTER DATABASE dbName SET MULTI_USER WITH ROLLBACK IMMEDIATE

Soner Gönül's user avatar

Soner Gönül

96.8k102 gold badges205 silver badges362 bronze badges

answered Jun 13, 2014 at 7:55

user3736882's user avatar

To avoid this error, use the T-SQL script below in the master database. Make sure to run this (and modify the @dbname) for each database you are running the ALTER DATABASE command in.

«The database could not be exclusively locked to perform the
operation»

This «connection killer» script will work if Windows has established JDBC connections to the database. But this script is unable to kill off JDBC connections for Linux services (e.g. JBoss). So you’ll still get that error if you don’t stop JBoss manually. I haven’t tried other protocols, but please comment if you find out more information as you build new systems.

USE master;

DECLARE @dbname sysname

Set @dbname = 'DATABASE_NAME_HERE-PROD'

Declare @spid int
Select @spid = min(spid) from master.dbo.sysprocesses
where dbid = db_id(@dbname)
While @spid Is Not Null
Begin
        Execute ('Kill ' + @spid)
        Select @spid = min(spid) from master.dbo.sysprocesses
        where dbid = db_id(@dbname) and spid > @spid
End

answered Oct 28, 2015 at 20:26

Entree's user avatar

EntreeEntree

18.3k38 gold badges159 silver badges243 bronze badges

This error normally occurs when your database is in Multi User mode where users are accessing your database or some objects are referring to your database.
First you should set the database to single user mode:

ALTER DATABASE dbName
SET SINGLE_USER WITH ROLLBACK IMMEDIATE

Now we will try to delete the database

delete DATABASE ...

Finally set the database to Multiuser mode

ALTER DATABASE dbName
SET MULTI_USER WITH ROLLBACK IMMEDIATE

Rahul Hendawe's user avatar

answered Sep 16, 2013 at 5:37

farnoush resa's user avatar

When you want to rename your database and you hit the error below, you need to set the database to​​ Single User Mode. After you rename your database, then you set the database back to Multi-User mode.​​

Msg 5030, Level 16, State 2, Line 1

The database could not be​​ exclusively locked to perform the operation

Follow the steps​​ below to rename your database.​

  1. Set the database to single-mode
ALTER DATABASE OLD_DBName SET SINGLE_USER WITH ROLLBACK IMMEDIATE;

2. Rename the Database

ALTER DATABASE OLD_DBName MODIFY NAME = NEW_DBNAME;

3. Set the database to Multi-user mode

ALTER DATABASE NEW_DBNAME SET MULTI_USER WITH ROLLBACK IMMEDIATE;

You may check out this blog post where I show a better way to rename a database.

Cheers!

  • Remove From My Forums
  • Question

  • I am trying to rename the database but i am getting below exception while doing it—>

    Error: the database could not be exclusively locked to perform the operation.(Microsoft Sql Server,Error 5030)

    Thanks.

Answers

  • Thats because someone else is accessing the database.. Put the database into single user mode the rename it.

    USE [master];
    GO
    ALTER DATABASE foo SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
    GO
    EXEC sp_renamedb N'foo', N'bar';

    vt


    Please mark answered if I’ve answered your question and vote for it as helpful to help other user’s find a solution quicker

    • Proposed as answer by

      Tuesday, October 23, 2012 9:15 AM

    • Marked as answer by
      Maggy111
      Tuesday, October 23, 2012 9:22 AM

If you are facing this error : “The database could not be exclusively locked to perform the operation. (Microsoft SQL Server, Error: 5030)” when you try to rename SQL server database you need to temporary switch from Multi User mode to single user mode, then rename the database and then set it back to Multi user mode.

Do it step by step.

ALTER DATABASE dbName
SET SINGLE_USER WITH ROLLBACK IMMEDIATE

ALTER DATABASE dbName MODIFY NAME = dbNewName

ALTER DATABASE dbNewName
SET MULTI_USER WITH ROLLBACK IMMEDIATE

Published
27 November 202124 July 2022

Содержание

  1. Сообщение об ошибке при выполнении команды DBCC ПРОВЕРИТЬ в SQL Server: «базы данных не удалось заблокировать монопольно для выполнения операции»
  2. Симптомы
  3. Причина
  4. Решение
  5. Статус
  6. Дополнительные сведения
  7. Ms sql server error 5030
  8. Answered by:
  9. Question
  10. Answers
  11. All replies
  12. Ms sql server error 5030
  13. Answered by:
  14. Question
  15. Answers
  16. All replies
  17. Ms sql server error 5030
  18. Все ответы

Сообщение об ошибке при выполнении команды DBCC ПРОВЕРИТЬ в SQL Server: «базы данных не удалось заблокировать монопольно для выполнения операции»

Симптомы

В Microsoft SQL Server может появиться сообщение об ошибке при выполнении команды DBCC:

ИНСТРУКЦИЯ DBCC CHECKDB

ИНСТРУКЦИЯ DBCC CHECKTABLE

ИНСТРУКЦИЯ DBCC CHECKALLOC

ИНСТРУКЦИЯ DBCC CHECKFILEGROUP

Сообщение об ошибке содержит следующий текст:

Сообщение 5030, уровень 16, состояние 12, 1 строки базы данных не удалось заблокировать монопольно для выполнения операции.
Сообщение 7926, уровень 16, состояние 1, строка 1
Инструкция проверки прервана. Не удалось вернуть базу данных не удалось создать моментальный снимок базы данных и базы данных или таблицы не может быть заблокирован. Дополнительные сведения, когда возникает данная ситуация и какие существуют обходные пути. Также см. Дополнительные сведения.

Если запланированные задачи плана обслуживания, которые выполняют проверку целостности базы данных в файл журнала для соответствующего плана может записать сообщение об ошибке, подобное приведенному ниже:

Версия программы (Юникод) обслуживание Microsoft(R) сервера 9.0.2047
Отчет был сформирован на « имя_компьютера».
План обслуживания: PlanForReadOnlyDb
Длительность: 00:00:52
Состояние: Предупреждение: не удалось выполнить одну или несколько задач.
Подробности:
Проверьте задача проверки целостности базы данных ( имя компьютера)
Проверить целостность базы данных на имя_компьютера
Базы данных: AdventureWorks, в базе данных msdb, PassDb, продажи, test1 включить индексы
Начало задачи:
Даты и времени.
Окончание задачи:
Даты и времени.
При выполнении запроса «DBCC CHECKDB параметр WITH NO_INFOMSGS Failed:(-1073548784)
«Ошибка со следующей ошибкой: «базы данных не удалось заблокировать монопольно для выполнения операции. Инструкция проверки прервана. Не удалось вернуть базу данных не удалось создать моментальный снимок базы данных и базы данных или таблицы не может быть заблокирован. Дополнительные сведения, когда возникает данная ситуация и какие существуют обходные пути. Также см. Дополнительные сведения.» Возможные причины сбоя: проблемы с запроса, «ResultSet» свойства заданы неправильно, параметры установлены неправильно или соединение не установлено правильно.

Причина

Эта проблема возникает, если выполняются следующие условия:

Хотя бы одно подключение используется база данных, в которой команда команда DBCC CHECK.

База данных содержит по крайней мере одну группу файлов, помечены как доступные только для чтения.

Начиная с SQL Server 2005, команда DBCC CHECK команды Создать и использовать моментальный снимок внутренней базы данных для сохранения согласованности при команда выполняет все проверки. Если группы только для чтения файл существует в базе данных, моментальный снимок внутренней базы данных не создается. Чтобы продолжить проверку, команда команда DBCC CHECK пытается получить блокировку базы данных EX. Если к базе данных подключены другие пользователи, это попытка получить блокировку EX завершается неудачей. Таким образом появляется сообщение об ошибке.

Решение

Чтобы устранить эту проблему, выполните следующие действия, вместо выполнения команды DBCC ПРОВЕРИТЬ в базе данных.

Создание моментального снимка базы данных, базы данных, для которого требуется выполнить проверку. Дополнительные сведения о способах создания моментального снимка базы данных приведены в разделе «Создание моментального снимка базы данных (Transact-SQL)» в электронной документации по SQL Server.

Выполните команду проверки DBCC для моментального снимка базы данных.

После завершения команды DBCC ПРОВЕРЬТЕ удалите моментальный снимок базы данных.

Статус

Корпорация Майкрософт подтверждает, что это проблема продуктов Майкрософт, перечисленных в разделе «Относится к».

Дополнительные сведения

Дополнительные сведения об использовании команды проверки DBCC моментальный снимок внутренней базы данных приведены в разделе «DBCC (Transact-SQL)» в разделе «DBCC внутреннего использования базы данных моментальных снимков» в электронной документации по SQL Server 2005.

Чтобы воспроизвести эту проблему, выполните следующие команды в SQL Server:

Источник

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Answered by:

Question

I am trying to rename the database but i am getting below exception while doing it—>

Error: the database could not be exclusively locked to perform the operation.(Microsoft Sql Server,Error 5030)

Answers

Thats because someone else is accessing the database.. Put the database into single user mode the rename it.

Please mark answered if I’ve answered your question and vote for it as helpful to help other user’s find a solution quicker

Thats because someone else is accessing the database.. Put the database into single user mode the rename it.

Please mark answered if I’ve answered your question and vote for it as helpful to help other user’s find a solution quicker

Sounds like you have active connections to the database. You can verify this by running sp_who2, or through Activity Monitor and look for your database.

You could set the database to single user, i.e:

then do your sp_renamedb ‘myolddbname’, ‘mynewdbname’ or;

as mentioned earlier by both these users just wait for all the connections to go and then try- it will succed

or else if it is devUat environment & you can kill the conenctions — make the changes (use this as last option)

i was just wondering if you are connected to the same DB? If yes change your context to master(means connect to master DB ) and then issue this command.

Sarabpreet Singh Anand

This posting is provided , «AS IS» with no warranties, and confers no rights.

Please remember to click «Mark as Answer» and «Vote as Helpful» on posts that help you. This can be beneficial to other community members reading the thread.

Источник

Ms sql server error 5030

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Answered by:

Question

I am trying to rename the database but i am getting below exception while doing it—>

Error: the database could not be exclusively locked to perform the operation.(Microsoft Sql Server,Error 5030)

Answers

Thats because someone else is accessing the database.. Put the database into single user mode the rename it.

Please mark answered if I’ve answered your question and vote for it as helpful to help other user’s find a solution quicker

Thats because someone else is accessing the database.. Put the database into single user mode the rename it.

Please mark answered if I’ve answered your question and vote for it as helpful to help other user’s find a solution quicker

Sounds like you have active connections to the database. You can verify this by running sp_who2, or through Activity Monitor and look for your database.

You could set the database to single user, i.e:

then do your sp_renamedb ‘myolddbname’, ‘mynewdbname’ or;

as mentioned earlier by both these users just wait for all the connections to go and then try- it will succed

or else if it is devUat environment & you can kill the conenctions — make the changes (use this as last option)

i was just wondering if you are connected to the same DB? If yes change your context to master(means connect to master DB ) and then issue this command.

Sarabpreet Singh Anand

This posting is provided , «AS IS» with no warranties, and confers no rights.

Please remember to click «Mark as Answer» and «Vote as Helpful» on posts that help you. This can be beneficial to other community members reading the thread.

Источник

Ms sql server error 5030

I have read a lot about this problem, but cant figure out mine.

First og all, I cant geet the MOMServer.MSI to run. Error messages in the MOMDB.log is diffrent from what the FF MOMDB.log reports.

I Run W2K3 R2, SQL 2005 Std, and SCE on a newly installed server. Here is what seems to be the most important lines in en MOMDB files:

Forefront — MOMDB.log

CPreReqUtil::LoadPropertyString: MsiViewFetch failed. HRESULT = -2147024637
LoadPropertyString failedfailed: hr: -2147024637
CPreReqVerifier::CheckMOMComponentVersion: Open key failed. HRESULT = -2147024894 SOFTWAREMission Critical SoftwareOnePointConfigurationsDefaultMcsApplicationsOperations ManagerInstall
CPreReqVerifier::Checkfailed: hr: -2147024894
CPreReqVerifier::CheckSp1Agent: Open key failed. HRESULT = -2147024894 SOFTWAREMission Critical SoftwareOnePoint
CPreReqVerifier::ExclusiveChecksfailed: hr: -2147024894
CPreReqVerifier::CheckInstallDir: Open key failed. HRESULT = -2147024894 SOFTWAREMicrosoftMicrosoft Operations Manager2.0Setup
CPreReqVerifier::ExclusiveChecksfailed: hr: -2147024894

CPreReqVerifier::CheckCurrentUserIsDBAdmin: Setup registry key not found. Error Code: 0x80070002.
CPreReqVerifier::ExclusiveChecksfailed: hr: -2147024894
CPreReqVerifier::ExclusiveChecksfailed: hr: -2147024894
CPreReqVerifier::Checkfailed: hr: -2147024894
CPreReqUtil::CopyFileFromMsi: Query: . HRESULT = 0 SELECT `Data` FROM `Binary` WHERE `Name`=’PreReq.dll’
CPreReqUtil::CopyFileFromMsi: Create failed. HRESULT = -2147024891
CPreReqUtil::LoadHTMLResourceFromMsiBin: CopyFileFromMsi failed. HRESULT = -2147024891
CReportWriter::WriteReport: CopyFileFromMsi failed. HRESULT = -2147024891
CReportWriter::WriteReport: Copy failed. HRESULT = -2147024894
CPreReqVerifier::Checkfailed: hr: -2147024894
VerifyPreReqs: Check failed. HRESULT = -2147024894
VerifyPreRequisites: Check failed. Error Code: 0x80070002.
VerifyPreRequisites: Function returned value. Error Code: 0x80070002.
Action ended 13:37:46: _VerifyPreRequisites. Return value 3.
Action ended 13:37:46: INSTALL. Return value 3.

MSI (s) (CC:10) [13:37:46:656]: Product: Microsoft Operations Manager 2005 — Installation failed.

MOMServer.MSI-MOMDB.log

MSI (c) (3C:80) [15:28:12:406]: Skipping action: _Set_MOMX_PRODUCT_FOUND_ExpressSameVersion (condition is false)
MSI (c) (3C:80) [15:28:12:406]: Skipping action: _Set_MOMX_PRODUCT_FOUND_EvalSameVersion (condition is false)
MSI (c) (3C:80) [15:28:12:406]: Skipping action: _AbortDowngradeProductAttempt (condition is false)
MSI (c) (3C:80) [15:28:12:406]: Skipping action: _AbortInvalidUpgradeProductAttempt (condition is false)
MSI (c) (3C:80) [15:28:12:406]: Skipping action: _AbortIncompatibleAgent (condition is false)
MSI (c) (3C:80) [15:28:12:406]: Skipping action: CCPSearch (condition is false)
MSI (c) (3C:80) [15:28:12:406]: Skipping action: RMCCPSearch (condition is false)
MSI (c) (3C:80) [15:28:12:406]: Doing action: CostInitialize
Action 15:28:12: CostInitialize. Determining disk space requirements
Action start 15:28:12: CostInitialize.
MSI (c) (3C:80) [15:28:12:406]: Machine policy value ‘MaxPatchCacheSize’ is 10
MSI (c) (3C:80) [15:28:12:406]: PROPERTY CHANGE: Adding ROOTDRIVE property. Its value is ‘D:’.
MSI (c) (3C:80) [15:28:12:421]: PROPERTY CHANGE: Adding CostingComplete property. Its value is ‘0’.
Action ended 15:28:12: CostInitialize. Return value 1.
MSI (c) (3C:80) [15:28:12:421]: Doing action: FileCost
Action 15:28:12: FileCost. Determining disk space requirements
Action start 15:28:12: FileCost.
Action ended 15:28:12: FileCost. Return value 1.

Action start 15:28:18: _SetFeatureStatesForTypicalInstall.
MSI (c) (3C:9C) [15:28:18:796]: Invoking remote custom action. DLL: C:DOCUME

1TempMSI6A1.tmp, Entrypoint: SetFeatureStatesForTypicalInstall
MSI (c) (3C!88) [15:28:18:812]: Note: 1: 2727 2:
MSI (c) (3C!88) [15:28:18:968]: Disallowing installation of component: since the same component with higher versioned keyfile exists
MSI (c) (3C!88) [15:28:18:984]: Disallowing installation of component: <1a6d8713-9116-44ae-ba60-4cf0e8c1d58b>since the same component with higher versioned keyfile exists
MSI (c) (3C!88) [15:28:18:984]: Disallowing installation of component: since the same component with higher versioned keyfile exists
MSI (c) (3C!88) [15:28:19:000]: Disallowing installation of component: <1ca051b6-1b70-11d2-9add-006097c4e452>since the same component with higher versioned keyfile exists
MSI (c) (3C!88) [15:28:19:000]: Note: 1: 2727 2:
MSI (c) (3C!88) [15:28:19:000]: Note: 1: 2262 2: MIME 3: -2147287038
MSI (c) (3C!88) [15:28:19:031]: Disallowing installation of component: <1ca051b6-1b70-11d2-9add-006097c4e452>since the same component with higher versioned keyfile exists
MSI (c) (3C!88) [15:28:19:031]: Note: 1: 2727 2:
Action ended 15:28:19: _SetFeatureStatesForTypicalInstall. Return value 1.
MSI (c) (3C:3C) [15:28:19:031]: Doing action: _VerifyPreRequisites_Wizard
Action 15:28:19: _VerifyPreRequisites_Wizard.
Action start 15:28:19: _VerifyPreRequisites_Wizard.
MSI (c) (3C:C0) [15:28:19:046]: Invoking remote custom action. DLL: C:DOCUME

1TempMSI6A2.tmp, Entrypoint: VerifyPreRequisites
MSI (c) (3C!9C) [15:28:19:062]: Note: 1: 2711 2: MOMReporting
Action ended 15:28:19: _VerifyPreRequisites_Wizard. Return value 1.
MSI (c) (3C:3C) [15:28:19:234]: PROPERTY CHANGE: Modifying PREREQ_COMPLETED property. Its current value is ‘0’. Its new value: ‘1’.
Action 15:28:19: PreReqResultDlg. Dialog created

Hope someone have seen similar messages.

Все ответы

Are you attempting to run the MOMServer.msi manually? If so, please don’t — it will be launched properly as part of FCS Server setup

That said, none of the error messages below appear to be directly pointing out the problem. Can you run ServerSetup.exe and view the log file when it fails. From there, please post the first section that fails (it’s likely to be a 1603 error code)

Forefront Client Security PM

Did you solve a problem? I have the same issue:

MSI (s) (98:64) [21:29:37:659]: Note: 1: 1708
MSI (s) (98:64) [21:29:37:674]: Product: Microsoft Operations Manager 2005 — Installation failed.

MSI (s) (98:64) [21:29:37:674]: Cleaning up uninstalled install packages, if any exist
MSI (s) (98:64) [21:29:37:674]: MainEngineThread is returning 1603
MSI (s) (98:9C) [21:29:37:784]: Destroying RemoteAPI object.
MSI (s) (98:54) [21:29:37:784]: Custom Action Manager thread ending.
=== Logging stopped: 12/5/2007 21:29:37 ===
MSI (c) (3C:90) [21:29:37:784]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1
MSI (c) (3C:90) [21:29:37:784]: MainEngineThread is returning 1603
=== Verbose logging stopped: 12/5/2007 21:29:37 ===

Tasks started: [12/5/2007 9:29:20 PM]
Root Directory: C:distForefrontserver
Current Directory: C:distForefrontAUTORUN
[12/5/2007 9:29:20 PM] Task(Install the Collection Database)
Installing from this MSI: ‘c:distforefrontServerMOMServer.msi’
Log file: ‘C:Program FilesMicrosoft ForefrontClient SecurityServerLogsMOMDB.log’.
[12/5/2007 9:29:20 PM] Task(Install the Collection Database)
Starting Install the Collection Database.
[12/5/2007 9:29:20 PM] Task(Install the Collection Database)
Starting C:WINDOWSsystem32msiexec.exe.
[12/5/2007 9:29:20 PM] Task(Install the Collection Database)
Process command ‘C:WINDOWSsystem32msiexec.exe’
[12/5/2007 9:29:20 PM] Task(Install the Collection Database)

Process arguments ‘/i «c:distforefrontServerMOMServer.msi» /norestart /qn /l*v «C:Program FilesMicrosoft ForefrontClient SecurityServerLogsMOMDB.log» INSTALLDIR=»C:Program FilesMicrosoft ForefrontClient SecurityServerMicrosoft Operations Manager 2005″ ADDLOCAL=»MOMXDB» MOM_SERVER=.

[12/5/2007 9:29:37 PM] Task(Install the Collection Database)

[12/5/2007 9:29:37 PM] Task(Install the Collection Database)
The following process failed.
Process: C:WINDOWSsystem32msiexec.exe
Exit code: 1603Number of tasks completed: [12/5/2007 9:29:38 PM]

I am getting the SAME exact error when installing Forefront. I read other replies and increase my disk space. I now have 35GB free on all drives and still no luck. The account is the local admin as well and has full SQL access.

MS, Could you please help?

My ServerSetup_. file:

Number of verifications started: [12/27/2007 4:04:59 PM]

[12/27/2007 4:05:00 PM] Verification(Verifying operating system requirements)

[12/27/2007 4:05:00 PM] Verification(Verifying hardware requirements)

[12/27/2007 4:05:00 PM] Verification(Verifying software prerequisites)

[12/27/2007 4:05:01 PM] Verification(Verifying collection database)

[12/27/2007 4:05:01 PM] Verification(Verifying access to collection server)

[12/27/2007 4:05:02 PM] Verification(Verifying DAS account)

Number of verifications completed: [12/27/2007 4:05:02 PM]
Tasks started: [12/27/2007 4:05:07 PM]
Root Directory: C:. server
Current Directory: C:. AUTORUN
[12/27/2007 4:05:07 PM] Task(Install the Collection Database)
Installing from this MSI: ‘c:. ServerMOMServer.msi’
Log file: ‘C:Program FilesMicrosoft ForefrontClient SecurityServerLogsMOMDB.log’.
[12/27/2007 4:05:07 PM] Task(Install the Collection Database)
Starting Install the Collection Database.
[12/27/2007 4:05:07 PM] Task(Install the Collection Database)
Starting C:WINDOWSsystem32msiexec.exe.
[12/27/2007 4:05:07 PM] Task(Install the Collection Database)
Process command ‘C:WINDOWSsystem32msiexec.exe’
[12/27/2007 4:05:07 PM] Task(Install the Collection Database)
Process arguments ‘/i «c:documents and settingsasmforefrontdesktopforefrontServerMOMServer.msi» /norestart /qn /l*v «C:Program FilesMicrosoft ForefrontClient SecurityServerLogsMOMDB.log» INSTALLDIR=»C:. ServerMicrosoft Operations Manager 2005″ ADDLOCAL=»MOMXDB» MOM_SERVER=»NVFFDB» SQLSVR_INSTANCE=»NVFFDB» DAS_ACCOUNT=»TheAccount» DAS_PASSWORD=»*****» DAS_DOMAIN=»TheDomain» DB_SIZE=»15360″ CONFIG_GROUP=»ForefrontClientSecurity» DATA_DIR=»E:SQLDATA» LOG_DIR=»D:SQLLOG»‘
[12/27/2007 4:05:12 PM] Task(Install the Collection Database)

[12/27/2007 4:05:12 PM] Task(Install the Collection Database)
The following process failed.
Process: C:WINDOWSsystem32msiexec.exe
Exit code: 1603Number of tasks completed: [12/27/2007 4:05:13 PM]

My MOMDB.LOG file:

MSI (s) (BC:B8) [16:05:12:609]: Product: Microsoft Operations Manager 2005 — Installation failed.

MSI (s) (BC:B8) [16:05:12:640]: Cleaning up uninstalled install packages, if any exist
MSI (s) (BC:B8) [16:05:12:640]: MainEngineThread is returning 1603
MSI (s) (BC:A0) [16:05:12:750]: Destroying RemoteAPI object.
MSI (s) (BC:A4) [16:05:12:750]: Custom Action Manager thread ending.
=== Logging stopped: 12/27/2007 16:05:12 ===
MSI (c) (A4:E4) [16:05:12:828]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1
MSI (c) (A4:E4) [16:05:12:828]: MainEngineThread is returning 1603
=== Verbose logging stopped: 12/27/2007 16:05:12 ===

MSI (s) (BC:B8) [16:05:12:609]: Product: Microsoft Operations Manager 2005 — Installation failed.

MSI (s) (BC:B8) [16:05:12:640]: Cleaning up uninstalled install packages, if any exist
MSI (s) (BC:B8) [16:05:12:640]: MainEngineThread is returning 1603
MSI (s) (BC:A0) [16:05:12:750]: Destroying RemoteAPI object.
MSI (s) (BC:A4) [16:05:12:750]: Custom Action Manager thread ending.
=== Logging stopped: 12/27/2007 16:05:12 ===
MSI (c) (A4:E4) [16:05:12:828]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1
MSI (c) (A4:E4) [16:05:12:828]: MainEngineThread is returning 1603
=== Verbose logging stopped: 12/27/2007 16:05:12 ===

seems like MOM 2005 installation failed.

I came across this previously and had to get more info abt the failure cause.

my problem previously was i changed my computer name after i installed SQL.

So to find out what’s failing:

Run momserver.msi, Click next until the Prerequisite Check.

there’s the log there that provides more info if it fails.

Hope this helps.

I think the problem is that you have SCE on the same box, which is not supported. I would recommend trying the install without SCE being on the same machine

Forefront Client Security PM

This is very strange from Microsoft. Basically, the SQL Collation Setting was set wrong. When installing, per documentation on TechNet, you have to choose a collation setting that is not case sensative. I had chosen that. BUT, the collation setting has to be Case sensative for this to work. I was on a call with MS for about 4 hours and no one figured it out untill I re-installed a new instance using the case-sensative collation and boom, everything worked.

I am getting a similar error installing MOM Reporting services.

Fresh installation 2008 32bit, SQl 2005 32bit, SSRS and SSIS up and running.

Источник

На чтение 7 мин. Просмотров 474 Опубликовано 02.05.2021

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

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

Содержание

  1. Создание базы данных:
  2. Метод 1. Использование параметра переименования SSMS для переименования базы данных SQL Server
  3. Метод 2: Использование SSMS для переименования базы данных SQL Server
  4. Метод 3: Использование T-SQL для переименования базы данных SQL Server
  5. Метод 4. Использование отсоединения и присоединения для переименования SQL Server
  6. Использование SSMS для отключения и повторного подключения баз данных
  7. Ошибки, возникающие при переименовании базы данных через SSMS и при выполнении запроса:
  8. Ошибка 1: ошибка возникает при переименовании базы данных через SSMS
  9. Ошибка 2: ошибка возникает при переименовании базы данных с помощью запроса
  10. Решение:
  11. Заключение:

Создание базы данных:

Выберите любую базу данных в вашей системе управления SQL Server (SSMS) . Если у вас его нет, вы можете создать его, выполнив эту процедуру.

  1. Щелкните правой кнопкой мыши « Database » в «Обозреватель объектов» и выберите вариант «Новая база данных» .
  2. На левой панели появится окно
  3. выберите «Общие» , введите имя базы данных на правой панели и нажмите «ОК» . База данных будет создана

Существует несколько способов переименования базы данных в SQL Server. , которые подробно обсуждаются ниже вместе с версиями, поддерживаемыми любым конкретным методом. Позже мы также обсудим ошибки, возникающие при переименовании базы данных, и процедуру их исправления.

Метод 1. Использование параметра переименования SSMS для переименования базы данных SQL Server

Это самый простой способ переименовать базу данных. Для этого необходимо поступить следующим образом.

  1. Щелкните правой кнопкой мыши имя базы данных в обозревателе объектов.
  2. Выберите «переименовать ”, введите имя базы данных и нажмите

Метод 2: Использование SSMS для переименования базы данных SQL Server

Еще один простейший способ переименовать базу данных точно так же, как переименование любой папки в Windows. Чтобы сделать это, вы должны продолжать в том же духе. Щелкните базу данных, чтобы переименовать ее, как при переименовании папок Windows.

Метод 3: Использование T-SQL для переименования базы данных SQL Server

Для SQL Server 2005, 2008, 2008R2, 2012, 2014, 2016 и 2017 эта команда работает. Выполните следующий оператор.

 ALTER DATABASE [test] MODIFY NAME = [test_cases] 

Результатом будет «Имя базы данных ‘test_cases’ установлен ». Как показано на рисунке ниже.

Вы можете использовать Приведенная ниже команда T-SQL для изменения имени базы данных, если вы используете SQL Server 2000. В SQL 2005, 2008, 2008R2, 2012, 2014, 2016 и 2017 это все еще работает, но на каком-то этапе Microsoft утверждает, что это будет прекращено.

Метод 4. Использование отсоединения и присоединения для переименования SQL Server

Использование функции отсоединения и присоединения SQL Server может использоваться для удаления сначала базу данных и присвойте базе данных другое имя при повторном подключении базы данных. Для этого можно использовать следующие команды T-SQL

Отсоединение базы данных , выполнив следующий код:

 EXEC sp_detach_db  'test', 'true' 

Результат будет таким

Присоединение базы данных.

 EXEC sp_attach_db @dbname = N'test ', @ filename1 = N'C:  Program Files  Microsoft SQL Server  MSSQL12  .MSSQLSERVER  MSSQL  DATA  test.mdf ', @ filename2 = N'C:  Program Files  Microsoft SQL Server  MSSQL12.MSSQLSERVER  MSSQL  DATA  test_log.ldf'; 

вывод будет следующим:

Использование SSMS для отключения и повторного подключения баз данных

Этого также можно достичь с помощью SSMS, выполнив следующие действия.

  1. Щелкните правой кнопкой мыши базу данных, выберите «задача» , затем нажмите
  2. Теперь нажмите «ОК»
  3. Теперь, чтобы присоединить базу данных, щелкните правой кнопкой мыши «Базы данных» в «Обозревателе объектов» и нажмите « Прикрепить ». Появится экран, нажмите «Добавить». Появится другое окно с именами баз данных в нем, как показано ниже, выберите «test».
  4. Но мы хотим добавить его как измененное имя базы данных «test_cases» , поэтому введите «test_case» в »Присоединить как “ поле. Теперь вот так. Это приведет к переименованию вашей базы данных.

Кроме того, мы обсудим ошибки, которые могут возникнуть при переименование базы данных. Вам понадобится монопольный доступ к базе данных, чтобы переименовать базу данных, что гарантирует, что база данных не имеет других подключений к базе данных. Но если это не так, это может привести к ошибкам, как показано ниже. Ошибка может возникнуть даже тогда, когда мы случайно открываем другое окно с тем же именем базы данных, которое необходимо переименовать.

Ошибки, возникающие при переименовании базы данных через SSMS и при выполнении запроса:

Эти две указанные ниже ошибки имеют два разных представления, потому что они возникают при переименовании базы данных с использованием двух разные методы. Ошибка 1 возникает при переименовании базы данных с помощью SSMS, а вторая ошибка возникает при переименовании базы данных с помощью запроса.. Обе ошибки показывают одно и то же сообщение «База данных не может быть монопольно заблокирована для выполнения операции», что означает, что ошибка возникает из-за того, что пользователю не предоставляется монопольный доступ к базе данных для переименования базы данных. Итак, чтобы переименовать базу данных, нам нужно установить базу данных в « однопользовательский режим ».

Ошибка 1: ошибка возникает при переименовании базы данных через SSMS

«Невозможно переименовать тест. (ObjectExplorer)
Дополнительная информация:
Ошибка переименования для теста базы данных (Microsoft.SqlServer.Smo)
Исключение при выполнении инструкции или пакета Transact-SQL.
(Microsoft.SqlServer.ConnectionInfo)
База данных не может быть монопольно заблокирована для выполнения операции. (Microsoft SQL Server, ошибка: 5030) »

Ошибка 2: ошибка возникает при переименовании базы данных с помощью запроса

« Msg 5030, уровень 16, состояние 2, строка 2. База данных не может быть заблокирована исключительно для выполнения операции ».

Прежде всего, мы воспроизведем вышеупомянутые сообщения об ошибках, чтобы понять, в каком сценарии они возникают и как их исправить.

  1. Верно -щелкните имя базы данных в «Обозревателе объектов»
  2. Выберите переименовать и введите имя базы данных и нажмите «ввод» , если это работает это нормально, но если это не работает и приводит к такой ошибке, как эта «Невозможно переименовать (ObjectExplorer). База данных не может быть монопольно заблокирована для выполнения операции. (Microsoft SQL Server, ошибка: 5030) », как показано на рисунке ниже, то у вас нет монопольного доступа к базе данных для переименования базы данных.
  3. Эта ошибка означает, что SQL Server не позволит переименовать базу данных до тех пор, пока она не находится в «однопользовательском режиме».
  4. Итак, вам понадобится монопольный доступ к базе данных, чтобы переименовать базу данных, чтобы понять это, откройте другое окно запроса и выберите базу данных «test»
  5. Теперь в первом окне попробуйте выполнить следующий код.
  6.  ALTER DATABASE [test] MODIFY NAME = [test_cases] 
  7. Но это может привести к появлению такого сообщения об ошибке: «Msg 5030, уровень 16 , Состояние 2, строка 2. Невозможно заблокировать базу данных исключительно для выполнения операции ».

Решение:

Это настроит заставить базу данных откатить все ожидающие транзакции и установить ее в «однопользовательский режим» , а затем обратно в «многопользовательский режим».

  1. Чтобы исправить это, нам нужно закрыть все другие окна, в которых используется то же имя базы данных, или установить базу данных в «single пользовательский режим » с помощью следующих команд.
  2.  Изменить набор тестов базы данных single_user с немедленным откатом goEXEC sp_renamedb 'test', 'test_cases'goalter database test_cases set multi_usergo 
  3. Результат будет примерно таким: «Откат неквалифицированных транзакций. Предполагаемое завершение отката: 0%. Выполняется откат неквалифицированных транзакций. Предполагаемое завершение отката: 100%. Установлено имя базы данных test_cases ».

Заключение:

Есть несколько способов переименовать базу данных. Если один способ не работает для вас. Вы можете перейти к другому. Следует иметь в виду, что при изменении имен баз данных этими способами просто переименовывают базу данных. «Физические файлы» по-прежнему имеют те же имена. Как видно на рисунке ниже, мы изменили имя базы данных с «test» на «test_cases» , но в физическом расположении оно осталось прежним. .

Итак, самый простой подход – использовать решение 4, если вы также хотите изменить имя файла. . Вы должны сначала изменить имена физических файлов перед повторным присоединением файлов, а затем указать переименованные файлы при повторном подключении.

Более того, помимо изменения имен баз данных, вам также потребуется чтобы проверить, есть ли в коде вашего приложения ссылки на имя базы данных. Это может быть как внутри SQL Server, так и вне SQL Server.

Sometimes we need to change database name because the original name was based on the project that has become irrelevant to the data stored into the database or you had given temporarily name before and now you want to modify it. Irrespective of the reasons behind renaming the database, in this article, we will come up with ways about how to rename the database, what error may arise while doing so and how to fix them.

So to rename the database, you need to follow one of the methods as discussed below. First of all, we have to create a database which needs to be renamed.

Database Creation:

Select any database in your SQL Server Management System (SSMS). If you don’t have any you can create one by following this procedure.

  1. Right-click on “Database” in the “Object Explorer” and select option “New Database”
  2. A window will appear, in the left pane
  3. select “General” type database name into the right pan and press “ok”. The database will be created
    Database Creation

There are multiple methods to rename a database in SQL Server, which are discussed below in detail along with versions supported by any specific method. Later on, we will also discuss errors that arise while renaming the database, and procedure to fix them.

Method 1: Using SSMS rename option to rename the SQL Server Database

This is the simplest way to rename a database. You have to proceed like this to do so.

  1. Right-click on database name from object explorer
  2. Select “rename”, type database name, and press “enter”

Using SSMS rename option to rename the SQL Server Database

Method 2: Using SSMS to rename the SQL Server Database

Another simplest way to rename a database just like renaming any folder in the windows.  You have to continue like this to do so. Click on the database to rename it just like renaming windows folders.

Using SSMS to rename the SQL Server Database

Method 3: Using T-SQL to rename the SQL Server Database

For SQL Server 2005, 2008, 2008R2, 2012, 2014, 2016 and 2017, this command works. Execute the following statement.

ALTER DATABASE [test] MODIFY NAME = [test_cases]

The output will be “The database name ‘test_cases’ has been set.” As seen in the figure below.

Using T-SQL to rename the SQL Server Database

You can use the T-SQL command below to change the name of the database if you are using SQL Server 2000. With SQL 2005, 2008, 2008R2, 2012, 2014, 2016 and 2017, this still works, but at some stage, Microsoft claims it will be phased out.

Method 4: Using detach and attach rename the SQL Server

Using SQL Server’s detach and attach feature can be used to remove the database first and assign the database a different name when you re-attach the database. The following T-SQL commands can be used to do this

Detaching the database by executing the following code:

EXEC sp_detach_db 'test', 'true'

The output will be like this

Detaching the database

Attaching the database.

EXEC sp_attach_db @dbname = N'test',  
    @filename1 =  
N'C:Program FilesMicrosoft SQL ServerMSSQL12.MSSQLSERVERMSSQLDATAtest.mdf',  
    @filename2 =  
N'C:Program FilesMicrosoft SQL ServerMSSQL12.MSSQLSERVERMSSQLDATAtest_log.ldf';

The output will be:

Attaching the database.

Using SSMS to detach and reattach databases

This can also be achieved using SSMS by following these steps.

  1. Right-click the database, select “task” then click on “Detach”
  2. Now click on “ok”
    Detaching Database
  3. Now to attach the database right click on “Databases” in “Object Explorer” and click “Attach”. A screen will appear, click on Add. Another window will appear with database names in it as shown below select “test”.
    Attaching the database
  4. But we want to add it as modified database name “test_cases” so type “test_case” in ”Attach as” box. Now like this. This will rename your database.

Renaming the database while attaching it

Furthermore, we will discuss errors that may arise while renaming the database. You will need exclusive access to the database to rename the database, which ensures that the database does not have any other database connections. But if this is not the case, it can result in errors as shown below. The error can even arise when we accidentally open another window with the same database name which has to be renamed.

Errors that arise while renaming the database via SSMS and by executing the query:

These below mentioned two errors have two different views because they arise while renaming the database using two different methods. Error 1 arises while renaming the database using SSMS and the second error arises while renaming the database using query. Both errors show the same message  “The database could not be exclusively locked to perform the operation”, that means the error arises as the user is not given exclusive access to the database to rename a database. So to rename the database we need to set the database in “single-user mode“.

Error 1: Error arises while renaming the database via SSMS

The error arises while renaming the database via SSMS. “The database could not be exclusively locked to perform the operation. (Microsoft SQL Server, Error: 5030)”

“Unable to rename test. (ObjectExplorer)
Additional information:
Rename failed for Database test (Microsoft.SqlServer.Smo)
An exception occurred while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.ConnectionInfo)
The database could not be exclusively locked to perform the operation. (Microsoft SQL Server, Error: 5030)”

Error 2: Error arises while renaming the database using query

 “Msg 5030, Level 16, State 2, Line 2. The database could not be exclusively locked to perform the operation.”

The error arises while renaming the database using a query. “Msg 5030, Level 16, State 2, Line 2. The database could not be exclusively locked to perform the operation.”

First of all, we will reproduce the above-mentioned error messages for understanding that in which scenario they arise and how to fix them.

  1. Right-click database name from “Object Explorer”
  2. Select rename and type database name and press “enter” if it works its fine but if it does not work and results in an error like this “Unable to rename <database_name> (ObjectExplorer). The database could not be exclusively locked to perform the operation. (Microsoft SQL Server, Error: 5030)” as seen in the figure below, then you don’t have exclusive access to the database to rename a database.
    The error arises while renaming the database via SSMS. “The database could not be exclusively locked to perform the operation. (Microsoft SQL Server, Error: 5030)”
  3. This error means that the SQL Server will not allow the database to be renamed until unless it is in “single-user mode”.
  4. So you will need exclusive access to the database to rename a database, to understand this open another query window and select database “test”
    Another window with the same database is opened which will not allow us to modify that database name
  5. Now in the first window try to execute the following code.
  6. ALTER DATABASE [test] MODIFY NAME = [test_cases]
  7. But this will prone to an error message like this: “Msg 5030, Level 16, State 2, Line 2. The database could not be exclusively locked to perform the operation.”

The error arises because SQL Server will not allow the database to be renamed until unless it is in “single-user mode”

Solution:

This will configure the database to roll back any pending transactions and set it in “single user mode” and then back into “multi-user mode”.

  1. To fix this we need to close all other windows in which the same database name is being used or to set the database in “single user mode” by using the following commands.
  2. Alter database test set single_user with rollback immediate
    go
    EXEC sp_renamedb 'test', 'test_cases'
    go
    alter database test_cases set multi_user
    go
  3. The output will be like this: “Nonqualified transactions are being rolled back. Estimated rollback completion: 0%. Nonqualified transactions are being rolled back. Estimated rollback completion: 100%. The database name ‘test_cases’ has been set.”

Configuring the database to roll back any pending transactions and set it in “single user mode” and then back into “multi-user mode”.

Conclusion:

These are multiple ways to rename the database. If one way is not working for you. You can go to another one. One thing that should be kept in mind that changing database names using these ways just rename the database. The “physical files” still have the same names. As we can see in the figure below we have changed the database name from “test” to “test_cases” but in the physical location, it remained the same.

we have changed database name from “test” to “test_cases” but in the physical location, it is still “test”

So the simplest approach is to use solution 4 if you want to change the file name as well. You must first change the name of the physical files before reattaching the files and then specify the renamed files when you do the reattach.

Moreover, in addition to changing the names of the databases, you also need to check if there are any references in your application code to the database name.  This can be either within SQL Server or outside of SQL Server.

  • Mr4038 ошибка мерседес актрос
  • Mr white has the fish three times a week исправить ошибки
  • Mr slim mitsubishi electric коды ошибок
  • Mr je 70a ошибки
  • Mr 9963 ошибка мерседес atego