cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Which Rehosting Method?

SOLVED
BrianToussaint
Tanzanite

Which Rehosting Method?

It has been a while since I had to rehost my production machine to a test server, but I recently upgraded to 10.2 and would like my test server to reflect the 10.2 production server so that I have a fresh start. I would like to use the Rehost 2.0 tool to help me since I do not want to go through a manual rehost. I do have Solr turned on, some customization and connect to our corporate LDAP. I have an app server and a database server in production and am moving to the same on two virtual servers. Which method would be better and why?

  • Copy all the files to the new machines, import the database and use Rename
  • Use Rehost with a staging area
  • Use Clone with a staging area
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Which Rehosting Method?

Brian,

I'm also on 10.2 M020 in a virtual environment. I have a .bat file that manually stops the services on the test system, copies the files from production, then runs the rehosting utility. It pauses prior to the rehost step to give me time to export and re-import the database. I do all of this with the production system online and I do not use a second staging area.

The projects.properties file contains just this one line:

clone.prod=InfoEngine,Database,Apache,IEAdapter,WVSAgent

Here are the steps I use:

Production Database Server

  • Backup Windchill database to disk (SQL script)

Test Database Server

  • Copy database backup file from production server
  • Restore Database
  • Fix Windchill user account

USE windchill
GO

sp_change_users_login @Action='Report'
GO

EXEC sp_change_users_login 'Auto_Fix', 'windchill'
GO

  • Delete the entry from RMISTUBS table in the database. See CS150162.

delete from windchill.RMIStubs where RMIStubs.Name ='CacheMaster'

Test Application Server

Scripted Steps

  • Stop Windchill Services
  • Copy Application Data
  • Copy File Vault
  • Replace WVS Agent.ini File (single CAD worker for test environment)
  • Customize GUI for DEV (differnt color background, header message, etc.)
  • Clear Tomcat Cache
  • Delete Windchill Log Files
  • Delete Apache Log Files
  • Delete Directory Server Log Files
  • Start Windchill DS
  • Run Rehost Utility

Manually Steps

  • Stop WindchillDS
  • Clear Tomcat Cache
  • Update Trusted Hosts (for different CAD worker)
  • Start Windchill Services
  • Manually remove the remote file server
  • Clear out the visualization queues
  • Delete extra publisher queues

windchill wt.queue.QueueManager

View solution in original post

26 REPLIES 26

Re: Which Rehosting Method?

Brian,

I'm also on 10.2 M020 in a virtual environment. I have a .bat file that manually stops the services on the test system, copies the files from production, then runs the rehosting utility. It pauses prior to the rehost step to give me time to export and re-import the database. I do all of this with the production system online and I do not use a second staging area.

The projects.properties file contains just this one line:

clone.prod=InfoEngine,Database,Apache,IEAdapter,WVSAgent

Here are the steps I use:

Production Database Server

  • Backup Windchill database to disk (SQL script)

Test Database Server

  • Copy database backup file from production server
  • Restore Database
  • Fix Windchill user account

USE windchill
GO

sp_change_users_login @Action='Report'
GO

EXEC sp_change_users_login 'Auto_Fix', 'windchill'
GO

  • Delete the entry from RMISTUBS table in the database. See CS150162.

delete from windchill.RMIStubs where RMIStubs.Name ='CacheMaster'

Test Application Server

Scripted Steps

  • Stop Windchill Services
  • Copy Application Data
  • Copy File Vault
  • Replace WVS Agent.ini File (single CAD worker for test environment)
  • Customize GUI for DEV (differnt color background, header message, etc.)
  • Clear Tomcat Cache
  • Delete Windchill Log Files
  • Delete Apache Log Files
  • Delete Directory Server Log Files
  • Start Windchill DS
  • Run Rehost Utility

Manually Steps

  • Stop WindchillDS
  • Clear Tomcat Cache
  • Update Trusted Hosts (for different CAD worker)
  • Start Windchill Services
  • Manually remove the remote file server
  • Clear out the visualization queues
  • Delete extra publisher queues

