Showing posts with label thefollowing. Show all posts
Showing posts with label thefollowing. Show all posts

Monday, March 19, 2012

Error on deleting SQL/MSDE database

Hi,
On calling the source attached below to drop sql database, I get the
following error randomly,
"Cannot detach the database 'DBNAME' because it is currently in use.
[Microsoft OLE DB Provider for SQL Server]"
I am not sure what am I doing wrong here.
Any pointers in this regard will be appreciated.
Regards,
Usman
con.Execute "use master"
' Get list of processes blocking this catalog and try to
kill all them
Set rs = con.Execute("sp_who2", , adCmdStoredProc)
If Err.Number = 0 And Not rs Is Nothing Then
While Not rs.EOF
If StrComp(rs("dbname"), sCatalog, vbTextCompare)
= 0 Then
con.Execute "kill " & rs("spid")
' Ignore errors
Err.Clear
End If
rs.MoveNext
Wend
rs.Close
End If
con.Execute "sp_detach_db('" & sCatalog & "', 'true')", ,
adCmdStoredProc ''''''''$$$$$$$$$$$$$$$
Hello,
Do the below command from ISQL window
USE MASTER
GO
ALTER DATABASE <DBNAME> Set SINGLE_USER with Rollback Immediate
GO
DROP Database <dbname>
Thanks
Hari
"Usman" <khanusman@.gmail.com> wrote in message
news:1170770913.673583.11240@.s48g2000cws.googlegro ups.com...
> Hi,
> On calling the source attached below to drop sql database, I get the
> following error randomly,
> "Cannot detach the database 'DBNAME' because it is currently in use.
> [Microsoft OLE DB Provider for SQL Server]"
> I am not sure what am I doing wrong here.
> Any pointers in this regard will be appreciated.
> Regards,
> Usman
>
> con.Execute "use master"
> ' Get list of processes blocking this catalog and try to
> kill all them
> Set rs = con.Execute("sp_who2", , adCmdStoredProc)
> If Err.Number = 0 And Not rs Is Nothing Then
> While Not rs.EOF
> If StrComp(rs("dbname"), sCatalog, vbTextCompare)
> = 0 Then
> con.Execute "kill " & rs("spid")
> ' Ignore errors
> Err.Clear
> End If
> rs.MoveNext
> Wend
> rs.Close
> End If
> con.Execute "sp_detach_db('" & sCatalog & "', 'true')", ,
> adCmdStoredProc ''''''''$$$$$$$$$$$$$$$
>

Sunday, February 19, 2012

error message in event viewer but not in SQL server log

I have got a strange porblem. In the application log of the event viewer the
following error message apear:
SQL Server Scheduled Job 'job name' (0xE90E17B42DE94240935ED80B7702BD49) -
Status: Failed - Invoked on: 2007-02-13 08:00:00 - Message: The job failed.
Unable to determine if the owner (sa) of job job name has server access
(reason: Unable to connect to server - check SQL Server and SQL Server Agent
errorlogs).
This error message does not apear in the SQL server log or the SQL server
agent log. In the SQL server I get the message that the job run succesfull.
This is correct because the job runs succesful. The error message in the
event viewer seems to be not correct.
The happens on a SQL server 2000 cluster environment with Windows Server 2003.
Hopefully someone can help me with this problem
Hi
"cas" wrote:

> I have got a strange porblem. In the application log of the event viewer the
> following error message apear:
> SQL Server Scheduled Job 'job name' (0xE90E17B42DE94240935ED80B7702BD49) -
> Status: Failed - Invoked on: 2007-02-13 08:00:00 - Message: The job failed.
> Unable to determine if the owner (sa) of job job name has server access
> (reason: Unable to connect to server - check SQL Server and SQL Server Agent
> errorlogs).
> This error message does not apear in the SQL server log or the SQL server
> agent log. In the SQL server I get the message that the job run succesfull.
> This is correct because the job runs succesful. The error message in the
> event viewer seems to be not correct.
> The happens on a SQL server 2000 cluster environment with Windows Server 2003.
> Hopefully someone can help me with this problem
This sounds like you have something similar to
http://support.microsoft.com/default.aspx/kb/286253 although not the same
message it could be a conflict occurring when two jobs are run at the same
time. Have you checked the schedules for your jobs?
John
|||John,
This is the only job that is scheduled at 08:00 in the morning. This is not
the same as in http://support.microsoft.com/default.aspx/kb/286253
The error message only apear in the event viewer and not in SQL logs. In SQL
server the job is succeeded, and this is correct. I can see that the results
of the job are OK.
"John Bell" wrote:

