Showing posts with label recreate. Show all posts
Showing posts with label recreate. Show all posts

Monday, March 26, 2012

Log Files

Hi

Im having a problem with disk issue, My database is currently 9.5 gb and my transaction log is 28 gb? is there any way i can reset or recreate a transaction log without affecting the integrity of the database (MDF)? Please help

Hi,

First of all you need to do regular backups to keep the size of your transaction log reasonable.

What you can do then is take a full database backup, then switch to simple recovery model and switch back to full recovery model (or just use the deprecating BACKUP LOG WITH TRUNCATE_ONLY).

After this you should be able to use DBCC SHRINKFILE to shrink the log to a smaller size.

Remember to set up a schedule for your database and log backups afterwards.

WesleyB

Visit my SQL Server weblog @. http://dis4ea.blogspot.com

|||

You might want to run this query periodically to make sure you don't have any other issues that are preventing the transaction log from being truncated.

-- Find the problem with the transaction log SELECT name, database_id, log_reuse_wait_desc FROM sys.databases

http://glennberrysqlperformance.spaces.live.com/blog/cns!45041418ECCAA960!509.entry

|||

Also, consider your recovery model. If you have a "Full" recovery model, the transaction log will grow much larger. Depending on your needs (and your backup plan), you can consider using a "Simple" recovery model.

http://msdn2.microsoft.com/en-us/library/ms191253(SQL.90).aspx

-Steve

Friday, March 9, 2012

Log file

SQL log file grew around 136Gb & I could not back it up.so I deleted it
without backup. I was told by my friend that it will recreate it
automatically as long as you have mdb file. Now i cannot recreate it and its
gives error messge. I tried attaching and sql query attaching single file but
none of the option works. Can someone suggest how to recover it. I only have
the original mdb file.
Hitesh Patel wrote:
> SQL log file grew around 136Gb & I could not back it up.so I deleted
> it without backup. I was told by my friend that it will recreate it
> automatically as long as you have mdb file. Now i cannot recreate it
> and its gives error messge. I tried attaching and sql query attaching
> single file but none of the option works. Can someone suggest how to
> recover it. I only have the original mdb file.
What happens when you issue the sp_attach_single_file_db command?
David Gugick
Quest Software
www.imceda.com
www.quest.com
|||You should have detahed the database first using sp_detach_db, and then
attach it without the log file. That would have worked.
Anyway, I think there are some undocumented DBCC commands that can add a log
file. But you really might want to contact Microsoft Support to sort out
this issue.
And then please make sure you select the appropriate recovery model for your
database, and that you have a backup plan as well.
--Vyas
"Hitesh Patel" <HiteshPatel@.discussions.microsoft.com> wrote in message
news:C8555A3B-4045-4FF6-A5D3-60C0C82F0959@.microsoft.com...
> SQL log file grew around 136Gb & I could not back it up.so I deleted it
> without backup. I was told by my friend that it will recreate it
> automatically as long as you have mdb file. Now i cannot recreate it and
> its
> gives error messge. I tried attaching and sql query attaching single file
> but
> none of the option works. Can someone suggest how to recover it. I only
> have
> the original mdb file.
|||> You should have detahed the database first using sp_detach_db, and then
> attach it without the log file. That would have worked.
Unless the database has multiple log files. Hitesh should have use DBCC
SHRINKFILE to reduce the log file size.
Hope this helps.
Dan Guzman
SQL Server MVP
"Narayana Vyas Kondreddi" <answer_me@.hotmail.com> wrote in message
news:uZJXPlxhFHA.3912@.tk2msftngp13.phx.gbl...
> You should have detahed the database first using sp_detach_db, and then
> attach it without the log file. That would have worked.
> Anyway, I think there are some undocumented DBCC commands that can add a
> log file. But you really might want to contact Microsoft Support to sort
> out this issue.
> And then please make sure you select the appropriate recovery model for
> your database, and that you have a backup plan as well.
> --Vyas
> "Hitesh Patel" <HiteshPatel@.discussions.microsoft.com> wrote in message
> news:C8555A3B-4045-4FF6-A5D3-60C0C82F0959@.microsoft.com...
>
|||And please give your buddy a nice kick to the knee for giving such advice :-)
"Dan Guzman" wrote:

> Unless the database has multiple log files. Hitesh should have use DBCC
> SHRINKFILE to reduce the log file size.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Narayana Vyas Kondreddi" <answer_me@.hotmail.com> wrote in message
> news:uZJXPlxhFHA.3912@.tk2msftngp13.phx.gbl...
>
>
|||Thanks to everyone for sound advise. I have cotacted micorsoft support and
recovered the database. If any of you are intereseted, let me know i will
write the solution. its really useful to be a part of telented community.
"einman" wrote:
[vbcol=seagreen]
> And please give your buddy a nice kick to the knee for giving such advice :-)
> --
>
>
> "Dan Guzman" wrote:

Log file

