Is Windows CE the correct choice for developing an
application which will be used on a laptop type of device
while disconnected from the main database (SQL Server
2000 Ent. Ed.) but when connection is available will
connect and synchronize with the master database (bi-
directional upload/download new information since last
sync). Are there any such features available in SQL
Server 2000 Ent. Edition where I can work with my local
instance of the database and then somehow at the SQL
Server level I can synchronize with the master database
in a relatively short period of time. Any assistance or
point in the right direction would be much appreciated.
-- Devendra.
Hi
Have a look at SQL Server CE edition on
http://www.microsoft.com/sql/ce/default.asp
You can run merge replication to sync between your device and the master
server.
Regards
Mike
"Devendra Rao" wrote:
> Is Windows CE the correct choice for developing an
> application which will be used on a laptop type of device
> while disconnected from the main database (SQL Server
> 2000 Ent. Ed.) but when connection is available will
> connect and synchronize with the master database (bi-
> directional upload/download new information since last
> sync). Are there any such features available in SQL
> Server 2000 Ent. Edition where I can work with my local
> instance of the database and then somehow at the SQL
> Server level I can synchronize with the master database
> in a relatively short period of time. Any assistance or
> point in the right direction would be much appreciated.
> -- Devendra.
>
2012年3月20日星期二
2012年3月19日星期一
Disconnected app with sql server compact
Hi
I am developing an app in vb.net 2008 with sql server 2000 backend. I also
need disconnected version of the app for laptop users who would connect off
and on with LAN and thereby with the company sql server 2000. I am wondering
if I can use sql server compact 3.5 for local caching when laptops are
disconnected. My question is; how would my app use views and stored
procedures in disconnected mode as sql server compact does not support
either of these. Any help to clarify this would be appreciated.
Thanks
Regards
The local Compact Edition database could be used for data caching. You could
write your own managed code to access it but as you found, there is no
support for SPs or Views. Your only other alternative would be to use the
Express edition on the client system which does support SPs and Views. In
either case you would want to use one of the various synchronization
paradigms to keep the two databases in sync.
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
------
"John" <John@.nospam.infovis.co.uk> wrote in message
news:O5clkypMIHA.4480@.TK2MSFTNGP06.phx.gbl...
> Hi
> I am developing an app in vb.net 2008 with sql server 2000 backend. I also
> need disconnected version of the app for laptop users who would connect
> off and on with LAN and thereby with the company sql server 2000. I am
> wondering if I can use sql server compact 3.5 for local caching when
> laptops are disconnected. My question is; how would my app use views and
> stored procedures in disconnected mode as sql server compact does not
> support either of these. Any help to clarify this would be appreciated.
> Thanks
> Regards
>
|||Like Bill V said, the main point is that you'd need to synchronize your
data. since there aren't views or stored procs, there's no way to do it
directly. You can create a backgroun thread or other mechanism to determine
when you are connected to the network, and when you are, flip a flag and
then use your DALC to talk directly to the big sql server.
You can mimick views (although not anything close to the real thing) by
filling a datatable with a query that corresponds to what the view was.
Although I'm not going to even touch the stored proc vs dynamic sql debate,
I can say that much of the benefit of using stored procs diminishes when
you're using a local db like Compact Edition in this manner.
You can also just bypass CE altogether. Pull down the data from sql server
into a dataset that contains everything you need to work with, interact with
that local data, buy some persistence by saving it to XML using writexml and
then when you're connected again, you can just run your Update() on the full
sql server. There's a ton of tradeoffs here so don't take this is a
recommendation, rather it's just a statement saying if you only need a
local cache of data, you don't necessarily need Compact Edition at all.
If it were mine though, i'd do as Mr Vaughn says and use it w/
synchronization.
"John" <John@.nospam.infovis.co.uk> wrote in message
news:O5clkypMIHA.4480@.TK2MSFTNGP06.phx.gbl...
> Hi
> I am developing an app in vb.net 2008 with sql server 2000 backend. I also
> need disconnected version of the app for laptop users who would connect
> off and on with LAN and thereby with the company sql server 2000. I am
> wondering if I can use sql server compact 3.5 for local caching when
> laptops are disconnected. My question is; how would my app use views and
> stored procedures in disconnected mode as sql server compact does not
> support either of these. Any help to clarify this would be appreciated.
> Thanks
> Regards
>
I am developing an app in vb.net 2008 with sql server 2000 backend. I also
need disconnected version of the app for laptop users who would connect off
and on with LAN and thereby with the company sql server 2000. I am wondering
if I can use sql server compact 3.5 for local caching when laptops are
disconnected. My question is; how would my app use views and stored
procedures in disconnected mode as sql server compact does not support
either of these. Any help to clarify this would be appreciated.
Thanks
Regards
The local Compact Edition database could be used for data caching. You could
write your own managed code to access it but as you found, there is no
support for SPs or Views. Your only other alternative would be to use the
Express edition on the client system which does support SPs and Views. In
either case you would want to use one of the various synchronization
paradigms to keep the two databases in sync.
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
------
"John" <John@.nospam.infovis.co.uk> wrote in message
news:O5clkypMIHA.4480@.TK2MSFTNGP06.phx.gbl...
> Hi
> I am developing an app in vb.net 2008 with sql server 2000 backend. I also
> need disconnected version of the app for laptop users who would connect
> off and on with LAN and thereby with the company sql server 2000. I am
> wondering if I can use sql server compact 3.5 for local caching when
> laptops are disconnected. My question is; how would my app use views and
> stored procedures in disconnected mode as sql server compact does not
> support either of these. Any help to clarify this would be appreciated.
> Thanks
> Regards
>
|||Like Bill V said, the main point is that you'd need to synchronize your
data. since there aren't views or stored procs, there's no way to do it
directly. You can create a backgroun thread or other mechanism to determine
when you are connected to the network, and when you are, flip a flag and
then use your DALC to talk directly to the big sql server.
You can mimick views (although not anything close to the real thing) by
filling a datatable with a query that corresponds to what the view was.
Although I'm not going to even touch the stored proc vs dynamic sql debate,
I can say that much of the benefit of using stored procs diminishes when
you're using a local db like Compact Edition in this manner.
You can also just bypass CE altogether. Pull down the data from sql server
into a dataset that contains everything you need to work with, interact with
that local data, buy some persistence by saving it to XML using writexml and
then when you're connected again, you can just run your Update() on the full
sql server. There's a ton of tradeoffs here so don't take this is a
recommendation, rather it's just a statement saying if you only need a
local cache of data, you don't necessarily need Compact Edition at all.
If it were mine though, i'd do as Mr Vaughn says and use it w/
synchronization.
"John" <John@.nospam.infovis.co.uk> wrote in message
news:O5clkypMIHA.4480@.TK2MSFTNGP06.phx.gbl...
> Hi
> I am developing an app in vb.net 2008 with sql server 2000 backend. I also
> need disconnected version of the app for laptop users who would connect
> off and on with LAN and thereby with the company sql server 2000. I am
> wondering if I can use sql server compact 3.5 for local caching when
> laptops are disconnected. My question is; how would my app use views and
> stored procedures in disconnected mode as sql server compact does not
> support either of these. Any help to clarify this would be appreciated.
> Thanks
> Regards
>
Disconnected app with sql server compact
Hi
I am developing an app in vb.net 2008 with sql server 2000 backend. I also
need disconnected version of the app for laptop users who would connect off
and on with LAN and thereby with the company sql server 2000. I am wondering
if I can use sql server compact 3.5 for local caching when laptops are
disconnected. My question is; how would my app use views and stored
procedures in disconnected mode as sql server compact does not support
either of these. Any help to clarify this would be appreciated.
Thanks
Regards
If you want to use views and stored procedures, then SQL Server Compact is
not an option. However, you can use SQL Server Express, which supports
procedural T-SQL.
HTH,
Plamen Ratchev
http://www.SQLStudio.com
|||The local Compact Edition database could be used for data caching. You could
write your own managed code to access it but as you found, there is no
support for SPs or Views. Your only other alternative would be to use the
Express edition on the client system which does support SPs and Views. In
either case you would want to use one of the various synchronization
paradigms to keep the two databases in sync.
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
------
"John" <John@.nospam.infovis.co.uk> wrote in message
news:O5clkypMIHA.4480@.TK2MSFTNGP06.phx.gbl...
> Hi
> I am developing an app in vb.net 2008 with sql server 2000 backend. I also
> need disconnected version of the app for laptop users who would connect
> off and on with LAN and thereby with the company sql server 2000. I am
> wondering if I can use sql server compact 3.5 for local caching when
> laptops are disconnected. My question is; how would my app use views and
> stored procedures in disconnected mode as sql server compact does not
> support either of these. Any help to clarify this would be appreciated.
> Thanks
> Regards
>
|||Like Bill V said, the main point is that you'd need to synchronize your
data. since there aren't views or stored procs, there's no way to do it
directly. You can create a backgroun thread or other mechanism to determine
when you are connected to the network, and when you are, flip a flag and
then use your DALC to talk directly to the big sql server.
You can mimick views (although not anything close to the real thing) by
filling a datatable with a query that corresponds to what the view was.
Although I'm not going to even touch the stored proc vs dynamic sql debate,
I can say that much of the benefit of using stored procs diminishes when
you're using a local db like Compact Edition in this manner.
You can also just bypass CE altogether. Pull down the data from sql server
into a dataset that contains everything you need to work with, interact with
that local data, buy some persistence by saving it to XML using writexml and
then when you're connected again, you can just run your Update() on the full
sql server. There's a ton of tradeoffs here so don't take this is a
recommendation, rather it's just a statement saying if you only need a
local cache of data, you don't necessarily need Compact Edition at all.
If it were mine though, i'd do as Mr Vaughn says and use it w/
synchronization.
"John" <John@.nospam.infovis.co.uk> wrote in message
news:O5clkypMIHA.4480@.TK2MSFTNGP06.phx.gbl...
> Hi
> I am developing an app in vb.net 2008 with sql server 2000 backend. I also
> need disconnected version of the app for laptop users who would connect
> off and on with LAN and thereby with the company sql server 2000. I am
> wondering if I can use sql server compact 3.5 for local caching when
> laptops are disconnected. My question is; how would my app use views and
> stored procedures in disconnected mode as sql server compact does not
> support either of these. Any help to clarify this would be appreciated.
> Thanks
> Regards
>
I am developing an app in vb.net 2008 with sql server 2000 backend. I also
need disconnected version of the app for laptop users who would connect off
and on with LAN and thereby with the company sql server 2000. I am wondering
if I can use sql server compact 3.5 for local caching when laptops are
disconnected. My question is; how would my app use views and stored
procedures in disconnected mode as sql server compact does not support
either of these. Any help to clarify this would be appreciated.
Thanks
Regards
If you want to use views and stored procedures, then SQL Server Compact is
not an option. However, you can use SQL Server Express, which supports
procedural T-SQL.
HTH,
Plamen Ratchev
http://www.SQLStudio.com
|||The local Compact Edition database could be used for data caching. You could
write your own managed code to access it but as you found, there is no
support for SPs or Views. Your only other alternative would be to use the
Express edition on the client system which does support SPs and Views. In
either case you would want to use one of the various synchronization
paradigms to keep the two databases in sync.
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
------
"John" <John@.nospam.infovis.co.uk> wrote in message
news:O5clkypMIHA.4480@.TK2MSFTNGP06.phx.gbl...
> Hi
> I am developing an app in vb.net 2008 with sql server 2000 backend. I also
> need disconnected version of the app for laptop users who would connect
> off and on with LAN and thereby with the company sql server 2000. I am
> wondering if I can use sql server compact 3.5 for local caching when
> laptops are disconnected. My question is; how would my app use views and
> stored procedures in disconnected mode as sql server compact does not
> support either of these. Any help to clarify this would be appreciated.
> Thanks
> Regards
>
|||Like Bill V said, the main point is that you'd need to synchronize your
data. since there aren't views or stored procs, there's no way to do it
directly. You can create a backgroun thread or other mechanism to determine
when you are connected to the network, and when you are, flip a flag and
then use your DALC to talk directly to the big sql server.
You can mimick views (although not anything close to the real thing) by
filling a datatable with a query that corresponds to what the view was.
Although I'm not going to even touch the stored proc vs dynamic sql debate,
I can say that much of the benefit of using stored procs diminishes when
you're using a local db like Compact Edition in this manner.
You can also just bypass CE altogether. Pull down the data from sql server
into a dataset that contains everything you need to work with, interact with
that local data, buy some persistence by saving it to XML using writexml and
then when you're connected again, you can just run your Update() on the full
sql server. There's a ton of tradeoffs here so don't take this is a
recommendation, rather it's just a statement saying if you only need a
local cache of data, you don't necessarily need Compact Edition at all.
If it were mine though, i'd do as Mr Vaughn says and use it w/
synchronization.
"John" <John@.nospam.infovis.co.uk> wrote in message
news:O5clkypMIHA.4480@.TK2MSFTNGP06.phx.gbl...
> Hi
> I am developing an app in vb.net 2008 with sql server 2000 backend. I also
> need disconnected version of the app for laptop users who would connect
> off and on with LAN and thereby with the company sql server 2000. I am
> wondering if I can use sql server compact 3.5 for local caching when
> laptops are disconnected. My question is; how would my app use views and
> stored procedures in disconnected mode as sql server compact does not
> support either of these. Any help to clarify this would be appreciated.
> Thanks
> Regards
>
Disconnected app with sql server compact
Hi
I am developing an app in vb.net 2008 with sql server 2000 backend. I also
need disconnected version of the app for laptop users who would connect off
and on with LAN and thereby with the company sql server 2000. I am wondering
if I can use sql server compact 3.5 for local caching when laptops are
disconnected. My question is; how would my app use views and stored
procedures in disconnected mode as sql server compact does not support
either of these. Any help to clarify this would be appreciated.
Thanks
RegardsIf you want to use views and stored procedures, then SQL Server Compact is
not an option. However, you can use SQL Server Express, which supports
procedural T-SQL.
HTH,
Plamen Ratchev
http://www.SQLStudio.com|||The local Compact Edition database could be used for data caching. You could
write your own managed code to access it but as you found, there is no
support for SPs or Views. Your only other alternative would be to use the
Express edition on the client system which does support SPs and Views. In
either case you would want to use one of the various synchronization
paradigms to keep the two databases in sync.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
------
"John" <John@.nospam.infovis.co.uk> wrote in message
news:O5clkypMIHA.4480@.TK2MSFTNGP06.phx.gbl...
> Hi
> I am developing an app in vb.net 2008 with sql server 2000 backend. I also
> need disconnected version of the app for laptop users who would connect
> off and on with LAN and thereby with the company sql server 2000. I am
> wondering if I can use sql server compact 3.5 for local caching when
> laptops are disconnected. My question is; how would my app use views and
> stored procedures in disconnected mode as sql server compact does not
> support either of these. Any help to clarify this would be appreciated.
> Thanks
> Regards
>|||Like Bill V said, the main point is that you'd need to synchronize your
data. since there aren't views or stored procs, there's no way to do it
directly. You can create a backgroun thread or other mechanism to determine
when you are connected to the network, and when you are, flip a flag and
then use your DALC to talk directly to the big sql server.
You can mimick views (although not anything close to the real thing) by
filling a datatable with a query that corresponds to what the view was.
Although I'm not going to even touch the stored proc vs dynamic sql debate,
I can say that much of the benefit of using stored procs diminishes when
you're using a local db like Compact Edition in this manner.
You can also just bypass CE altogether. Pull down the data from sql server
into a dataset that contains everything you need to work with, interact with
that local data, buy some persistence by saving it to XML using writexml and
then when you're connected again, you can just run your Update() on the full
sql server. There's a ton of tradeoffs here so don't take this is a
recommendation, rather it's just a statement saying if you only need a
local cache of data, you don't necessarily need Compact Edition at all.
If it were mine though, i'd do as Mr Vaughn says and use it w/
synchronization.
"John" <John@.nospam.infovis.co.uk> wrote in message
news:O5clkypMIHA.4480@.TK2MSFTNGP06.phx.gbl...
> Hi
> I am developing an app in vb.net 2008 with sql server 2000 backend. I also
> need disconnected version of the app for laptop users who would connect
> off and on with LAN and thereby with the company sql server 2000. I am
> wondering if I can use sql server compact 3.5 for local caching when
> laptops are disconnected. My question is; how would my app use views and
> stored procedures in disconnected mode as sql server compact does not
> support either of these. Any help to clarify this would be appreciated.
> Thanks
> Regards
>
I am developing an app in vb.net 2008 with sql server 2000 backend. I also
need disconnected version of the app for laptop users who would connect off
and on with LAN and thereby with the company sql server 2000. I am wondering
if I can use sql server compact 3.5 for local caching when laptops are
disconnected. My question is; how would my app use views and stored
procedures in disconnected mode as sql server compact does not support
either of these. Any help to clarify this would be appreciated.
Thanks
RegardsIf you want to use views and stored procedures, then SQL Server Compact is
not an option. However, you can use SQL Server Express, which supports
procedural T-SQL.
HTH,
Plamen Ratchev
http://www.SQLStudio.com|||The local Compact Edition database could be used for data caching. You could
write your own managed code to access it but as you found, there is no
support for SPs or Views. Your only other alternative would be to use the
Express edition on the client system which does support SPs and Views. In
either case you would want to use one of the various synchronization
paradigms to keep the two databases in sync.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
------
"John" <John@.nospam.infovis.co.uk> wrote in message
news:O5clkypMIHA.4480@.TK2MSFTNGP06.phx.gbl...
> Hi
> I am developing an app in vb.net 2008 with sql server 2000 backend. I also
> need disconnected version of the app for laptop users who would connect
> off and on with LAN and thereby with the company sql server 2000. I am
> wondering if I can use sql server compact 3.5 for local caching when
> laptops are disconnected. My question is; how would my app use views and
> stored procedures in disconnected mode as sql server compact does not
> support either of these. Any help to clarify this would be appreciated.
> Thanks
> Regards
>|||Like Bill V said, the main point is that you'd need to synchronize your
data. since there aren't views or stored procs, there's no way to do it
directly. You can create a backgroun thread or other mechanism to determine
when you are connected to the network, and when you are, flip a flag and
then use your DALC to talk directly to the big sql server.
You can mimick views (although not anything close to the real thing) by
filling a datatable with a query that corresponds to what the view was.
Although I'm not going to even touch the stored proc vs dynamic sql debate,
I can say that much of the benefit of using stored procs diminishes when
you're using a local db like Compact Edition in this manner.
You can also just bypass CE altogether. Pull down the data from sql server
into a dataset that contains everything you need to work with, interact with
that local data, buy some persistence by saving it to XML using writexml and
then when you're connected again, you can just run your Update() on the full
sql server. There's a ton of tradeoffs here so don't take this is a
recommendation, rather it's just a statement saying if you only need a
local cache of data, you don't necessarily need Compact Edition at all.
If it were mine though, i'd do as Mr Vaughn says and use it w/
synchronization.
"John" <John@.nospam.infovis.co.uk> wrote in message
news:O5clkypMIHA.4480@.TK2MSFTNGP06.phx.gbl...
> Hi
> I am developing an app in vb.net 2008 with sql server 2000 backend. I also
> need disconnected version of the app for laptop users who would connect
> off and on with LAN and thereby with the company sql server 2000. I am
> wondering if I can use sql server compact 3.5 for local caching when
> laptops are disconnected. My question is; how would my app use views and
> stored procedures in disconnected mode as sql server compact does not
> support either of these. Any help to clarify this would be appreciated.
> Thanks
> Regards
>
Disconnected app with sql server compact
Hi
I am developing an app in vb.net 2008 with sql server 2000 backend. I also
need disconnected version of the app for laptop users who would connect off
and on with LAN and thereby with the company sql server 2000. I am wondering
if I can use sql server compact 3.5 for local caching when laptops are
disconnected. My question is; how would my app use views and stored
procedures in disconnected mode as sql server compact does not support
either of these. Any help to clarify this would be appreciated.
Thanks
RegardsIf you want to use views and stored procedures, then SQL Server Compact is
not an option. However, you can use SQL Server Express, which supports
procedural T-SQL.
HTH,
Plamen Ratchev
http://www.SQLStudio.com|||The local Compact Edition database could be used for data caching. You could
write your own managed code to access it but as you found, there is no
support for SPs or Views. Your only other alternative would be to use the
Express edition on the client system which does support SPs and Views. In
either case you would want to use one of the various synchronization
paradigms to keep the two databases in sync.
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
----
---
"John" <John@.nospam.infovis.co.uk> wrote in message
news:O5clkypMIHA.4480@.TK2MSFTNGP06.phx.gbl...
> Hi
> I am developing an app in vb.net 2008 with sql server 2000 backend. I also
> need disconnected version of the app for laptop users who would connect
> off and on with LAN and thereby with the company sql server 2000. I am
> wondering if I can use sql server compact 3.5 for local caching when
> laptops are disconnected. My question is; how would my app use views and
> stored procedures in disconnected mode as sql server compact does not
> support either of these. Any help to clarify this would be appreciated.
> Thanks
> Regards
>|||Like Bill V said, the main point is that you'd need to synchronize your
data. since there aren't views or stored procs, there's no way to do it
directly. You can create a backgroun thread or other mechanism to determine
when you are connected to the network, and when you are, flip a flag and
then use your DALC to talk directly to the big sql server.
You can mimick views (although not anything close to the real thing) by
filling a datatable with a query that corresponds to what the view was.
Although I'm not going to even touch the stored proc vs dynamic sql debate,
I can say that much of the benefit of using stored procs diminishes when
you're using a local db like Compact Edition in this manner.
You can also just bypass CE altogether. Pull down the data from sql server
into a dataset that contains everything you need to work with, interact with
that local data, buy some persistence by saving it to XML using writexml and
then when you're connected again, you can just run your Update() on the full
sql server. There's a ton of tradeoffs here so don't take this is a
recommendation, rather it's just a statement saying if you only need a
local cache of data, you don't necessarily need Compact Edition at all.
If it were mine though, i'd do as Mr Vaughn says and use it w/
synchronization.
"John" <John@.nospam.infovis.co.uk> wrote in message
news:O5clkypMIHA.4480@.TK2MSFTNGP06.phx.gbl...
> Hi
> I am developing an app in vb.net 2008 with sql server 2000 backend. I also
> need disconnected version of the app for laptop users who would connect
> off and on with LAN and thereby with the company sql server 2000. I am
> wondering if I can use sql server compact 3.5 for local caching when
> laptops are disconnected. My question is; how would my app use views and
> stored procedures in disconnected mode as sql server compact does not
> support either of these. Any help to clarify this would be appreciated.
> Thanks
> Regards
>
I am developing an app in vb.net 2008 with sql server 2000 backend. I also
need disconnected version of the app for laptop users who would connect off
and on with LAN and thereby with the company sql server 2000. I am wondering
if I can use sql server compact 3.5 for local caching when laptops are
disconnected. My question is; how would my app use views and stored
procedures in disconnected mode as sql server compact does not support
either of these. Any help to clarify this would be appreciated.
Thanks
RegardsIf you want to use views and stored procedures, then SQL Server Compact is
not an option. However, you can use SQL Server Express, which supports
procedural T-SQL.
HTH,
Plamen Ratchev
http://www.SQLStudio.com|||The local Compact Edition database could be used for data caching. You could
write your own managed code to access it but as you found, there is no
support for SPs or Views. Your only other alternative would be to use the
Express edition on the client system which does support SPs and Views. In
either case you would want to use one of the various synchronization
paradigms to keep the two databases in sync.
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
----
---
"John" <John@.nospam.infovis.co.uk> wrote in message
news:O5clkypMIHA.4480@.TK2MSFTNGP06.phx.gbl...
> Hi
> I am developing an app in vb.net 2008 with sql server 2000 backend. I also
> need disconnected version of the app for laptop users who would connect
> off and on with LAN and thereby with the company sql server 2000. I am
> wondering if I can use sql server compact 3.5 for local caching when
> laptops are disconnected. My question is; how would my app use views and
> stored procedures in disconnected mode as sql server compact does not
> support either of these. Any help to clarify this would be appreciated.
> Thanks
> Regards
>|||Like Bill V said, the main point is that you'd need to synchronize your
data. since there aren't views or stored procs, there's no way to do it
directly. You can create a backgroun thread or other mechanism to determine
when you are connected to the network, and when you are, flip a flag and
then use your DALC to talk directly to the big sql server.
You can mimick views (although not anything close to the real thing) by
filling a datatable with a query that corresponds to what the view was.
Although I'm not going to even touch the stored proc vs dynamic sql debate,
I can say that much of the benefit of using stored procs diminishes when
you're using a local db like Compact Edition in this manner.
You can also just bypass CE altogether. Pull down the data from sql server
into a dataset that contains everything you need to work with, interact with
that local data, buy some persistence by saving it to XML using writexml and
then when you're connected again, you can just run your Update() on the full
sql server. There's a ton of tradeoffs here so don't take this is a
recommendation, rather it's just a statement saying if you only need a
local cache of data, you don't necessarily need Compact Edition at all.
If it were mine though, i'd do as Mr Vaughn says and use it w/
synchronization.
"John" <John@.nospam.infovis.co.uk> wrote in message
news:O5clkypMIHA.4480@.TK2MSFTNGP06.phx.gbl...
> Hi
> I am developing an app in vb.net 2008 with sql server 2000 backend. I also
> need disconnected version of the app for laptop users who would connect
> off and on with LAN and thereby with the company sql server 2000. I am
> wondering if I can use sql server compact 3.5 for local caching when
> laptops are disconnected. My question is; how would my app use views and
> stored procedures in disconnected mode as sql server compact does not
> support either of these. Any help to clarify this would be appreciated.
> Thanks
> Regards
>
2012年3月8日星期四
Disaster freeing space in 200GB database
Hi,
I have been developing a database which a couple of days ago was about
180GB, which almost filled up the 200GB hard drive.
In order to free space I used DBCC ShrinkDatabase(logfilename,1) on the log
file which was 20GB but this then ADDED 20GB to the database (I understand
now that you shouldn't try to shrink the log this much). Using shrink
database on the data file didn't seem to work - kept running and running with
the system idle so I eventually stopped it. I then attached a 80GB hardrive
and added a new datafile to allow the database more temporary room.
Next I tried the DELETE command on a number of tables no longer required to
have data in them (I need the tables to still exist but be empty for now so I
didn't use DROP) but this then added to the database once again and filled
the entire new 80GB drive.
I now have 280GB full and no idea how to reduce it in size. I have read
everything in Books Online and read many posts and articles on the net
without really having an idea of what to try next. Unfortunately I don't
have any room at all elsewhere to shift parts of the database around.
The transaction log is only 1.7GB and was before the DELETEs as well. Given
that DELETEs should swell the log what has happened here? - log stayed the
same size, data file increased by the amount of data deleted (80GB). What is
filling up the data file? If it is any help, I have specific tables which
are now empty of records which are where all the free space should be. There
might be some way to shift these to a small database (since empty tables
shouldn't consume much memory) and then free up the space? Not sure if this
would transfer the huge files across or if it would help anyway with
shrinking the database...
Appreciate any help at all!
TIA,
RobRobert Chapman wrote:
> Hi,
> I have been developing a database which a couple of days ago was about
> 180GB, which almost filled up the 200GB hard drive.
> In order to free space I used DBCC ShrinkDatabase(logfilename,1) on
> the log file which was 20GB but this then ADDED 20GB to the database
> (I understand now that you shouldn't try to shrink the log this
> much). Using shrink database on the data file didn't seem to work -
> kept running and running with the system idle so I eventually stopped
> it. I then attached a 80GB hardrive and added a new datafile to
> allow the database more temporary room.
> Next I tried the DELETE command on a number of tables no longer
> required to have data in them (I need the tables to still exist but
> be empty for now so I didn't use DROP) but this then added to the
> database once again and filled the entire new 80GB drive.
> I now have 280GB full and no idea how to reduce it in size. I have
> read everything in Books Online and read many posts and articles on
> the net without really having an idea of what to try next.
> Unfortunately I don't have any room at all elsewhere to shift parts
> of the database around.
> The transaction log is only 1.7GB and was before the DELETEs as well.
> Given that DELETEs should swell the log what has happened here? - log
> stayed the same size, data file increased by the amount of data
> deleted (80GB). What is filling up the data file? If it is any
> help, I have specific tables which are now empty of records which are
> where all the free space should be. There might be some way to shift
> these to a small database (since empty tables shouldn't consume much
> memory) and then free up the space? Not sure if this would transfer
> the huge files across or if it would help anyway with shrinking the
> database...
> Appreciate any help at all!
> TIA,
> Rob
You could have empty space in the files. SQL Server does not attempt to
release unused space in data or log files. Run sp_spaceused on the
database and see what space is unused. You may have more space than you
think. Then I would set an upper limit for the data file on the 200GB
drive so it does not attempt to grow beyond the drive limits.
--
David Gugick
Imceda Software
www.imceda.com|||Ouch. Lets see exactly what went wrong and how to deal with this.
Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
You may be confused about the Enterprise Manager display. Use the TASKPAD
view to get a good look at the overall space and the space used. If you do
have a lot of free data and log space, then you can proceed to recapture
that empty space.
DBCC SHRINKDATABASE is probably not the correct command. I strongly prefer
DBCC SHRINKFILE since it gives me a finer degree of control. It sounds like
your log file may not be able to accommodate what you are trying to do so
lets do it in smaller increments. Run DBCC SHRINKFILE
(MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller than
your existing file size. You will have to run it several times, but
eventually you will get more space.
If you want to empty a large table, try the TRUNCATE TABLE command. It
doesn't take up much log space at all. Delete does take up log space.
These suggestions should get you started. Feel free to ask back for more
help if you run into more problems.
--
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:5440B4DA-8FF1-4DF7-88B2-B60C6B174668@.microsoft.com...
> Hi,
> I have been developing a database which a couple of days ago was about
> 180GB, which almost filled up the 200GB hard drive.
> In order to free space I used DBCC ShrinkDatabase(logfilename,1) on the
log
> file which was 20GB but this then ADDED 20GB to the database (I understand
> now that you shouldn't try to shrink the log this much). Using shrink
> database on the data file didn't seem to work - kept running and running
with
> the system idle so I eventually stopped it. I then attached a 80GB
hardrive
> and added a new datafile to allow the database more temporary room.
> Next I tried the DELETE command on a number of tables no longer required
to
> have data in them (I need the tables to still exist but be empty for now
so I
> didn't use DROP) but this then added to the database once again and filled
> the entire new 80GB drive.
> I now have 280GB full and no idea how to reduce it in size. I have read
> everything in Books Online and read many posts and articles on the net
> without really having an idea of what to try next. Unfortunately I don't
> have any room at all elsewhere to shift parts of the database around.
> The transaction log is only 1.7GB and was before the DELETEs as well.
Given
> that DELETEs should swell the log what has happened here? - log stayed the
> same size, data file increased by the amount of data deleted (80GB). What
is
> filling up the data file? If it is any help, I have specific tables which
> are now empty of records which are where all the free space should be.
There
> might be some way to shift these to a small database (since empty tables
> shouldn't consume much memory) and then free up the space? Not sure if
this
> would transfer the huge files across or if it would help anyway with
> shrinking the database...
> Appreciate any help at all!
> TIA,
> Rob|||Sounds like you have a bunch of empty text pages. Did your tables have
text/image columns in them? There's a bug in one version of shrink (fixed in
SP3) that can cause a shrink to allocate more text space - this would
account for the db growth you saw when you ran shrink on the database.
Deletes can't take more space in the data file. I suggest you contact PSS to
help you remedy this as, from what you've described, there's something
strange going on.
Regards.
--
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"David Gugick" <davidg-nospam@.imceda.com> wrote in message
news:OTULvWa$EHA.2016@.TK2MSFTNGP15.phx.gbl...
> Robert Chapman wrote:
> > Hi,
> >
> > I have been developing a database which a couple of days ago was about
> > 180GB, which almost filled up the 200GB hard drive.
> >
> > In order to free space I used DBCC ShrinkDatabase(logfilename,1) on
> > the log file which was 20GB but this then ADDED 20GB to the database
> > (I understand now that you shouldn't try to shrink the log this
> > much). Using shrink database on the data file didn't seem to work -
> > kept running and running with the system idle so I eventually stopped
> > it. I then attached a 80GB hardrive and added a new datafile to
> > allow the database more temporary room.
> >
> > Next I tried the DELETE command on a number of tables no longer
> > required to have data in them (I need the tables to still exist but
> > be empty for now so I didn't use DROP) but this then added to the
> > database once again and filled the entire new 80GB drive.
> >
> > I now have 280GB full and no idea how to reduce it in size. I have
> > read everything in Books Online and read many posts and articles on
> > the net without really having an idea of what to try next.
> > Unfortunately I don't have any room at all elsewhere to shift parts
> > of the database around.
> >
> > The transaction log is only 1.7GB and was before the DELETEs as well.
> > Given that DELETEs should swell the log what has happened here? - log
> > stayed the same size, data file increased by the amount of data
> > deleted (80GB). What is filling up the data file? If it is any
> > help, I have specific tables which are now empty of records which are
> > where all the free space should be. There might be some way to shift
> > these to a small database (since empty tables shouldn't consume much
> > memory) and then free up the space? Not sure if this would transfer
> > the huge files across or if it would help anyway with shrinking the
> > database...
> >
> > Appreciate any help at all!
> >
> > TIA,
> >
> > Rob
> You could have empty space in the files. SQL Server does not attempt to
> release unused space in data or log files. Run sp_spaceused on the
> database and see what space is unused. You may have more space than you
> think. Then I would set an upper limit for the data file on the 200GB
> drive so it does not attempt to grow beyond the drive limits.
> --
> David Gugick
> Imceda Software
> www.imceda.com
>|||And if you ever need to recapture so much space again in the future, you
might want to try, during off-hours of course, temporarily setting the
RECOVERY MODE to SIMPLE, do your work, then set it back to FULL RECOVERY,
and make an immediate FULL DATABASE backup.
Sincerely,
Anthony Thomas
"Geoff N. Hiten" <SRDBA@.Careerbuilder.com> wrote in message
news:u5Y5jba$EHA.2540@.TK2MSFTNGP09.phx.gbl...
Ouch. Lets see exactly what went wrong and how to deal with this.
Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
You may be confused about the Enterprise Manager display. Use the TASKPAD
view to get a good look at the overall space and the space used. If you do
have a lot of free data and log space, then you can proceed to recapture
that empty space.
DBCC SHRINKDATABASE is probably not the correct command. I strongly prefer
DBCC SHRINKFILE since it gives me a finer degree of control. It sounds like
your log file may not be able to accommodate what you are trying to do so
lets do it in smaller increments. Run DBCC SHRINKFILE
(MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller than
your existing file size. You will have to run it several times, but
eventually you will get more space.
If you want to empty a large table, try the TRUNCATE TABLE command. It
doesn't take up much log space at all. Delete does take up log space.
These suggestions should get you started. Feel free to ask back for more
help if you run into more problems.
--
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:5440B4DA-8FF1-4DF7-88B2-B60C6B174668@.microsoft.com...
> Hi,
> I have been developing a database which a couple of days ago was about
> 180GB, which almost filled up the 200GB hard drive.
> In order to free space I used DBCC ShrinkDatabase(logfilename,1) on the
log
> file which was 20GB but this then ADDED 20GB to the database (I understand
> now that you shouldn't try to shrink the log this much). Using shrink
> database on the data file didn't seem to work - kept running and running
with
> the system idle so I eventually stopped it. I then attached a 80GB
hardrive
> and added a new datafile to allow the database more temporary room.
> Next I tried the DELETE command on a number of tables no longer required
to
> have data in them (I need the tables to still exist but be empty for now
so I
> didn't use DROP) but this then added to the database once again and filled
> the entire new 80GB drive.
> I now have 280GB full and no idea how to reduce it in size. I have read
> everything in Books Online and read many posts and articles on the net
> without really having an idea of what to try next. Unfortunately I don't
> have any room at all elsewhere to shift parts of the database around.
> The transaction log is only 1.7GB and was before the DELETEs as well.
Given
> that DELETEs should swell the log what has happened here? - log stayed the
> same size, data file increased by the amount of data deleted (80GB). What
is
> filling up the data file? If it is any help, I have specific tables which
> are now empty of records which are where all the free space should be.
There
> might be some way to shift these to a small database (since empty tables
> shouldn't consume much memory) and then free up the space? Not sure if
this
> would transfer the huge files across or if it would help anyway with
> shrinking the database...
> Appreciate any help at all!
> TIA,
> Rob|||Hi Geoff,
Thanks for your suggestions (and everyone else's too).
I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
Database size Unallocated space
257672.06 MB 224.60 MB
Reserved Data Space Indexes
Unused
261840344 KB 240624184 KB 20345472 KB 870688 KB
Current Size Used pages
Estimated pages
8 3 9729984 128 9729824 9729824
So hasn't exposed any free space however about half of my tables (all the
unindexed ones) are empty so there should be plenty of unused space.
I have tried to run shrinkfile on the data file on the 2nd (80GB) hard drive
which seemed to complete saying 1 row affected and didn't reduce the size of
the file. I am going to try it again with a different value.
I have downloaded Service Pack 3 and updated but this hasn't helped. Paul,
who is PSS?
Hmm, getting a bit desperate here as very limited time to sort this out.
Need to get some idea if I'll have to bail out of this by creating a new
database elsewhere and copying tables over bit by bit (not much storage space
available) and whetehr that has a chance of sorting the problem. Another
possibility is to somehow detach the second data file that sits on the new
80GB drive as I didn't add any fresh data to that, it has simply been filled
up somehow with the results/logs (though doesn't appear as a log of course)
of my table DELETEs, is there any chance of that working?
Appreciate any more ideas if there are any out there?
Thanks,
Rob
"Geoff N. Hiten" wrote:
> Ouch. Lets see exactly what went wrong and how to deal with this.
> Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
> You may be confused about the Enterprise Manager display. Use the TASKPAD
> view to get a good look at the overall space and the space used. If you do
> have a lot of free data and log space, then you can proceed to recapture
> that empty space.
> DBCC SHRINKDATABASE is probably not the correct command. I strongly prefer
> DBCC SHRINKFILE since it gives me a finer degree of control. It sounds like
> your log file may not be able to accommodate what you are trying to do so
> lets do it in smaller increments. Run DBCC SHRINKFILE
> (MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller than
> your existing file size. You will have to run it several times, but
> eventually you will get more space.
> If you want to empty a large table, try the TRUNCATE TABLE command. It
> doesn't take up much log space at all. Delete does take up log space.
> These suggestions should get you started. Feel free to ask back for more
> help if you run into more problems.
> --
> Geoff N. Hiten
> Microsoft SQL Server MVP
> Senior Database Administrator
> Careerbuilder.com
>|||PSS is Microsoft Product Support Services. They offer fee-based and
subscription based support. I believe the current per-incident support
charge is $250. They take credit cards.
http://support.microsoft.com
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:49AB9EEE-C51A-4BED-84BA-8364DBBE538F@.microsoft.com...
> Hi Geoff,
> Thanks for your suggestions (and everyone else's too).
> I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
> Database size Unallocated space
> 257672.06 MB 224.60 MB
> Reserved Data Space Indexes
> Unused
> 261840344 KB 240624184 KB 20345472 KB 870688 KB
> Current Size Used pages
> Estimated pages
> 8 3 9729984 128 9729824 9729824
> So hasn't exposed any free space however about half of my tables (all the
> unindexed ones) are empty so there should be plenty of unused space.
> I have tried to run shrinkfile on the data file on the 2nd (80GB) hard
drive
> which seemed to complete saying 1 row affected and didn't reduce the size
of
> the file. I am going to try it again with a different value.
> I have downloaded Service Pack 3 and updated but this hasn't helped.
Paul,
> who is PSS?
> Hmm, getting a bit desperate here as very limited time to sort this out.
> Need to get some idea if I'll have to bail out of this by creating a new
> database elsewhere and copying tables over bit by bit (not much storage
space
> available) and whetehr that has a chance of sorting the problem. Another
> possibility is to somehow detach the second data file that sits on the new
> 80GB drive as I didn't add any fresh data to that, it has simply been
filled
> up somehow with the results/logs (though doesn't appear as a log of
course)
> of my table DELETEs, is there any chance of that working?
> Appreciate any more ideas if there are any out there?
> Thanks,
> Rob
> "Geoff N. Hiten" wrote:
> > Ouch. Lets see exactly what went wrong and how to deal with this.
> >
> > Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
> > You may be confused about the Enterprise Manager display. Use the
TASKPAD
> > view to get a good look at the overall space and the space used. If you
do
> > have a lot of free data and log space, then you can proceed to recapture
> > that empty space.
> >
> > DBCC SHRINKDATABASE is probably not the correct command. I strongly
prefer
> > DBCC SHRINKFILE since it gives me a finer degree of control. It sounds
like
> > your log file may not be able to accommodate what you are trying to do
so
> > lets do it in smaller increments. Run DBCC SHRINKFILE
> > (MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller
than
> > your existing file size. You will have to run it several times, but
> > eventually you will get more space.
> >
> > If you want to empty a large table, try the TRUNCATE TABLE command. It
> > doesn't take up much log space at all. Delete does take up log space.
> >
> > These suggestions should get you started. Feel free to ask back for
more
> > help if you run into more problems.
> >
> > --
> > Geoff N. Hiten
> > Microsoft SQL Server MVP
> > Senior Database Administrator
> > Careerbuilder.com
> >
>|||I don't understand this line:
"So hasn't exposed any free space however about half of my tables (all the
unindexed ones) are empty so there should be plenty of unused space."
Who cares about the empty ones? It's the full ones that you need to be
worried about.
Could you post the results of the following query? You can mask the names,
but put some other indicated in there so we have a reference that you can
translate on your side.
Here's the query:
SELECT objname = OBJECT_NAME(id), indname = [name], indid, groupid, keycnt,
maxirow
,minlen, xmaxlen, dpages, reserved, used, rowcnt, rowmodctr, pgmodctr
FROM dbo.sysindexes
WHERE indid IN(0, 1, 255)
AND id > 1000
ORDER BY reserved DESC
This will tell you which indexes have been reserved the most database pages.
INDID 0 are the data pages that use heap indexes--tables without clustered
indexes defined. INDID 1 are the datapages that use clustered indexes.
INDID 255 are the data pages allocated for BLOB/CLOB data.
I've ordered this by reserved. This will show you which tables have the
bulk of the database usage. However, take a look at the used attribute.
This will show you how many data and index pages have been allocated to this
table, sans BLOB/CLOB data. If reserved is high but used is log, you have
space that you can reclaim. However, given the output of the sp_spaceused
you provided earlier, not only do you have reserved space, 250 GB, you have
high used space, 230 GB.
Now, if you have the defaults for AUTOGROW set to 10% increments, or
increased it to 20%, and, if you were almost out of space when you added the
secondary data file, the first AUTOGROW allocation could have added anywhere
from 25 to 50 GB of new unused data and index pages. Given you have about
20 GB of unused space, I suspect this is what happened.
When was the last time you did a database reorg in with the maintenance plan
wizard or buy rebuilding all of the clustered indexes? If you use the
wizard, you can also have it move all the pages to the beginning of the
file. This would let you shrink the file more easily, which is what I
suspect was happening when you attempted the shrink operation before. It
has to move pages before it can shrink and 250 GB of data just doesn't move
that quickly.
Sincerely,
Anthony Thomas
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:49AB9EEE-C51A-4BED-84BA-8364DBBE538F@.microsoft.com...
Hi Geoff,
Thanks for your suggestions (and everyone else's too).
I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
Database size Unallocated space
257672.06 MB 224.60 MB
Reserved Data Space Indexes
Unused
261840344 KB 240624184 KB 20345472 KB 870688 KB
Current Size Used pages
Estimated pages
8 3 9729984 128 9729824 9729824
So hasn't exposed any free space however about half of my tables (all the
unindexed ones) are empty so there should be plenty of unused space.
I have tried to run shrinkfile on the data file on the 2nd (80GB) hard drive
which seemed to complete saying 1 row affected and didn't reduce the size of
the file. I am going to try it again with a different value.
I have downloaded Service Pack 3 and updated but this hasn't helped. Paul,
who is PSS?
Hmm, getting a bit desperate here as very limited time to sort this out.
Need to get some idea if I'll have to bail out of this by creating a new
database elsewhere and copying tables over bit by bit (not much storage
space
available) and whetehr that has a chance of sorting the problem. Another
possibility is to somehow detach the second data file that sits on the new
80GB drive as I didn't add any fresh data to that, it has simply been filled
up somehow with the results/logs (though doesn't appear as a log of course)
of my table DELETEs, is there any chance of that working?
Appreciate any more ideas if there are any out there?
Thanks,
Rob
"Geoff N. Hiten" wrote:
> Ouch. Lets see exactly what went wrong and how to deal with this.
> Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
> You may be confused about the Enterprise Manager display. Use the TASKPAD
> view to get a good look at the overall space and the space used. If you
do
> have a lot of free data and log space, then you can proceed to recapture
> that empty space.
> DBCC SHRINKDATABASE is probably not the correct command. I strongly
prefer
> DBCC SHRINKFILE since it gives me a finer degree of control. It sounds
like
> your log file may not be able to accommodate what you are trying to do so
> lets do it in smaller increments. Run DBCC SHRINKFILE
> (MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller
than
> your existing file size. You will have to run it several times, but
> eventually you will get more space.
> If you want to empty a large table, try the TRUNCATE TABLE command. It
> doesn't take up much log space at all. Delete does take up log space.
> These suggestions should get you started. Feel free to ask back for more
> help if you run into more problems.
> --
> Geoff N. Hiten
> Microsoft SQL Server MVP
> Senior Database Administrator
> Careerbuilder.com
>|||Hi Anthony,
Thanks a whole lot for your post, it led to a solution. What I found is
that the problem wasn't the DELETEs run but rather a table that had swelled
to almost 100GB! Not quite sure how it occured but there it was sitting at
the top of the list in the query you gave me with rather an unrealistic
number of rows. A quick TRUNCATE TABLE solved the problem and I have used
DBCC SHRINKFILE to return things to order.
Many thanks for your help!
Rob
"Anthony Thomas" wrote:
> I don't understand this line:
> "So hasn't exposed any free space however about half of my tables (all the
> unindexed ones) are empty so there should be plenty of unused space."
> Who cares about the empty ones? It's the full ones that you need to be
> worried about.
> Could you post the results of the following query? You can mask the names,
> but put some other indicated in there so we have a reference that you can
> translate on your side.
> Here's the query:
> SELECT objname = OBJECT_NAME(id), indname = [name], indid, groupid, keycnt,
> maxirow
> ,minlen, xmaxlen, dpages, reserved, used, rowcnt, rowmodctr, pgmodctr
> FROM dbo.sysindexes
> WHERE indid IN(0, 1, 255)
> AND id > 1000
> ORDER BY reserved DESC
> This will tell you which indexes have been reserved the most database pages.
> INDID 0 are the data pages that use heap indexes--tables without clustered
> indexes defined. INDID 1 are the datapages that use clustered indexes.
> INDID 255 are the data pages allocated for BLOB/CLOB data.
> I've ordered this by reserved. This will show you which tables have the
> bulk of the database usage. However, take a look at the used attribute.
> This will show you how many data and index pages have been allocated to this
> table, sans BLOB/CLOB data. If reserved is high but used is log, you have
> space that you can reclaim. However, given the output of the sp_spaceused
> you provided earlier, not only do you have reserved space, 250 GB, you have
> high used space, 230 GB.
> Now, if you have the defaults for AUTOGROW set to 10% increments, or
> increased it to 20%, and, if you were almost out of space when you added the
> secondary data file, the first AUTOGROW allocation could have added anywhere
> from 25 to 50 GB of new unused data and index pages. Given you have about
> 20 GB of unused space, I suspect this is what happened.
> When was the last time you did a database reorg in with the maintenance plan
> wizard or buy rebuilding all of the clustered indexes? If you use the
> wizard, you can also have it move all the pages to the beginning of the
> file. This would let you shrink the file more easily, which is what I
> suspect was happening when you attempted the shrink operation before. It
> has to move pages before it can shrink and 250 GB of data just doesn't move
> that quickly.
> Sincerely,
>
> Anthony Thomas
>
> --
> "Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
> news:49AB9EEE-C51A-4BED-84BA-8364DBBE538F@.microsoft.com...
> Hi Geoff,
> Thanks for your suggestions (and everyone else's too).
> I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
> Database size Unallocated space
> 257672.06 MB 224.60 MB
> Reserved Data Space Indexes
> Unused
> 261840344 KB 240624184 KB 20345472 KB 870688 KB
> Current Size Used pages
> Estimated pages
> 8 3 9729984 128 9729824 9729824
> So hasn't exposed any free space however about half of my tables (all the
> unindexed ones) are empty so there should be plenty of unused space.
> I have tried to run shrinkfile on the data file on the 2nd (80GB) hard drive
> which seemed to complete saying 1 row affected and didn't reduce the size of
> the file. I am going to try it again with a different value.
> I have downloaded Service Pack 3 and updated but this hasn't helped. Paul,
> who is PSS?
> Hmm, getting a bit desperate here as very limited time to sort this out.
> Need to get some idea if I'll have to bail out of this by creating a new
> database elsewhere and copying tables over bit by bit (not much storage
> space
> available) and whetehr that has a chance of sorting the problem. Another
> possibility is to somehow detach the second data file that sits on the new
> 80GB drive as I didn't add any fresh data to that, it has simply been filled
> up somehow with the results/logs (though doesn't appear as a log of course)
> of my table DELETEs, is there any chance of that working?
> Appreciate any more ideas if there are any out there?
> Thanks,
> Rob
> "Geoff N. Hiten" wrote:
> > Ouch. Lets see exactly what went wrong and how to deal with this.
> >
> > Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
> > You may be confused about the Enterprise Manager display. Use the TASKPAD
> > view to get a good look at the overall space and the space used. If you
> do
> > have a lot of free data and log space, then you can proceed to recapture
> > that empty space.
> >
> > DBCC SHRINKDATABASE is probably not the correct command. I strongly
> prefer
> > DBCC SHRINKFILE since it gives me a finer degree of control. It sounds
> like
> > your log file may not be able to accommodate what you are trying to do so
> > lets do it in smaller increments. Run DBCC SHRINKFILE
> > (MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller
> than
> > your existing file size. You will have to run it several times, but
> > eventually you will get more space.
> >
> > If you want to empty a large table, try the TRUNCATE TABLE command. It
> > doesn't take up much log space at all. Delete does take up log space.
> >
> > These suggestions should get you started. Feel free to ask back for more
> > help if you run into more problems.
> >
> > --
> > Geoff N. Hiten
> > Microsoft SQL Server MVP
> > Senior Database Administrator
> > Careerbuilder.com
> >
>
>
I have been developing a database which a couple of days ago was about
180GB, which almost filled up the 200GB hard drive.
In order to free space I used DBCC ShrinkDatabase(logfilename,1) on the log
file which was 20GB but this then ADDED 20GB to the database (I understand
now that you shouldn't try to shrink the log this much). Using shrink
database on the data file didn't seem to work - kept running and running with
the system idle so I eventually stopped it. I then attached a 80GB hardrive
and added a new datafile to allow the database more temporary room.
Next I tried the DELETE command on a number of tables no longer required to
have data in them (I need the tables to still exist but be empty for now so I
didn't use DROP) but this then added to the database once again and filled
the entire new 80GB drive.
I now have 280GB full and no idea how to reduce it in size. I have read
everything in Books Online and read many posts and articles on the net
without really having an idea of what to try next. Unfortunately I don't
have any room at all elsewhere to shift parts of the database around.
The transaction log is only 1.7GB and was before the DELETEs as well. Given
that DELETEs should swell the log what has happened here? - log stayed the
same size, data file increased by the amount of data deleted (80GB). What is
filling up the data file? If it is any help, I have specific tables which
are now empty of records which are where all the free space should be. There
might be some way to shift these to a small database (since empty tables
shouldn't consume much memory) and then free up the space? Not sure if this
would transfer the huge files across or if it would help anyway with
shrinking the database...
Appreciate any help at all!
TIA,
RobRobert Chapman wrote:
> Hi,
> I have been developing a database which a couple of days ago was about
> 180GB, which almost filled up the 200GB hard drive.
> In order to free space I used DBCC ShrinkDatabase(logfilename,1) on
> the log file which was 20GB but this then ADDED 20GB to the database
> (I understand now that you shouldn't try to shrink the log this
> much). Using shrink database on the data file didn't seem to work -
> kept running and running with the system idle so I eventually stopped
> it. I then attached a 80GB hardrive and added a new datafile to
> allow the database more temporary room.
> Next I tried the DELETE command on a number of tables no longer
> required to have data in them (I need the tables to still exist but
> be empty for now so I didn't use DROP) but this then added to the
> database once again and filled the entire new 80GB drive.
> I now have 280GB full and no idea how to reduce it in size. I have
> read everything in Books Online and read many posts and articles on
> the net without really having an idea of what to try next.
> Unfortunately I don't have any room at all elsewhere to shift parts
> of the database around.
> The transaction log is only 1.7GB and was before the DELETEs as well.
> Given that DELETEs should swell the log what has happened here? - log
> stayed the same size, data file increased by the amount of data
> deleted (80GB). What is filling up the data file? If it is any
> help, I have specific tables which are now empty of records which are
> where all the free space should be. There might be some way to shift
> these to a small database (since empty tables shouldn't consume much
> memory) and then free up the space? Not sure if this would transfer
> the huge files across or if it would help anyway with shrinking the
> database...
> Appreciate any help at all!
> TIA,
> Rob
You could have empty space in the files. SQL Server does not attempt to
release unused space in data or log files. Run sp_spaceused on the
database and see what space is unused. You may have more space than you
think. Then I would set an upper limit for the data file on the 200GB
drive so it does not attempt to grow beyond the drive limits.
--
David Gugick
Imceda Software
www.imceda.com|||Ouch. Lets see exactly what went wrong and how to deal with this.
Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
You may be confused about the Enterprise Manager display. Use the TASKPAD
view to get a good look at the overall space and the space used. If you do
have a lot of free data and log space, then you can proceed to recapture
that empty space.
DBCC SHRINKDATABASE is probably not the correct command. I strongly prefer
DBCC SHRINKFILE since it gives me a finer degree of control. It sounds like
your log file may not be able to accommodate what you are trying to do so
lets do it in smaller increments. Run DBCC SHRINKFILE
(MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller than
your existing file size. You will have to run it several times, but
eventually you will get more space.
If you want to empty a large table, try the TRUNCATE TABLE command. It
doesn't take up much log space at all. Delete does take up log space.
These suggestions should get you started. Feel free to ask back for more
help if you run into more problems.
--
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:5440B4DA-8FF1-4DF7-88B2-B60C6B174668@.microsoft.com...
> Hi,
> I have been developing a database which a couple of days ago was about
> 180GB, which almost filled up the 200GB hard drive.
> In order to free space I used DBCC ShrinkDatabase(logfilename,1) on the
log
> file which was 20GB but this then ADDED 20GB to the database (I understand
> now that you shouldn't try to shrink the log this much). Using shrink
> database on the data file didn't seem to work - kept running and running
with
> the system idle so I eventually stopped it. I then attached a 80GB
hardrive
> and added a new datafile to allow the database more temporary room.
> Next I tried the DELETE command on a number of tables no longer required
to
> have data in them (I need the tables to still exist but be empty for now
so I
> didn't use DROP) but this then added to the database once again and filled
> the entire new 80GB drive.
> I now have 280GB full and no idea how to reduce it in size. I have read
> everything in Books Online and read many posts and articles on the net
> without really having an idea of what to try next. Unfortunately I don't
> have any room at all elsewhere to shift parts of the database around.
> The transaction log is only 1.7GB and was before the DELETEs as well.
Given
> that DELETEs should swell the log what has happened here? - log stayed the
> same size, data file increased by the amount of data deleted (80GB). What
is
> filling up the data file? If it is any help, I have specific tables which
> are now empty of records which are where all the free space should be.
There
> might be some way to shift these to a small database (since empty tables
> shouldn't consume much memory) and then free up the space? Not sure if
this
> would transfer the huge files across or if it would help anyway with
> shrinking the database...
> Appreciate any help at all!
> TIA,
> Rob|||Sounds like you have a bunch of empty text pages. Did your tables have
text/image columns in them? There's a bug in one version of shrink (fixed in
SP3) that can cause a shrink to allocate more text space - this would
account for the db growth you saw when you ran shrink on the database.
Deletes can't take more space in the data file. I suggest you contact PSS to
help you remedy this as, from what you've described, there's something
strange going on.
Regards.
--
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"David Gugick" <davidg-nospam@.imceda.com> wrote in message
news:OTULvWa$EHA.2016@.TK2MSFTNGP15.phx.gbl...
> Robert Chapman wrote:
> > Hi,
> >
> > I have been developing a database which a couple of days ago was about
> > 180GB, which almost filled up the 200GB hard drive.
> >
> > In order to free space I used DBCC ShrinkDatabase(logfilename,1) on
> > the log file which was 20GB but this then ADDED 20GB to the database
> > (I understand now that you shouldn't try to shrink the log this
> > much). Using shrink database on the data file didn't seem to work -
> > kept running and running with the system idle so I eventually stopped
> > it. I then attached a 80GB hardrive and added a new datafile to
> > allow the database more temporary room.
> >
> > Next I tried the DELETE command on a number of tables no longer
> > required to have data in them (I need the tables to still exist but
> > be empty for now so I didn't use DROP) but this then added to the
> > database once again and filled the entire new 80GB drive.
> >
> > I now have 280GB full and no idea how to reduce it in size. I have
> > read everything in Books Online and read many posts and articles on
> > the net without really having an idea of what to try next.
> > Unfortunately I don't have any room at all elsewhere to shift parts
> > of the database around.
> >
> > The transaction log is only 1.7GB and was before the DELETEs as well.
> > Given that DELETEs should swell the log what has happened here? - log
> > stayed the same size, data file increased by the amount of data
> > deleted (80GB). What is filling up the data file? If it is any
> > help, I have specific tables which are now empty of records which are
> > where all the free space should be. There might be some way to shift
> > these to a small database (since empty tables shouldn't consume much
> > memory) and then free up the space? Not sure if this would transfer
> > the huge files across or if it would help anyway with shrinking the
> > database...
> >
> > Appreciate any help at all!
> >
> > TIA,
> >
> > Rob
> You could have empty space in the files. SQL Server does not attempt to
> release unused space in data or log files. Run sp_spaceused on the
> database and see what space is unused. You may have more space than you
> think. Then I would set an upper limit for the data file on the 200GB
> drive so it does not attempt to grow beyond the drive limits.
> --
> David Gugick
> Imceda Software
> www.imceda.com
>|||And if you ever need to recapture so much space again in the future, you
might want to try, during off-hours of course, temporarily setting the
RECOVERY MODE to SIMPLE, do your work, then set it back to FULL RECOVERY,
and make an immediate FULL DATABASE backup.
Sincerely,
Anthony Thomas
"Geoff N. Hiten" <SRDBA@.Careerbuilder.com> wrote in message
news:u5Y5jba$EHA.2540@.TK2MSFTNGP09.phx.gbl...
Ouch. Lets see exactly what went wrong and how to deal with this.
Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
You may be confused about the Enterprise Manager display. Use the TASKPAD
view to get a good look at the overall space and the space used. If you do
have a lot of free data and log space, then you can proceed to recapture
that empty space.
DBCC SHRINKDATABASE is probably not the correct command. I strongly prefer
DBCC SHRINKFILE since it gives me a finer degree of control. It sounds like
your log file may not be able to accommodate what you are trying to do so
lets do it in smaller increments. Run DBCC SHRINKFILE
(MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller than
your existing file size. You will have to run it several times, but
eventually you will get more space.
If you want to empty a large table, try the TRUNCATE TABLE command. It
doesn't take up much log space at all. Delete does take up log space.
These suggestions should get you started. Feel free to ask back for more
help if you run into more problems.
--
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:5440B4DA-8FF1-4DF7-88B2-B60C6B174668@.microsoft.com...
> Hi,
> I have been developing a database which a couple of days ago was about
> 180GB, which almost filled up the 200GB hard drive.
> In order to free space I used DBCC ShrinkDatabase(logfilename,1) on the
log
> file which was 20GB but this then ADDED 20GB to the database (I understand
> now that you shouldn't try to shrink the log this much). Using shrink
> database on the data file didn't seem to work - kept running and running
with
> the system idle so I eventually stopped it. I then attached a 80GB
hardrive
> and added a new datafile to allow the database more temporary room.
> Next I tried the DELETE command on a number of tables no longer required
to
> have data in them (I need the tables to still exist but be empty for now
so I
> didn't use DROP) but this then added to the database once again and filled
> the entire new 80GB drive.
> I now have 280GB full and no idea how to reduce it in size. I have read
> everything in Books Online and read many posts and articles on the net
> without really having an idea of what to try next. Unfortunately I don't
> have any room at all elsewhere to shift parts of the database around.
> The transaction log is only 1.7GB and was before the DELETEs as well.
Given
> that DELETEs should swell the log what has happened here? - log stayed the
> same size, data file increased by the amount of data deleted (80GB). What
is
> filling up the data file? If it is any help, I have specific tables which
> are now empty of records which are where all the free space should be.
There
> might be some way to shift these to a small database (since empty tables
> shouldn't consume much memory) and then free up the space? Not sure if
this
> would transfer the huge files across or if it would help anyway with
> shrinking the database...
> Appreciate any help at all!
> TIA,
> Rob|||Hi Geoff,
Thanks for your suggestions (and everyone else's too).
I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
Database size Unallocated space
257672.06 MB 224.60 MB
Reserved Data Space Indexes
Unused
261840344 KB 240624184 KB 20345472 KB 870688 KB
Current Size Used pages
Estimated pages
8 3 9729984 128 9729824 9729824
So hasn't exposed any free space however about half of my tables (all the
unindexed ones) are empty so there should be plenty of unused space.
I have tried to run shrinkfile on the data file on the 2nd (80GB) hard drive
which seemed to complete saying 1 row affected and didn't reduce the size of
the file. I am going to try it again with a different value.
I have downloaded Service Pack 3 and updated but this hasn't helped. Paul,
who is PSS?
Hmm, getting a bit desperate here as very limited time to sort this out.
Need to get some idea if I'll have to bail out of this by creating a new
database elsewhere and copying tables over bit by bit (not much storage space
available) and whetehr that has a chance of sorting the problem. Another
possibility is to somehow detach the second data file that sits on the new
80GB drive as I didn't add any fresh data to that, it has simply been filled
up somehow with the results/logs (though doesn't appear as a log of course)
of my table DELETEs, is there any chance of that working?
Appreciate any more ideas if there are any out there?
Thanks,
Rob
"Geoff N. Hiten" wrote:
> Ouch. Lets see exactly what went wrong and how to deal with this.
> Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
> You may be confused about the Enterprise Manager display. Use the TASKPAD
> view to get a good look at the overall space and the space used. If you do
> have a lot of free data and log space, then you can proceed to recapture
> that empty space.
> DBCC SHRINKDATABASE is probably not the correct command. I strongly prefer
> DBCC SHRINKFILE since it gives me a finer degree of control. It sounds like
> your log file may not be able to accommodate what you are trying to do so
> lets do it in smaller increments. Run DBCC SHRINKFILE
> (MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller than
> your existing file size. You will have to run it several times, but
> eventually you will get more space.
> If you want to empty a large table, try the TRUNCATE TABLE command. It
> doesn't take up much log space at all. Delete does take up log space.
> These suggestions should get you started. Feel free to ask back for more
> help if you run into more problems.
> --
> Geoff N. Hiten
> Microsoft SQL Server MVP
> Senior Database Administrator
> Careerbuilder.com
>|||PSS is Microsoft Product Support Services. They offer fee-based and
subscription based support. I believe the current per-incident support
charge is $250. They take credit cards.
http://support.microsoft.com
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:49AB9EEE-C51A-4BED-84BA-8364DBBE538F@.microsoft.com...
> Hi Geoff,
> Thanks for your suggestions (and everyone else's too).
> I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
> Database size Unallocated space
> 257672.06 MB 224.60 MB
> Reserved Data Space Indexes
> Unused
> 261840344 KB 240624184 KB 20345472 KB 870688 KB
> Current Size Used pages
> Estimated pages
> 8 3 9729984 128 9729824 9729824
> So hasn't exposed any free space however about half of my tables (all the
> unindexed ones) are empty so there should be plenty of unused space.
> I have tried to run shrinkfile on the data file on the 2nd (80GB) hard
drive
> which seemed to complete saying 1 row affected and didn't reduce the size
of
> the file. I am going to try it again with a different value.
> I have downloaded Service Pack 3 and updated but this hasn't helped.
Paul,
> who is PSS?
> Hmm, getting a bit desperate here as very limited time to sort this out.
> Need to get some idea if I'll have to bail out of this by creating a new
> database elsewhere and copying tables over bit by bit (not much storage
space
> available) and whetehr that has a chance of sorting the problem. Another
> possibility is to somehow detach the second data file that sits on the new
> 80GB drive as I didn't add any fresh data to that, it has simply been
filled
> up somehow with the results/logs (though doesn't appear as a log of
course)
> of my table DELETEs, is there any chance of that working?
> Appreciate any more ideas if there are any out there?
> Thanks,
> Rob
> "Geoff N. Hiten" wrote:
> > Ouch. Lets see exactly what went wrong and how to deal with this.
> >
> > Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
> > You may be confused about the Enterprise Manager display. Use the
TASKPAD
> > view to get a good look at the overall space and the space used. If you
do
> > have a lot of free data and log space, then you can proceed to recapture
> > that empty space.
> >
> > DBCC SHRINKDATABASE is probably not the correct command. I strongly
prefer
> > DBCC SHRINKFILE since it gives me a finer degree of control. It sounds
like
> > your log file may not be able to accommodate what you are trying to do
so
> > lets do it in smaller increments. Run DBCC SHRINKFILE
> > (MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller
than
> > your existing file size. You will have to run it several times, but
> > eventually you will get more space.
> >
> > If you want to empty a large table, try the TRUNCATE TABLE command. It
> > doesn't take up much log space at all. Delete does take up log space.
> >
> > These suggestions should get you started. Feel free to ask back for
more
> > help if you run into more problems.
> >
> > --
> > Geoff N. Hiten
> > Microsoft SQL Server MVP
> > Senior Database Administrator
> > Careerbuilder.com
> >
>|||I don't understand this line:
"So hasn't exposed any free space however about half of my tables (all the
unindexed ones) are empty so there should be plenty of unused space."
Who cares about the empty ones? It's the full ones that you need to be
worried about.
Could you post the results of the following query? You can mask the names,
but put some other indicated in there so we have a reference that you can
translate on your side.
Here's the query:
SELECT objname = OBJECT_NAME(id), indname = [name], indid, groupid, keycnt,
maxirow
,minlen, xmaxlen, dpages, reserved, used, rowcnt, rowmodctr, pgmodctr
FROM dbo.sysindexes
WHERE indid IN(0, 1, 255)
AND id > 1000
ORDER BY reserved DESC
This will tell you which indexes have been reserved the most database pages.
INDID 0 are the data pages that use heap indexes--tables without clustered
indexes defined. INDID 1 are the datapages that use clustered indexes.
INDID 255 are the data pages allocated for BLOB/CLOB data.
I've ordered this by reserved. This will show you which tables have the
bulk of the database usage. However, take a look at the used attribute.
This will show you how many data and index pages have been allocated to this
table, sans BLOB/CLOB data. If reserved is high but used is log, you have
space that you can reclaim. However, given the output of the sp_spaceused
you provided earlier, not only do you have reserved space, 250 GB, you have
high used space, 230 GB.
Now, if you have the defaults for AUTOGROW set to 10% increments, or
increased it to 20%, and, if you were almost out of space when you added the
secondary data file, the first AUTOGROW allocation could have added anywhere
from 25 to 50 GB of new unused data and index pages. Given you have about
20 GB of unused space, I suspect this is what happened.
When was the last time you did a database reorg in with the maintenance plan
wizard or buy rebuilding all of the clustered indexes? If you use the
wizard, you can also have it move all the pages to the beginning of the
file. This would let you shrink the file more easily, which is what I
suspect was happening when you attempted the shrink operation before. It
has to move pages before it can shrink and 250 GB of data just doesn't move
that quickly.
Sincerely,
Anthony Thomas
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:49AB9EEE-C51A-4BED-84BA-8364DBBE538F@.microsoft.com...
Hi Geoff,
Thanks for your suggestions (and everyone else's too).
I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
Database size Unallocated space
257672.06 MB 224.60 MB
Reserved Data Space Indexes
Unused
261840344 KB 240624184 KB 20345472 KB 870688 KB
Current Size Used pages
Estimated pages
8 3 9729984 128 9729824 9729824
So hasn't exposed any free space however about half of my tables (all the
unindexed ones) are empty so there should be plenty of unused space.
I have tried to run shrinkfile on the data file on the 2nd (80GB) hard drive
which seemed to complete saying 1 row affected and didn't reduce the size of
the file. I am going to try it again with a different value.
I have downloaded Service Pack 3 and updated but this hasn't helped. Paul,
who is PSS?
Hmm, getting a bit desperate here as very limited time to sort this out.
Need to get some idea if I'll have to bail out of this by creating a new
database elsewhere and copying tables over bit by bit (not much storage
space
available) and whetehr that has a chance of sorting the problem. Another
possibility is to somehow detach the second data file that sits on the new
80GB drive as I didn't add any fresh data to that, it has simply been filled
up somehow with the results/logs (though doesn't appear as a log of course)
of my table DELETEs, is there any chance of that working?
Appreciate any more ideas if there are any out there?
Thanks,
Rob
"Geoff N. Hiten" wrote:
> Ouch. Lets see exactly what went wrong and how to deal with this.
> Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
> You may be confused about the Enterprise Manager display. Use the TASKPAD
> view to get a good look at the overall space and the space used. If you
do
> have a lot of free data and log space, then you can proceed to recapture
> that empty space.
> DBCC SHRINKDATABASE is probably not the correct command. I strongly
prefer
> DBCC SHRINKFILE since it gives me a finer degree of control. It sounds
like
> your log file may not be able to accommodate what you are trying to do so
> lets do it in smaller increments. Run DBCC SHRINKFILE
> (MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller
than
> your existing file size. You will have to run it several times, but
> eventually you will get more space.
> If you want to empty a large table, try the TRUNCATE TABLE command. It
> doesn't take up much log space at all. Delete does take up log space.
> These suggestions should get you started. Feel free to ask back for more
> help if you run into more problems.
> --
> Geoff N. Hiten
> Microsoft SQL Server MVP
> Senior Database Administrator
> Careerbuilder.com
>|||Hi Anthony,
Thanks a whole lot for your post, it led to a solution. What I found is
that the problem wasn't the DELETEs run but rather a table that had swelled
to almost 100GB! Not quite sure how it occured but there it was sitting at
the top of the list in the query you gave me with rather an unrealistic
number of rows. A quick TRUNCATE TABLE solved the problem and I have used
DBCC SHRINKFILE to return things to order.
Many thanks for your help!
Rob
"Anthony Thomas" wrote:
> I don't understand this line:
> "So hasn't exposed any free space however about half of my tables (all the
> unindexed ones) are empty so there should be plenty of unused space."
> Who cares about the empty ones? It's the full ones that you need to be
> worried about.
> Could you post the results of the following query? You can mask the names,
> but put some other indicated in there so we have a reference that you can
> translate on your side.
> Here's the query:
> SELECT objname = OBJECT_NAME(id), indname = [name], indid, groupid, keycnt,
> maxirow
> ,minlen, xmaxlen, dpages, reserved, used, rowcnt, rowmodctr, pgmodctr
> FROM dbo.sysindexes
> WHERE indid IN(0, 1, 255)
> AND id > 1000
> ORDER BY reserved DESC
> This will tell you which indexes have been reserved the most database pages.
> INDID 0 are the data pages that use heap indexes--tables without clustered
> indexes defined. INDID 1 are the datapages that use clustered indexes.
> INDID 255 are the data pages allocated for BLOB/CLOB data.
> I've ordered this by reserved. This will show you which tables have the
> bulk of the database usage. However, take a look at the used attribute.
> This will show you how many data and index pages have been allocated to this
> table, sans BLOB/CLOB data. If reserved is high but used is log, you have
> space that you can reclaim. However, given the output of the sp_spaceused
> you provided earlier, not only do you have reserved space, 250 GB, you have
> high used space, 230 GB.
> Now, if you have the defaults for AUTOGROW set to 10% increments, or
> increased it to 20%, and, if you were almost out of space when you added the
> secondary data file, the first AUTOGROW allocation could have added anywhere
> from 25 to 50 GB of new unused data and index pages. Given you have about
> 20 GB of unused space, I suspect this is what happened.
> When was the last time you did a database reorg in with the maintenance plan
> wizard or buy rebuilding all of the clustered indexes? If you use the
> wizard, you can also have it move all the pages to the beginning of the
> file. This would let you shrink the file more easily, which is what I
> suspect was happening when you attempted the shrink operation before. It
> has to move pages before it can shrink and 250 GB of data just doesn't move
> that quickly.
> Sincerely,
>
> Anthony Thomas
>
> --
> "Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
> news:49AB9EEE-C51A-4BED-84BA-8364DBBE538F@.microsoft.com...
> Hi Geoff,
> Thanks for your suggestions (and everyone else's too).
> I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
> Database size Unallocated space
> 257672.06 MB 224.60 MB
> Reserved Data Space Indexes
> Unused
> 261840344 KB 240624184 KB 20345472 KB 870688 KB
> Current Size Used pages
> Estimated pages
> 8 3 9729984 128 9729824 9729824
> So hasn't exposed any free space however about half of my tables (all the
> unindexed ones) are empty so there should be plenty of unused space.
> I have tried to run shrinkfile on the data file on the 2nd (80GB) hard drive
> which seemed to complete saying 1 row affected and didn't reduce the size of
> the file. I am going to try it again with a different value.
> I have downloaded Service Pack 3 and updated but this hasn't helped. Paul,
> who is PSS?
> Hmm, getting a bit desperate here as very limited time to sort this out.
> Need to get some idea if I'll have to bail out of this by creating a new
> database elsewhere and copying tables over bit by bit (not much storage
> space
> available) and whetehr that has a chance of sorting the problem. Another
> possibility is to somehow detach the second data file that sits on the new
> 80GB drive as I didn't add any fresh data to that, it has simply been filled
> up somehow with the results/logs (though doesn't appear as a log of course)
> of my table DELETEs, is there any chance of that working?
> Appreciate any more ideas if there are any out there?
> Thanks,
> Rob
> "Geoff N. Hiten" wrote:
> > Ouch. Lets see exactly what went wrong and how to deal with this.
> >
> > Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
> > You may be confused about the Enterprise Manager display. Use the TASKPAD
> > view to get a good look at the overall space and the space used. If you
> do
> > have a lot of free data and log space, then you can proceed to recapture
> > that empty space.
> >
> > DBCC SHRINKDATABASE is probably not the correct command. I strongly
> prefer
> > DBCC SHRINKFILE since it gives me a finer degree of control. It sounds
> like
> > your log file may not be able to accommodate what you are trying to do so
> > lets do it in smaller increments. Run DBCC SHRINKFILE
> > (MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller
> than
> > your existing file size. You will have to run it several times, but
> > eventually you will get more space.
> >
> > If you want to empty a large table, try the TRUNCATE TABLE command. It
> > doesn't take up much log space at all. Delete does take up log space.
> >
> > These suggestions should get you started. Feel free to ask back for more
> > help if you run into more problems.
> >
> > --
> > Geoff N. Hiten
> > Microsoft SQL Server MVP
> > Senior Database Administrator
> > Careerbuilder.com
> >
>
>
Disaster freeing space in 200GB database
Hi,
I have been developing a database which a couple of days ago was about
180GB, which almost filled up the 200GB hard drive.
In order to free space I used DBCC ShrinkDatabase(logfilename,1) on the log
file which was 20GB but this then ADDED 20GB to the database (I understand
now that you shouldn't try to shrink the log this much). Using shrink
database on the data file didn't seem to work - kept running and running with
the system idle so I eventually stopped it. I then attached a 80GB hardrive
and added a new datafile to allow the database more temporary room.
Next I tried the DELETE command on a number of tables no longer required to
have data in them (I need the tables to still exist but be empty for now so I
didn't use DROP) but this then added to the database once again and filled
the entire new 80GB drive.
I now have 280GB full and no idea how to reduce it in size. I have read
everything in Books Online and read many posts and articles on the net
without really having an idea of what to try next. Unfortunately I don't
have any room at all elsewhere to shift parts of the database around.
The transaction log is only 1.7GB and was before the DELETEs as well. Given
that DELETEs should swell the log what has happened here? - log stayed the
same size, data file increased by the amount of data deleted (80GB). What is
filling up the data file? If it is any help, I have specific tables which
are now empty of records which are where all the free space should be. There
might be some way to shift these to a small database (since empty tables
shouldn't consume much memory) and then free up the space? Not sure if this
would transfer the huge files across or if it would help anyway with
shrinking the database...
Appreciate any help at all!
TIA,
Rob
Robert Chapman wrote:
> Hi,
> I have been developing a database which a couple of days ago was about
> 180GB, which almost filled up the 200GB hard drive.
> In order to free space I used DBCC ShrinkDatabase(logfilename,1) on
> the log file which was 20GB but this then ADDED 20GB to the database
> (I understand now that you shouldn't try to shrink the log this
> much). Using shrink database on the data file didn't seem to work -
> kept running and running with the system idle so I eventually stopped
> it. I then attached a 80GB hardrive and added a new datafile to
> allow the database more temporary room.
> Next I tried the DELETE command on a number of tables no longer
> required to have data in them (I need the tables to still exist but
> be empty for now so I didn't use DROP) but this then added to the
> database once again and filled the entire new 80GB drive.
> I now have 280GB full and no idea how to reduce it in size. I have
> read everything in Books Online and read many posts and articles on
> the net without really having an idea of what to try next.
> Unfortunately I don't have any room at all elsewhere to shift parts
> of the database around.
> The transaction log is only 1.7GB and was before the DELETEs as well.
> Given that DELETEs should swell the log what has happened here? - log
> stayed the same size, data file increased by the amount of data
> deleted (80GB). What is filling up the data file? If it is any
> help, I have specific tables which are now empty of records which are
> where all the free space should be. There might be some way to shift
> these to a small database (since empty tables shouldn't consume much
> memory) and then free up the space? Not sure if this would transfer
> the huge files across or if it would help anyway with shrinking the
> database...
> Appreciate any help at all!
> TIA,
> Rob
You could have empty space in the files. SQL Server does not attempt to
release unused space in data or log files. Run sp_spaceused on the
database and see what space is unused. You may have more space than you
think. Then I would set an upper limit for the data file on the 200GB
drive so it does not attempt to grow beyond the drive limits.
David Gugick
Imceda Software
www.imceda.com
|||Ouch. Lets see exactly what went wrong and how to deal with this.
Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
You may be confused about the Enterprise Manager display. Use the TASKPAD
view to get a good look at the overall space and the space used. If you do
have a lot of free data and log space, then you can proceed to recapture
that empty space.
DBCC SHRINKDATABASE is probably not the correct command. I strongly prefer
DBCC SHRINKFILE since it gives me a finer degree of control. It sounds like
your log file may not be able to accommodate what you are trying to do so
lets do it in smaller increments. Run DBCC SHRINKFILE
(MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller than
your existing file size. You will have to run it several times, but
eventually you will get more space.
If you want to empty a large table, try the TRUNCATE TABLE command. It
doesn't take up much log space at all. Delete does take up log space.
These suggestions should get you started. Feel free to ask back for more
help if you run into more problems.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:5440B4DA-8FF1-4DF7-88B2-B60C6B174668@.microsoft.com...
> Hi,
> I have been developing a database which a couple of days ago was about
> 180GB, which almost filled up the 200GB hard drive.
> In order to free space I used DBCC ShrinkDatabase(logfilename,1) on the
log
> file which was 20GB but this then ADDED 20GB to the database (I understand
> now that you shouldn't try to shrink the log this much). Using shrink
> database on the data file didn't seem to work - kept running and running
with
> the system idle so I eventually stopped it. I then attached a 80GB
hardrive
> and added a new datafile to allow the database more temporary room.
> Next I tried the DELETE command on a number of tables no longer required
to
> have data in them (I need the tables to still exist but be empty for now
so I
> didn't use DROP) but this then added to the database once again and filled
> the entire new 80GB drive.
> I now have 280GB full and no idea how to reduce it in size. I have read
> everything in Books Online and read many posts and articles on the net
> without really having an idea of what to try next. Unfortunately I don't
> have any room at all elsewhere to shift parts of the database around.
> The transaction log is only 1.7GB and was before the DELETEs as well.
Given
> that DELETEs should swell the log what has happened here? - log stayed the
> same size, data file increased by the amount of data deleted (80GB). What
is
> filling up the data file? If it is any help, I have specific tables which
> are now empty of records which are where all the free space should be.
There
> might be some way to shift these to a small database (since empty tables
> shouldn't consume much memory) and then free up the space? Not sure if
this
> would transfer the huge files across or if it would help anyway with
> shrinking the database...
> Appreciate any help at all!
> TIA,
> Rob
|||Sounds like you have a bunch of empty text pages. Did your tables have
text/image columns in them? There's a bug in one version of shrink (fixed in
SP3) that can cause a shrink to allocate more text space - this would
account for the db growth you saw when you ran shrink on the database.
Deletes can't take more space in the data file. I suggest you contact PSS to
help you remedy this as, from what you've described, there's something
strange going on.
Regards.
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"David Gugick" <davidg-nospam@.imceda.com> wrote in message
news:OTULvWa$EHA.2016@.TK2MSFTNGP15.phx.gbl...
> Robert Chapman wrote:
> You could have empty space in the files. SQL Server does not attempt to
> release unused space in data or log files. Run sp_spaceused on the
> database and see what space is unused. You may have more space than you
> think. Then I would set an upper limit for the data file on the 200GB
> drive so it does not attempt to grow beyond the drive limits.
> --
> David Gugick
> Imceda Software
> www.imceda.com
>
|||And if you ever need to recapture so much space again in the future, you
might want to try, during off-hours of course, temporarily setting the
RECOVERY MODE to SIMPLE, do your work, then set it back to FULL RECOVERY,
and make an immediate FULL DATABASE backup.
Sincerely,
Anthony Thomas
"Geoff N. Hiten" <SRDBA@.Careerbuilder.com> wrote in message
news:u5Y5jba$EHA.2540@.TK2MSFTNGP09.phx.gbl...
Ouch. Lets see exactly what went wrong and how to deal with this.
Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
You may be confused about the Enterprise Manager display. Use the TASKPAD
view to get a good look at the overall space and the space used. If you do
have a lot of free data and log space, then you can proceed to recapture
that empty space.
DBCC SHRINKDATABASE is probably not the correct command. I strongly prefer
DBCC SHRINKFILE since it gives me a finer degree of control. It sounds like
your log file may not be able to accommodate what you are trying to do so
lets do it in smaller increments. Run DBCC SHRINKFILE
(MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller than
your existing file size. You will have to run it several times, but
eventually you will get more space.
If you want to empty a large table, try the TRUNCATE TABLE command. It
doesn't take up much log space at all. Delete does take up log space.
These suggestions should get you started. Feel free to ask back for more
help if you run into more problems.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:5440B4DA-8FF1-4DF7-88B2-B60C6B174668@.microsoft.com...
> Hi,
> I have been developing a database which a couple of days ago was about
> 180GB, which almost filled up the 200GB hard drive.
> In order to free space I used DBCC ShrinkDatabase(logfilename,1) on the
log
> file which was 20GB but this then ADDED 20GB to the database (I understand
> now that you shouldn't try to shrink the log this much). Using shrink
> database on the data file didn't seem to work - kept running and running
with
> the system idle so I eventually stopped it. I then attached a 80GB
hardrive
> and added a new datafile to allow the database more temporary room.
> Next I tried the DELETE command on a number of tables no longer required
to
> have data in them (I need the tables to still exist but be empty for now
so I
> didn't use DROP) but this then added to the database once again and filled
> the entire new 80GB drive.
> I now have 280GB full and no idea how to reduce it in size. I have read
> everything in Books Online and read many posts and articles on the net
> without really having an idea of what to try next. Unfortunately I don't
> have any room at all elsewhere to shift parts of the database around.
> The transaction log is only 1.7GB and was before the DELETEs as well.
Given
> that DELETEs should swell the log what has happened here? - log stayed the
> same size, data file increased by the amount of data deleted (80GB). What
is
> filling up the data file? If it is any help, I have specific tables which
> are now empty of records which are where all the free space should be.
There
> might be some way to shift these to a small database (since empty tables
> shouldn't consume much memory) and then free up the space? Not sure if
this
> would transfer the huge files across or if it would help anyway with
> shrinking the database...
> Appreciate any help at all!
> TIA,
> Rob
|||Hi Geoff,
Thanks for your suggestions (and everyone else's too).
I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
Database size Unallocated space
257672.06 MB224.60 MB
Reserved Data Space Indexes
Unused
261840344 KB240624184 KB20345472 KB 870688 KB
Current Size Used pages
Estimated pages
839729984128 9729824 9729824
So hasn't exposed any free space however about half of my tables (all the
unindexed ones) are empty so there should be plenty of unused space.
I have tried to run shrinkfile on the data file on the 2nd (80GB) hard drive
which seemed to complete saying 1 row affected and didn't reduce the size of
the file. I am going to try it again with a different value.
I have downloaded Service Pack 3 and updated but this hasn't helped. Paul,
who is PSS?
Hmm, getting a bit desperate here as very limited time to sort this out.
Need to get some idea if I'll have to bail out of this by creating a new
database elsewhere and copying tables over bit by bit (not much storage space
available) and whetehr that has a chance of sorting the problem. Another
possibility is to somehow detach the second data file that sits on the new
80GB drive as I didn't add any fresh data to that, it has simply been filled
up somehow with the results/logs (though doesn't appear as a log of course)
of my table DELETEs, is there any chance of that working?
Appreciate any more ideas if there are any out there?
Thanks,
Rob
"Geoff N. Hiten" wrote:
> Ouch. Lets see exactly what went wrong and how to deal with this.
> Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
> You may be confused about the Enterprise Manager display. Use the TASKPAD
> view to get a good look at the overall space and the space used. If you do
> have a lot of free data and log space, then you can proceed to recapture
> that empty space.
> DBCC SHRINKDATABASE is probably not the correct command. I strongly prefer
> DBCC SHRINKFILE since it gives me a finer degree of control. It sounds like
> your log file may not be able to accommodate what you are trying to do so
> lets do it in smaller increments. Run DBCC SHRINKFILE
> (MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller than
> your existing file size. You will have to run it several times, but
> eventually you will get more space.
> If you want to empty a large table, try the TRUNCATE TABLE command. It
> doesn't take up much log space at all. Delete does take up log space.
> These suggestions should get you started. Feel free to ask back for more
> help if you run into more problems.
> --
> Geoff N. Hiten
> Microsoft SQL Server MVP
> Senior Database Administrator
> Careerbuilder.com
>
|||PSS is Microsoft Product Support Services. They offer fee-based and
subscription based support. I believe the current per-incident support
charge is $250. They take credit cards.
http://support.microsoft.com
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:49AB9EEE-C51A-4BED-84BA-8364DBBE538F@.microsoft.com...
> Hi Geoff,
> Thanks for your suggestions (and everyone else's too).
> I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
> Database size Unallocated space
> 257672.06 MB 224.60 MB
> Reserved Data Space Indexes
> Unused
> 261840344 KB 240624184 KB 20345472 KB 870688 KB
> Current Size Used pages
> Estimated pages
> 8 3 9729984 128 9729824 9729824
> So hasn't exposed any free space however about half of my tables (all the
> unindexed ones) are empty so there should be plenty of unused space.
> I have tried to run shrinkfile on the data file on the 2nd (80GB) hard
drive
> which seemed to complete saying 1 row affected and didn't reduce the size
of
> the file. I am going to try it again with a different value.
> I have downloaded Service Pack 3 and updated but this hasn't helped.
Paul,
> who is PSS?
> Hmm, getting a bit desperate here as very limited time to sort this out.
> Need to get some idea if I'll have to bail out of this by creating a new
> database elsewhere and copying tables over bit by bit (not much storage
space
> available) and whetehr that has a chance of sorting the problem. Another
> possibility is to somehow detach the second data file that sits on the new
> 80GB drive as I didn't add any fresh data to that, it has simply been
filled
> up somehow with the results/logs (though doesn't appear as a log of
course)[vbcol=seagreen]
> of my table DELETEs, is there any chance of that working?
> Appreciate any more ideas if there are any out there?
> Thanks,
> Rob
> "Geoff N. Hiten" wrote:
TASKPAD[vbcol=seagreen]
do[vbcol=seagreen]
prefer[vbcol=seagreen]
like[vbcol=seagreen]
so[vbcol=seagreen]
than[vbcol=seagreen]
more
>
|||I don't understand this line:
"So hasn't exposed any free space however about half of my tables (all the
unindexed ones) are empty so there should be plenty of unused space."
Who cares about the empty ones? It's the full ones that you need to be
worried about.
Could you post the results of the following query? You can mask the names,
but put some other indicated in there so we have a reference that you can
translate on your side.
Here's the query:
SELECT objname = OBJECT_NAME(id), indname = [name], indid, groupid, keycnt,
maxirow
,minlen, xmaxlen, dpages, reserved, used, rowcnt, rowmodctr, pgmodctr
FROM dbo.sysindexes
WHERE indid IN(0, 1, 255)
AND id > 1000
ORDER BY reserved DESC
This will tell you which indexes have been reserved the most database pages.
INDID 0 are the data pages that use heap indexes--tables without clustered
indexes defined. INDID 1 are the datapages that use clustered indexes.
INDID 255 are the data pages allocated for BLOB/CLOB data.
I've ordered this by reserved. This will show you which tables have the
bulk of the database usage. However, take a look at the used attribute.
This will show you how many data and index pages have been allocated to this
table, sans BLOB/CLOB data. If reserved is high but used is log, you have
space that you can reclaim. However, given the output of the sp_spaceused
you provided earlier, not only do you have reserved space, 250 GB, you have
high used space, 230 GB.
Now, if you have the defaults for AUTOGROW set to 10% increments, or
increased it to 20%, and, if you were almost out of space when you added the
secondary data file, the first AUTOGROW allocation could have added anywhere
from 25 to 50 GB of new unused data and index pages. Given you have about
20 GB of unused space, I suspect this is what happened.
When was the last time you did a database reorg in with the maintenance plan
wizard or buy rebuilding all of the clustered indexes? If you use the
wizard, you can also have it move all the pages to the beginning of the
file. This would let you shrink the file more easily, which is what I
suspect was happening when you attempted the shrink operation before. It
has to move pages before it can shrink and 250 GB of data just doesn't move
that quickly.
Sincerely,
Anthony Thomas
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:49AB9EEE-C51A-4BED-84BA-8364DBBE538F@.microsoft.com...
Hi Geoff,
Thanks for your suggestions (and everyone else's too).
I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
Database size Unallocated space
257672.06 MB 224.60 MB
Reserved Data Space Indexes
Unused
261840344 KB 240624184 KB 20345472 KB 870688 KB
Current Size Used pages
Estimated pages
8 3 9729984 128 9729824 9729824
So hasn't exposed any free space however about half of my tables (all the
unindexed ones) are empty so there should be plenty of unused space.
I have tried to run shrinkfile on the data file on the 2nd (80GB) hard drive
which seemed to complete saying 1 row affected and didn't reduce the size of
the file. I am going to try it again with a different value.
I have downloaded Service Pack 3 and updated but this hasn't helped. Paul,
who is PSS?
Hmm, getting a bit desperate here as very limited time to sort this out.
Need to get some idea if I'll have to bail out of this by creating a new
database elsewhere and copying tables over bit by bit (not much storage
space
available) and whetehr that has a chance of sorting the problem. Another
possibility is to somehow detach the second data file that sits on the new
80GB drive as I didn't add any fresh data to that, it has simply been filled
up somehow with the results/logs (though doesn't appear as a log of course)
of my table DELETEs, is there any chance of that working?
Appreciate any more ideas if there are any out there?
Thanks,
Rob
"Geoff N. Hiten" wrote:
> Ouch. Lets see exactly what went wrong and how to deal with this.
> Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
> You may be confused about the Enterprise Manager display. Use the TASKPAD
> view to get a good look at the overall space and the space used. If you
do
> have a lot of free data and log space, then you can proceed to recapture
> that empty space.
> DBCC SHRINKDATABASE is probably not the correct command. I strongly
prefer
> DBCC SHRINKFILE since it gives me a finer degree of control. It sounds
like
> your log file may not be able to accommodate what you are trying to do so
> lets do it in smaller increments. Run DBCC SHRINKFILE
> (MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller
than
> your existing file size. You will have to run it several times, but
> eventually you will get more space.
> If you want to empty a large table, try the TRUNCATE TABLE command. It
> doesn't take up much log space at all. Delete does take up log space.
> These suggestions should get you started. Feel free to ask back for more
> help if you run into more problems.
> --
> Geoff N. Hiten
> Microsoft SQL Server MVP
> Senior Database Administrator
> Careerbuilder.com
>
|||Hi Anthony,
Thanks a whole lot for your post, it led to a solution. What I found is
that the problem wasn't the DELETEs run but rather a table that had swelled
to almost 100GB! Not quite sure how it occured but there it was sitting at
the top of the list in the query you gave me with rather an unrealistic
number of rows. A quick TRUNCATE TABLE solved the problem and I have used
DBCC SHRINKFILE to return things to order.
Many thanks for your help!
Rob
"Anthony Thomas" wrote:
> I don't understand this line:
> "So hasn't exposed any free space however about half of my tables (all the
> unindexed ones) are empty so there should be plenty of unused space."
> Who cares about the empty ones? It's the full ones that you need to be
> worried about.
> Could you post the results of the following query? You can mask the names,
> but put some other indicated in there so we have a reference that you can
> translate on your side.
> Here's the query:
> SELECT objname = OBJECT_NAME(id), indname = [name], indid, groupid, keycnt,
> maxirow
> ,minlen, xmaxlen, dpages, reserved, used, rowcnt, rowmodctr, pgmodctr
> FROM dbo.sysindexes
> WHERE indid IN(0, 1, 255)
> AND id > 1000
> ORDER BY reserved DESC
> This will tell you which indexes have been reserved the most database pages.
> INDID 0 are the data pages that use heap indexes--tables without clustered
> indexes defined. INDID 1 are the datapages that use clustered indexes.
> INDID 255 are the data pages allocated for BLOB/CLOB data.
> I've ordered this by reserved. This will show you which tables have the
> bulk of the database usage. However, take a look at the used attribute.
> This will show you how many data and index pages have been allocated to this
> table, sans BLOB/CLOB data. If reserved is high but used is log, you have
> space that you can reclaim. However, given the output of the sp_spaceused
> you provided earlier, not only do you have reserved space, 250 GB, you have
> high used space, 230 GB.
> Now, if you have the defaults for AUTOGROW set to 10% increments, or
> increased it to 20%, and, if you were almost out of space when you added the
> secondary data file, the first AUTOGROW allocation could have added anywhere
> from 25 to 50 GB of new unused data and index pages. Given you have about
> 20 GB of unused space, I suspect this is what happened.
> When was the last time you did a database reorg in with the maintenance plan
> wizard or buy rebuilding all of the clustered indexes? If you use the
> wizard, you can also have it move all the pages to the beginning of the
> file. This would let you shrink the file more easily, which is what I
> suspect was happening when you attempted the shrink operation before. It
> has to move pages before it can shrink and 250 GB of data just doesn't move
> that quickly.
> Sincerely,
>
> Anthony Thomas
>
> --
> "Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
> news:49AB9EEE-C51A-4BED-84BA-8364DBBE538F@.microsoft.com...
> Hi Geoff,
> Thanks for your suggestions (and everyone else's too).
> I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
> Database size Unallocated space
> 257672.06 MB 224.60 MB
> Reserved Data Space Indexes
> Unused
> 261840344 KB 240624184 KB 20345472 KB 870688 KB
> Current Size Used pages
> Estimated pages
> 8 3 9729984 128 9729824 9729824
> So hasn't exposed any free space however about half of my tables (all the
> unindexed ones) are empty so there should be plenty of unused space.
> I have tried to run shrinkfile on the data file on the 2nd (80GB) hard drive
> which seemed to complete saying 1 row affected and didn't reduce the size of
> the file. I am going to try it again with a different value.
> I have downloaded Service Pack 3 and updated but this hasn't helped. Paul,
> who is PSS?
> Hmm, getting a bit desperate here as very limited time to sort this out.
> Need to get some idea if I'll have to bail out of this by creating a new
> database elsewhere and copying tables over bit by bit (not much storage
> space
> available) and whetehr that has a chance of sorting the problem. Another
> possibility is to somehow detach the second data file that sits on the new
> 80GB drive as I didn't add any fresh data to that, it has simply been filled
> up somehow with the results/logs (though doesn't appear as a log of course)
> of my table DELETEs, is there any chance of that working?
> Appreciate any more ideas if there are any out there?
> Thanks,
> Rob
> "Geoff N. Hiten" wrote:
> do
> prefer
> like
> than
>
>
I have been developing a database which a couple of days ago was about
180GB, which almost filled up the 200GB hard drive.
In order to free space I used DBCC ShrinkDatabase(logfilename,1) on the log
file which was 20GB but this then ADDED 20GB to the database (I understand
now that you shouldn't try to shrink the log this much). Using shrink
database on the data file didn't seem to work - kept running and running with
the system idle so I eventually stopped it. I then attached a 80GB hardrive
and added a new datafile to allow the database more temporary room.
Next I tried the DELETE command on a number of tables no longer required to
have data in them (I need the tables to still exist but be empty for now so I
didn't use DROP) but this then added to the database once again and filled
the entire new 80GB drive.
I now have 280GB full and no idea how to reduce it in size. I have read
everything in Books Online and read many posts and articles on the net
without really having an idea of what to try next. Unfortunately I don't
have any room at all elsewhere to shift parts of the database around.
The transaction log is only 1.7GB and was before the DELETEs as well. Given
that DELETEs should swell the log what has happened here? - log stayed the
same size, data file increased by the amount of data deleted (80GB). What is
filling up the data file? If it is any help, I have specific tables which
are now empty of records which are where all the free space should be. There
might be some way to shift these to a small database (since empty tables
shouldn't consume much memory) and then free up the space? Not sure if this
would transfer the huge files across or if it would help anyway with
shrinking the database...
Appreciate any help at all!
TIA,
Rob
Robert Chapman wrote:
> Hi,
> I have been developing a database which a couple of days ago was about
> 180GB, which almost filled up the 200GB hard drive.
> In order to free space I used DBCC ShrinkDatabase(logfilename,1) on
> the log file which was 20GB but this then ADDED 20GB to the database
> (I understand now that you shouldn't try to shrink the log this
> much). Using shrink database on the data file didn't seem to work -
> kept running and running with the system idle so I eventually stopped
> it. I then attached a 80GB hardrive and added a new datafile to
> allow the database more temporary room.
> Next I tried the DELETE command on a number of tables no longer
> required to have data in them (I need the tables to still exist but
> be empty for now so I didn't use DROP) but this then added to the
> database once again and filled the entire new 80GB drive.
> I now have 280GB full and no idea how to reduce it in size. I have
> read everything in Books Online and read many posts and articles on
> the net without really having an idea of what to try next.
> Unfortunately I don't have any room at all elsewhere to shift parts
> of the database around.
> The transaction log is only 1.7GB and was before the DELETEs as well.
> Given that DELETEs should swell the log what has happened here? - log
> stayed the same size, data file increased by the amount of data
> deleted (80GB). What is filling up the data file? If it is any
> help, I have specific tables which are now empty of records which are
> where all the free space should be. There might be some way to shift
> these to a small database (since empty tables shouldn't consume much
> memory) and then free up the space? Not sure if this would transfer
> the huge files across or if it would help anyway with shrinking the
> database...
> Appreciate any help at all!
> TIA,
> Rob
You could have empty space in the files. SQL Server does not attempt to
release unused space in data or log files. Run sp_spaceused on the
database and see what space is unused. You may have more space than you
think. Then I would set an upper limit for the data file on the 200GB
drive so it does not attempt to grow beyond the drive limits.
David Gugick
Imceda Software
www.imceda.com
|||Ouch. Lets see exactly what went wrong and how to deal with this.
Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
You may be confused about the Enterprise Manager display. Use the TASKPAD
view to get a good look at the overall space and the space used. If you do
have a lot of free data and log space, then you can proceed to recapture
that empty space.
DBCC SHRINKDATABASE is probably not the correct command. I strongly prefer
DBCC SHRINKFILE since it gives me a finer degree of control. It sounds like
your log file may not be able to accommodate what you are trying to do so
lets do it in smaller increments. Run DBCC SHRINKFILE
(MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller than
your existing file size. You will have to run it several times, but
eventually you will get more space.
If you want to empty a large table, try the TRUNCATE TABLE command. It
doesn't take up much log space at all. Delete does take up log space.
These suggestions should get you started. Feel free to ask back for more
help if you run into more problems.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:5440B4DA-8FF1-4DF7-88B2-B60C6B174668@.microsoft.com...
> Hi,
> I have been developing a database which a couple of days ago was about
> 180GB, which almost filled up the 200GB hard drive.
> In order to free space I used DBCC ShrinkDatabase(logfilename,1) on the
log
> file which was 20GB but this then ADDED 20GB to the database (I understand
> now that you shouldn't try to shrink the log this much). Using shrink
> database on the data file didn't seem to work - kept running and running
with
> the system idle so I eventually stopped it. I then attached a 80GB
hardrive
> and added a new datafile to allow the database more temporary room.
> Next I tried the DELETE command on a number of tables no longer required
to
> have data in them (I need the tables to still exist but be empty for now
so I
> didn't use DROP) but this then added to the database once again and filled
> the entire new 80GB drive.
> I now have 280GB full and no idea how to reduce it in size. I have read
> everything in Books Online and read many posts and articles on the net
> without really having an idea of what to try next. Unfortunately I don't
> have any room at all elsewhere to shift parts of the database around.
> The transaction log is only 1.7GB and was before the DELETEs as well.
Given
> that DELETEs should swell the log what has happened here? - log stayed the
> same size, data file increased by the amount of data deleted (80GB). What
is
> filling up the data file? If it is any help, I have specific tables which
> are now empty of records which are where all the free space should be.
There
> might be some way to shift these to a small database (since empty tables
> shouldn't consume much memory) and then free up the space? Not sure if
this
> would transfer the huge files across or if it would help anyway with
> shrinking the database...
> Appreciate any help at all!
> TIA,
> Rob
|||Sounds like you have a bunch of empty text pages. Did your tables have
text/image columns in them? There's a bug in one version of shrink (fixed in
SP3) that can cause a shrink to allocate more text space - this would
account for the db growth you saw when you ran shrink on the database.
Deletes can't take more space in the data file. I suggest you contact PSS to
help you remedy this as, from what you've described, there's something
strange going on.
Regards.
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"David Gugick" <davidg-nospam@.imceda.com> wrote in message
news:OTULvWa$EHA.2016@.TK2MSFTNGP15.phx.gbl...
> Robert Chapman wrote:
> You could have empty space in the files. SQL Server does not attempt to
> release unused space in data or log files. Run sp_spaceused on the
> database and see what space is unused. You may have more space than you
> think. Then I would set an upper limit for the data file on the 200GB
> drive so it does not attempt to grow beyond the drive limits.
> --
> David Gugick
> Imceda Software
> www.imceda.com
>
|||And if you ever need to recapture so much space again in the future, you
might want to try, during off-hours of course, temporarily setting the
RECOVERY MODE to SIMPLE, do your work, then set it back to FULL RECOVERY,
and make an immediate FULL DATABASE backup.
Sincerely,
Anthony Thomas
"Geoff N. Hiten" <SRDBA@.Careerbuilder.com> wrote in message
news:u5Y5jba$EHA.2540@.TK2MSFTNGP09.phx.gbl...
Ouch. Lets see exactly what went wrong and how to deal with this.
Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
You may be confused about the Enterprise Manager display. Use the TASKPAD
view to get a good look at the overall space and the space used. If you do
have a lot of free data and log space, then you can proceed to recapture
that empty space.
DBCC SHRINKDATABASE is probably not the correct command. I strongly prefer
DBCC SHRINKFILE since it gives me a finer degree of control. It sounds like
your log file may not be able to accommodate what you are trying to do so
lets do it in smaller increments. Run DBCC SHRINKFILE
(MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller than
your existing file size. You will have to run it several times, but
eventually you will get more space.
If you want to empty a large table, try the TRUNCATE TABLE command. It
doesn't take up much log space at all. Delete does take up log space.
These suggestions should get you started. Feel free to ask back for more
help if you run into more problems.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:5440B4DA-8FF1-4DF7-88B2-B60C6B174668@.microsoft.com...
> Hi,
> I have been developing a database which a couple of days ago was about
> 180GB, which almost filled up the 200GB hard drive.
> In order to free space I used DBCC ShrinkDatabase(logfilename,1) on the
log
> file which was 20GB but this then ADDED 20GB to the database (I understand
> now that you shouldn't try to shrink the log this much). Using shrink
> database on the data file didn't seem to work - kept running and running
with
> the system idle so I eventually stopped it. I then attached a 80GB
hardrive
> and added a new datafile to allow the database more temporary room.
> Next I tried the DELETE command on a number of tables no longer required
to
> have data in them (I need the tables to still exist but be empty for now
so I
> didn't use DROP) but this then added to the database once again and filled
> the entire new 80GB drive.
> I now have 280GB full and no idea how to reduce it in size. I have read
> everything in Books Online and read many posts and articles on the net
> without really having an idea of what to try next. Unfortunately I don't
> have any room at all elsewhere to shift parts of the database around.
> The transaction log is only 1.7GB and was before the DELETEs as well.
Given
> that DELETEs should swell the log what has happened here? - log stayed the
> same size, data file increased by the amount of data deleted (80GB). What
is
> filling up the data file? If it is any help, I have specific tables which
> are now empty of records which are where all the free space should be.
There
> might be some way to shift these to a small database (since empty tables
> shouldn't consume much memory) and then free up the space? Not sure if
this
> would transfer the huge files across or if it would help anyway with
> shrinking the database...
> Appreciate any help at all!
> TIA,
> Rob
|||Hi Geoff,
Thanks for your suggestions (and everyone else's too).
I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
Database size Unallocated space
257672.06 MB224.60 MB
Reserved Data Space Indexes
Unused
261840344 KB240624184 KB20345472 KB 870688 KB
Current Size Used pages
Estimated pages
839729984128 9729824 9729824
So hasn't exposed any free space however about half of my tables (all the
unindexed ones) are empty so there should be plenty of unused space.
I have tried to run shrinkfile on the data file on the 2nd (80GB) hard drive
which seemed to complete saying 1 row affected and didn't reduce the size of
the file. I am going to try it again with a different value.
I have downloaded Service Pack 3 and updated but this hasn't helped. Paul,
who is PSS?
Hmm, getting a bit desperate here as very limited time to sort this out.
Need to get some idea if I'll have to bail out of this by creating a new
database elsewhere and copying tables over bit by bit (not much storage space
available) and whetehr that has a chance of sorting the problem. Another
possibility is to somehow detach the second data file that sits on the new
80GB drive as I didn't add any fresh data to that, it has simply been filled
up somehow with the results/logs (though doesn't appear as a log of course)
of my table DELETEs, is there any chance of that working?
Appreciate any more ideas if there are any out there?
Thanks,
Rob
"Geoff N. Hiten" wrote:
> Ouch. Lets see exactly what went wrong and how to deal with this.
> Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
> You may be confused about the Enterprise Manager display. Use the TASKPAD
> view to get a good look at the overall space and the space used. If you do
> have a lot of free data and log space, then you can proceed to recapture
> that empty space.
> DBCC SHRINKDATABASE is probably not the correct command. I strongly prefer
> DBCC SHRINKFILE since it gives me a finer degree of control. It sounds like
> your log file may not be able to accommodate what you are trying to do so
> lets do it in smaller increments. Run DBCC SHRINKFILE
> (MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller than
> your existing file size. You will have to run it several times, but
> eventually you will get more space.
> If you want to empty a large table, try the TRUNCATE TABLE command. It
> doesn't take up much log space at all. Delete does take up log space.
> These suggestions should get you started. Feel free to ask back for more
> help if you run into more problems.
> --
> Geoff N. Hiten
> Microsoft SQL Server MVP
> Senior Database Administrator
> Careerbuilder.com
>
|||PSS is Microsoft Product Support Services. They offer fee-based and
subscription based support. I believe the current per-incident support
charge is $250. They take credit cards.
http://support.microsoft.com
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:49AB9EEE-C51A-4BED-84BA-8364DBBE538F@.microsoft.com...
> Hi Geoff,
> Thanks for your suggestions (and everyone else's too).
> I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
> Database size Unallocated space
> 257672.06 MB 224.60 MB
> Reserved Data Space Indexes
> Unused
> 261840344 KB 240624184 KB 20345472 KB 870688 KB
> Current Size Used pages
> Estimated pages
> 8 3 9729984 128 9729824 9729824
> So hasn't exposed any free space however about half of my tables (all the
> unindexed ones) are empty so there should be plenty of unused space.
> I have tried to run shrinkfile on the data file on the 2nd (80GB) hard
drive
> which seemed to complete saying 1 row affected and didn't reduce the size
of
> the file. I am going to try it again with a different value.
> I have downloaded Service Pack 3 and updated but this hasn't helped.
Paul,
> who is PSS?
> Hmm, getting a bit desperate here as very limited time to sort this out.
> Need to get some idea if I'll have to bail out of this by creating a new
> database elsewhere and copying tables over bit by bit (not much storage
space
> available) and whetehr that has a chance of sorting the problem. Another
> possibility is to somehow detach the second data file that sits on the new
> 80GB drive as I didn't add any fresh data to that, it has simply been
filled
> up somehow with the results/logs (though doesn't appear as a log of
course)[vbcol=seagreen]
> of my table DELETEs, is there any chance of that working?
> Appreciate any more ideas if there are any out there?
> Thanks,
> Rob
> "Geoff N. Hiten" wrote:
TASKPAD[vbcol=seagreen]
do[vbcol=seagreen]
prefer[vbcol=seagreen]
like[vbcol=seagreen]
so[vbcol=seagreen]
than[vbcol=seagreen]
more
>
|||I don't understand this line:
"So hasn't exposed any free space however about half of my tables (all the
unindexed ones) are empty so there should be plenty of unused space."
Who cares about the empty ones? It's the full ones that you need to be
worried about.
Could you post the results of the following query? You can mask the names,
but put some other indicated in there so we have a reference that you can
translate on your side.
Here's the query:
SELECT objname = OBJECT_NAME(id), indname = [name], indid, groupid, keycnt,
maxirow
,minlen, xmaxlen, dpages, reserved, used, rowcnt, rowmodctr, pgmodctr
FROM dbo.sysindexes
WHERE indid IN(0, 1, 255)
AND id > 1000
ORDER BY reserved DESC
This will tell you which indexes have been reserved the most database pages.
INDID 0 are the data pages that use heap indexes--tables without clustered
indexes defined. INDID 1 are the datapages that use clustered indexes.
INDID 255 are the data pages allocated for BLOB/CLOB data.
I've ordered this by reserved. This will show you which tables have the
bulk of the database usage. However, take a look at the used attribute.
This will show you how many data and index pages have been allocated to this
table, sans BLOB/CLOB data. If reserved is high but used is log, you have
space that you can reclaim. However, given the output of the sp_spaceused
you provided earlier, not only do you have reserved space, 250 GB, you have
high used space, 230 GB.
Now, if you have the defaults for AUTOGROW set to 10% increments, or
increased it to 20%, and, if you were almost out of space when you added the
secondary data file, the first AUTOGROW allocation could have added anywhere
from 25 to 50 GB of new unused data and index pages. Given you have about
20 GB of unused space, I suspect this is what happened.
When was the last time you did a database reorg in with the maintenance plan
wizard or buy rebuilding all of the clustered indexes? If you use the
wizard, you can also have it move all the pages to the beginning of the
file. This would let you shrink the file more easily, which is what I
suspect was happening when you attempted the shrink operation before. It
has to move pages before it can shrink and 250 GB of data just doesn't move
that quickly.
Sincerely,
Anthony Thomas
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:49AB9EEE-C51A-4BED-84BA-8364DBBE538F@.microsoft.com...
Hi Geoff,
Thanks for your suggestions (and everyone else's too).
I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
Database size Unallocated space
257672.06 MB 224.60 MB
Reserved Data Space Indexes
Unused
261840344 KB 240624184 KB 20345472 KB 870688 KB
Current Size Used pages
Estimated pages
8 3 9729984 128 9729824 9729824
So hasn't exposed any free space however about half of my tables (all the
unindexed ones) are empty so there should be plenty of unused space.
I have tried to run shrinkfile on the data file on the 2nd (80GB) hard drive
which seemed to complete saying 1 row affected and didn't reduce the size of
the file. I am going to try it again with a different value.
I have downloaded Service Pack 3 and updated but this hasn't helped. Paul,
who is PSS?
Hmm, getting a bit desperate here as very limited time to sort this out.
Need to get some idea if I'll have to bail out of this by creating a new
database elsewhere and copying tables over bit by bit (not much storage
space
available) and whetehr that has a chance of sorting the problem. Another
possibility is to somehow detach the second data file that sits on the new
80GB drive as I didn't add any fresh data to that, it has simply been filled
up somehow with the results/logs (though doesn't appear as a log of course)
of my table DELETEs, is there any chance of that working?
Appreciate any more ideas if there are any out there?
Thanks,
Rob
"Geoff N. Hiten" wrote:
> Ouch. Lets see exactly what went wrong and how to deal with this.
> Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
> You may be confused about the Enterprise Manager display. Use the TASKPAD
> view to get a good look at the overall space and the space used. If you
do
> have a lot of free data and log space, then you can proceed to recapture
> that empty space.
> DBCC SHRINKDATABASE is probably not the correct command. I strongly
prefer
> DBCC SHRINKFILE since it gives me a finer degree of control. It sounds
like
> your log file may not be able to accommodate what you are trying to do so
> lets do it in smaller increments. Run DBCC SHRINKFILE
> (MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller
than
> your existing file size. You will have to run it several times, but
> eventually you will get more space.
> If you want to empty a large table, try the TRUNCATE TABLE command. It
> doesn't take up much log space at all. Delete does take up log space.
> These suggestions should get you started. Feel free to ask back for more
> help if you run into more problems.
> --
> Geoff N. Hiten
> Microsoft SQL Server MVP
> Senior Database Administrator
> Careerbuilder.com
>
|||Hi Anthony,
Thanks a whole lot for your post, it led to a solution. What I found is
that the problem wasn't the DELETEs run but rather a table that had swelled
to almost 100GB! Not quite sure how it occured but there it was sitting at
the top of the list in the query you gave me with rather an unrealistic
number of rows. A quick TRUNCATE TABLE solved the problem and I have used
DBCC SHRINKFILE to return things to order.
Many thanks for your help!
Rob
"Anthony Thomas" wrote:
> I don't understand this line:
> "So hasn't exposed any free space however about half of my tables (all the
> unindexed ones) are empty so there should be plenty of unused space."
> Who cares about the empty ones? It's the full ones that you need to be
> worried about.
> Could you post the results of the following query? You can mask the names,
> but put some other indicated in there so we have a reference that you can
> translate on your side.
> Here's the query:
> SELECT objname = OBJECT_NAME(id), indname = [name], indid, groupid, keycnt,
> maxirow
> ,minlen, xmaxlen, dpages, reserved, used, rowcnt, rowmodctr, pgmodctr
> FROM dbo.sysindexes
> WHERE indid IN(0, 1, 255)
> AND id > 1000
> ORDER BY reserved DESC
> This will tell you which indexes have been reserved the most database pages.
> INDID 0 are the data pages that use heap indexes--tables without clustered
> indexes defined. INDID 1 are the datapages that use clustered indexes.
> INDID 255 are the data pages allocated for BLOB/CLOB data.
> I've ordered this by reserved. This will show you which tables have the
> bulk of the database usage. However, take a look at the used attribute.
> This will show you how many data and index pages have been allocated to this
> table, sans BLOB/CLOB data. If reserved is high but used is log, you have
> space that you can reclaim. However, given the output of the sp_spaceused
> you provided earlier, not only do you have reserved space, 250 GB, you have
> high used space, 230 GB.
> Now, if you have the defaults for AUTOGROW set to 10% increments, or
> increased it to 20%, and, if you were almost out of space when you added the
> secondary data file, the first AUTOGROW allocation could have added anywhere
> from 25 to 50 GB of new unused data and index pages. Given you have about
> 20 GB of unused space, I suspect this is what happened.
> When was the last time you did a database reorg in with the maintenance plan
> wizard or buy rebuilding all of the clustered indexes? If you use the
> wizard, you can also have it move all the pages to the beginning of the
> file. This would let you shrink the file more easily, which is what I
> suspect was happening when you attempted the shrink operation before. It
> has to move pages before it can shrink and 250 GB of data just doesn't move
> that quickly.
> Sincerely,
>
> Anthony Thomas
>
> --
> "Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
> news:49AB9EEE-C51A-4BED-84BA-8364DBBE538F@.microsoft.com...
> Hi Geoff,
> Thanks for your suggestions (and everyone else's too).
> I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
> Database size Unallocated space
> 257672.06 MB 224.60 MB
> Reserved Data Space Indexes
> Unused
> 261840344 KB 240624184 KB 20345472 KB 870688 KB
> Current Size Used pages
> Estimated pages
> 8 3 9729984 128 9729824 9729824
> So hasn't exposed any free space however about half of my tables (all the
> unindexed ones) are empty so there should be plenty of unused space.
> I have tried to run shrinkfile on the data file on the 2nd (80GB) hard drive
> which seemed to complete saying 1 row affected and didn't reduce the size of
> the file. I am going to try it again with a different value.
> I have downloaded Service Pack 3 and updated but this hasn't helped. Paul,
> who is PSS?
> Hmm, getting a bit desperate here as very limited time to sort this out.
> Need to get some idea if I'll have to bail out of this by creating a new
> database elsewhere and copying tables over bit by bit (not much storage
> space
> available) and whetehr that has a chance of sorting the problem. Another
> possibility is to somehow detach the second data file that sits on the new
> 80GB drive as I didn't add any fresh data to that, it has simply been filled
> up somehow with the results/logs (though doesn't appear as a log of course)
> of my table DELETEs, is there any chance of that working?
> Appreciate any more ideas if there are any out there?
> Thanks,
> Rob
> "Geoff N. Hiten" wrote:
> do
> prefer
> like
> than
>
>
Disaster freeing space in 200GB database
Hi,
I have been developing a database which a couple of days ago was about
180GB, which almost filled up the 200GB hard drive.
In order to free space I used DBCC ShrinkDatabase(logfilename,1) on the log
file which was 20GB but this then ADDED 20GB to the database (I understand
now that you shouldn't try to shrink the log this much). Using shrink
database on the data file didn't seem to work - kept running and running wit
h
the system idle so I eventually stopped it. I then attached a 80GB hardrive
and added a new datafile to allow the database more temporary room.
Next I tried the DELETE command on a number of tables no longer required to
have data in them (I need the tables to still exist but be empty for now so
I
didn't use DROP) but this then added to the database once again and filled
the entire new 80GB drive.
I now have 280GB full and no idea how to reduce it in size. I have read
everything in Books Online and read many posts and articles on the net
without really having an idea of what to try next. Unfortunately I don't
have any room at all elsewhere to shift parts of the database around.
The transaction log is only 1.7GB and was before the DELETEs as well. Given
that DELETEs should swell the log what has happened here? - log stayed the
same size, data file increased by the amount of data deleted (80GB). What i
s
filling up the data file? If it is any help, I have specific tables which
are now empty of records which are where all the free space should be. Ther
e
might be some way to shift these to a small database (since empty tables
shouldn't consume much memory) and then free up the space? Not sure if this
would transfer the huge files across or if it would help anyway with
shrinking the database...
Appreciate any help at all!
TIA,
RobRobert Chapman wrote:
> Hi,
> I have been developing a database which a couple of days ago was about
> 180GB, which almost filled up the 200GB hard drive.
> In order to free space I used DBCC ShrinkDatabase(logfilename,1) on
> the log file which was 20GB but this then ADDED 20GB to the database
> (I understand now that you shouldn't try to shrink the log this
> much). Using shrink database on the data file didn't seem to work -
> kept running and running with the system idle so I eventually stopped
> it. I then attached a 80GB hardrive and added a new datafile to
> allow the database more temporary room.
> Next I tried the DELETE command on a number of tables no longer
> required to have data in them (I need the tables to still exist but
> be empty for now so I didn't use DROP) but this then added to the
> database once again and filled the entire new 80GB drive.
> I now have 280GB full and no idea how to reduce it in size. I have
> read everything in Books Online and read many posts and articles on
> the net without really having an idea of what to try next.
> Unfortunately I don't have any room at all elsewhere to shift parts
> of the database around.
> The transaction log is only 1.7GB and was before the DELETEs as well.
> Given that DELETEs should swell the log what has happened here? - log
> stayed the same size, data file increased by the amount of data
> deleted (80GB). What is filling up the data file? If it is any
> help, I have specific tables which are now empty of records which are
> where all the free space should be. There might be some way to shift
> these to a small database (since empty tables shouldn't consume much
> memory) and then free up the space? Not sure if this would transfer
> the huge files across or if it would help anyway with shrinking the
> database...
> Appreciate any help at all!
> TIA,
> Rob
You could have empty space in the files. SQL Server does not attempt to
release unused space in data or log files. Run sp_spaceused on the
database and see what space is unused. You may have more space than you
think. Then I would set an upper limit for the data file on the 200GB
drive so it does not attempt to grow beyond the drive limits.
David Gugick
Imceda Software
www.imceda.com|||Ouch. Lets see exactly what went wrong and how to deal with this.
Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
You may be confused about the Enterprise Manager display. Use the TASKPAD
view to get a good look at the overall space and the space used. If you do
have a lot of free data and log space, then you can proceed to recapture
that empty space.
DBCC SHRINKDATABASE is probably not the correct command. I strongly prefer
DBCC SHRINKFILE since it gives me a finer degree of control. It sounds like
your log file may not be able to accommodate what you are trying to do so
lets do it in smaller increments. Run DBCC SHRINKFILE
(MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller than
your existing file size. You will have to run it several times, but
eventually you will get more space.
If you want to empty a large table, try the TRUNCATE TABLE command. It
doesn't take up much log space at all. Delete does take up log space.
These suggestions should get you started. Feel free to ask back for more
help if you run into more problems.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:5440B4DA-8FF1-4DF7-88B2-B60C6B174668@.microsoft.com...
> Hi,
> I have been developing a database which a couple of days ago was about
> 180GB, which almost filled up the 200GB hard drive.
> In order to free space I used DBCC ShrinkDatabase(logfilename,1) on the
log
> file which was 20GB but this then ADDED 20GB to the database (I understand
> now that you shouldn't try to shrink the log this much). Using shrink
> database on the data file didn't seem to work - kept running and running
with
> the system idle so I eventually stopped it. I then attached a 80GB
hardrive
> and added a new datafile to allow the database more temporary room.
> Next I tried the DELETE command on a number of tables no longer required
to
> have data in them (I need the tables to still exist but be empty for now
so I
> didn't use DROP) but this then added to the database once again and filled
> the entire new 80GB drive.
> I now have 280GB full and no idea how to reduce it in size. I have read
> everything in Books Online and read many posts and articles on the net
> without really having an idea of what to try next. Unfortunately I don't
> have any room at all elsewhere to shift parts of the database around.
> The transaction log is only 1.7GB and was before the DELETEs as well.
Given
> that DELETEs should swell the log what has happened here? - log stayed the
> same size, data file increased by the amount of data deleted (80GB). What
is
> filling up the data file? If it is any help, I have specific tables which
> are now empty of records which are where all the free space should be.
There
> might be some way to shift these to a small database (since empty tables
> shouldn't consume much memory) and then free up the space? Not sure if
this
> would transfer the huge files across or if it would help anyway with
> shrinking the database...
> Appreciate any help at all!
> TIA,
> Rob|||Sounds like you have a bunch of empty text pages. Did your tables have
text/image columns in them? There's a bug in one version of shrink (fixed in
SP3) that can cause a shrink to allocate more text space - this would
account for the db growth you saw when you ran shrink on the database.
Deletes can't take more space in the data file. I suggest you contact PSS to
help you remedy this as, from what you've described, there's something
strange going on.
Regards.
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"David Gugick" <davidg-nospam@.imceda.com> wrote in message
news:OTULvWa$EHA.2016@.TK2MSFTNGP15.phx.gbl...
> Robert Chapman wrote:
> You could have empty space in the files. SQL Server does not attempt to
> release unused space in data or log files. Run sp_spaceused on the
> database and see what space is unused. You may have more space than you
> think. Then I would set an upper limit for the data file on the 200GB
> drive so it does not attempt to grow beyond the drive limits.
> --
> David Gugick
> Imceda Software
> www.imceda.com
>|||And if you ever need to recapture so much space again in the future, you
might want to try, during off-hours of course, temporarily setting the
RECOVERY MODE to SIMPLE, do your work, then set it back to FULL RECOVERY,
and make an immediate FULL DATABASE backup.
Sincerely,
Anthony Thomas
"Geoff N. Hiten" <SRDBA@.Careerbuilder.com> wrote in message
news:u5Y5jba$EHA.2540@.TK2MSFTNGP09.phx.gbl...
Ouch. Lets see exactly what went wrong and how to deal with this.
Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
You may be confused about the Enterprise Manager display. Use the TASKPAD
view to get a good look at the overall space and the space used. If you do
have a lot of free data and log space, then you can proceed to recapture
that empty space.
DBCC SHRINKDATABASE is probably not the correct command. I strongly prefer
DBCC SHRINKFILE since it gives me a finer degree of control. It sounds like
your log file may not be able to accommodate what you are trying to do so
lets do it in smaller increments. Run DBCC SHRINKFILE
(MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller than
your existing file size. You will have to run it several times, but
eventually you will get more space.
If you want to empty a large table, try the TRUNCATE TABLE command. It
doesn't take up much log space at all. Delete does take up log space.
These suggestions should get you started. Feel free to ask back for more
help if you run into more problems.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:5440B4DA-8FF1-4DF7-88B2-B60C6B174668@.microsoft.com...
> Hi,
> I have been developing a database which a couple of days ago was about
> 180GB, which almost filled up the 200GB hard drive.
> In order to free space I used DBCC ShrinkDatabase(logfilename,1) on the
log
> file which was 20GB but this then ADDED 20GB to the database (I understand
> now that you shouldn't try to shrink the log this much). Using shrink
> database on the data file didn't seem to work - kept running and running
with
> the system idle so I eventually stopped it. I then attached a 80GB
hardrive
> and added a new datafile to allow the database more temporary room.
> Next I tried the DELETE command on a number of tables no longer required
to
> have data in them (I need the tables to still exist but be empty for now
so I
> didn't use DROP) but this then added to the database once again and filled
> the entire new 80GB drive.
> I now have 280GB full and no idea how to reduce it in size. I have read
> everything in Books Online and read many posts and articles on the net
> without really having an idea of what to try next. Unfortunately I don't
> have any room at all elsewhere to shift parts of the database around.
> The transaction log is only 1.7GB and was before the DELETEs as well.
Given
> that DELETEs should swell the log what has happened here? - log stayed the
> same size, data file increased by the amount of data deleted (80GB). What
is
> filling up the data file? If it is any help, I have specific tables which
> are now empty of records which are where all the free space should be.
There
> might be some way to shift these to a small database (since empty tables
> shouldn't consume much memory) and then free up the space? Not sure if
this
> would transfer the huge files across or if it would help anyway with
> shrinking the database...
> Appreciate any help at all!
> TIA,
> Rob|||Hi Geoff,
Thanks for your suggestions (and everyone else's too).
I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
Database size Unallocated space
257672.06 MB 224.60 MB
Reserved Data Space Indexes
Unused
261840344 KB 240624184 KB 20345472 KB 870688 KB
Current Size Used pages
Estimated pages
8 3 9729984 128 9729824 9729824
So hasn't exposed any free space however about half of my tables (all the
unindexed ones) are empty so there should be plenty of unused space.
I have tried to run shrinkfile on the data file on the 2nd (80GB) hard drive
which seemed to complete saying 1 row affected and didn't reduce the size of
the file. I am going to try it again with a different value.
I have downloaded Service Pack 3 and updated but this hasn't helped. Paul,
who is PSS?
Hmm, getting a bit desperate here as very limited time to sort this out.
Need to get some idea if I'll have to bail out of this by creating a new
database elsewhere and copying tables over bit by bit (not much storage spac
e
available) and whetehr that has a chance of sorting the problem. Another
possibility is to somehow detach the second data file that sits on the new
80GB drive as I didn't add any fresh data to that, it has simply been filled
up somehow with the results/logs (though doesn't appear as a log of course)
of my table DELETEs, is there any chance of that working?
Appreciate any more ideas if there are any out there?
Thanks,
Rob
"Geoff N. Hiten" wrote:
> Ouch. Lets see exactly what went wrong and how to deal with this.
> Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
> You may be confused about the Enterprise Manager display. Use the TASKPAD
> view to get a good look at the overall space and the space used. If you d
o
> have a lot of free data and log space, then you can proceed to recapture
> that empty space.
> DBCC SHRINKDATABASE is probably not the correct command. I strongly prefe
r
> DBCC SHRINKFILE since it gives me a finer degree of control. It sounds li
ke
> your log file may not be able to accommodate what you are trying to do so
> lets do it in smaller increments. Run DBCC SHRINKFILE
> (MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller th
an
> your existing file size. You will have to run it several times, but
> eventually you will get more space.
> If you want to empty a large table, try the TRUNCATE TABLE command. It
> doesn't take up much log space at all. Delete does take up log space.
> These suggestions should get you started. Feel free to ask back for more
> help if you run into more problems.
> --
> Geoff N. Hiten
> Microsoft SQL Server MVP
> Senior Database Administrator
> Careerbuilder.com
>|||PSS is Microsoft Product Support Services. They offer fee-based and
subscription based support. I believe the current per-incident support
charge is $250. They take credit cards.
http://support.microsoft.com
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:49AB9EEE-C51A-4BED-84BA-8364DBBE538F@.microsoft.com...
> Hi Geoff,
> Thanks for your suggestions (and everyone else's too).
> I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
> Database size Unallocated space
> 257672.06 MB 224.60 MB
> Reserved Data Space Indexes
> Unused
> 261840344 KB 240624184 KB 20345472 KB 870688 KB
> Current Size Used pages
> Estimated pages
> 8 3 9729984 128 9729824 9729824
> So hasn't exposed any free space however about half of my tables (all the
> unindexed ones) are empty so there should be plenty of unused space.
> I have tried to run shrinkfile on the data file on the 2nd (80GB) hard
drive
> which seemed to complete saying 1 row affected and didn't reduce the size
of
> the file. I am going to try it again with a different value.
> I have downloaded Service Pack 3 and updated but this hasn't helped.
Paul,
> who is PSS?
> Hmm, getting a bit desperate here as very limited time to sort this out.
> Need to get some idea if I'll have to bail out of this by creating a new
> database elsewhere and copying tables over bit by bit (not much storage
space
> available) and whetehr that has a chance of sorting the problem. Another
> possibility is to somehow detach the second data file that sits on the new
> 80GB drive as I didn't add any fresh data to that, it has simply been
filled
> up somehow with the results/logs (though doesn't appear as a log of
course)
> of my table DELETEs, is there any chance of that working?
> Appreciate any more ideas if there are any out there?
> Thanks,
> Rob
> "Geoff N. Hiten" wrote:
>
TASKPAD[vbcol=seagreen]
do[vbcol=seagreen]
prefer[vbcol=seagreen]
like[vbcol=seagreen]
so[vbcol=seagreen]
than[vbcol=seagreen]
more[vbcol=seagreen]
>|||I don't understand this line:
"So hasn't exposed any free space however about half of my tables (all the
unindexed ones) are empty so there should be plenty of unused space."
Who cares about the empty ones? It's the full ones that you need to be
worried about.
Could you post the results of the following query? You can mask the names,
but put some other indicated in there so we have a reference that you can
translate on your side.
Here's the query:
SELECT objname = OBJECT_NAME(id), indname = [name], indid, groupid, keyc
nt,
maxirow
,minlen, xmaxlen, dpages, reserved, used, rowcnt, rowmodctr, pgmodctr
FROM dbo.sysindexes
WHERE indid IN(0, 1, 255)
AND id > 1000
ORDER BY reserved DESC
This will tell you which indexes have been reserved the most database pages.
INDID 0 are the data pages that use heap indexes--tables without clustered
indexes defined. INDID 1 are the datapages that use clustered indexes.
INDID 255 are the data pages allocated for BLOB/CLOB data.
I've ordered this by reserved. This will show you which tables have the
bulk of the database usage. However, take a look at the used attribute.
This will show you how many data and index pages have been allocated to this
table, sans BLOB/CLOB data. If reserved is high but used is log, you have
space that you can reclaim. However, given the output of the sp_spaceused
you provided earlier, not only do you have reserved space, 250 GB, you have
high used space, 230 GB.
Now, if you have the defaults for AUTOGROW set to 10% increments, or
increased it to 20%, and, if you were almost out of space when you added the
secondary data file, the first AUTOGROW allocation could have added anywhere
from 25 to 50 GB of new unused data and index pages. Given you have about
20 GB of unused space, I suspect this is what happened.
When was the last time you did a database reorg in with the maintenance plan
wizard or buy rebuilding all of the clustered indexes? If you use the
wizard, you can also have it move all the pages to the beginning of the
file. This would let you shrink the file more easily, which is what I
suspect was happening when you attempted the shrink operation before. It
has to move pages before it can shrink and 250 GB of data just doesn't move
that quickly.
Sincerely,
Anthony Thomas
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:49AB9EEE-C51A-4BED-84BA-8364DBBE538F@.microsoft.com...
Hi Geoff,
Thanks for your suggestions (and everyone else's too).
I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
Database size Unallocated space
257672.06 MB 224.60 MB
Reserved Data Space Indexes
Unused
261840344 KB 240624184 KB 20345472 KB 870688 KB
Current Size Used pages
Estimated pages
8 3 9729984 128 9729824 9729824
So hasn't exposed any free space however about half of my tables (all the
unindexed ones) are empty so there should be plenty of unused space.
I have tried to run shrinkfile on the data file on the 2nd (80GB) hard drive
which seemed to complete saying 1 row affected and didn't reduce the size of
the file. I am going to try it again with a different value.
I have downloaded Service Pack 3 and updated but this hasn't helped. Paul,
who is PSS?
Hmm, getting a bit desperate here as very limited time to sort this out.
Need to get some idea if I'll have to bail out of this by creating a new
database elsewhere and copying tables over bit by bit (not much storage
space
available) and whetehr that has a chance of sorting the problem. Another
possibility is to somehow detach the second data file that sits on the new
80GB drive as I didn't add any fresh data to that, it has simply been filled
up somehow with the results/logs (though doesn't appear as a log of course)
of my table DELETEs, is there any chance of that working?
Appreciate any more ideas if there are any out there?
Thanks,
Rob
"Geoff N. Hiten" wrote:
> Ouch. Lets see exactly what went wrong and how to deal with this.
> Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
> You may be confused about the Enterprise Manager display. Use the TASKPAD
> view to get a good look at the overall space and the space used. If you
do
> have a lot of free data and log space, then you can proceed to recapture
> that empty space.
> DBCC SHRINKDATABASE is probably not the correct command. I strongly
prefer
> DBCC SHRINKFILE since it gives me a finer degree of control. It sounds
like
> your log file may not be able to accommodate what you are trying to do so
> lets do it in smaller increments. Run DBCC SHRINKFILE
> (MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller
than
> your existing file size. You will have to run it several times, but
> eventually you will get more space.
> If you want to empty a large table, try the TRUNCATE TABLE command. It
> doesn't take up much log space at all. Delete does take up log space.
> These suggestions should get you started. Feel free to ask back for more
> help if you run into more problems.
> --
> Geoff N. Hiten
> Microsoft SQL Server MVP
> Senior Database Administrator
> Careerbuilder.com
>|||Hi Anthony,
Thanks a whole lot for your post, it led to a solution. What I found is
that the problem wasn't the DELETEs run but rather a table that had swelled
to almost 100GB! Not quite sure how it occured but there it was sitting at
the top of the list in the query you gave me with rather an unrealistic
number of rows. A quick TRUNCATE TABLE solved the problem and I have used
DBCC SHRINKFILE to return things to order.
Many thanks for your help!
Rob
"Anthony Thomas" wrote:
> I don't understand this line:
> "So hasn't exposed any free space however about half of my tables (all the
> unindexed ones) are empty so there should be plenty of unused space."
> Who cares about the empty ones? It's the full ones that you need to be
> worried about.
> Could you post the results of the following query? You can mask the names
,
> but put some other indicated in there so we have a reference that you can
> translate on your side.
> Here's the query:
> SELECT objname = OBJECT_NAME(id), indname = [name], indid, groupid, ke
ycnt,
> maxirow
> ,minlen, xmaxlen, dpages, reserved, used, rowcnt, rowmodctr, pgmodctr
> FROM dbo.sysindexes
> WHERE indid IN(0, 1, 255)
> AND id > 1000
> ORDER BY reserved DESC
> This will tell you which indexes have been reserved the most database page
s.
> INDID 0 are the data pages that use heap indexes--tables without clustered
> indexes defined. INDID 1 are the datapages that use clustered indexes.
> INDID 255 are the data pages allocated for BLOB/CLOB data.
> I've ordered this by reserved. This will show you which tables have the
> bulk of the database usage. However, take a look at the used attribute.
> This will show you how many data and index pages have been allocated to th
is
> table, sans BLOB/CLOB data. If reserved is high but used is log, you have
> space that you can reclaim. However, given the output of the sp_spaceused
> you provided earlier, not only do you have reserved space, 250 GB, you hav
e
> high used space, 230 GB.
> Now, if you have the defaults for AUTOGROW set to 10% increments, or
> increased it to 20%, and, if you were almost out of space when you added t
he
> secondary data file, the first AUTOGROW allocation could have added anywhe
re
> from 25 to 50 GB of new unused data and index pages. Given you have about
> 20 GB of unused space, I suspect this is what happened.
> When was the last time you did a database reorg in with the maintenance pl
an
> wizard or buy rebuilding all of the clustered indexes? If you use the
> wizard, you can also have it move all the pages to the beginning of the
> file. This would let you shrink the file more easily, which is what I
> suspect was happening when you attempted the shrink operation before. It
> has to move pages before it can shrink and 250 GB of data just doesn't mov
e
> that quickly.
> Sincerely,
>
> Anthony Thomas
>
> --
> "Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in messag
e
> news:49AB9EEE-C51A-4BED-84BA-8364DBBE538F@.microsoft.com...
> Hi Geoff,
> Thanks for your suggestions (and everyone else's too).
> I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
> Database size Unallocated space
> 257672.06 MB 224.60 MB
> Reserved Data Space Indexes
> Unused
> 261840344 KB 240624184 KB 20345472 KB 870688 KB
> Current Size Used pages
> Estimated pages
> 8 3 9729984 128 9729824 9729824
> So hasn't exposed any free space however about half of my tables (all the
> unindexed ones) are empty so there should be plenty of unused space.
> I have tried to run shrinkfile on the data file on the 2nd (80GB) hard dri
ve
> which seemed to complete saying 1 row affected and didn't reduce the size
of
> the file. I am going to try it again with a different value.
> I have downloaded Service Pack 3 and updated but this hasn't helped. Paul
,
> who is PSS?
> Hmm, getting a bit desperate here as very limited time to sort this out.
> Need to get some idea if I'll have to bail out of this by creating a new
> database elsewhere and copying tables over bit by bit (not much storage
> space
> available) and whetehr that has a chance of sorting the problem. Another
> possibility is to somehow detach the second data file that sits on the new
> 80GB drive as I didn't add any fresh data to that, it has simply been fill
ed
> up somehow with the results/logs (though doesn't appear as a log of course
)
> of my table DELETEs, is there any chance of that working?
> Appreciate any more ideas if there are any out there?
> Thanks,
> Rob
> "Geoff N. Hiten" wrote:
>
> do
> prefer
> like
> than
>
>
I have been developing a database which a couple of days ago was about
180GB, which almost filled up the 200GB hard drive.
In order to free space I used DBCC ShrinkDatabase(logfilename,1) on the log
file which was 20GB but this then ADDED 20GB to the database (I understand
now that you shouldn't try to shrink the log this much). Using shrink
database on the data file didn't seem to work - kept running and running wit
h
the system idle so I eventually stopped it. I then attached a 80GB hardrive
and added a new datafile to allow the database more temporary room.
Next I tried the DELETE command on a number of tables no longer required to
have data in them (I need the tables to still exist but be empty for now so
I
didn't use DROP) but this then added to the database once again and filled
the entire new 80GB drive.
I now have 280GB full and no idea how to reduce it in size. I have read
everything in Books Online and read many posts and articles on the net
without really having an idea of what to try next. Unfortunately I don't
have any room at all elsewhere to shift parts of the database around.
The transaction log is only 1.7GB and was before the DELETEs as well. Given
that DELETEs should swell the log what has happened here? - log stayed the
same size, data file increased by the amount of data deleted (80GB). What i
s
filling up the data file? If it is any help, I have specific tables which
are now empty of records which are where all the free space should be. Ther
e
might be some way to shift these to a small database (since empty tables
shouldn't consume much memory) and then free up the space? Not sure if this
would transfer the huge files across or if it would help anyway with
shrinking the database...
Appreciate any help at all!
TIA,
RobRobert Chapman wrote:
> Hi,
> I have been developing a database which a couple of days ago was about
> 180GB, which almost filled up the 200GB hard drive.
> In order to free space I used DBCC ShrinkDatabase(logfilename,1) on
> the log file which was 20GB but this then ADDED 20GB to the database
> (I understand now that you shouldn't try to shrink the log this
> much). Using shrink database on the data file didn't seem to work -
> kept running and running with the system idle so I eventually stopped
> it. I then attached a 80GB hardrive and added a new datafile to
> allow the database more temporary room.
> Next I tried the DELETE command on a number of tables no longer
> required to have data in them (I need the tables to still exist but
> be empty for now so I didn't use DROP) but this then added to the
> database once again and filled the entire new 80GB drive.
> I now have 280GB full and no idea how to reduce it in size. I have
> read everything in Books Online and read many posts and articles on
> the net without really having an idea of what to try next.
> Unfortunately I don't have any room at all elsewhere to shift parts
> of the database around.
> The transaction log is only 1.7GB and was before the DELETEs as well.
> Given that DELETEs should swell the log what has happened here? - log
> stayed the same size, data file increased by the amount of data
> deleted (80GB). What is filling up the data file? If it is any
> help, I have specific tables which are now empty of records which are
> where all the free space should be. There might be some way to shift
> these to a small database (since empty tables shouldn't consume much
> memory) and then free up the space? Not sure if this would transfer
> the huge files across or if it would help anyway with shrinking the
> database...
> Appreciate any help at all!
> TIA,
> Rob
You could have empty space in the files. SQL Server does not attempt to
release unused space in data or log files. Run sp_spaceused on the
database and see what space is unused. You may have more space than you
think. Then I would set an upper limit for the data file on the 200GB
drive so it does not attempt to grow beyond the drive limits.
David Gugick
Imceda Software
www.imceda.com|||Ouch. Lets see exactly what went wrong and how to deal with this.
Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
You may be confused about the Enterprise Manager display. Use the TASKPAD
view to get a good look at the overall space and the space used. If you do
have a lot of free data and log space, then you can proceed to recapture
that empty space.
DBCC SHRINKDATABASE is probably not the correct command. I strongly prefer
DBCC SHRINKFILE since it gives me a finer degree of control. It sounds like
your log file may not be able to accommodate what you are trying to do so
lets do it in smaller increments. Run DBCC SHRINKFILE
(MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller than
your existing file size. You will have to run it several times, but
eventually you will get more space.
If you want to empty a large table, try the TRUNCATE TABLE command. It
doesn't take up much log space at all. Delete does take up log space.
These suggestions should get you started. Feel free to ask back for more
help if you run into more problems.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:5440B4DA-8FF1-4DF7-88B2-B60C6B174668@.microsoft.com...
> Hi,
> I have been developing a database which a couple of days ago was about
> 180GB, which almost filled up the 200GB hard drive.
> In order to free space I used DBCC ShrinkDatabase(logfilename,1) on the
log
> file which was 20GB but this then ADDED 20GB to the database (I understand
> now that you shouldn't try to shrink the log this much). Using shrink
> database on the data file didn't seem to work - kept running and running
with
> the system idle so I eventually stopped it. I then attached a 80GB
hardrive
> and added a new datafile to allow the database more temporary room.
> Next I tried the DELETE command on a number of tables no longer required
to
> have data in them (I need the tables to still exist but be empty for now
so I
> didn't use DROP) but this then added to the database once again and filled
> the entire new 80GB drive.
> I now have 280GB full and no idea how to reduce it in size. I have read
> everything in Books Online and read many posts and articles on the net
> without really having an idea of what to try next. Unfortunately I don't
> have any room at all elsewhere to shift parts of the database around.
> The transaction log is only 1.7GB and was before the DELETEs as well.
Given
> that DELETEs should swell the log what has happened here? - log stayed the
> same size, data file increased by the amount of data deleted (80GB). What
is
> filling up the data file? If it is any help, I have specific tables which
> are now empty of records which are where all the free space should be.
There
> might be some way to shift these to a small database (since empty tables
> shouldn't consume much memory) and then free up the space? Not sure if
this
> would transfer the huge files across or if it would help anyway with
> shrinking the database...
> Appreciate any help at all!
> TIA,
> Rob|||Sounds like you have a bunch of empty text pages. Did your tables have
text/image columns in them? There's a bug in one version of shrink (fixed in
SP3) that can cause a shrink to allocate more text space - this would
account for the db growth you saw when you ran shrink on the database.
Deletes can't take more space in the data file. I suggest you contact PSS to
help you remedy this as, from what you've described, there's something
strange going on.
Regards.
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine
This posting is provided "AS IS" with no warranties, and confers no rights.
"David Gugick" <davidg-nospam@.imceda.com> wrote in message
news:OTULvWa$EHA.2016@.TK2MSFTNGP15.phx.gbl...
> Robert Chapman wrote:
> You could have empty space in the files. SQL Server does not attempt to
> release unused space in data or log files. Run sp_spaceused on the
> database and see what space is unused. You may have more space than you
> think. Then I would set an upper limit for the data file on the 200GB
> drive so it does not attempt to grow beyond the drive limits.
> --
> David Gugick
> Imceda Software
> www.imceda.com
>|||And if you ever need to recapture so much space again in the future, you
might want to try, during off-hours of course, temporarily setting the
RECOVERY MODE to SIMPLE, do your work, then set it back to FULL RECOVERY,
and make an immediate FULL DATABASE backup.
Sincerely,
Anthony Thomas
"Geoff N. Hiten" <SRDBA@.Careerbuilder.com> wrote in message
news:u5Y5jba$EHA.2540@.TK2MSFTNGP09.phx.gbl...
Ouch. Lets see exactly what went wrong and how to deal with this.
Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
You may be confused about the Enterprise Manager display. Use the TASKPAD
view to get a good look at the overall space and the space used. If you do
have a lot of free data and log space, then you can proceed to recapture
that empty space.
DBCC SHRINKDATABASE is probably not the correct command. I strongly prefer
DBCC SHRINKFILE since it gives me a finer degree of control. It sounds like
your log file may not be able to accommodate what you are trying to do so
lets do it in smaller increments. Run DBCC SHRINKFILE
(MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller than
your existing file size. You will have to run it several times, but
eventually you will get more space.
If you want to empty a large table, try the TRUNCATE TABLE command. It
doesn't take up much log space at all. Delete does take up log space.
These suggestions should get you started. Feel free to ask back for more
help if you run into more problems.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:5440B4DA-8FF1-4DF7-88B2-B60C6B174668@.microsoft.com...
> Hi,
> I have been developing a database which a couple of days ago was about
> 180GB, which almost filled up the 200GB hard drive.
> In order to free space I used DBCC ShrinkDatabase(logfilename,1) on the
log
> file which was 20GB but this then ADDED 20GB to the database (I understand
> now that you shouldn't try to shrink the log this much). Using shrink
> database on the data file didn't seem to work - kept running and running
with
> the system idle so I eventually stopped it. I then attached a 80GB
hardrive
> and added a new datafile to allow the database more temporary room.
> Next I tried the DELETE command on a number of tables no longer required
to
> have data in them (I need the tables to still exist but be empty for now
so I
> didn't use DROP) but this then added to the database once again and filled
> the entire new 80GB drive.
> I now have 280GB full and no idea how to reduce it in size. I have read
> everything in Books Online and read many posts and articles on the net
> without really having an idea of what to try next. Unfortunately I don't
> have any room at all elsewhere to shift parts of the database around.
> The transaction log is only 1.7GB and was before the DELETEs as well.
Given
> that DELETEs should swell the log what has happened here? - log stayed the
> same size, data file increased by the amount of data deleted (80GB). What
is
> filling up the data file? If it is any help, I have specific tables which
> are now empty of records which are where all the free space should be.
There
> might be some way to shift these to a small database (since empty tables
> shouldn't consume much memory) and then free up the space? Not sure if
this
> would transfer the huge files across or if it would help anyway with
> shrinking the database...
> Appreciate any help at all!
> TIA,
> Rob|||Hi Geoff,
Thanks for your suggestions (and everyone else's too).
I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
Database size Unallocated space
257672.06 MB 224.60 MB
Reserved Data Space Indexes
Unused
261840344 KB 240624184 KB 20345472 KB 870688 KB
Current Size Used pages
Estimated pages
8 3 9729984 128 9729824 9729824
So hasn't exposed any free space however about half of my tables (all the
unindexed ones) are empty so there should be plenty of unused space.
I have tried to run shrinkfile on the data file on the 2nd (80GB) hard drive
which seemed to complete saying 1 row affected and didn't reduce the size of
the file. I am going to try it again with a different value.
I have downloaded Service Pack 3 and updated but this hasn't helped. Paul,
who is PSS?
Hmm, getting a bit desperate here as very limited time to sort this out.
Need to get some idea if I'll have to bail out of this by creating a new
database elsewhere and copying tables over bit by bit (not much storage spac
e
available) and whetehr that has a chance of sorting the problem. Another
possibility is to somehow detach the second data file that sits on the new
80GB drive as I didn't add any fresh data to that, it has simply been filled
up somehow with the results/logs (though doesn't appear as a log of course)
of my table DELETEs, is there any chance of that working?
Appreciate any more ideas if there are any out there?
Thanks,
Rob
"Geoff N. Hiten" wrote:
> Ouch. Lets see exactly what went wrong and how to deal with this.
> Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
> You may be confused about the Enterprise Manager display. Use the TASKPAD
> view to get a good look at the overall space and the space used. If you d
o
> have a lot of free data and log space, then you can proceed to recapture
> that empty space.
> DBCC SHRINKDATABASE is probably not the correct command. I strongly prefe
r
> DBCC SHRINKFILE since it gives me a finer degree of control. It sounds li
ke
> your log file may not be able to accommodate what you are trying to do so
> lets do it in smaller increments. Run DBCC SHRINKFILE
> (MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller th
an
> your existing file size. You will have to run it several times, but
> eventually you will get more space.
> If you want to empty a large table, try the TRUNCATE TABLE command. It
> doesn't take up much log space at all. Delete does take up log space.
> These suggestions should get you started. Feel free to ask back for more
> help if you run into more problems.
> --
> Geoff N. Hiten
> Microsoft SQL Server MVP
> Senior Database Administrator
> Careerbuilder.com
>|||PSS is Microsoft Product Support Services. They offer fee-based and
subscription based support. I believe the current per-incident support
charge is $250. They take credit cards.
http://support.microsoft.com
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:49AB9EEE-C51A-4BED-84BA-8364DBBE538F@.microsoft.com...
> Hi Geoff,
> Thanks for your suggestions (and everyone else's too).
> I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
> Database size Unallocated space
> 257672.06 MB 224.60 MB
> Reserved Data Space Indexes
> Unused
> 261840344 KB 240624184 KB 20345472 KB 870688 KB
> Current Size Used pages
> Estimated pages
> 8 3 9729984 128 9729824 9729824
> So hasn't exposed any free space however about half of my tables (all the
> unindexed ones) are empty so there should be plenty of unused space.
> I have tried to run shrinkfile on the data file on the 2nd (80GB) hard
drive
> which seemed to complete saying 1 row affected and didn't reduce the size
of
> the file. I am going to try it again with a different value.
> I have downloaded Service Pack 3 and updated but this hasn't helped.
Paul,
> who is PSS?
> Hmm, getting a bit desperate here as very limited time to sort this out.
> Need to get some idea if I'll have to bail out of this by creating a new
> database elsewhere and copying tables over bit by bit (not much storage
space
> available) and whetehr that has a chance of sorting the problem. Another
> possibility is to somehow detach the second data file that sits on the new
> 80GB drive as I didn't add any fresh data to that, it has simply been
filled
> up somehow with the results/logs (though doesn't appear as a log of
course)
> of my table DELETEs, is there any chance of that working?
> Appreciate any more ideas if there are any out there?
> Thanks,
> Rob
> "Geoff N. Hiten" wrote:
>
TASKPAD[vbcol=seagreen]
do[vbcol=seagreen]
prefer[vbcol=seagreen]
like[vbcol=seagreen]
so[vbcol=seagreen]
than[vbcol=seagreen]
more[vbcol=seagreen]
>|||I don't understand this line:
"So hasn't exposed any free space however about half of my tables (all the
unindexed ones) are empty so there should be plenty of unused space."
Who cares about the empty ones? It's the full ones that you need to be
worried about.
Could you post the results of the following query? You can mask the names,
but put some other indicated in there so we have a reference that you can
translate on your side.
Here's the query:
SELECT objname = OBJECT_NAME(id), indname = [name], indid, groupid, keyc
nt,
maxirow
,minlen, xmaxlen, dpages, reserved, used, rowcnt, rowmodctr, pgmodctr
FROM dbo.sysindexes
WHERE indid IN(0, 1, 255)
AND id > 1000
ORDER BY reserved DESC
This will tell you which indexes have been reserved the most database pages.
INDID 0 are the data pages that use heap indexes--tables without clustered
indexes defined. INDID 1 are the datapages that use clustered indexes.
INDID 255 are the data pages allocated for BLOB/CLOB data.
I've ordered this by reserved. This will show you which tables have the
bulk of the database usage. However, take a look at the used attribute.
This will show you how many data and index pages have been allocated to this
table, sans BLOB/CLOB data. If reserved is high but used is log, you have
space that you can reclaim. However, given the output of the sp_spaceused
you provided earlier, not only do you have reserved space, 250 GB, you have
high used space, 230 GB.
Now, if you have the defaults for AUTOGROW set to 10% increments, or
increased it to 20%, and, if you were almost out of space when you added the
secondary data file, the first AUTOGROW allocation could have added anywhere
from 25 to 50 GB of new unused data and index pages. Given you have about
20 GB of unused space, I suspect this is what happened.
When was the last time you did a database reorg in with the maintenance plan
wizard or buy rebuilding all of the clustered indexes? If you use the
wizard, you can also have it move all the pages to the beginning of the
file. This would let you shrink the file more easily, which is what I
suspect was happening when you attempted the shrink operation before. It
has to move pages before it can shrink and 250 GB of data just doesn't move
that quickly.
Sincerely,
Anthony Thomas
"Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in message
news:49AB9EEE-C51A-4BED-84BA-8364DBBE538F@.microsoft.com...
Hi Geoff,
Thanks for your suggestions (and everyone else's too).
I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
Database size Unallocated space
257672.06 MB 224.60 MB
Reserved Data Space Indexes
Unused
261840344 KB 240624184 KB 20345472 KB 870688 KB
Current Size Used pages
Estimated pages
8 3 9729984 128 9729824 9729824
So hasn't exposed any free space however about half of my tables (all the
unindexed ones) are empty so there should be plenty of unused space.
I have tried to run shrinkfile on the data file on the 2nd (80GB) hard drive
which seemed to complete saying 1 row affected and didn't reduce the size of
the file. I am going to try it again with a different value.
I have downloaded Service Pack 3 and updated but this hasn't helped. Paul,
who is PSS?
Hmm, getting a bit desperate here as very limited time to sort this out.
Need to get some idea if I'll have to bail out of this by creating a new
database elsewhere and copying tables over bit by bit (not much storage
space
available) and whetehr that has a chance of sorting the problem. Another
possibility is to somehow detach the second data file that sits on the new
80GB drive as I didn't add any fresh data to that, it has simply been filled
up somehow with the results/logs (though doesn't appear as a log of course)
of my table DELETEs, is there any chance of that working?
Appreciate any more ideas if there are any out there?
Thanks,
Rob
"Geoff N. Hiten" wrote:
> Ouch. Lets see exactly what went wrong and how to deal with this.
> Run DBCC UPDATEUSAGE to make sure you are seeing accurate information.
> You may be confused about the Enterprise Manager display. Use the TASKPAD
> view to get a good look at the overall space and the space used. If you
do
> have a lot of free data and log space, then you can proceed to recapture
> that empty space.
> DBCC SHRINKDATABASE is probably not the correct command. I strongly
prefer
> DBCC SHRINKFILE since it gives me a finer degree of control. It sounds
like
> your log file may not be able to accommodate what you are trying to do so
> lets do it in smaller increments. Run DBCC SHRINKFILE
> (MyBigHonkingDataFileName, xxxxx) where xxxx is maybe 1 or 2 GB smaller
than
> your existing file size. You will have to run it several times, but
> eventually you will get more space.
> If you want to empty a large table, try the TRUNCATE TABLE command. It
> doesn't take up much log space at all. Delete does take up log space.
> These suggestions should get you started. Feel free to ask back for more
> help if you run into more problems.
> --
> Geoff N. Hiten
> Microsoft SQL Server MVP
> Senior Database Administrator
> Careerbuilder.com
>|||Hi Anthony,
Thanks a whole lot for your post, it led to a solution. What I found is
that the problem wasn't the DELETEs run but rather a table that had swelled
to almost 100GB! Not quite sure how it occured but there it was sitting at
the top of the list in the query you gave me with rather an unrealistic
number of rows. A quick TRUNCATE TABLE solved the problem and I have used
DBCC SHRINKFILE to return things to order.
Many thanks for your help!
Rob
"Anthony Thomas" wrote:
> I don't understand this line:
> "So hasn't exposed any free space however about half of my tables (all the
> unindexed ones) are empty so there should be plenty of unused space."
> Who cares about the empty ones? It's the full ones that you need to be
> worried about.
> Could you post the results of the following query? You can mask the names
,
> but put some other indicated in there so we have a reference that you can
> translate on your side.
> Here's the query:
> SELECT objname = OBJECT_NAME(id), indname = [name], indid, groupid, ke
ycnt,
> maxirow
> ,minlen, xmaxlen, dpages, reserved, used, rowcnt, rowmodctr, pgmodctr
> FROM dbo.sysindexes
> WHERE indid IN(0, 1, 255)
> AND id > 1000
> ORDER BY reserved DESC
> This will tell you which indexes have been reserved the most database page
s.
> INDID 0 are the data pages that use heap indexes--tables without clustered
> indexes defined. INDID 1 are the datapages that use clustered indexes.
> INDID 255 are the data pages allocated for BLOB/CLOB data.
> I've ordered this by reserved. This will show you which tables have the
> bulk of the database usage. However, take a look at the used attribute.
> This will show you how many data and index pages have been allocated to th
is
> table, sans BLOB/CLOB data. If reserved is high but used is log, you have
> space that you can reclaim. However, given the output of the sp_spaceused
> you provided earlier, not only do you have reserved space, 250 GB, you hav
e
> high used space, 230 GB.
> Now, if you have the defaults for AUTOGROW set to 10% increments, or
> increased it to 20%, and, if you were almost out of space when you added t
he
> secondary data file, the first AUTOGROW allocation could have added anywhe
re
> from 25 to 50 GB of new unused data and index pages. Given you have about
> 20 GB of unused space, I suspect this is what happened.
> When was the last time you did a database reorg in with the maintenance pl
an
> wizard or buy rebuilding all of the clustered indexes? If you use the
> wizard, you can also have it move all the pages to the beginning of the
> file. This would let you shrink the file more easily, which is what I
> suspect was happening when you attempted the shrink operation before. It
> has to move pages before it can shrink and 250 GB of data just doesn't mov
e
> that quickly.
> Sincerely,
>
> Anthony Thomas
>
> --
> "Robert Chapman" <RobertChapman@.discussions.microsoft.com> wrote in messag
e
> news:49AB9EEE-C51A-4BED-84BA-8364DBBE538F@.microsoft.com...
> Hi Geoff,
> Thanks for your suggestions (and everyone else's too).
> I have run EXEC sp_spaceused @.updateusage = 'TRUE' with these results:
> Database size Unallocated space
> 257672.06 MB 224.60 MB
> Reserved Data Space Indexes
> Unused
> 261840344 KB 240624184 KB 20345472 KB 870688 KB
> Current Size Used pages
> Estimated pages
> 8 3 9729984 128 9729824 9729824
> So hasn't exposed any free space however about half of my tables (all the
> unindexed ones) are empty so there should be plenty of unused space.
> I have tried to run shrinkfile on the data file on the 2nd (80GB) hard dri
ve
> which seemed to complete saying 1 row affected and didn't reduce the size
of
> the file. I am going to try it again with a different value.
> I have downloaded Service Pack 3 and updated but this hasn't helped. Paul
,
> who is PSS?
> Hmm, getting a bit desperate here as very limited time to sort this out.
> Need to get some idea if I'll have to bail out of this by creating a new
> database elsewhere and copying tables over bit by bit (not much storage
> space
> available) and whetehr that has a chance of sorting the problem. Another
> possibility is to somehow detach the second data file that sits on the new
> 80GB drive as I didn't add any fresh data to that, it has simply been fill
ed
> up somehow with the results/logs (though doesn't appear as a log of course
)
> of my table DELETEs, is there any chance of that working?
> Appreciate any more ideas if there are any out there?
> Thanks,
> Rob
> "Geoff N. Hiten" wrote:
>
> do
> prefer
> like
> than
>
>
订阅:
博文 (Atom)