Removing vaulted items from Windchill database

This past weekend I spent about 25 plus hours rehosting a production Windchill server to an identical development Windchill server. One of the last steps in cleaning up the rehost procedure is removing valuted items out of the database for replica sites. This needs to be done before you can remove all replica servers that are not being used. Typically, you aren't going to have replica servers talking to your development environment. Plus this helps keep your Windchill logs from getting cluttered with uneccesary errors and warnings.

Before you begin the SQL statement below is for MS SQL 2005 or MS SQL 2008. Also, remember that due to the settings of the Windchill database the column and table names are case sensitive.

  1. Idenitfy if your database has a scheme
    • By default the scheme is wtuser, but can be set to anything when the database is created
  2. Run the following SQL script to get your vault names
    select * from schemename.ReplicaVault
       
  3. Open up a new script window, and run the following script to see which vaults have vaulted files
    select idA2A2 from schemename.ReplicaFolder where idA3A5
    in (select  idA2A2 from schemename.ReplicaVault where name ='vault_name_from_query_above')
     
  4. Make note of the vaults that return a number from the query above, and then run the following script to delete from records from the database:
    delete from schemename.MasteredonReplicaItem where idA3A4 in
    (select idA2A2 from schemename.ReplicaFolder where idA3A5
    in (select  idA2A2 from schemename.ReplicaVault where name ='vault_name_with_records_from_step_2'))
     
  5. After this is complete you can now remove the sites from the Sites administration from within Windchill. This is not an approved process by PTC, but I have worked with PTC's tech support to come up with this solution.

猜你喜欢

转载自felixli.iteye.com/blog/1073514