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.L
DF
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?
Start Free Trial