nscontrol delete Command
Deletes an existing instance of SQL Server Notification Services.
- nologo
-
Suppresses the product and version statement that appears when you run an nscontrol command.
- help
-
Displays the command syntax.
- name instanceName
-
Is the name of the instance to delete.
- server databaseServer
-
Is the name of the server that hosts the instance and application databases. If you use a named instance of SQL Server, you must specify both the server name and the instance name using the format servername\instancename.
- sqlusername sqlUserName
-
Is the SQL Server logon ID used to connect to SQL Server.
If you are using SQL Server Authentication to connect to SQL Server, specify a login with this argument. Also specify a password using the sqlpassword argument.
If you are using Windows Authentication to connect to SQL Server, do not use the sqlusername and sqlpassword arguments.
Security Note: When possible, use Windows Authentication.
- sqlpassword sqlPassword
-
Is the password associated with the sqlusername login. This argument must be used together with the sqlusername argument.
- force
-
Attempts to force the closure of any open database connections before deleting databases, without prompting the user. Without the force argument, if a database still has open connections, the nscontrol delete command cannot delete that database. The nscontrol delete command will attempt to delete all other databases for the instance.
Note: Using nscontrol delete without the force argument when some databases have open connections can leave the instance in an inconsistent state. Before you run nscontrol delete with the force argument, make sure to stop the NS$instance_name Windows service.
The account used to run nscontrol delete, or the SQL Server login specified by the -sqlusername argument, must have permission to drop databases. This includes membership in the dbcreator or sysadmin fixed server role. The account must also have permission to execute the Notification Services binary files; this permission is granted to members of the Administrators and SQLServerNotificationServicesUser Windows groups.
A. Basic example
The following example shows how to delete the databases for an instance of Notification Services named StockInstance, using Windows Authentication to connect to SQL Server.
nscontrol delete -name StockInstance -server nsuetest
B. Forcing open connections to be closed and then deleting an instance
The following example shows how to force the closure of all open connections to the instance and application databases, without prompting the user, before deleting the databases. The nscontrol command uses Windows Authentication to connect to SQL Server.
nscontrol delete -name StockInstance -server nsuetest -force
C. Deleting an instance using SQL Server Authentication
The following example shows how to delete the databases for an instance of Notification Services named StockInstance, using SQL Server Authentication to connect to SQL Server.
nscontrol delete -name StockInstance -server nsuetest
-sqlusername SqlUser -sqlpassword sQl-P@sWd
Reference
nscontrol unregister Commandnscontrol Utility