If you have ever created a WebLogic Portal domain, you are aware that the Domain Wizard automatically creates your Portal Database schema. This is very nice if you are a developer or are new to the product, as it allows most anyone to create a fully functional Portal domain in minutes. However, this is not a long term solution for building out multiple environments with a repeatable and scripted process.

WebLogic Portal comes with all the necessary SQL scripts to create the required DB resources. However, it unfortunately does not provide clear documentation on how to leverage these scripts, nor does Oracle provide a master SQL script for executing the provided SQL scripts in the correct order.

I am going provide the steps to create this master SQL script for any supported WebLogic Portal DB. Also, I will provide the steps for the Oracle DB, you can easily adapt these for any supported DB. For the purpose of this blog I plan on using the following shortcut, so please adapt for your environment.

PORTAL_HOME - The wlportal_10.3 folder where you installed WebLogic Portal

  1. Create a local WebLogic Portal domain
  2. Find the file database.properties in the domain folder.
  3. Locate the value for the "files" property. It should look like this:
${env.WLPORTAL_HOME}/p13n/db/${database}/jdbc_index/jdbc.index,${env.WLPORTAL_HOME}/content-mgmt/db/${database}/jdbc_index/jdbc.index,${env.WLPORTAL_HOME}/portal/db/${database}/jdbc_index/jdbc.index.
  1. Find the three jdbc.index files in your PORTAL_HOME directory based off the relatives paths provided after the ${env.WLPORTAL_HOME} variable and replace the ${database} value with your applicable DB (one of the following: oracle, mysql, db2, sql_server, sybase).
  2. Create a new directory name portalSchema anywhere on machine
  3. Create new directories p13n/db, content-mgmt/db, and portal/db under portalSchema
  4. Create a file in portalSchema called master.sql
  5. Copy all the XML lines that start with element in each jdbc.index file into the file called master.sql (IMPORTANT: copy in the order of .index files specificied in step 3
  6. Do a search and replace on and replace with @. (The @. is Oracle specific, apply DB specific value here)
  7. Do a search and replace on "/> and replace with ""
  8. You should now have ~125 rows in the master.sql script looking similar to this:
    • @./p13n/db/oracle/seq_drop_tables.sql
  9. Copy the data and oracle folders from under PORTAL_HOME/p13n/db, PORTAL_HOME/content-mgmt/db, and PORTAL_HOME/portal/db to the corresponding sub folder in portalSchema

You now have a master SQL script that will create the required WebLogic Portal DB resources. The portalSchema directory can now be zipped up and provided to an environment team to create WebLogic Portal DB environments.

One caveate to this approach is that the security information stored in the database requires a hash for the password that is different with each domain. It is best to comment out all references to the resources Users, Groups, and GroupMembers and continue to maintain these as part of the domain creation.