Database recovery model

Configurare noua (How To)

Situatie

Mai jos aveti o procedura care rulata pe un server sql returneaza fiecare baza de date impreuna cu modelul setat de restaurare pentru fiecare baza in parte.

Solutie

alter procedure DatabasesRecoveryModel_prc

as

declare @dblist table(db sysname,model char(45))
declare @dbname sysname,@model char(45)

insert @dblist(db)select name from master..sysdatabases
where name not in (‘master’,’model’,’tempdb’,’msdb’)

select @dbname=min(db) from @dblist

while @dbname is not null
begin
select @model=cast(databasepropertyex(@dbname, ‘Recovery’) as char(45))

update @dblist set model=@model where db=@dbname

select @dbname=min(db) from @dblist where db>@dbname
end

select * from @dblist
order by 1

Tip solutie

Permanent
Etichetare:

Voteaza

(3 din 12 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?