> Hi
> "cas" wrote:
>
> This sounds like you have something similar to
> http://support.microsoft.com/default.aspx/kb/286253 although not the same
> message it could be a conflict occurring when two jobs are run at the same
> time. Have you checked the schedules for your jobs?
> John
|||"cas" wrote:

> John,
> This is the only job that is scheduled at 08:00 in the morning. This is not
> the same as in http://support.microsoft.com/default.aspx/kb/286253
> The error message only apear in the event viewer and not in SQL logs. In SQL
> server the job is succeeded, and this is correct. I can see that the results
> of the job are OK.
>
So you haven't tried changing the schedule to see if it still occurs?
John

error message in event viewer but not in SQL server log

I have got a strange porblem. In the application log of the event viewer the
following error message apear:
SQL Server Scheduled Job 'job name' (0xE90E17B42DE94240935ED80B7702BD49) -
Status: Failed - Invoked on: 2007-02-13 08:00:00 - Message: The job failed.
Unable to determine if the owner (sa) of job job name has server access
(reason: Unable to connect to server - check SQL Server and SQL Server Agent
errorlogs).
This error message does not apear in the SQL server log or the SQL server
agent log. In the SQL server I get the message that the job run succesfull.
This is correct because the job runs succesful. The error message in the
event viewer seems to be not correct.
The happens on a SQL server 2000 cluster environment with Windows Server 200
3.
Hopefully someone can help me with this problemHi
"cas" wrote:

> I have got a strange porblem. In the application log of the event viewer t
he
> following error message apear:
> SQL Server Scheduled Job 'job name' (0xE90E17B42DE94240935ED80B7702BD49) -
> Status: Failed - Invoked on: 2007-02-13 08:00:00 - Message: The job failed
.
> Unable to determine if the owner (sa) of job job name has server access
> (reason: Unable to connect to server - check SQL Server and SQL Server Age
nt
> errorlogs).
> This error message does not apear in the SQL server log or the SQL server
> agent log. In the SQL server I get the message that the job run succesfull
.
> This is correct because the job runs succesful. The error message in the
> event viewer seems to be not correct.
> The happens on a SQL server 2000 cluster environment with Windows Server 2
003.
> Hopefully someone can help me with this problem
This sounds like you have something similar to
http://support.microsoft.com/default.aspx/kb/286253 although not the same
message it could be a conflict occurring when two jobs are run at the same
time. Have you checked the schedules for your jobs?
John|||John,
This is the only job that is scheduled at 08:00 in the morning. This is not
the same as in http://support.microsoft.com/default.aspx/kb/286253
The error message only apear in the event viewer and not in SQL logs. In SQL
server the job is succeeded, and this is correct. I can see that the results
of the job are OK.
"John Bell" wrote:

> Hi
> "cas" wrote:
>
> This sounds like you have something similar to
> http://support.microsoft.com/default.aspx/kb/286253 although not the same
> message it could be a conflict occurring when two jobs are run at the same
> time. Have you checked the schedules for your jobs?
> John|||"cas" wrote:

> John,
> This is the only job that is scheduled at 08:00 in the morning. This is no
t
> the same as in http://support.microsoft.com/default.aspx/kb/286253
> The error message only apear in the event viewer and not in SQL logs. In S
QL
> server the job is succeeded, and this is correct. I can see that the resul
ts
> of the job are OK.
>
So you haven't tried changing the schedule to see if it still occurs?
John