Showing posts with label file. Show all posts
Showing posts with label file. Show all posts

Sunday, March 25, 2012

Bind 2 tables from different database file.

Hi!

I have 2 databases. One is ASPNETDB.MDF and another is PPQ_Data.MDF
ASPNETDB.MDF is generated by ASP.net (VWD 2005) when I use Login control.
PPQ_Data.MDF is created by me. It contains menu and order information of my website.

I would like to connect this 2 databases together so that I can createa GridView table that binds 2 tables, one from ASPNETDB.MDF and anothertable from PPQ_Data.MDF. So, it is kind of displaying nested data.

Is there anybody out there that know how to connect 2 databases together?

Again, my purpose of connecting 2 databases together is to pull out a table from each database and bind the 2 tables together.

thanks in advanced for any advice or articles submitted.

You can use qualified database object name to refer to tables in different databases, and even from different servers (you have to make sure the app can connect to all referenced databse resources). Forexample (I suppose you database name to be c:\ASPNETDB.MDF and c:\PPQ_Data.MDF):

select * from [c:\ASPNETDB.MDF]..table1 , [c:\PPQ_Data.MDF]..table2

For more information, please see this article:

http://msdn.microsoft.com/library/en-us/tsqlref/ts_fa-fz_4ox9.asp?frame=true

|||Ohhw, yeah, thanks for the reply. I almost forget about SQL server online book. thanks!

BinaryWrite

I succesfully uploaded various file into my SQL database. My question is, does anyone know how to retrieve or display these files such as jpg, word document... in VB.netThere are lots of resources on this. Essentially you either stream the data directly to the client or you bounce it off the disk, I prefer the former.

Try this for starters...
http://www.ftponline.com/vsm/2002_07/online/hottips/esposito/

Binary with XML into db using NS/filesystemwatcher?

Have a network share that will routinely get an xml file and a pdf dropped together. The xml file contains metadata about the pdf. Want to insert the various metadata elements in the xml file and the blob'd pdf as a varBinary into a table row as they are dropped.

Would like the Watcher to fire C# code to insert the xml elements and blob the pdf into the table (or can this be set up declaratively?)

Assuming not, best NS architecture to do this?

Thanks, Dan

Sorry, the SQL NS has absolutely nothing to do with this scenario.

Recommendation: use the FileSystemWatcher in a custom Windows Service.

Thursday, March 22, 2012

Binary File

Can someone firecct me to instructions on how to download a Binary file in a asp.net application.

I have a sql 2000 db that has a field that contains files and my users need access to them via my web app.At the end of this article it tells you how to retrieve binary data from the database and then shows you code to actually start the download:

http://www.developer.com/net/asp/article.php/3097661|||That works great thanx.

Binary data into File.

Is there any way to save the image data into one file.... basically I have
one record in a table and I want to save that image data into one separate
file... is that possible ?
What do you mean by file? Are you talking about a database file or a window
file?
Andrew J. Kelly SQL MVP
"msnews.microsoft.com" <Noor> wrote in message
news:%23zXUsBJtFHA.3188@.TK2MSFTNGP14.phx.gbl...
> Is there any way to save the image data into one file.... basically I
> have one record in a table and I want to save that image data into one
> separate file... is that possible ?
>
|||Windows file...
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:utBvIlKtFHA.2756@.TK2MSFTNGP09.phx.gbl...
> What do you mean by file? Are you talking about a database file or a
> window file?
> --
> Andrew J. Kelly SQL MVP
>
> "msnews.microsoft.com" <Noor> wrote in message
> news:%23zXUsBJtFHA.3188@.TK2MSFTNGP14.phx.gbl...
>
|||Have you tried using DTS to export it to a file?
Andrew J. Kelly SQL MVP
"msnews.microsoft.com" <Noor> wrote in message
news:O1no8nKtFHA.464@.TK2MSFTNGP15.phx.gbl...
> Windows file...
> "Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
> news:utBvIlKtFHA.2756@.TK2MSFTNGP09.phx.gbl...
>

Tuesday, March 20, 2012

Bigger log file a database

I have a database, the log file is very long (1 gb)
how to do to reduce the log file?
thank
Check in SEM, to see if your database is in full recovery mode... If so,
Backup the transaction log
ie
Backup log prod to disk="c:\lkjlklj.log" with init
then (until it shrinks) in Query Analyzer
Use prod
go
DBCC Shrinkfile (logfilename, neededsizeinMB)
GO
If the database is in simple recovery mode, just do the shrink
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"alexander" <alexander@.discussions.microsoft.com> wrote in message
news:8B1EF531-933E-4422-90D9-FFC040F2E2CF@.microsoft.com...
> I have a database, the log file is very long (1 gb)
> how to do to reduce the log file?
>
> thank

Bigger log file a database

I have a database, the log file is very long (1 gb)
how to do to reduce the log file'
thankCheck in SEM, to see if your database is in full recovery mode... If so,
Backup the transaction log
ie
Backup log prod to disk="c:\lkjlklj.log" with init
then (until it shrinks) in Query Analyzer
Use prod
go
DBCC Shrinkfile (logfilename, neededsizeinMB)
GO
If the database is in simple recovery mode, just do the shrink
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"alexander" <alexander@.discussions.microsoft.com> wrote in message
news:8B1EF531-933E-4422-90D9-FFC040F2E2CF@.microsoft.com...
> I have a database, the log file is very long (1 gb)
> how to do to reduce the log file'
>
> thank

Big Problem Sql server 2000 database crash

I have a small sql server 2000 database that has never been backed up. The
drive where the main database file resides failed on the server but the
drive where the transaction logs is still good.
Can I recover the database from just the transaction logs? And can you
point me to some documentation on how to do this?
Thank you
JoelYou can't restore any transaction logs without first restoring a full
backup.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
.
"Joel" <nowhere@.nowhere.com> wrote in message
news:%23gyxCqhxGHA.1248@.TK2MSFTNGP02.phx.gbl...
I have a small sql server 2000 database that has never been backed up. The
drive where the main database file resides failed on the server but the
drive where the transaction logs is still good.
Can I recover the database from just the transaction logs? And can you
point me to some documentation on how to do this?
Thank you
Joel|||If I remember correctly, you can't even back up the transaction log
without first backing up the database.
Roy Harvey
Beacon Falls, CT
On Tue, 22 Aug 2006 15:47:31 -0400, "Tom Moreau"
<tom@.dont.spam.me.cips.ca> wrote:

>You can't restore any transaction logs without first restoring a full
>backup.
>--
> Tom
>----
>Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>SQL Server MVP
>Toronto, ON Canada|||Roy Harvey wrote:
> If I remember correctly, you can't even back up the transaction log
> without first backing up the database.
>
And for the OP, the moral of this story is...
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||I know it might be stretching it a bit, but can I recreate a database and
then somehow use the log file to repopulate the database file?
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:OSHYaPixGHA.2260@.TK2MSFTNGP03.phx.gbl...
> You can't restore any transaction logs without first restoring a full
> backup.
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Toronto, ON Canada
> .
> "Joel" <nowhere@.nowhere.com> wrote in message
> news:%23gyxCqhxGHA.1248@.TK2MSFTNGP02.phx.gbl...
> I have a small sql server 2000 database that has never been backed up.
> The
> drive where the main database file resides failed on the server but the
> drive where the transaction logs is still good.
> Can I recover the database from just the transaction logs? And can you
> point me to some documentation on how to do this?
> Thank you
> Joel
>|||The moral is even if it is a semi "test" database back it up.
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:44EB6274.9080507@.realsqlguy.com...
> Roy Harvey wrote:
> And for the OP, the moral of this story is...
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com|||Joel wrote:
> The moral is even if it is a semi "test" database back it up.
>
Bingo!!
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Nope, that's not possible.
Bob
"Joel" wrote:

> I know it might be stretching it a bit, but can I recreate a database and
> then somehow use the log file to repopulate the database file?
> "Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
> news:OSHYaPixGHA.2260@.TK2MSFTNGP03.phx.gbl...
>
>

Big Problem Sql server 2000 database crash

I have a small sql server 2000 database that has never been backed up. The
drive where the main database file resides failed on the server but the
drive where the transaction logs is still good.
Can I recover the database from just the transaction logs? And can you
point me to some documentation on how to do this?
Thank you
JoelYou can't restore any transaction logs without first restoring a full
backup.
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
.
"Joel" <nowhere@.nowhere.com> wrote in message
news:%23gyxCqhxGHA.1248@.TK2MSFTNGP02.phx.gbl...
I have a small sql server 2000 database that has never been backed up. The
drive where the main database file resides failed on the server but the
drive where the transaction logs is still good.
Can I recover the database from just the transaction logs? And can you
point me to some documentation on how to do this?
Thank you
Joel|||If I remember correctly, you can't even back up the transaction log
without first backing up the database.
Roy Harvey
Beacon Falls, CT
On Tue, 22 Aug 2006 15:47:31 -0400, "Tom Moreau"
<tom@.dont.spam.me.cips.ca> wrote:
>You can't restore any transaction logs without first restoring a full
>backup.
>--
> Tom
>----
>Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
>SQL Server MVP
>Toronto, ON Canada|||Roy Harvey wrote:
> If I remember correctly, you can't even back up the transaction log
> without first backing up the database.
>
And for the OP, the moral of this story is...
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||I know it might be stretching it a bit, but can I recreate a database and
then somehow use the log file to repopulate the database file?
"Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
news:OSHYaPixGHA.2260@.TK2MSFTNGP03.phx.gbl...
> You can't restore any transaction logs without first restoring a full
> backup.
> --
> Tom
> ----
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> SQL Server MVP
> Toronto, ON Canada
> .
> "Joel" <nowhere@.nowhere.com> wrote in message
> news:%23gyxCqhxGHA.1248@.TK2MSFTNGP02.phx.gbl...
> I have a small sql server 2000 database that has never been backed up.
> The
> drive where the main database file resides failed on the server but the
> drive where the transaction logs is still good.
> Can I recover the database from just the transaction logs? And can you
> point me to some documentation on how to do this?
> Thank you
> Joel
>|||The moral is even if it is a semi "test" database back it up.
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:44EB6274.9080507@.realsqlguy.com...
> Roy Harvey wrote:
>> If I remember correctly, you can't even back up the transaction log
>> without first backing up the database.
> And for the OP, the moral of this story is...
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com|||Joel wrote:
> The moral is even if it is a semi "test" database back it up.
>
Bingo!!
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Nope, that's not possible.
Bob
"Joel" wrote:
> I know it might be stretching it a bit, but can I recreate a database and
> then somehow use the log file to repopulate the database file?
> "Tom Moreau" <tom@.dont.spam.me.cips.ca> wrote in message
> news:OSHYaPixGHA.2260@.TK2MSFTNGP03.phx.gbl...
> > You can't restore any transaction logs without first restoring a full
> > backup.
> >
> > --
> > Tom
> >
> > ----
> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
> > SQL Server MVP
> > Toronto, ON Canada
> > .
> > "Joel" <nowhere@.nowhere.com> wrote in message
> > news:%23gyxCqhxGHA.1248@.TK2MSFTNGP02.phx.gbl...
> > I have a small sql server 2000 database that has never been backed up.
> > The
> > drive where the main database file resides failed on the server but the
> > drive where the transaction logs is still good.
> >
> > Can I recover the database from just the transaction logs? And can you
> > point me to some documentation on how to do this?
> >
> > Thank you
> >
> > Joel
> >
> >
>
>

Monday, March 19, 2012

Big Log file that won't shrink....

I have a fairly simple DB, One Log file, one data file, its got half a dozen tables in it that are used for a web based app that allows users to look each other up (think online telephone directory with a few extra bits and you are there), there's a data feed that adds new lines each day as users data changes or new people get added. But this is a couple of hundred or so lines a day, the tables hold about 40,000 data lines as we never delete data just retire it.

The problem is the main data file is about 200Mb, the Log file however is 3.8Gb. Now we did import and re-import various bits initially and clear down tables and such. But I don't understand why i can't shrink the log file. I've tried everything I can think of. I've even detached and re-attached the DB. Still no joy.

The file size/usage is

data file 200Mb size in use 117Mb

log file 3749.99Mb size in use 3719.89Mb

Anyone have any suggestions for things to look at?

many thanks

Steve

Hi,

look here:

http://www.aspfaq.com/show.asp?id=2471

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

Big log file in backup

I have backup of database which have log file (LDF file) big around 7GB. At
the moment it seem that I don't have enough space to restore it, Is it
possible that I some hove restore only MDF file or reduce size of LDF in
backup?
Johny
If you don't 'need' the LOG file , you can detach the database , remove the
log file and attach the database with the option as single file (only .mdf)
I'd recommed you to start perfoming BACKUP LOG file on regular period of
time so you will be able to manage the size of the log as well as having a
posibility to restore the data at point of time .
"Johny" <goky2002@.beograd.com> wrote in message
news:%23VoAafBMGHA.532@.TK2MSFTNGP15.phx.gbl...
>I have backup of database which have log file (LDF file) big around 7GB. At
> the moment it seem that I don't have enough space to restore it, Is it
> possible that I some hove restore only MDF file or reduce size of LDF in
> backup?
>