windchill wt.queue.QueueManager

View solution in original post

Re: Which Rehosting Method?

Hello Tom,

Thank you for the information. Gives me a good starting point to work from. On the Replace WVS Agent.ini File, if I do not have CAD worker for my test environment, what do I do? For WindchillDS, do I copy that as well, or do I need to install that first and import the ldif file?

Thank you,

Brian

Re: Which Rehosting Method?

If you don't want the test environment configured for publishing, you can just completely delete the agent.ini file. (This defines the workers.)

As far as Windchill DS, I just copy the entire thing. I don't bother with exporting or importing the ldif. There is nothing about Windchill, WindchillDS, or Apache that requires any type of actual Windows installation. As long as the files are in the right place, they will run.

Re: Which Rehosting Method?

Gotcha. Thanks for the information. Does the copy slow down your productions server? I'm worried that it might slow mine down when I get to the file vault. I have 400GB in my vault.

Re: Which Rehosting Method?

Yes, a little. I think the database export is actually more impactful than the vault copy. Normally I kick this off after most people have gone home for the day. The whole process can be completed in less than an hour. (Our database is 60 GB and file vault is 650 GB.)

Re: Which Rehosting Method?

By the way, I use robocopy for the file copying. See below for sample. (I actually did install the Java SDK locally on the test system, so only the Java installer folder needed to be copied.)

REM ======= Copy Application Data ========
REM ======================================
robocopy \\production_server\e$\ptc\Windchill_10.2\HTTPServer E:\PTC\Windchill_10.2\HTTPServer /mir /ns /nc /nfl
robocopy \\production_server\e$\ptc\Windchill_10.2\PSI E:\PTC\Windchill_10.2\PSI /mir /ns /nc /nfl
robocopy \\production_server\e$\ptc\Windchill_10.2\Windchill E:\PTC\Windchill_10.2\Windchill /mir /ns /nc /nfl
robocopy \\production_server\e$\ptc\Windchill_10.2\WindchillDS E:\PTC\Windchill_10.2\WindchillDS /mir /ns /nc /nfl
robocopy \\production_server\e$\PTC\Windchill_10.2\Java\installer E:\PTC\Windchill_10.2\Java\installer /mir /ns /nc /nfl

REM ========== Copy File Vault ===========
REM ======================================
robocopy \\production_server\f$\WC_Vault F:\WC_Vault /mir /ns /nc /nfl

Re: Which Rehosting Method?

Tom,

So far most of it is going okay but I did run across a couple of things and was wondering what you did.

When I try to copy the HTTPServer directory, it errors on the logs saying that the file cannot be copied and it keeps on trying to copy it. Once I turned off Apache on the production server, it copied fine. How does yours work since you are doing it live?

What do you do with the PTC software installed on the SQL server? Do you copy that directory over or do you install it separately and go with that?

Other than that it is going okay. I'm in the middle of copying the vault for the first time and have stopped it during working hours since I do not want to tie up the production server copying files. I let it run over 8 hours last night and am less than 75% done. Once it is done, then I can try the rehost portion.

Thanks,

Brian

Re: Which Rehosting Method?

What copy method are you using? Did you try the robocopy syntax? If so, maybe try adding /r:2 to the end. This will limit the retries to twice on failure.

I'm running Windows Server 2012 and 2012R2 and I don't have any problem copying files that are in use. On the other hand, you don't need the logs. You're probably going to delete them anyway. Maybe you should tweak your copy script to just exclude them.

I have SQL fully installed on both the production and test database servers. To copy the database over I'm simply making a backup of the database on the production system, physically copying the file to the test system, then restoring the database from the backup. If you've never had a Windchill database in the test system before, you will also need to create the proper SQL login for the Windchill database user.

I actually performed a clean installation of Windchill on the entire test environment and then later did the clone. This had the benefit of getting the proper shortcuts created for the Windchill shell, getting the database server properly configured, etc. Probably worth doing...

Re: Which Rehosting Method?

I am using Robocopy for the first time and like it a bunch. I'll have to play around with it.

