Sunday, August 10, 2014

Fix User Permission in SQL Server

After the restore, it is needed to fix the previous user permissions in SQL Server Database.
EXEC sp_change_users_login 'Auto_Fix', 'webuser'
Here webuser is the user name.

Enable Database Mail in SQL Server

Enable the db mail feature at server level:
sp_configure 'Database Mail XPs', 1
reconfigure

Enable service broker in the MSDB database:
USE [master]
GO
ALTER DATABASE [MSDB] SET  ENABLE_BROKER WITH NO_WAIT
GO

Enable 'xp_cmdshell' SQL Server


-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1
GO
-- To update the currently configured value for advanced options.
RECONFIGURE
GO
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO