Showing posts with label active. Show all posts
Showing posts with label active. Show all posts

Wednesday, March 21, 2012

How to Configure Virtual SQL Server to listen on Multiple ports

We have Active / Passive Cluster .We need to cofigure SQL Server Virtual Server (DBVirtual) to listen on multiple ports like (1433,9901,9902...etc).
Please let me know how we can achieve this.
Thanks for the help
294453 INF: How to Set Up SQL Server 2000 to Listen on Multiple Static TCP
Ports
http://support.microsoft.com/?id=294453
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.

How to Configure Virtual SQL Server to listen on Multiple ports

We have Active / Passive Cluster .We need to cofigure SQL Server Virtual Ser
ver (DBVirtual) to listen on multiple ports like (1433,9901,9902...etc).
Please let me know how we can achieve this.
Thanks for the help294453 INF: How to Set Up SQL Server 2000 to Listen on Multiple Static TCP
Ports
http://support.microsoft.com/?id=294453
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.

Sunday, February 19, 2012

How to clear all database connection using SQLDMO?

Hello guys! I'm using SQLDMO to restore a database backup. The problem is, the program cannot restore the backup if there are active connections using the database. Is there are way to clear all database connections using SQLDMO (or other libraries)? Thanks in advance

You could create a storedproc in master that kills any existing spids per db, then run that proc from DMO as part of the restore job.. something like this

CREATE procedure sp_KillOldspids

@.dbName varchar (30) = NULL
AS

set nocount on

declare @.currentspid int,@.cmdstring varchar(30)

dECLARE OPENSPIDS CURSOR FOR SELECT [SPID] from [MASTER].[DBO].[SYSPROCESSES] WHERE DBID = db_id (@.dbName)
OPEN OPENSPIDS

FETCH NEXT FROM OPENSPIDS INTO @.CURRENTSPID

WHILE @.@.FETCH_STATUS = 0
BEGIN

SELECT @.cmdString = 'kill ' + convert(varchar(10), @.CURRENTspid)
IF @.@.SPID <> @.CURRENTSPID
BEGIN
EXEC (@.cmdString)
END
FETCH NEXT FROM OPENSPIDS INTO @.CURRENTSPID

END

CLOSE CURRENTSPIDS
DEALLOCATE CURRENTSPIDS

hopes this helps.