I did install 10.2 on my test servers for upgrade testing, so that was already setup. I was just wondering about when you update the software if you did it manually on the SQL server machine or if you copied it. I'll probably go with manually updating it.

I'm on Windows 2008 R2 and SQL 20008 and IT is wanting me to switch to 2012 on both fronts. Was going from 2008 to 2012 easy? Did you need a new server for the upgrade or did you just upgrade the software and OS?

Thanks Tom for all the help!

Re: Which Rehosting Method?

Copying the database is simple enough, but you just can't copy the entire SQL installation. That is heavily integrated with the OS, so you will need to use the installer for that. (Make sure you're collation is set right!)

We run a VMware virtual environment, so when I moved from 9.1 to 10.2 I just set up entirely new VMs for the application and database servers. As a rule I much prefer clean OS installs to in-place upgrades. By the way, 2012R2 isn't supported for 10.2 M020, so I'm only running that on the development system. Production is running 2012. 2012R2 is supported for 10.2 M030.

Re: Which Rehosting Method?

Hi Tom;

I know this was long time ago. I am struggling with being able to rehost 11.0 to a test environment from prod. Do you have a sample script you use for this task that you can share ?  

Or how do you do a refresh, from PROD to DEV? 

Re: Which Rehosting Method?

Thanks for this information I am trying to do the same thing.

FYI:

I noticed that you had stop and start windchill services as well as clearing the tomcat cache as manual steps. I just wrote some powershell scripts to do this here they are if you want them obviously you will need to change the service names and paths to be correct for your Windchill environment:

Script 1 Stop Windchilll Services: ===================================

#Stop Windchill Services

#3-30-2015

#Brian R. Reed

FUNCTION STOPWINDCHILL(){

Stop-Service "PTC-Windchill"

Stop-Service "PTC-WindchillDS"

Stop-Service "PTC-Apache"

}

Script 2 Start Windchill Services: ====================================

#Script to Start Windchill Services

#3-30-2015

#Brian R. Reed

FUNCTION STARTWINDCHILL(){

Start-Service "PTC-Apache"

Start-Service "PTC-WindchillDS"

Sleep 15

Start-Service "PTC-Windchill"

}

STARTWINDCHILL

Script 3 Stop Services Clear Cache Start Services: ===================================

#Script Written by Brian Reed
#Functionality: This script does the following:
#----1. Shuts down Windchill
#----2. Shuts down Windchill DS
#----3. Shuts down Apache
#----4. Checks to make sure Services were terminated - If not tries again.
#----5. Clears System Cache
#----6. Restarts Apache
#----7. Restarts Windchill DS
#----8. Restarts Windchill

$allServicesStoppedFlag = $false
$allServicesStartedFlag = $false

#allServicesStatus gives the current state of the Windchill Services
#$True means services are on
#$False means services are off
#"" means service status unknown
$allServicesStatus = $null


FUNCTION STOPWINDCHILL(){
Stop-Service "PTC-Windchill"
Stop-Service "Windchill Directory Server"
Stop-Service "PTC-Apache"
}
FUNCTION STARTWINDCHILL(){
Start-Service "PTC-Apache"
Start-Service "Windchill Directory Server"
sleep 15
Start-Service "PTC-Windchill"
}

#Attempt to Stop Windchill Services:
STOPWINDCHILL

#Get status of Windchill Services:
FUNCTION GETSERVICESTATUS(){
$WindchillServiceInfo = Get-Service "PTC-Windchill"
$ApacheServiceInfo = Get-Service "PTC-Apache"
$WindchillDSServiceInfo = Get-Service "Windchill Directory Server"
return $WindchillServiceInfo, $ApacheServiceInfo, $WindchillDSServiceInfo
}

