Solved

Sysfiles name shows wrong database

Posted on 2008-06-19
1
438 Views
Last Modified: 2008-06-19
I've inherited a database that had relatively large log files. Datafiles: 23GB, 11GB, 9GB. Log files: 25GB, 13GB, 10GB. I wanted to get this fixed. I backed up the databases and then tried to run DBCC Shrinkfile. On database1 and 3 I had no problems. But on database2, it fails with "could not locate file 'database2' in sysfiles. I looked at sysfiles for database2 and the filename column points to database2.mdf and database2_log.ldf. However, the name column shows database1_dat and database1_log.

Will ALTER DATABASE resolve this?
0
Comment
Question by:evcevis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 13

Accepted Solution

by:
MikeWalsh earned 250 total points
ID: 21827910
My guess here is that the logical/physical names got screwed up during a restore operation previously.

So you should be able to use Alter Database to modify your logical filename.

From BOL:

ALTER DATABASE test
MODIFY FILE
    (NAME = oldname, NEWNAME = newname);
GO

If you have an issue with the physical name you would just use the move command for that logical file and put the new path/name for the new physical name.


I know you didn't ask this, but I also would comment on the practice of shrinking files. It is generally a bad practice. Files grew to their size for a reason. If you go through the process of shrinking a file and it grows back you now have a performance hit during that growth and you are causing potential fragmentation and data access perf hits moving forward. When you shrink a log file and allow it to grow, that log file will now have more virtual log files which can also cause a performance hit.

I generally like to grow the files to the size I expect them to be for the next n months and set them once. Just food for thought. Paul Randal, formerly of the SQL Server Storage Engine team at Microsoft, blogs about this on his blog: http://www.sqlskills.com/blogs/paul/
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question