Big log file in backup

I have backup of database which have log file (LDF file) big around 7GB. At
the moment it seem that I don't have enough space to restore it, Is it
possible that I some hove restore only MDF file or reduce size of LDF in
backup?Johny
If you don't 'need' the LOG file , you can detach the database , remove the
log file and attach the database with the option as single file (only .mdf)
I'd recommed you to start perfoming BACKUP LOG file on regular period of
time so you will be able to manage the size of the log as well as having a
posibility to restore the data at point of time .
"Johny" <goky2002@.beograd.com> wrote in message
news:%23VoAafBMGHA.532@.TK2MSFTNGP15.phx.gbl...
>I have backup of database which have log file (LDF file) big around 7GB. At
> the moment it seem that I don't have enough space to restore it, Is it
> possible that I some hove restore only MDF file or reduce size of LDF in
> backup?
>

Big log file in backup

I have backup of database which have log file (LDF file) big around 7GB. At
the moment it seem that I don't have enough space to restore it, Is it
possible that I some hove restore only MDF file or reduce size of LDF in
backup?Johny
If you don't 'need' the LOG file , you can detach the database , remove the
log file and attach the database with the option as single file (only .mdf)
I'd recommed you to start perfoming BACKUP LOG file on regular period of
time so you will be able to manage the size of the log as well as having a
posibility to restore the data at point of time .
"Johny" <goky2002@.beograd.com> wrote in message
news:%23VoAafBMGHA.532@.TK2MSFTNGP15.phx.gbl...
>I have backup of database which have log file (LDF file) big around 7GB. At
> the moment it seem that I don't have enough space to restore it, Is it
> possible that I some hove restore only MDF file or reduce size of LDF in
> backup?
>

Big Log File Help

hi All
in my database The log File Is to Big How can i Trancate
or deleted Pelase Help me
use SQL2000The log is truncated when you back it up. If you don't want to do log
backups then run under the Simple Recovery model and just shrink the
log file as required.
More information:
http://www.aspfaq.com/show.asp?id=2471
David Portas
SQL Server MVP
--

big log file

Hello:
I have a db with 2 data files and 2 log file, but one log files is about
9GB, I would like first reduce the db to only one pair of file, one data and
one log and second reduce the size of log about 1gb or 2. how can I do that?
Best regards,
Owen.Firstly to remove 1 of the log files use
DBCC SHRINKFILE with the EMPTYFILE option.
Then ALTER DATABASE to remove it.
As for shrinking the other log, there are numerous articles on this, here a
few...
http://www.support.microsoft.com/?id=256650 INF: How to Shrink the SQL
Server 7.0 Tran Log
http://www.support.microsoft.com/?id=317375 Log File Grows too big
http://www.support.microsoft.com/?id=110139 Log file filling up
http://www.mssqlserver.com/faq/logs-shrinklog.asp Shrink File
http://www.support.microsoft.com/?id=315512 Considerations for Autogrow
and AutoShrink
http://www.support.microsoft.com/?id=272318 INF: Shrinking Log in SQL
Server 2000 with DBCC SHRINKFILE
http://www.support.microsoft.com/?id=317375 Log File Grows too big
http://www.support.microsoft.com/?id=110139 Log file filling up
http://www.mssqlserver.com/faq/logs-shrinklog.asp Shrink File
http://www.support.microsoft.com/?id=315512 Considerations for Autogrow
and AutoShrink
HTH. Ryan
"Owen" <anibal@.prensa-latina.cu> wrote in message
news:O0nvZdRHGHA.1424@.TK2MSFTNGP12.phx.gbl...
> Hello:
> I have a db with 2 data files and 2 log file, but one log files is about
> 9GB, I would like first reduce the db to only one pair of file, one data
> and
> one log and second reduce the size of log about 1gb or 2. how can I do
> that?
> Best regards,
> Owen.
>

BIG LDF file size

