Database | Proc | Application | Created | Links |
sybsystemprocs | sp_listsuspect_db ![]() | ![]() | 31 Aug 14 | Defects Dependencies |
1 2 /* Sccsid = "%Z% generic/sproc/%M% %I% %G% */ 3 4 5 /* 6 ** 17260, "Can't run %1! from within a transaction." 7 ** 17421, "No such database -- run sp_helpdb to list databases." 8 ** 17422, "The 'master' database's options can not be changed." 9 ** 17428, "You must be in the 'master' database in order to change 10 ** database options." 11 ** 18530, "The database '%1!' has %2! suspect pages belonging to %3! objects" 12 */ 13 14 create procedure sp_listsuspect_db 15 as 16 declare @dbid int, /* dbid of the database */ 17 @class int, 18 @attrib_id int, 19 @action int, 20 @object_type varchar(2), 21 @msg varchar(1024), 22 @sptlang int, 23 @state int, 24 @old_state int, 25 @susgran int, 26 @numpgs int, 27 @numobjs int, 28 @dbname varchar(40), 29 @pgid int, 30 @whichone int /* which language? */ 31 32 select @class = 10 /* for suspect granularity */ 33 select @action = 2 /* modify entry */ 34 select @attrib_id = 1 /* attribute is SUSPECT PAGES */ 35 select @object_type = 'D' 36 37 select @sptlang = @@langid, @whichone = 0 38 39 if @@langid != 0 40 begin 41 if not exists ( 42 select * from master.dbo.sysmessages where error 43 between 17050 and 17069 44 and langid = @@langid) 45 select @sptlang = 0 46 end 47 48 declare suspect_db cursor for 49 select object from master.dbo.sysattributes 50 where class = @class AND 51 attribute = 0 AND 52 object_type = @object_type 53 open suspect_db 54 fetch suspect_db into @dbid 55 56 while (@@sqlstatus = 0) 57 begin 58 select @numpgs = count(*) from master.dbo.sysattributes 59 where class = @class AND 60 attribute = 2 AND 61 object_type = @object_type AND 62 object = @dbid 63 64 select @numobjs = count(*) from master.dbo.sysattributes 65 where class = @class AND 66 attribute = 3 AND 67 object_type = @object_type AND 68 object = @dbid 69 70 /* 71 ** 18530, "The database '%1!' has %2! suspect pages belonging to %3! objects" 72 */ 73 if (@numpgs > 0) 74 begin 75 select @dbname = db_name(@dbid) 76 exec sp_getmessage 18530, @msg output 77 print @msg, @dbname, @numpgs, @numobjs 78 end 79 fetch suspect_db into @dbid 80 end 81 close suspect_db 82 deallocate cursor suspect_db 83 84 return (0) 85
exec sp_procxmode 'sp_listsuspect_db', 'AnyMode' go Grant Execute on sp_listsuspect_db to public go
DEFECTS | |
![]() | master..sysattributes |
![]() | master..sysmessages |
![]() | 44 |
![]() | 44 |
![]() | 50 |
![]() | 50 |
![]() | 51 |
![]() | 59 |
![]() | 59 |
![]() | 60 |
![]() | 65 |
![]() | 65 |
![]() | 66 |
![]() | 49 |
![]() | |
![]() | |
![]() | |
![]() | 76 |
![]() | 56 |
![]() | 73 |
![]() | 84 |
![]() (error, dlevel, langid) Intersection: {error, langid} | 42 |
![]() (class, attribute, object_type, object, object_info1, object_info2, object_info3, object_cinfo) Intersection: {class, object_type, attribute} | 50 |
![]() (class, attribute, object_type, object, object_info1, object_info2, object_info3, object_cinfo) Intersection: {object_type, object, attribute, class} | 59 |
![]() (class, attribute, object_type, object, object_info1, object_info2, object_info3, object_cinfo) Intersection: {object_type, object, attribute, class} | 65 |
![]() | 33 |
![]() | 34 |
![]() | 37 |
![]() | 45 |
![]() | 23 |
![]() | 24 |
![]() | 25 |
![]() | 29 |
![]() | 49 |
![]() | 41 |
![]() | 14 |
![]() | 14 |
![]() | 14 |
DEPENDENCIES |
PROCS AND TABLES USED calls proc sybsystemprocs..sp_getmessage ![]() reads table master..sysmessages (1) ![]() reads table master..syslanguages (1) ![]() reads table sybsystemprocs..sysusermessages ![]() calls proc sybsystemprocs..sp_validlang ![]() reads table master..syslanguages (1) ![]() reads table master..sysmessages (1) ![]() reads table master..sysattributes (1) ![]() |