Home

Showing posts with label DBA. Show all posts
Showing posts with label DBA. Show all posts

Tuesday, December 17, 2013

SQL Server, Configure Database Mail


Description

This post shows how to configure SQL Server Database Mail in SQL Server 2012.

Solution

Open SQL Server Management Studio.  Expand Management.  Right-click on Database Mail and select Configure Database Mail.

Click Next on the Database Mail Configuration Wizard Welcome Screen.

Choose "Set up Database Mail" and click Next.

Database Mail is disabled by default.  When prompted, click "Yes" to enable the Database Mail feature.

Create a new Database Mail Account.

Complete the "New Profile" screen and click Next.

Mark the Profile "Public" and click Next.

Complete the "Configure System Parameters" screen and click Next.

Click Finish to complete the Database Mail Configuration Wizard.


Verify all configurations are successful and click Close.



References

Microsoft TechNet (2008).  Database Mail.  Retrieved December 17, 2013 from http://technet.microsoft.com/en-us/library/ms175887%28v=sql.105%29.aspx

Sunday, August 11, 2013

Error: SQL Server: Unable to Shrink Transaction Log, "Could not locate file for database..."



Description

You attempt to shrink a transaction log file associated with a SQL Server database, but you receive in error:

"Could not locate file 'Transaction Log Name' for database
'Database Name' in sys.database_files. The file either does not exist, or was dropped."



Solution


1)  Run SP_HelpFile to get the correct name of the transaction log file.

USE Database Name
EXEC sp_helpfile

(TechNet, 2013)

This will return the following information about the database files, including the associated transation log(s):  Name, FileId, FileName, FileGroup, Size, MaxSize, Growth, Usage



2)  Run the Transact-SQL statement again, using the correct Transaction Log Name.  You can find this in the Name column of the SP_HelpFile query results set.

USE [Database Name]
 GO
ALTER DATABASE Database Name SET RECOVERY SIMPLE WITH NO_WAIT
DBCC SHRINKFILE(Transaction Log Name, 1)
ALTER DATABASE Database Name SET RECOVERY FULL WITH NO_WAIT
 GO

(TechNet, 2013)



3)  Verify that there are configured, scheduled, and enabled SQL Server Backup jobs in place for:

a) Full Database Backup
b) Transaction Log Backup *Important for Full Recovery Model*



Reference

TechNet (2013).  Backup Under the Full Recovery Model.  Retrieved August 11, 2013 from http://technet.microsoft.com/en-us/library/ms190217%28v=sql.105%29.aspx

TechNet (2013).  DBCC SHRINKFILE (Transact-SQL).  Retrieved August 11, 2013 from http://technet.microsoft.com/en-us/library/ms189493.aspx

TechNet (2013).  Recovery Models and Transaction Log Management.  Retrieved August 11, 2013 from http://technet.microsoft.com/en-us/library/ms366344%28v=sql.105%29.aspx

TechNet (2013).  sp_helpfile.  Retrieved August 11, 2013 from http://technet.microsoft.com/en-us/library/aa933456%28v=sql.80%29.aspx

Blog Archive

Followers