How to check for LDF file size I.e. my database ldf size is 10 times the
size of mdf. is it ok. For having smaller ldf do i need to check for some sp
or tune sps and other DTS packages.
I am using JOB which execute 10 DTS once daily...ldf file growing many times bigger than mdf is fine...
But if you want to limit the ldf's from growing beyond, you need to
take regular transaction log backups.
If you want to shrink ldf file and release the space back to OS, then
you can even do SHRINKFILE|||Vikram wrote:
> How to check for LDF file size I.e. my database ldf size is 10 times the
> size of mdf. is it ok. For having smaller ldf do i need to check for some
sp
> or tune sps and other DTS packages.
> I am using JOB which execute 10 DTS once daily...
>
It's not very likely that your logfile needs to be 10 times your
datafile, so you might have to backup your logfile.
If your database are in FULL recovery mode, you should make sure that
you run logfile backups regularly so the logfile get truncated and you
can reuse the space in the file.
If your database are in Simple recovery mode, you can't backup the log
and it will be truncated automatically, but then it might be that you
simply need such a big logfile.
Executing 10 DTS jobs daily doesn't tell a lot since you don't tell what
they actually do.
If you find that you have a lot of unused space in your logfile (e.g. if
you've never ran a logfile backup and then starts to do it) you can
shrink the file to a more appropriate size by running DBCC SHRINKFILE.
You can check how much space is used in the logfile by running DBCC
SQLPERF ( LOGSPACE ) or by using Enterprise Manager.
Regards
Steen

BIG LDF file size

How to check for LDF file size I.e. my database ldf size is 10 times the
size of mdf. is it ok. For having smaller ldf do i need to check for some sp
or tune sps and other DTS packages.
I am using JOB which execute 10 DTS once daily...
ldf file growing many times bigger than mdf is fine...
But if you want to limit the ldf's from growing beyond, you need to
take regular transaction log backups.
If you want to shrink ldf file and release the space back to OS, then
you can even do SHRINKFILE
|||Vikram wrote:
> How to check for LDF file size I.e. my database ldf size is 10 times the
> size of mdf. is it ok. For having smaller ldf do i need to check for some sp
> or tune sps and other DTS packages.
> I am using JOB which execute 10 DTS once daily...
>
It's not very likely that your logfile needs to be 10 times your
datafile, so you might have to backup your logfile.
If your database are in FULL recovery mode, you should make sure that
you run logfile backups regularly so the logfile get truncated and you
can reuse the space in the file.
If your database are in Simple recovery mode, you can't backup the log
and it will be truncated automatically, but then it might be that you
simply need such a big logfile.
Executing 10 DTS jobs daily doesn't tell a lot since you don't tell what
they actually do.
If you find that you have a lot of unused space in your logfile (e.g. if
you've never ran a logfile backup and then starts to do it) you can
shrink the file to a more appropriate size by running DBCC SHRINKFILE.
You can check how much space is used in the logfile by running DBCC
SQLPERF ( LOGSPACE ) or by using Enterprise Manager.

Regards
Steen

BIG LDF file size

How to check for LDF file size I.e. my database ldf size is 10 times the
size of mdf. is it ok. For having smaller ldf do i need to check for some sp
or tune sps and other DTS packages.
I am using JOB which execute 10 DTS once daily...ldf file growing many times bigger than mdf is fine...
But if you want to limit the ldf's from growing beyond, you need to
take regular transaction log backups.
If you want to shrink ldf file and release the space back to OS, then
you can even do SHRINKFILE|||Vikram wrote:
> How to check for LDF file size I.e. my database ldf size is 10 times the
> size of mdf. is it ok. For having smaller ldf do i need to check for some sp
> or tune sps and other DTS packages.
> I am using JOB which execute 10 DTS once daily...
>
It's not very likely that your logfile needs to be 10 times your
datafile, so you might have to backup your logfile.
If your database are in FULL recovery mode, you should make sure that
you run logfile backups regularly so the logfile get truncated and you
can reuse the space in the file.
If your database are in Simple recovery mode, you can't backup the log
and it will be truncated automatically, but then it might be that you
simply need such a big logfile.
Executing 10 DTS jobs daily doesn't tell a lot since you don't tell what
they actually do.
If you find that you have a lot of unused space in your logfile (e.g. if
you've never ran a logfile backup and then starts to do it) you can
shrink the file to a more appropriate size by running DBCC SHRINKFILE.
You can check how much space is used in the logfile by running DBCC
SQLPERF ( LOGSPACE ) or by using Enterprise Manager.
Regards
Steen

Big Database needs pruning

I have a big sql database running on sql server 2000. The manager wasn't
watching the file sizes and the db made it up to 144 gig and the log is up
to 80 gig. We have been working on pruning this pig but it just has
completely consumed the disk. My expertise is not SQL, but I am the guy for
this issue.
So I am in a quandary. A Delete statement was run to prune the db down, but
that just caused the tlog to chew up the disk space that was left on the
disk. So things got slow so we ended up restarting the sql service and
figure the Checkpoint piece is running in the background rebuilding the
pointers.
Question #1)
Is there a way to determine if Checkpointing is going on rebuilding the
pointers,etc... ? Reason for the curiosity is that Enterprise Manager (EM)
won't respond right now. I can manage the DB's (except for the DB pig) via
SQL Analyzer. It is amazing how quick you can learn tsql when you gotta
keep things up and running.
Question #2)
If/When I get control back I want to chuck the Log via
a) sp_detach_db
b) Delete the Log file
c) sp_attach_single_file_db
Will this work?
Question #3)
There are months and months of data that is easily purgable by date but I
want to avoid making the log file large and clogging up the system again.
Can I use a statement like
Delete from tableA where date_time between '2006-10-01 00:00:00' and
'2006-10-14 23:59:59'
I am unsure how the SQL server will handle this statement. If there are
only 5% of the records in the DB that match this query will the log file
only grow by that amount? I assume it must for backout purposes.
--
Thanks for any help
Paul"Paul Bergson [MVP-DS]" <pbergson@.allete_nospam.com> wrote in message
news:OD3Vvd8dHHA.2128@.TK2MSFTNGP04.phx.gbl...
>I have a big sql database running on sql server 2000. The manager wasn't
>watching the file sizes and the db made it up to 144 gig and the log is up
>to 80 gig. We have been working on pruning this pig but it just has
>completely consumed the disk. My expertise is not SQL, but I am the guy
>for this issue.
> So I am in a quandary. A Delete statement was run to prune the db down,
> but that just caused the tlog to chew up the disk space that was left on
> the disk. So things got slow so we ended up restarting the sql service
> and figure the Checkpoint piece is running in the background rebuilding
> the pointers.
> Question #1)
> Is there a way to determine if Checkpointing is going on rebuilding the
> pointers,etc... ? Reason for the curiosity is that Enterprise Manager
> (EM) won't respond right now. I can manage the DB's (except for the DB
> pig) via SQL Analyzer. It is amazing how quick you can learn tsql when
> you gotta keep things up and running.
> Question #2)
> If/When I get control back I want to chuck the Log via
> a) sp_detach_db
> b) Delete the Log file
> c) sp_attach_single_file_db
> Will this work?
>
> Question #3)
> There are months and months of data that is easily purgable by date but I
> want to avoid making the log file large and clogging up the system again.
> Can I use a statement like
> Delete from tableA where date_time between '2006-10-01 00:00:00' and
> '2006-10-14 23:59:59'
> I am unsure how the SQL server will handle this statement. If there are
> only 5% of the records in the DB that match this query will the log file
> only grow by that amount? I assume it must for backout purposes.
> --
I've always used the following statements to shrink big logs.
backup log DBName with truncate_only
go
use DBName
go
dbcc shrinkfile(2, 100, TRUNCATEONLY)
go
You should also look into backing up the log file on a regular basis or
changing to the Simple recovery model if your model allows it.|||This really isn't providing any answers to my questions. Do you know about
the Checkpoint, etc...?
--
Paul Bergson
MVP - Directory Services
MCT, MCSE, MCSA, Security+, BS CSci
2003, 2000 (Early Achiever), NT
http://www.pbbergs.com
Please no e-mails, any questions should be posted in the NewsGroup
This posting is provided "AS IS" with no warranties, and confers no rights.
"Isaac Alexander" <isaacNOSPAM@.goNOSPAMprocura.com> wrote in message
news:efbR2j8dHHA.2316@.TK2MSFTNGP04.phx.gbl...
> "Paul Bergson [MVP-DS]" <pbergson@.allete_nospam.com> wrote in message
> news:OD3Vvd8dHHA.2128@.TK2MSFTNGP04.phx.gbl...
>>I have a big sql database running on sql server 2000. The manager wasn't
>>watching the file sizes and the db made it up to 144 gig and the log is up
>>to 80 gig. We have been working on pruning this pig but it just has
>>completely consumed the disk. My expertise is not SQL, but I am the guy
>>for this issue.
>> So I am in a quandary. A Delete statement was run to prune the db down,
>> but that just caused the tlog to chew up the disk space that was left on
>> the disk. So things got slow so we ended up restarting the sql service
>> and figure the Checkpoint piece is running in the background rebuilding
>> the pointers.
>> Question #1)
>> Is there a way to determine if Checkpointing is going on rebuilding the
>> pointers,etc... ? Reason for the curiosity is that Enterprise Manager
>> (EM) won't respond right now. I can manage the DB's (except for the DB
>> pig) via SQL Analyzer. It is amazing how quick you can learn tsql when
>> you gotta keep things up and running.
>> Question #2)
>> If/When I get control back I want to chuck the Log via
>> a) sp_detach_db
>> b) Delete the Log file
>> c) sp_attach_single_file_db
>> Will this work?
>>
>> Question #3)
>> There are months and months of data that is easily purgable by date but I
>> want to avoid making the log file large and clogging up the system again.
>> Can I use a statement like
>> Delete from tableA where date_time between '2006-10-01 00:00:00' and
>> '2006-10-14 23:59:59'
>> I am unsure how the SQL server will handle this statement. If there are
>> only 5% of the records in the DB that match this query will the log file
>> only grow by that amount? I assume it must for backout purposes.
>> --
> I've always used the following statements to shrink big logs.
> backup log DBName with truncate_only
> go
> use DBName
> go
> dbcc shrinkfile(2, 100, TRUNCATEONLY)
> go
> You should also look into backing up the log file on a regular basis or
> changing to the Simple recovery model if your model allows it.
>|||"Paul Bergson [MVP-DS]" <pbergson@.allete_nospam.com> wrote in message
news:OD3Vvd8dHHA.2128@.TK2MSFTNGP04.phx.gbl...
>I have a big sql database running on sql server 2000. The manager wasn't
>watching the file sizes and the db made it up to 144 gig and the log is up
>to 80 gig. We have been working on pruning this pig but it just has
>completely consumed the disk. My expertise is not SQL, but I am the guy
>for this issue.
> So I am in a quandary. A Delete statement was run to prune the db down,
> but that just caused the tlog to chew up the disk space that was left on
> the disk. So things got slow so we ended up restarting the sql service
> and figure the Checkpoint piece is running in the background rebuilding
> the pointers.
> Question #1)
> Is there a way to determine if Checkpointing is going on rebuilding the
> pointers,etc... ? Reason for the curiosity is that Enterprise Manager
> (EM) won't respond right now. I can manage the DB's (except for the DB
> pig) via SQL Analyzer. It is amazing how quick you can learn tsql when
> you gotta keep things up and running.
> Question #2)
> If/When I get control back I want to chuck the Log via
> a) sp_detach_db
> b) Delete the Log file
> c) sp_attach_single_file_db
> Will this work?
>
> Question #3)
> There are months and months of data that is easily purgable by date but I
> want to avoid making the log file large and clogging up the system again.
> Can I use a statement like
> Delete from tableA where date_time between '2006-10-01 00:00:00' and
> '2006-10-14 23:59:59'
> I am unsure how the SQL server will handle this statement. If there are
> only 5% of the records in the DB that match this query will the log file
> only grow by that amount? I assume it must for backout purposes.
> --
> Thanks for any help
> Paul
>|||"Paul Bergson [MVP-DS]" <pbergson@.allete_nospam.com> wrote in message
news:OD3Vvd8dHHA.2128@.TK2MSFTNGP04.phx.gbl...
>I have a big sql database running on sql server 2000. The manager wasn't
>watching the file sizes and the db made it up to 144 gig and the log is up
>to 80 gig. We have been working on pruning this pig but it just has
>completely consumed the disk. My expertise is not SQL, but I am the guy
>for this issue.
> So I am in a quandary. A Delete statement was run to prune the db down,
> but that just caused the tlog to chew up the disk space that was left on
> the disk. So things got slow so we ended up restarting the sql service
> and figure the Checkpoint piece is running in the background rebuilding
> the pointers.
> Question #1)
> Is there a way to determine if Checkpointing is going on rebuilding the
> pointers,etc... ? Reason for the curiosity is that Enterprise Manager
> (EM) won't respond right now. I can manage the DB's (except for the DB
> pig) via SQL Analyzer. It is amazing how quick you can learn tsql when
> you gotta keep things up and running.
Check the SQL Error log, but my guess is that DB is still in recovery mode.
(sorry, I don't recall off the top of my head the command to get this via
QA.
I THINK
select * from master.dbo.sysdatabases w
will give the info, but I don't recall which status you need to look for.
> Question #2)
> If/When I get control back I want to chuck the Log via
> a) sp_detach_db
> b) Delete the Log file
> c) sp_attach_single_file_db
> Will this work?
It MIGHT. But don't do that. It's one of those, "99% of the time it'll
work.. and 1% you're hosed.)
You may want to do an actual transaction log backup (especially if up to now
you have a consistent chain of backups.)
Otherwise, do a backup log PigDB with truncate_only
Then DBCC shrinkfile on the DB log.
>
> Question #3)
> There are months and months of data that is easily purgable by date but I
> want to avoid making the log file large and clogging up the system again.
> Can I use a statement like
> Delete from tableA where date_time between '2006-10-01 00:00:00' and
> '2006-10-14 23:59:59'
>
Certainly.
You can even do this in a loop with a SET ROWCOUNT and do backups of the log
in between.
> I am unsure how the SQL server will handle this statement. If there are
> only 5% of the records in the DB that match this query will the log file
> only grow by that amount? I assume it must for backout purposes.
Unfortunately, off the top of my head, I'm not 100% sure how to calculate
this (there are ways) but I'd start with that assumption.
Hope this helps.
> --
> Thanks for any help
> Paul
>
--
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html|||I can't believe I didn't think to look in the logs, duh... Only 72 hours to
go, what a stinking pig
I have a follow up but it refers to code pruning it self. I will repost
Paul
http://www.pbbergs.com
Please no e-mails, any questions should be posted in the NewsGroup
This posting is provided "AS IS" with no warranties, and confers no rights.
"Greg D. Moore (Strider)" <mooregr_deleteth1s@.greenms.com> wrote in message
news:%23RdOZD9dHHA.1240@.TK2MSFTNGP04.phx.gbl...
>
> "Paul Bergson [MVP-DS]" <pbergson@.allete_nospam.com> wrote in message
> news:OD3Vvd8dHHA.2128@.TK2MSFTNGP04.phx.gbl...
>>I have a big sql database running on sql server 2000. The manager wasn't
>>watching the file sizes and the db made it up to 144 gig and the log is up
>>to 80 gig. We have been working on pruning this pig but it just has
>>completely consumed the disk. My expertise is not SQL, but I am the guy
>>for this issue.
>> So I am in a quandary. A Delete statement was run to prune the db down,
>> but that just caused the tlog to chew up the disk space that was left on
>> the disk. So things got slow so we ended up restarting the sql service
>> and figure the Checkpoint piece is running in the background rebuilding
>> the pointers.
>> Question #1)
>> Is there a way to determine if Checkpointing is going on rebuilding the
>> pointers,etc... ? Reason for the curiosity is that Enterprise Manager
>> (EM) won't respond right now. I can manage the DB's (except for the DB
>> pig) via SQL Analyzer. It is amazing how quick you can learn tsql when
>> you gotta keep things up and running.
> Check the SQL Error log, but my guess is that DB is still in recovery
> mode.
> (sorry, I don't recall off the top of my head the command to get this via
> QA.
> I THINK
> select * from master.dbo.sysdatabases w
> will give the info, but I don't recall which status you need to look for.
>
>> Question #2)
>> If/When I get control back I want to chuck the Log via
>> a) sp_detach_db
>> b) Delete the Log file
>> c) sp_attach_single_file_db
>> Will this work?
> It MIGHT. But don't do that. It's one of those, "99% of the time it'll
> work.. and 1% you're hosed.)
> You may want to do an actual transaction log backup (especially if up to
> now you have a consistent chain of backups.)
> Otherwise, do a backup log PigDB with truncate_only
> Then DBCC shrinkfile on the DB log.
>>
>> Question #3)
>> There are months and months of data that is easily purgable by date but I
>> want to avoid making the log file large and clogging up the system again.
>> Can I use a statement like
>> Delete from tableA where date_time between '2006-10-01 00:00:00' and
>> '2006-10-14 23:59:59'
> Certainly.
> You can even do this in a loop with a SET ROWCOUNT and do backups of the
> log in between.
>
>> I am unsure how the SQL server will handle this statement. If there are
>> only 5% of the records in the DB that match this query will the log file
>> only grow by that amount? I assume it must for backout purposes.
> Unfortunately, off the top of my head, I'm not 100% sure how to calculate
> this (there are ways) but I'd start with that assumption.
>
> Hope this helps.
>
>> --
>> Thanks for any help
>> Paul
> --
> Greg Moore
> SQL Server DBA Consulting Remote and Onsite available!
> Email: sql (at) greenms.com
> http://www.greenms.com/sqlserver.html
>|||Paul Bergson [MVP-DS] wrote:
> I have a big sql database running on sql server 2000. The manager wasn't
> watching the file sizes and the db made it up to 144 gig and the log is up
> to 80 gig. We have been working on pruning this pig but it just has
> completely consumed the disk. My expertise is not SQL, but I am the guy for
> this issue.
> So I am in a quandary. A Delete statement was run to prune the db down, but
> that just caused the tlog to chew up the disk space that was left on the
> disk. So things got slow so we ended up restarting the sql service and
> figure the Checkpoint piece is running in the background rebuilding the
> pointers.
> Question #1)
> Is there a way to determine if Checkpointing is going on rebuilding the
> pointers,etc... ? Reason for the curiosity is that Enterprise Manager (EM)
> won't respond right now. I can manage the DB's (except for the DB pig) via
> SQL Analyzer. It is amazing how quick you can learn tsql when you gotta
> keep things up and running.
From Books Online
Table master..sysdatabases:
Field [status]:
=====Status bits, some of which can be set by the user with sp_dboption (read
only, dbo use only, single user, and so on):
1 = autoclose; set with sp_dboption.
4 = select into/bulkcopy; set with sp_dboption.
8 = trunc. log on chkpt; set with sp_dboption.
16 = torn page detection, set with sp_dboption.
32 = loading.
64 = pre recovery.
128 = recovering.
256 = not recovered.
512 = offline; set with sp_dboption.
1024 = read only; set with sp_dboption.
2048 = dbo use only; set with sp_dboption.
4096 = single user; set with sp_dboption.
32768 = emergency mode.
4194304 = autoshrink.
1073741824 = cleanly shutdown.
Multiple bits can be on at the same time.
=========field [status2]:
16384 = ANSI null default; set with sp_dboption.
65536 = concat null yields null , set with sp_dboption.
131072 = recursive triggers, set with sp_dboption.
1048576 = default to local cursor, set with sp_dboption.
8388608 = quoted identifier, set with
sp_dboption.
33554432 = cursor close on commit, set with sp_dboption.
67108864 = ANSI nulls, set with sp_dboption.
268435456 = ANSI warnings, set with sp_dboption.
536870912 = full text enabled, set with sp_fulltext_database.
> Question #2)
> If/When I get control back I want to chuck the Log via
> a) sp_detach_db
> b) Delete the Log file
> c) sp_attach_single_file_db
> Will this work?
You better do the following:
backup log <dbname> with no_log
dbcc shrinkdatabase('<dbname>',TRUNCATEONLY)
> Question #3)
> There are months and months of data that is easily purgable by date but I
> want to avoid making the log file large and clogging up the system again.
> Can I use a statement like
> Delete from tableA where date_time between '2006-10-01 00:00:00' and
> '2006-10-14 23:59:59'
Yes
> I am unsure how the SQL server will handle this statement. If there are
> only 5% of the records in the DB that match this query will the log file
> only grow by that amount? I assume it must for backout purposes.|||"Paul Bergson [MVP-DS]" <pbergson@.allete_nospam.com> wrote in message
news:OSMpANFeHHA.1244@.TK2MSFTNGP04.phx.gbl...
>I can't believe I didn't think to look in the logs, duh... Only 72 hours
>to go, what a stinking pig
>
Yeah, I've done the same thing regarding forgetting ;-)
> I have a follow up but it refers to code pruning it self. I will repost
>
--
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html

