Solved

Change Name is Sysfiles

Posted on 2007-12-06
2
610 Views
Last Modified: 2012-05-05
Our ERP system (JDE) has three enviroments each in it's own SQL Database. The easiest way to refresh the production data to the prototype enviroment is to backup the production database (PS_Prod) and restore it to the prototype enviroment (PS_CRP). This works fine with one exceeption. After the restore we run the following SQLs:
sp_msforeachtable @command1='grant all on ? to public'
and
update sysobjects
set UID = User_ID('CRPDTA')
where UID= USER_ID('PRODDTA')

These work fine
However the name is sysfiles table is wrong. The file path is correct though. Below are the results of query select name, filename from sysfile
PS_PROD_Data   E:\mssql\data\PS_CRP.mdf                                                              
PS_PROD_Log     F:\mssql\log\\PS_CRP_log.LDF                                                        
This causes a problem whenn trying to run the DBBC shrinkfile command

is there a way to change the name back to PS_CRP_Data and PS_CRP_Log in the field name in sysfiles without causing any residual problems?

0
Comment
Question by:EVANFAGER
2 Comments
 
LVL 18

Accepted Solution

by:
ShogunWade earned 500 total points
ID: 20422228
0
 

Expert Comment

by:Hurric8ne
ID: 21313784
I tired using the Alter database Modify file option to amend a file name contained in SYSFILES but I got an error message telling me that the file did not exist. Now I know that the file doesn't exist and that is why I want to amend the reference to it in the [name] field in SYSFILES so that I can shrink the log files.

Please can someone tell me how I update that [name] field in SYSFILES, as it's driving me insane.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how the fundamental information of how to create a table.

746 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now