FUNCTION TESTSERVICESTATUS(){
$aStatus = GETSERVICESTATUS
$wc1 = ""
$wc2 = ""
$wc3 = ""
$serviceOn = ""
foreach($item in $aStatus){
if ($item.Name -eq "PTC-Windchill"){
if($item.Status -eq "Running"){$wc1 = $true}
elseif($item.Status -eq "Stopped"){$wc1 = $false}
else{$wc1 = ""}
}
elseif($item.Name -eq "PTC-Apache"){
if($item.Status -eq "Running"){$wc2 = $true}
elseif($item.Status -eq "Stopped"){$wc2 = $false}
else{$wc2 = ""}
}
elseif($item.Name -eq "Windchill Directory Server"){
if($item.Status -eq "Running"){$wc3 = $true}
elseif($item.Status -eq "Stopped"){$wc3 = $false}
else{$wc3 = ""}
}
else{
$allServicesStartedFlag = $null
}
}
if($wc1 -eq $true -and $wc2 -eq $true -and $wc3 -eq $true){
$serviceOn -eq $true
}
elseif($wc1 -eq $false -and $wc2 -eq $false -and $wc3 -eq $false){
$serviceOn -eq $false
}
else{
$serviceOn -eq $null
}
return $serviceOn
}

#Test Services Status
$serviceStatus = TESTSERVICESTATUS


#If Services stopped continue
if($serviceStatus -eq $false){
}
#If Services did not stop try again:
else{
$i = 0
while($i -lt 3){
sleep 20
STOPWINDCHILL
$serviceStatus = TESTSERVICESTATUS
$i++
}
}

#Clear System Cache:
Remove-Item D:\ptc\Windchill_10.0\Windchill\tomcat\instances\* -recurse
Remove-Item D:\ptc\Windchill_10.0\Windchill\tasks\codebase\com\infoengine\compiledTasks\* -recurse
Remove-Item D:\ptc\Windchill_10.0\Windchill\logs\* -recurse


#Start Windchill
STARTWINDCHILL

#If Services started exit script
if($serviceStatus -eq $true){
}
#If Services did not start try again:
else{
$i = 0
while($i -lt 3){
sleep 20
STARTWINDCHILL
$serviceStatus = TESTSERVICESTATUS
$i++
}
}

Re: Which Rehosting Method?

Actually they are scripted the first time around, just not after the rehosting process. (For some reason the rehost process terminates the script I launch it from when finished.)

I'm just using plain old batch file syntax. Quite a bit simpler.

REM ====== Stop Windchill Services =======

REM ======================================

net stop "PTC Windchill Method Server"

net stop "PTCWindchillWebServer"

net stop "PTC Windchill Directory Server"

REM ========= Clear Tomcat Cache =========
REM ======================================
RMDIR E:\ptc\Windchill_10.2\Windchill\tomcat\instances /Q /S
RMDIR E:\ptc\Windchill_10.2\Windchill\tasks\codebase\com\infoengine\compiledTasks /Q /S

REM ===== Delete Windchill Log Files =====
REM ======================================
RMDIR /S /Q E:\PTC\Windchill_10.2\Windchill\logs\
MKDIR E:\PTC\Windchill_10.2\Windchill\logs\

REM ====== Delete Apache Log Files =======
REM ======================================
del /f /q E:\PTC\Windchill_10.2\HTTPServer\logs\*

REM ====== Delete Directory Server Log Files ======
REM ======================================
del /f /q E:\PTC\Windchill_10.2\WindchillDS\server\logs\*

Re: Which Rehosting Method?

Ah, I see. I wonder why it terminates? Maybe you could use the start command to launch a second batch file and then wait for it to terminate before continuing?

Re: Which Rehosting Method?

I've occasionally run into issues using sc to stop services, as not all of the processes would stop (we have multiple background method servers and method servers running on each server) before it returned. I wonder if using Power shell to do this would help. Right now we're using a Java program that queries sc to see if all of the processes are stopped (and does some other stuff, such as pausing after stopping the processes to allow files to be released before attempting to delete them).

Re: Which Rehosting Method?

If you are having trouble getting the services to stop you should give Powershell a try. I don't use it in the script above but, you can use the "-force" flag to forcefully terminate a process that is hanging. I recomend at the very least trying to stop the process without using the -force flag first to avoid any data loss from terminating a process before it has committed user changes.