Big Database needs pruning

I have a big sql database running on sql server 2000. The manager wasn't
watching the file sizes and the db made it up to 144 gig and the log is up
to 80 gig. We have been working on pruning this pig but it just has
completely consumed the disk. My expertise is not SQL, but I am the guy for
this issue.
So I am in a quandary. A Delete statement was run to prune the db down, but
that just caused the tlog to chew up the disk space that was left on the
disk. So things got slow so we ended up restarting the sql service and
figure the Checkpoint piece is running in the background rebuilding the
pointers.
Question #1)
Is there a way to determine if Checkpointing is going on rebuilding the
pointers,etc... ? Reason for the curiosity is that Enterprise Manager (EM)
won't respond right now. I can manage the DB's (except for the DB pig) via
SQL Analyzer. It is amazing how quick you can learn tsql when you gotta
keep things up and running.
Question #2)
If/When I get control back I want to chuck the Log via
a) sp_detach_db
b) Delete the Log file
c) sp_attach_single_file_db
Will this work?
Question #3)
There are months and months of data that is easily purgable by date but I
want to avoid making the log file large and clogging up the system again.
Can I use a statement like
Delete from tableA where date_time between '2006-10-01 00:00:00' and
'2006-10-14 23:59:59'
I am unsure how the SQL server will handle this statement. If there are
only 5% of the records in the DB that match this query will the log file
only grow by that amount? I assume it must for backout purposes.
Thanks for any help
Paul
"Paul Bergson [MVP-DS]" <pbergson@.allete_nospam.com> wrote in message
news:OD3Vvd8dHHA.2128@.TK2MSFTNGP04.phx.gbl...
>I have a big sql database running on sql server 2000. The manager wasn't
>watching the file sizes and the db made it up to 144 gig and the log is up
>to 80 gig. We have been working on pruning this pig but it just has
>completely consumed the disk. My expertise is not SQL, but I am the guy
>for this issue.
> So I am in a quandary. A Delete statement was run to prune the db down,
> but that just caused the tlog to chew up the disk space that was left on
> the disk. So things got slow so we ended up restarting the sql service
> and figure the Checkpoint piece is running in the background rebuilding
> the pointers.
> Question #1)
> Is there a way to determine if Checkpointing is going on rebuilding the
> pointers,etc... ? Reason for the curiosity is that Enterprise Manager
> (EM) won't respond right now. I can manage the DB's (except for the DB
> pig) via SQL Analyzer. It is amazing how quick you can learn tsql when
> you gotta keep things up and running.
> Question #2)
> If/When I get control back I want to chuck the Log via
> a) sp_detach_db
> b) Delete the Log file
> c) sp_attach_single_file_db
> Will this work?
>
> Question #3)
> There are months and months of data that is easily purgable by date but I
> want to avoid making the log file large and clogging up the system again.
> Can I use a statement like
> Delete from tableA where date_time between '2006-10-01 00:00:00' and
> '2006-10-14 23:59:59'
> I am unsure how the SQL server will handle this statement. If there are
> only 5% of the records in the DB that match this query will the log file
> only grow by that amount? I assume it must for backout purposes.
> --
I've always used the following statements to shrink big logs.
backup log DBName with truncate_only
go
use DBName
go
dbcc shrinkfile(2, 100, TRUNCATEONLY)
go
You should also look into backing up the log file on a regular basis or
changing to the Simple recovery model if your model allows it.
|||This really isn't providing any answers to my questions. Do you know about
the Checkpoint, etc...?
Paul Bergson
MVP - Directory Services
MCT, MCSE, MCSA, Security+, BS CSci
2003, 2000 (Early Achiever), NT
http://www.pbbergs.com
Please no e-mails, any questions should be posted in the NewsGroup
This posting is provided "AS IS" with no warranties, and confers no rights.
"Isaac Alexander" <isaacNOSPAM@.goNOSPAMprocura.com> wrote in message
news:efbR2j8dHHA.2316@.TK2MSFTNGP04.phx.gbl...
> "Paul Bergson [MVP-DS]" <pbergson@.allete_nospam.com> wrote in message
> news:OD3Vvd8dHHA.2128@.TK2MSFTNGP04.phx.gbl...
> I've always used the following statements to shrink big logs.
> backup log DBName with truncate_only
> go
> use DBName
> go
> dbcc shrinkfile(2, 100, TRUNCATEONLY)
> go
> You should also look into backing up the log file on a regular basis or
> changing to the Simple recovery model if your model allows it.
>
|||"Paul Bergson [MVP-DS]" <pbergson@.allete_nospam.com> wrote in message
news:OD3Vvd8dHHA.2128@.TK2MSFTNGP04.phx.gbl...
>I have a big sql database running on sql server 2000. The manager wasn't
>watching the file sizes and the db made it up to 144 gig and the log is up
>to 80 gig. We have been working on pruning this pig but it just has
>completely consumed the disk. My expertise is not SQL, but I am the guy
>for this issue.
> So I am in a quandary. A Delete statement was run to prune the db down,
> but that just caused the tlog to chew up the disk space that was left on
> the disk. So things got slow so we ended up restarting the sql service
> and figure the Checkpoint piece is running in the background rebuilding
> the pointers.
> Question #1)
> Is there a way to determine if Checkpointing is going on rebuilding the
> pointers,etc... ? Reason for the curiosity is that Enterprise Manager
> (EM) won't respond right now. I can manage the DB's (except for the DB
> pig) via SQL Analyzer. It is amazing how quick you can learn tsql when
> you gotta keep things up and running.
> Question #2)
> If/When I get control back I want to chuck the Log via
> a) sp_detach_db
> b) Delete the Log file
> c) sp_attach_single_file_db
> Will this work?
>
> Question #3)
> There are months and months of data that is easily purgable by date but I
> want to avoid making the log file large and clogging up the system again.
> Can I use a statement like
> Delete from tableA where date_time between '2006-10-01 00:00:00' and
> '2006-10-14 23:59:59'
> I am unsure how the SQL server will handle this statement. If there are
> only 5% of the records in the DB that match this query will the log file
> only grow by that amount? I assume it must for backout purposes.
> --
> Thanks for any help
> Paul
>
|||"Paul Bergson [MVP-DS]" <pbergson@.allete_nospam.com> wrote in message
news:OD3Vvd8dHHA.2128@.TK2MSFTNGP04.phx.gbl...
>I have a big sql database running on sql server 2000. The manager wasn't
>watching the file sizes and the db made it up to 144 gig and the log is up
>to 80 gig. We have been working on pruning this pig but it just has
>completely consumed the disk. My expertise is not SQL, but I am the guy
>for this issue.
> So I am in a quandary. A Delete statement was run to prune the db down,
> but that just caused the tlog to chew up the disk space that was left on
> the disk. So things got slow so we ended up restarting the sql service
> and figure the Checkpoint piece is running in the background rebuilding
> the pointers.
> Question #1)
> Is there a way to determine if Checkpointing is going on rebuilding the
> pointers,etc... ? Reason for the curiosity is that Enterprise Manager
> (EM) won't respond right now. I can manage the DB's (except for the DB
> pig) via SQL Analyzer. It is amazing how quick you can learn tsql when
> you gotta keep things up and running.
Check the SQL Error log, but my guess is that DB is still in recovery mode.
(sorry, I don't recall off the top of my head the command to get this via
QA.
I THINK
select * from master.dbo.sysdatabases w
will give the info, but I don't recall which status you need to look for.

> Question #2)
> If/When I get control back I want to chuck the Log via
> a) sp_detach_db
> b) Delete the Log file
> c) sp_attach_single_file_db
> Will this work?
It MIGHT. But don't do that. It's one of those, "99% of the time it'll
work.. and 1% you're hosed.)
You may want to do an actual transaction log backup (especially if up to now
you have a consistent chain of backups.)
Otherwise, do a backup log PigDB with truncate_only
Then DBCC shrinkfile on the DB log.
>
> Question #3)
> There are months and months of data that is easily purgable by date but I
> want to avoid making the log file large and clogging up the system again.
> Can I use a statement like
> Delete from tableA where date_time between '2006-10-01 00:00:00' and
> '2006-10-14 23:59:59'
>
Certainly.
You can even do this in a loop with a SET ROWCOUNT and do backups of the log
in between.