SQL log file grew around 136Gb & I could not back it up.so I deleted it
without backup. I was told by my friend that it will recreate it
automatically as long as you have mdb file. Now i cannot recreate it and its
gives error messge. I tried attaching and sql query attaching single file but
none of the option works. Can someone suggest how to recover it. I only have
the original mdb file.Hitesh Patel wrote:
> SQL log file grew around 136Gb & I could not back it up.so I deleted
> it without backup. I was told by my friend that it will recreate it
> automatically as long as you have mdb file. Now i cannot recreate it
> and its gives error messge. I tried attaching and sql query attaching
> single file but none of the option works. Can someone suggest how to
> recover it. I only have the original mdb file.
What happens when you issue the sp_attach_single_file_db command?
--
David Gugick
Quest Software
www.imceda.com
www.quest.com|||You should have detahed the database first using sp_detach_db, and then
attach it without the log file. That would have worked.
Anyway, I think there are some undocumented DBCC commands that can add a log
file. But you really might want to contact Microsoft Support to sort out
this issue.
And then please make sure you select the appropriate recovery model for your
database, and that you have a backup plan as well.
--Vyas
"Hitesh Patel" <HiteshPatel@.discussions.microsoft.com> wrote in message
news:C8555A3B-4045-4FF6-A5D3-60C0C82F0959@.microsoft.com...
> SQL log file grew around 136Gb & I could not back it up.so I deleted it
> without backup. I was told by my friend that it will recreate it
> automatically as long as you have mdb file. Now i cannot recreate it and
> its
> gives error messge. I tried attaching and sql query attaching single file
> but
> none of the option works. Can someone suggest how to recover it. I only
> have
> the original mdb file.|||> You should have detahed the database first using sp_detach_db, and then
> attach it without the log file. That would have worked.
Unless the database has multiple log files. Hitesh should have use DBCC
SHRINKFILE to reduce the log file size.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Narayana Vyas Kondreddi" <answer_me@.hotmail.com> wrote in message
news:uZJXPlxhFHA.3912@.tk2msftngp13.phx.gbl...
> You should have detahed the database first using sp_detach_db, and then
> attach it without the log file. That would have worked.
> Anyway, I think there are some undocumented DBCC commands that can add a
> log file. But you really might want to contact Microsoft Support to sort
> out this issue.
> And then please make sure you select the appropriate recovery model for
> your database, and that you have a backup plan as well.
> --Vyas
> "Hitesh Patel" <HiteshPatel@.discussions.microsoft.com> wrote in message
> news:C8555A3B-4045-4FF6-A5D3-60C0C82F0959@.microsoft.com...
>> SQL log file grew around 136Gb & I could not back it up.so I deleted it
>> without backup. I was told by my friend that it will recreate it
>> automatically as long as you have mdb file. Now i cannot recreate it and
>> its
>> gives error messge. I tried attaching and sql query attaching single file
>> but
>> none of the option works. Can someone suggest how to recover it. I only
>> have
>> the original mdb file.
>|||And please give your buddy a nice kick to the knee for giving such advice :-)
--
"Dan Guzman" wrote:
> > You should have detahed the database first using sp_detach_db, and then
> > attach it without the log file. That would have worked.
> Unless the database has multiple log files. Hitesh should have use DBCC
> SHRINKFILE to reduce the log file size.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Narayana Vyas Kondreddi" <answer_me@.hotmail.com> wrote in message
> news:uZJXPlxhFHA.3912@.tk2msftngp13.phx.gbl...
> > You should have detahed the database first using sp_detach_db, and then
> > attach it without the log file. That would have worked.
> >
> > Anyway, I think there are some undocumented DBCC commands that can add a
> > log file. But you really might want to contact Microsoft Support to sort
> > out this issue.
> >
> > And then please make sure you select the appropriate recovery model for
> > your database, and that you have a backup plan as well.
> >
> > --Vyas
> >
> > "Hitesh Patel" <HiteshPatel@.discussions.microsoft.com> wrote in message
> > news:C8555A3B-4045-4FF6-A5D3-60C0C82F0959@.microsoft.com...
> >> SQL log file grew around 136Gb & I could not back it up.so I deleted it
> >> without backup. I was told by my friend that it will recreate it
> >> automatically as long as you have mdb file. Now i cannot recreate it and
> >> its
> >> gives error messge. I tried attaching and sql query attaching single file
> >> but
> >> none of the option works. Can someone suggest how to recover it. I only
> >> have
> >> the original mdb file.
> >
> >
>
>|||Thanks to everyone for sound advise. I have cotacted micorsoft support and
recovered the database. If any of you are intereseted, let me know i will
write the solution. its really useful to be a part of telented community.
"einman" wrote:
> And please give your buddy a nice kick to the knee for giving such advice :-)
> --
>
>
> "Dan Guzman" wrote:
> > > You should have detahed the database first using sp_detach_db, and then
> > > attach it without the log file. That would have worked.
> >
> > Unless the database has multiple log files. Hitesh should have use DBCC
> > SHRINKFILE to reduce the log file size.
> >
> > --
> > Hope this helps.
> >
> > Dan Guzman
> > SQL Server MVP
> >
> > "Narayana Vyas Kondreddi" <answer_me@.hotmail.com> wrote in message
> > news:uZJXPlxhFHA.3912@.tk2msftngp13.phx.gbl...
> > > You should have detahed the database first using sp_detach_db, and then
> > > attach it without the log file. That would have worked.
> > >
> > > Anyway, I think there are some undocumented DBCC commands that can add a
> > > log file. But you really might want to contact Microsoft Support to sort
> > > out this issue.
> > >
> > > And then please make sure you select the appropriate recovery model for
> > > your database, and that you have a backup plan as well.
> > >
> > > --Vyas
> > >
> > > "Hitesh Patel" <HiteshPatel@.discussions.microsoft.com> wrote in message
> > > news:C8555A3B-4045-4FF6-A5D3-60C0C82F0959@.microsoft.com...
> > >> SQL log file grew around 136Gb & I could not back it up.so I deleted it
> > >> without backup. I was told by my friend that it will recreate it
> > >> automatically as long as you have mdb file. Now i cannot recreate it and
> > >> its
> > >> gives error messge. I tried attaching and sql query attaching single file
> > >> but
> > >> none of the option works. Can someone suggest how to recover it. I only
> > >> have
> > >> the original mdb file.
> > >
> > >
> >
> >
> >

