Solved

Change Name is Sysfiles

Posted on 2007-12-06
2
614 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

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…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

839 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