> I am unsure how the SQL server will handle this statement. If there are
> only 5% of the records in the DB that match this query will the log file
> only grow by that amount? I assume it must for backout purposes.
Unfortunately, off the top of my head, I'm not 100% sure how to calculate
this (there are ways) but I'd start with that assumption.
Hope this helps.

> --
> Thanks for any help
> Paul
>
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html
|||I can't believe I didn't think to look in the logs, duh... Only 72 hours to
go, what a stinking pig
I have a follow up but it refers to code pruning it self. I will repost

Paul
http://www.pbbergs.com
Please no e-mails, any questions should be posted in the NewsGroup
This posting is provided "AS IS" with no warranties, and confers no rights.
"Greg D. Moore (Strider)" <mooregr_deleteth1s@.greenms.com> wrote in message
news:%23RdOZD9dHHA.1240@.TK2MSFTNGP04.phx.gbl...
>
> "Paul Bergson [MVP-DS]" <pbergson@.allete_nospam.com> wrote in message
> news:OD3Vvd8dHHA.2128@.TK2MSFTNGP04.phx.gbl...
> Check the SQL Error log, but my guess is that DB is still in recovery
> mode.
> (sorry, I don't recall off the top of my head the command to get this via
> QA.
> I THINK
> select * from master.dbo.sysdatabases w
> will give the info, but I don't recall which status you need to look for.
>
> It MIGHT. But don't do that. It's one of those, "99% of the time it'll
> work.. and 1% you're hosed.)
> You may want to do an actual transaction log backup (especially if up to
> now you have a consistent chain of backups.)
> Otherwise, do a backup log PigDB with truncate_only
> Then DBCC shrinkfile on the DB log.
> Certainly.
> You can even do this in a loop with a SET ROWCOUNT and do backups of the
> log in between.
>
> Unfortunately, off the top of my head, I'm not 100% sure how to calculate
> this (there are ways) but I'd start with that assumption.
>
> Hope this helps.
>
> --
> Greg Moore
> SQL Server DBA Consulting Remote and Onsite available!
> Email: sql (at) greenms.com
> http://www.greenms.com/sqlserver.html
>
|||Paul Bergson [MVP-DS] wrote:
> I have a big sql database running on sql server 2000. The manager wasn't
> watching the file sizes and the db made it up to 144 gig and the log is up
> to 80 gig. We have been working on pruning this pig but it just has
> completely consumed the disk. My expertise is not SQL, but I am the guy for
> this issue.
> So I am in a quandary. A Delete statement was run to prune the db down, but
> that just caused the tlog to chew up the disk space that was left on the
> disk. So things got slow so we ended up restarting the sql service and
> figure the Checkpoint piece is running in the background rebuilding the
> pointers.
> Question #1)
> Is there a way to determine if Checkpointing is going on rebuilding the
> pointers,etc... ? Reason for the curiosity is that Enterprise Manager (EM)
> won't respond right now. I can manage the DB's (except for the DB pig) via
> SQL Analyzer. It is amazing how quick you can learn tsql when you gotta
> keep things up and running.
From Books Online
Table master..sysdatabases:
Field [status]:
=====
Status bits, some of which can be set by the user with sp_dboption (read
only, dbo use only, single user, and so on):
1 = autoclose; set with sp_dboption.
4 = select into/bulkcopy; set with sp_dboption.
8 = trunc. log on chkpt; set with sp_dboption.
16 = torn page detection, set with sp_dboption.
32 = loading.
64 = pre recovery.
128 = recovering.
256 = not recovered.
512 = offline; set with sp_dboption.
1024 = read only; set with sp_dboption.
2048 = dbo use only; set with sp_dboption.
4096 = single user; set with sp_dboption.
32768 = emergency mode.
4194304 = autoshrink.
1073741824 = cleanly shutdown.
Multiple bits can be on at the same time.
=========
field [status2]:
16384 = ANSI null default; set with sp_dboption.
65536 = concat null yields null , set with sp_dboption.
131072 = recursive triggers, set with sp_dboption.
1048576 = default to local cursor, set with sp_dboption.
8388608 = quoted identifier, set with
sp_dboption.
33554432 = cursor close on commit, set with sp_dboption.
67108864 = ANSI nulls, set with sp_dboption.
268435456 = ANSI warnings, set with sp_dboption.
536870912 = full text enabled, set with sp_fulltext_database.

> Question #2)
> If/When I get control back I want to chuck the Log via
> a) sp_detach_db
> b) Delete the Log file
> c) sp_attach_single_file_db
> Will this work?
You better do the following:
backup log <dbname> with no_log
dbcc shrinkdatabase('<dbname>',TRUNCATEONLY)

> Question #3)
> There are months and months of data that is easily purgable by date but I
> want to avoid making the log file large and clogging up the system again.
> Can I use a statement like
> Delete from tableA where date_time between '2006-10-01 00:00:00' and
> '2006-10-14 23:59:59'
Yes

> I am unsure how the SQL server will handle this statement. If there are
> only 5% of the records in the DB that match this query will the log file
> only grow by that amount? I assume it must for backout purposes.
|||"Paul Bergson [MVP-DS]" <pbergson@.allete_nospam.com> wrote in message
news:OSMpANFeHHA.1244@.TK2MSFTNGP04.phx.gbl...
>I can't believe I didn't think to look in the logs, duh... Only 72 hours
>to go, what a stinking pig
>
Yeah, I've done the same thing regarding forgetting ;-)

> I have a follow up but it refers to code pruning it self. I will repost
>
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html