Here are some exaples for ending a process and service:

Try to end them in a "nice" way:

Get-Process "PTC-Windchill" | Stop-Process

Get-Service "PTC-Windchill" | Stop-Service

Force them to stop:

Get-Process "PTC-Windchill" | Stop-Process -force

Get-Service "PTC-Windchill" | Stop-Service -force

Re: Which Rehosting Method?

Hello Tom,

I am finally at the point where I want to do the rehost. I have followed your steps above and am at the rehost portion.

If you are doing a lot of manual copying, how can you run it as clone? I thought that clone does a copy? Why wouldn't you use rename for the type of rehost?

Thank you,

Brian

Re: Which Rehosting Method?

After reading through the guide I determined that the clone made the most sense based on the following statements:

Rehost

rehost.PNG

Clone

clone.PNG

Each time I refresh the test environment, I want an exact copy of production. I don't want to run the risk that something in test is left different than production.

Even though I'm running the "clone" scenario, I'm not running the "Copy" task. When I originally worked through the guide I was under the impression that I needed to have an intermediate staging area that the production data had to be copied to before the rehost copy task could be run. Since I wasn't interested in doing that I opted to copy the data manually myself and then leave that step out of the projects.properties file. It's entirely possible that copy will actually copy directly from production to test, but I've never taken the time to configure it that way or try it out.

Re: Which Rehosting Method?

Thanks! I think I've got it now. At least I'm on a virtual and can go back if I mess something up.

Re: Which Rehosting Method?

Hi, Tom:

I saw this commands and seems like this is for SQL Server only:

  • Fix Windchill user account

USE windchill
GO

sp_change_users_login @Action='Report'
GO

EXEC sp_change_users_login 'Auto_Fix', 'windchill'
GO

I can't find this info in the Rehosting Utility Guide.

Do you or anyone know if I have to do this in Oracle DB?  (I am not the DBA)

Re: Which Rehosting Method?

Yes, this is for MS SQL Server.  I don't know what the equivalent is for Oracle, or if it's even needed.  Essentially the issue is related to user account permission.  In MS SQL there is access given in the Windchill database to the Windchill user.  When a new database (from another server) is loaded on top of the previous database, the user permissions don't map correctly to the user (some unique user identifier).  These commands remap the user in the newly loaded Windchill database back to the Windchill user defined on that system.  Fundamentally, if you can import the database and still login as the same Windchill user with the same password, you should be all set.  On MS SQL, I can't until I run these commands to reconnect everything.

Re: Which Rehosting Method?

Thanks for the update.  We have a DBA from DB Dept. that does all this DB cloning in Oracle and VMware.  I don't recall every doing something similar to this.  I guess Oracle is OK in the Windchill user mapping...   May be I will ask them tomorrow...

Thanks, again.

Re: Which Rehosting Method?

User will not get orphaned in Oracle. You have to verify whether there are any invalid object types though

select object_name, object_type from dba_objects where status='INVALID' - will output the invalid object types

If any packages are there in this you can repair it by compiling it - alter package owner.package_name compile

Thank you

Binesh Kumar

Barry Wehmiller

Re: Which Rehosting Method?

Thank you.  This is good information.  I will check with our DBA

Re: Which Rehosting Method?

BTW, I have another question.  We use the clone technique to create the Test system from Production in 10.2.  Before that, we were in 9.1 and 10.1 on the Physical server box.  We use the Rehosting and is taking longer time than cloning.

We would like to build a DEV system that has the same logic, but without production data.  In the past, we would probably just start with a brand new installation for DEV system with brand new DB.

Is there an easy way we can clone it from Production, but creating a brand new DB?

Re: Which Rehosting Method?

The only option available in the current release is to export and import independent packages (LC, WF and so on) to move just the business configuration without data. It is easy if you have windchill configuration and customization as build. With Windchill 10.2 M030, we have selective promotion of administrative objects from test to production. I think with Windchill 11, we will have most of the administrative object types will be exportable using the Business Administrative Change Framework

Thank You

Binesh Kumar

Barry Wehmiller

Announcements