Monday, February 20, 2012

Please help! How to execute a Query without keeping log?

I try ro delete many data from a table but the log file is always full so
that I cannot delete the uncessary data in a table.
How can I disable the keeping log function so that I can execute the Query
successfully.
--
Regards,
Anthony LamHi Anthony,
If it is SQL server 2000 , check the recovary model. If the database is not
critical u can change the model to Simple and run the command Backup tran
dbname with no_log.
After this u can run the delete statement.
In the other way if u database is very critical , perform a backup logdbname
to disk='c:\dbname.trn'
after this run the delete statement again.
If you are running SQL 7 , Simple recovary model is equalent to "truncate
log on checkpoint' db option. The rest of things are same as SQL 2000.
Thanks
Hari
MCDBA
"AA" <anthony@.jadeflex.com> wrote in message
news:uTgtSMfmDHA.1244@.TK2MSFTNGP11.phx.gbl...
> I try ro delete many data from a table but the log file is always full so
> that I cannot delete the uncessary data in a table.
> How can I disable the keeping log function so that I can execute the Query
> successfully.
> --
> Regards,
> Anthony Lam
>|||If it was a problem about running out of the log space with a single DELETE
statement, changing the recovery model to SIMPLE will not help.
1. You may get away with TRUNCATE TABLE because it uses less tran log space
by only recording the page deallocations in the tran log.
2. Or you can put your DELETE in a loop and delete a smaller chunk each time
followed by a BACKUP LOG statement. The size of the 'chunk' is basically the
number of rows to delete.
--
Linchi Shea
linchi_shea@.NOSPAMml.com
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:OMC3BUfmDHA.2528@.TK2MSFTNGP10.phx.gbl...
> Hi Anthony,
> If it is SQL server 2000 , check the recovary model. If the database is
not
> critical u can change the model to Simple and run the command Backup tran
> dbname with no_log.
> After this u can run the delete statement.
> In the other way if u database is very critical , perform a backup
logdbname
> to disk='c:\dbname.trn'
> after this run the delete statement again.
> If you are running SQL 7 , Simple recovary model is equalent to "truncate
> log on checkpoint' db option. The rest of things are same as SQL 2000.
> Thanks
> Hari
> MCDBA
>
> "AA" <anthony@.jadeflex.com> wrote in message
> news:uTgtSMfmDHA.1244@.TK2MSFTNGP11.phx.gbl...
> > I try ro delete many data from a table but the log file is always full
so
> > that I cannot delete the uncessary data in a table.
> > How can I disable the keeping log function so that I can execute the
Query
> > successfully.
> >
> > --
> > Regards,
> >
> > Anthony Lam
> >
> >
>

No comments:

Post a Comment