Log file

SQL log file grew around 136Gb & I could not back it up.so I deleted it
without backup. I was told by my friend that it will recreate it
automatically as long as you have mdb file. Now i cannot recreate it and its
gives error messge. I tried attaching and sql query attaching single file bu
t
none of the option works. Can someone suggest how to recover it. I only have
the original mdb file.Hitesh Patel wrote:
> SQL log file grew around 136Gb & I could not back it up.so I deleted
> it without backup. I was told by my friend that it will recreate it
> automatically as long as you have mdb file. Now i cannot recreate it
> and its gives error messge. I tried attaching and sql query attaching
> single file but none of the option works. Can someone suggest how to
> recover it. I only have the original mdb file.
What happens when you issue the sp_attach_single_file_db command?
David Gugick
Quest Software
www.imceda.com
www.quest.com|||You should have detahed the database first using sp_detach_db, and then
attach it without the log file. That would have worked.
Anyway, I think there are some undocumented DBCC commands that can add a log
file. But you really might want to contact Microsoft Support to sort out
this issue.
And then please make sure you select the appropriate recovery model for your
database, and that you have a backup plan as well.
--Vyas
"Hitesh Patel" <HiteshPatel@.discussions.microsoft.com> wrote in message
news:C8555A3B-4045-4FF6-A5D3-60C0C82F0959@.microsoft.com...
> SQL log file grew around 136Gb & I could not back it up.so I deleted it
> without backup. I was told by my friend that it will recreate it
> automatically as long as you have mdb file. Now i cannot recreate it and
> its
> gives error messge. I tried attaching and sql query attaching single file
> but
> none of the option works. Can someone suggest how to recover it. I only
> have
> the original mdb file.|||> You should have detahed the database first using sp_detach_db, and then
> attach it without the log file. That would have worked.
Unless the database has multiple log files. Hitesh should have use DBCC
SHRINKFILE to reduce the log file size.
Hope this helps.
Dan Guzman
SQL Server MVP
"Narayana Vyas Kondreddi" <answer_me@.hotmail.com> wrote in message
news:uZJXPlxhFHA.3912@.tk2msftngp13.phx.gbl...
> You should have detahed the database first using sp_detach_db, and then
> attach it without the log file. That would have worked.
> Anyway, I think there are some undocumented DBCC commands that can add a
> log file. But you really might want to contact Microsoft Support to sort
> out this issue.
> And then please make sure you select the appropriate recovery model for
> your database, and that you have a backup plan as well.
> --Vyas
> "Hitesh Patel" <HiteshPatel@.discussions.microsoft.com> wrote in message
> news:C8555A3B-4045-4FF6-A5D3-60C0C82F0959@.microsoft.com...
>|||And please give your buddy a nice kick to the knee for giving such advice :-
)
--
"Dan Guzman" wrote:

> Unless the database has multiple log files. Hitesh should have use DBCC
> SHRINKFILE to reduce the log file size.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Narayana Vyas Kondreddi" <answer_me@.hotmail.com> wrote in message
> news:uZJXPlxhFHA.3912@.tk2msftngp13.phx.gbl...
>
>|||Thanks to everyone for sound advise. I have cotacted micorsoft support and
recovered the database. If any of you are intereseted, let me know i will
write the solution. its really useful to be a part of telented community.
"einman" wrote:
[vbcol=seagreen]
> And please give your buddy a nice kick to the knee for giving such advice
:-)
> --
>
>
> "Dan Guzman" wrote:
>