SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Find The Database Recovery Model


Find The Database Recovery Model

Author
Message
Oliver Wootton
Oliver Wootton
Valued Member
Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)Valued Member (67 reputation)

Group: General Forum Members
Points: 67 Visits: 563
Comments posted to this topic are about the item Find The Database Recovery Model
Fraser Blyth
Fraser Blyth
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 66
You can also determine the recovery model using the function DATABASEPROPERTYEX
It returns a SQL_VARIANT, so you need to convert it into character data

CONVERT(NVARCHAR,DATABASEPROPERTYEX(' ','Recovery'))

It will return 'FULL', 'SIMPLE' or 'BULK_LOGGED'
Wendell Sá
Wendell Sá
SSC Rookie
SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)

Group: General Forum Members
Points: 27 Visits: 178
Script para listar todos os bancos de dados da instância utilizando sp_msforeachdb.

IF object_id('Recovery') is not null
DROP TABLE Recovery

CREATE TABLE Recovery(
[name] sysname NOT NULL,
[RecoveryModel] nvarchar(128) NOT NULL
)

--sp_msforeachdb: http://blogs.techrepublic.com.com/datacenter/?p=292
INSERT INTO Recovery
EXECUTE master.dbo.sp_msforeachdb 'select DB_NAME(DB_ID(''?'')) as name, convert(sysname,DatabasePropertyEx(DB_NAME(DB_ID(''?'')),''Recovery'')) as RecoveryModel'

SELECT * FROM Recovery

IF object_id('Recovery') is not null
DROP TABLE Recovery
premkuttan
premkuttan
SSC-Addicted
SSC-Addicted (493 reputation)SSC-Addicted (493 reputation)SSC-Addicted (493 reputation)SSC-Addicted (493 reputation)SSC-Addicted (493 reputation)SSC-Addicted (493 reputation)SSC-Addicted (493 reputation)SSC-Addicted (493 reputation)

Group: General Forum Members
Points: 493 Visits: 303
When i try executing that query it shows an error "string or binary data truncated"
there is a pblm in insert into #temp exec sp_helpdb
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search