Saturday, October 9, 2010

Database Mirroring Setup Steps

You need to perform the following prior to start database mirroing:
1. Take a full backup in principal database and copy it to mirror server
2. Restore the principal database using With NORECOVERY option
3. Take a single transaction log backup in principal servers database and copy it to mirror server
4. Restore that single t-log backup using With NORECOVERY option and start mirroring,
it should work..

Wednesday, October 6, 2010

SQL Server Agent jobs setup minimum permissions

SQL Server 2005 introduced the following msdb database fixed database roles, which give administrators finer control over access to SQL Server Agent. The roles listed from least to most privileged access are:
SQLAgentUserRole
SQLAgentReaderRole
SQLAgentOperatorRole


http://msdn.microsoft.com/en-us/library/ms188283.aspx

To find out users and roles on SQL Server Instance

--users and roles on SQL Server Instance
sp_helplogins

Wednesday, September 1, 2010

Snapshot Database Creation

CREATE DATABASE Test_Snapshot ON
(
NAME = N'Test_Datafile',
FILENAME = N'D:\DB_Snapshots\test_snapshot.ss'
)
AS SNAPSHOT OF Test;

1.Test_Datafile' is the logical name for Test(primary DB) database, which is same logical name for snapshot database.
2. Only physical location is different
3.Snashot Database
  • is a read-only static view of a database.
  • This option is available only Enterprise Edition.
  • Can create in same Instance only.It is not possible with different Instanaces
  • Can not take backup of the Snapshot Database.

4.To drop the Snapshot Database
DROP Database [Test_Snapshot ]

5.Hourly based Snapshot Database:

  • Create Sql Server Agent job
  • Configure the Agent job as first drop snapshot database
  • Re-create Snapshot database
  • Schedule the agent job every hour

Tran Log/Differential/File group Backups can not take for Master Database

Only full database backups of master database can be performed. Transactional log, differential or filegroup backups of master are not allowed. Thus if you create a Database Maintenance Plan for all the system databases or if you select the master database and you select the Back up the transaction log as part of the maintenance plan option, the backup transaction log step for the master database will fail with the error message.