Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Migration to 12c: Transferring Workspace User Views From ADF 11g

DZone's Guide to

Migration to 12c: Transferring Workspace User Views From ADF 11g

Learn about migrating workspace specific user views in a database and dive into how to export views from the old environment and import views into the new environment.

· Database Zone ·
Free Resource

RavenDB vs MongoDB: Which is Better? This White Paper compares the two leading NoSQL Document Databases on 9 features to find out which is the best solution for your next project.  

Migration to 12c has become a requirement for many projects. Recently, we did an update of the ADF stack for our project and along with this update came the requirement to migrate workspace user views so they could be available when users started working on the new environment. For clarity, by user views, I mean this:

Those are the custom views you can create to allow better filtering of tasks in a workspace. What we wanted was each user working on our application to have the personal views they created available on the migrated version (12c) without needing to recreate them by their own.

At first, I started with searching for a method to migrate all views for all users. This appeared to be possible, but after testing it, it did not work for me. What did work, though, was migrating all views for a specific user. And since we had no more than 20 users needing this, it was an acceptable solution.

There are three main steps to follow for this process:

  1. Determine the users for whom you want migrated views.

  2. Export views from old environment (11g).

  3. Import views to new environment (12c).

Now, I can go into details regarding each step.

1. Determine Users for Whom You Want Migrated Views

It is possible that you already know exactly which users to migrate (you have either decided that by yourself or have received a list by someone), but if that is not the case, there is a handy table in the SOA-INFRA schema which can help you. The following query should give you all the information you need for this use case:

select * from WFUSERTASKVIEW;

Each row in the result contains a definition for a single view (containing fields like user, view name, view owner, description, creation date, etc). For example, you can group by user to see how many views each user has. Some might ask, "Why not just copy the content of this table to the new environment and be done with it, instead of doing this more complicated migration process?" The problem is that there are keys in WFUSERTASKVIEW that are foreign to other tables, which prevents us from using that method.

2. Export Views From Old Environment (11g)

Here is an overview of the steps for this section:

  1. Log into the machine on which you have the old Oracle domain.

  2. Create a folder there that will be used for the view migration work.

  3. Add the file migration.properties (example below) to the created folder, which will determine the views you want to migrate.

  4. Execute the ant script, which exports the views using the configuration provided in the migration.properties file). This creates two new files containing the exported information: AttributesMapper.xml and Attributes.xml. Those files will later be used to import the views on the new environment.

The migration.properties file should have the following content inside:

operationType = EXPORT
objectType = VIEW
name = ALL (or you can specify specific view to export)
user = <name_of_user>
group =
grantPermission = true
migrateAttributeLabel = false
override = true
skip = true
migrateToActiveVersion = false

You can modify the parameters to suit your needs. Here is documentation from Oracle that explains each attribute mentioned above.

As I mentioned above, personally, I tried different combinations in order to export all views for all users at the same time, but that worked for me only when I specified the user. Maybe you will have better luck, though, so try and see if it works for you!

After that, you need to execute an ant script, which will generate the files containing information about the exported views. I found some differences in the parameters regarding 11g and 12c directories, though, which I will highlight. Here is the ant file for the 11g environment:

 ant -f $ORACLE_HOME/bin/ant-t2p-worklist.xml 
-Dbea.home=$MW_HOME 
-Dsoa.home=$ORACLE_HOME 
-Dmigration.properties.file= <full_path_to_migration_properties_from_above>
-Dsoa.hostname=<soa_server_node>
-Dsoa.rmi.port=<soa_server_port>
-Dsoa.admin.user=<user_with_admin_rights>
-Dsoa.admin.password=<password_of_above_user>
-Drealm=jazn.com 
-Dmigration.file=<path_where_exported_files_with_views_will_be_generated>/Attributes.xml 
-Dmap.file=<path_where_exported_files_with_views_will_be_generated>/AttributesMapper.xml

ant actually comes with Oracle installation, and if it is not already added to the path on the machine you are working on, it can be found here:

$MW_HOME/modules/org.apache.ant_1.7.1/bin/

You can check the Oracle documentation linked above for more information on the parameters of the ant script. After executing the script, the following two files will be created in the location specified on its parameters: AttributesMapper.xml and Attributes.xml.

The Attributes.xml file contains the XML definition of the exported views. Please check carefully after executing the ant script that this file is populated with the appropriate information and that the export was successful. AttributesMapper.xml contains the description of the operations that you chose to perform using the migration properties file.

3. Import Views to New Environment (12c)

Now that we have exported the views from the old environment, here are the things we need to do to import them into the new one:

  1. Log into the machine on which you have the new Oracle domain.

  2. Create a folder there that will be used for the view migration work.

  3. Add the file migration.properties (this time, with the import function) to the created folder, which will be used to import the migrated views.

  4. Add the files generated in the previous step with the information about the exported views to the created folder (AttributesMapper.xml and Attributes.xml).

  5. Execute the ant script, which imports the views using the configuration provided in the migration.properties file.

migration.properties should be the same as the one in the previous step, only with the operationType being changed to IMPORT:

operationType = IMPORT
objectType = VIEW
name = ALL
user = <name_of_user>
group =
grantPermission = true
migrateAttributeLabel = false
override = true
skip = true
migrateToActiveVersion = false

The ant script file should be configured with attributes matching the new environment. There are some differences in directories between 11g and 12c installation, as I mentioned before, though; I highlight those below:

 ant -f $ORACLE_HOME/soa/bin/ant-t2p-worklist.xml 
-Dbea.home=$ORACLE_HOME
-Dsoa.home=$ORACLE_HOME/soa 
-Dmigration.properties.file=<path_to_created_folder_from_above>/migration.properties 
-Dsoa.hostname=<soa_server_node>
-Dsoa.rmi.port=<soa_server_port>
-Dsoa.admin.user=<user_with_admin_rights>
-Dsoa.admin.password=<password_of_above_user>
-Drealm=jazn.com 
-Dmigration.file=<path_to_created_folder_from_above>/Attributes.xml 
-Dmap.file=<path_to_created_folder_from_above>/AttributesMapper.xml

ant also comes with the installation of Oracle; here is the directory:

$ORACLE_HOME/oracle_common/modules/org.apache.ant_1.9.2/bin/ant

You can check the ant file, of course (ant-t2p-worklist.xml), to make sure you are setting the directories correctly.

Now, we are ready, and after executing the ant script, all views for the specified user in the migration.properties file should be imported to the new environment.

We need to do this whole procedure for every user for whom we need view migration... After getting used to the process, it will take around a minute or two to finish with one user, but it is still tedious work. Let me know if you have success with this or, even better, if you find a way to migrate all views for all users at the same time!

In addition, you can read more about migration to 12c for ADF SOA applications in these useful blogs:

I would appreciate you leaving a comment to share your opinion and experience on the topic.

Do you pay to use your database? What if your database paid you? Learn more with RavenDB.

Topics:
adf ,database ,migration ,user views ,tutorial ,11g ,12c

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}