Re: How do I shrink my logfile?

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Kalen Delaney (replies_at_public_newsgroups.com)
Date: 07/23/04


Date: Thu, 22 Jul 2004 17:32:15 -0700

I assumed that because you were posting a question on the newsgroup that you
did not know EVERYTHING about SQL Server. I had to guess how much you knew
and how much you didn't know.
The Duh! is really uncalled for. It seems to assume that I should have known
exactly how much you already knew, and there was no way I could know that.
If you peruse the newsgroups for a while, instead of just posting your own
question and waiting for an answer, you will see there is an extremely wide
range of experience in the people who ask questions here.

Without more details, I would also assume that your db was restored from a
backup of one with a different name. The sysfiles table is populated when
the db is created, and that can happen during a restore if you are not
restoring on top of an existing db.

You can use ALTER DATABASE to change the logical filenames, but only if you
are running SQL Server 2000. You never once said what version you are
running, and there is no way I could know that either.
You can only change the physical file names of tempdb. If you need to change
the physical file names, you can detach the db, move the files, reattach
with the MOVE option.

Please see ALTER DATABASE, sp_detach_db and sp_attach_db in the Books Online
for full details.

--
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Sydney Lotterby" <sydney@infosearch.com> wrote in message
news:#mlWxpDcEHA.808@tk2msftngp13.phx.gbl...
> Duh!  I know that!  I was making a generic statement.
>
> My comment still stands ... mydb_log (alias cpmain_log) is not in SysFiles
> and I would like to know why.
> The entry in cpmain.sysfiles is cphooks_log and cphooks_data
> I suspect this db was restored from one named cphooks.
> So ...
> 1)  When is the entry made to sysfiles?
> 2)  Can I change the entries in sysfiles manually with impunity?
>
> "Kalen Delaney" <replies@public_newsgroups.com> wrote in message
> news:uzmxUeBcEHA.2468@TK2MSFTNGP09.phx.gbl...
> > Usually when you see MY in an object name, it means you should replace
it
> > with whatever YOUR name really is.
> >
> > What is the name of the log file for YOUR db? That is the name you
should
> > use instead of mydb_log. Sysfiles, or sp_helpfile, should show you the
> name
> > used for your database.
> >
> > --
> > HTH
> > ----------------
> > Kalen Delaney
> > SQL Server MVP
> > www.SolidQualityLearning.com
> >
> >
> > "Sydney Lotterby" <sydney@infosearch.com> wrote in message
> > news:#qNPqBBcEHA.3460@TK2MSFTNGP10.phx.gbl...
> > > I followed the instructions in the link but when I run DBCC
> > > SHRINKFILE(mydb_log,2) it says "could not locate mydb_log in sysfiles.
> I
> > > checked sysfiles and, true, it is not there.
> > > What can I do?
> > >
> > > "Narayana Vyas Kondreddi" <answer_me@hotmail.com> wrote in message
> > > news:%23pOUoKAcEHA.3988@tk2msftngp13.phx.gbl...
> > > > See DBCC SHRINKFILE in SQL Server Books Online. Also see:
> > > >
> > > > INF: Shrinking the Transaction Log in SQL Server 2000 with DBCC
> > SHRINKFILE
> > > > http://support.microsoft.com/default.aspx?scid=kb;EN-US;272318
> > > > --
> > > > HTH,
> > > > Vyas, MVP (SQL Server)
> > > > http://vyaskn.tripod.com/
> > > > Is .NET important for a database professional?
> > > > http://vyaskn.tripod.com/poll.htm
> > > >
> > > >
> > > > "Joseph Geretz" <jgeretz@nospam.com> wrote in message
> > > > news:ewNWyDAcEHA.1656@TK2MSFTNGP09.phx.gbl...
> > > > I set my recovery model to simple. I set my database option to
> > AutoShrink.
> > > I
> > > > backed up my database. But the logfile is still 2.3 GB(!). How do I
> > shrink
> > > > this?
> > > >
> > > > Thanks!
> > > >
> > > > - Joe Geretz -
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


Relevant Pages

  • Re: How do I shrink my logfile?
    ... the database. ... >> did not know EVERYTHING about SQL Server. ... and that can happen during a restore if you are not ... >> You can only change the physical file names of tempdb. ...
    (microsoft.public.sqlserver.server)
  • Re: How do I shrink my logfile?
    ... You're right - I apologize for the duh. ... > did not know EVERYTHING about SQL Server. ... and that can happen during a restore if you are not ... > You can only change the physical file names of tempdb. ...
    (microsoft.public.sqlserver.server)
  • Re: Statistics IO logical reads sometimes 15 million and other times down to 90 thousand?
    ... different physical file names, I run my query, the first time it takes ... I am sure now if I restore this same db on another SQL Server ... Then that SQL Server Instance ...
    (comp.databases.ms-sqlserver)
  • Re: Backing Up WSS
    ... Backup and Restore Options for Windows SharePoint Services ... ·Use the Microsoft SQL Server 2000 tools to back up the databases. ...
    (microsoft.public.sharepoint.portalserver)
  • Re: Disaster Recovery question
    ... Can you post the SQL Server error log of the dysfunctional server? ... > You can restore master to another box. ... > 1) Drop the suspect DB's and simply restore from backup. ...
    (microsoft.public.sqlserver.server)