configuration

How to get database owner

SELECT suser_sname(owner_sid)
FROM sys.databases
WHERE name = '<dbname>';
GO

How to get current recovery model for a database

Option 1:

SELECT
     name as [Database Name],
     recovery_model_desc as [Recovery Model]
FROM sys.databases
GO

Option 2:

SELECT DATABASEPROPERTYEX(N'<db name>', N'Recovery') as [Recovery Model];
GO

Choosing a recovery model

Recovery model choices:
Simple
Recovery to the end of the last full backup, no log backups.

Bulk logged
All backup types are permitted, reduced log space for minimal logged, bulk operations, but additional risk exposure is log is damaged and a limit on point-in-time recovery.

Full
All backups types permitted, point-in-time recovery possible.

Script to modify the database recovery model:

ALTER DATABASE [<dbname>] SET RECOVERY FULL;
GO

Subscribe to RSS - configuration