![]() | |
![]() |
| | Thread Tools | Display Modes |
#31
| |||
| |||
|
|
Hi, Roy. Thanks for these! I installed them in Master, and sp__spaceall ran fine. However sp__spaceavail gave the error: Server: Msg 208, Level 16, State 1, Procedure sp__spaceavail, Line 18 Invalid object name 'master..sysusages'. |
#32
| |||
| |||
|
#33
| |||
| |||
|
|
OK, I looked at the data a bit that has been changed. The database backup the night of 12/20 was 1.2 GB. The database backup the night of 12/21 was 3.3 GB. So whatever happened had to have happened on 12/21. Nevertheless, looking at ALL changes from 12/21 through the current database, roughly a week's worth of changes -- all records that have been added or modified in that table since 12/21, the entire amount data in all of those records is about 1.5 MB -- about 1,000 times short of what it needs to be. So there's no way that data added or modified caused this change. For some reason this table went from 1/2 GB to 2 GB overnight, with hardly any changes to the data. This is just very strange. |
#34
| |||
| |||
|
|
On Sat, 29 Dec 2007 17:04:33 GMT, "Neil" <nospam (AT) nospam (DOT) net> wrote: Hi, Roy. Thanks for these! I installed them in Master, and sp__spaceall ran fine. However sp__spaceavail gave the error: Server: Msg 208, Level 16, State 1, Procedure sp__spaceavail, Line 18 Invalid object name 'master..sysusages'. Sorry about that, I pulled it from by SQL 7.0 collection of tricks, which apparently got mixed up with something else. I don't have 7.0 (or 6.5) running to fix it. 8-( Roy Harvey Beacon Falls, CT |
#35
| |||
| |||
|
|
Neil (nospam (AT) nospam (DOT) net) writes: OK, I looked at the data a bit that has been changed. The database backup the night of 12/20 was 1.2 GB. The database backup the night of 12/21 was 3.3 GB. So whatever happened had to have happened on 12/21. Nevertheless, looking at ALL changes from 12/21 through the current database, roughly a week's worth of changes -- all records that have been added or modified in that table since 12/21, the entire amount data in all of those records is about 1.5 MB -- about 1,000 times short of what it needs to be. So there's no way that data added or modified caused this change. For some reason this table went from 1/2 GB to 2 GB overnight, with hardly any changes to the data. This is just very strange. And SELECT SUM(datalength(textcol1)) + SUM(datalength(textcol2)) + ... FROM Description_Docs returns what? I don't know if you can get fragmentation in text columns, but I guess you can. But it would hardly happen out of the blue. Unless, hum, you passed some magic threshold? Nah... Anyway, you could try running DBCC CHECKTABLE on the table, or DBCC CHECKDB on the database to see if there is any corruption. You could also test the effects of DBCC CLEANTABLE. Yet an idea is to copy the table to another database, and see how much size it takes up there. |
#36
| ||||
| ||||
|
|
OK, getting the sum of all text column lengths resulted in: 374,457,113 -- which approximates the half GB size before it ballooned. I created a new database and transferred the 2 GB Descriptions_Docs table to that db. In the new db, according to Roy's sp__spaceall, the size of the table is 420 MB. That seems about what it should be, given the above count, as well as its size on 12/21, before the ballooning. |
|
I ran DBCC CHECKTABLE, and it returned: DBCC results for 'Descriptions_Docs'. There are 66570 rows in 1171 pages for object 'Descriptions_Docs'. DBCC execution completed. If DBCC printed error messages, contact your system administrator. |
|
I looked in BOL for CLEANTABLE, but it wasn't there. So I'm thinking it's not in SQL 7? |
|
In any case, given the above, there clearly seems to be a problem with the table, where it's showing 2 GB worth of data, but there's only in actuality half a GB. Very strange. |
#37
| |||
| |||
|
|
OK, so there is obviously a lot of air in that table. No idea where it came from. |
|
o Rename it. o Create it again. o Move the data to the new table. o Recreate triggers, indexes and constraints. o Move referencing constraints. o Drop the old table. o Shrink the database. |
|
I would suggest that you first do this in a test environment to see that it works well. And, oh, I would also suggest that you download SQL Compare from Red Gate (www.red-gate.com) to compare the schema of the database after the change with a reference copy. SQL Compare has a price tag, but there is a preview period you could benefit from. Caveat: I don't know if they support SQL 7. |
#38
| |||
| |||
|
|
I think that's a good idea. What about the idea of just exporting it to a blank db, like I did today, with the triggers, indexes, and constraints in place, and then reimporting it with those? Then only the referencing constraints would have to be recreated. |
#39
| |||
| |||
|
|
Neil (nospam (AT) nospam (DOT) net) writes: I think that's a good idea. What about the idea of just exporting it to a blank db, like I did today, with the triggers, indexes, and constraints in place, and then reimporting it with those? Then only the referencing constraints would have to be recreated. Whichever way you fancy, as long as you don't wreck anything. But if you do it that way, you don't even have to drop the referencing constraints, you only need to disable them: ALTER TABLE tbl NOCHECK CONSTRAINT fk_this_that to enable them, this is the command: ALTER TABLE tbl WITH CHECK CHECK CONSTRAINT fk_this_that A somewhat bizarre syntax, but without the WITH CHECK part, SQL Server will just enable the constraints without checking them. And whichever path you go, use SQL Compare as I suggested to verify that you have all in place! |
![]() |
| Thread Tools | |
| Display Modes | |
| |