Sunday, February 8, 2015

Workaround for Setting up Workspace Mappings in Toad for Oracle 12.6 and Team Foundation Server 2013 (RTM or Update N)

Challenge:

Recently I had the chance to work again with Toad for Oracle and its versioning control options called Team Coding for purposes of versioning Oracle databases with TFS.

I am currently using the latest available bits, namely Toad 12.6.0.53 with Team Coding 7.1 and Team Foundation Server 2013 Update 3.

Note: I am using the Visual Studio 2013 Application Lifecycle Management Virtual Machine currently with TFS 2013 Update 3 and Visual Studio 2013 Update 3, where I have additionally installed the Oracle Demo DB locally (Oracle Database 11g Release 2 (11.2.0.1.0) for Microsoft Windows (x64))

Setting up Team Coding consists of several steps. The overview of the newest version is available in this video "The new Team Coding Dashboard in Toad for Oracle 12". No official instructions for the newest version are available at the moment of writing this, except the application’s built-in help. The older version 11.6 is documented in "Version Control and Team Coding in Toad for Oracle 11.6", and is useful as a startup guide if you are not familiar with the concept, but differs from the current Team Coding in several points regarding Team Coding and Code Collections (called Code Control Groups prior to Toad 11).

Moving further to my scenario, one of the steps you need to perform when setting up Team Coding is creating a new TFS workspace and defining mappings from TFS source folders to local folders.

 Toad_For_Oracle-TFS_Create_New_Workspace

As I have my own preferences regarding my local folder structure, I created a new workspace and I mapped the root TFS Oracle folder "$/Default/TOAD" to a folder of my choice: "C:\TFS\Default\TOAD".

This kind of mapping causes a buggy behavior in Team Coding as described here - Team Coding Sub-Projects folder location on Toad for Oracle Beta Program Community and further in this blog.

My initial settings were following:

Toad_For_Oracle-TFS_And_Team_Coding_Settings

Notice that for my workspace "TOAD" the source control folder "$/Default/TOAD" is mapped to the local folder "C:\TFS\Default\TOAD".

Next, I proceeded to setting up Code Collections.

I created one code collection "HR-All" to control all different types of objects at once but within separated folders (new in Toad 12.6).

I selected the root TFS folder under Project, selected the HR schema under Criteria—>Schema. Then checked Sub-Projects, left the Parent Folder empty (because subfolders are created using the structure PARENT_FOLDER\SHEMA_NAME\OBJECT_TYPE) and hit the Create Folders button.

 Toad_For_Oracle-TFS_Create_New_Code_Collection_Error_Failed_to_Create_VCS_Project

As you see on the picture, I got multiple errors in the Output window (marked in orange):

"Output: Failed to Create VCS Project $/Default/TOAD/HR/TABLE"

Additionally I got a lot of dummy folders created on the root of my C: drive!

 Toad_For_Oracle-TFS_Create_New_Code_Collection_Error_Dummy_Folders_On_Disk

Note: If you do not select to create folders while setting a code collection group, you get the same error when performing any VCS related action, e.g.. "Create new revision in VCS".

Resolution/Workaround:

I resolved this error thanks to my previous experience with earlier Toad versions (10.6.X) where a similar error occurred. We used to resolve it by mapping the TFS root folder (not some subfolder in TFS, but the root, because otherwise it still does not work) to the root of some local disk. I tried to use the same trick here, and it worked!

So the above problem is solved if you set the workspace mapping from TFS root folder "$/" to "C:\" for example.

The major problem I see here is that you usually do not have spare disks just for this purpose, and I personally do not like mapping anything directly on any root disk folder.

To solve this, you can use a workaround and associate a path with a drive letter using the SUBST command and then use this disk for your workspace mapping.

And voila, everything just starts working as expected…

 

Quick Guide:

So the steps for the workaround are:

  1. Choose a local path where you want map your TFS root folder (not some subfolder in TFS, but the root, because otherwise it still does not work).
  2. Associate this path with a drive letter.
    For my case I used: subst x: C:\TFS\Default\TOAD
  3. Edit workspace mappings and map the TFS root folder to this drive letter.
  4. Work further with Toad and Team Coding.

 Toad_For_Oracle-TFS_Create_New_Workspace_Resolved

Toad_For_Oracle-TFS_Create_New_Code_Collection_Resolved

 

I hope that the Team Coding team will address this bug in some future update. Until then, you can use the current version just fine thanks to this small trick ;)

Cheers,
Ana