{"id":21853,"date":"2023-01-28T12:51:16","date_gmt":"2023-01-28T11:51:16","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/?p=21853"},"modified":"2025-10-24T09:38:32","modified_gmt":"2025-10-24T07:38:32","slug":"a-quick-repository-creation-utility-part-iv","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/","title":{"rendered":"A quick repository creation utility (part IV)"},"content":{"rendered":"\n<p>This is part IV of the article, see here for Part I <a href=\"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-i\/\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>, Part II <a href=\"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-ii\/\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>, and Part III <a href=\"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iii\/\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Instantiating a new docbase<\/h3>\n\n\n\n<p>See <a href=\"https:\/\/github.com\/dbiservices\" target=\"_blank\" rel=\"noreferrer noopener\">dbi services<\/a> for the script&#8217;s source.<\/p>\n\n\n\n<p>Roughly speaking, the instantiation process uncompresses a seed, or model, docbase from its compressed tar ball and runs the Migration Utility against it to adapt its name and id. Those actions are performed by the script <code>instantiate_docbase.sh<\/code>. Its usage is:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; gutter: false; title: ; notranslate\" title=\"\">\n$ instantiate_docbase.sh seed_repo new_repo\n<\/pre><\/div>\n\n\n<p>where <em>seed_repo<\/em> and <em>new_repo<\/em> are stems pointing to the settings of the respective docbase defined in the <code>global_parameters<\/code> file. The easy-to-remember syntax is the same as that of the <code>cp<\/code> command, for a similar concept.<\/p>\n\n\n\n<p>Instantiation is always performed locally so if it needs to be done on a machine different from the one where the model docbase was created, the new machine needs first to be enrolled (see script <code>pre-requisites.sh<\/code>) and the script invoked from there.<\/p>\n\n\n\n<p>The procedure looks in the <code>${DOCUMENTUM}<\/code> tree and changes all the references to the seed docbase so they match the target docbase, including the settings such as port numbers, docbroker names, host names, http server memory sizing, sym links, etc, and then tackles the metadata\u2019s big part. For this to be successful, make sure the seed docbase\u2019s definition in the <code>global_parameter<\/code> file has not changed and still matches its installation in the compressed tar ball.<\/p>\n\n\n\n<p>For an Oracle RDBMS, a new schema is created with the required tablespaces and grants, the dump file that was produced by the <code>exp<\/code> utility is copied onto the database\u2019s host, slightly edited (references to the seed\u2019s schema are changed to the new instance\u2019s schema) and imported into the new schema. Next, as the creation of some views\u2019 fails with \u201c<code>IMP-00008: unrecognized statement in the export file:<\/code>\u201d errors, the view creation statements (almost 1000 of them) are extracted from the dump file (although this is a binary file, the SQL statements it contains can be extracted as text and edited), corrected and re-executed separately, as shown here:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; gutter: false; highlight: [2,10]; title: ; notranslate\" title=\"\">\n# extract the view creation statements from export file and create the views;\nstrings ${seed_dmp_file} | sed -r &#039;s\/^&#x5B; \\t\\$]*(\\(*)(SELECT)(.+)\/\\1\\2\\3\/I&#039; | gawk &#039;{if (sub(\/^CREATE VIEW \/, &quot;CREATE or REPLACE VIEW &quot;, \\$0)) {print; getline; pos = 2000; if (length(\\$0) &gt; pos) {while (substr(\\$0, --pos, 1) != &quot;,&quot;); print substr(\\$0, 1, pos); print substr(\\$0, pos + 1)}else print; print &quot;\/&quot;}}END{print &quot;quit&quot;}&#039; &gt;&gt; create_views.sql\n\n# count the views to be created;\ngrep &quot;CREATE or REPLACE VIEW&quot; create_views.sql | wc -l\n# 977 in CS 22.2;\n# 983 in CS 22.4;\n\n# create the views;\nsqlplus ${ACTIVE_DATABASE_OWNER}\/${ACTIVE_DATABASE_PASSWORD}@${db_remote_connect_string} @create_views.sql\n<\/pre><\/div>\n\n\n<p>The view text needs to be reformatted to work around the weird legacy format of the dump file.<\/p>\n\n\n\n<p>For good measure, all the new schema\u2019s compilable objects are recompiled and the schema\u2019s statistics computed. A verification of the schema&#8217;s object validity is performed:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: sql; gutter: false; highlight: [6,7]; title: ; notranslate\" title=\"\">\nset echo on\nset pagesize 10000\nset linesize 100\ncol object_name format a30\ncol object_type format a30\nselect object_name, object_type from user_objects where status = &#039;INVALID&#039;;\nselect object_name, object_type, status from user_objects;\nquit\neoq\n# output:\nno rows selected\nOBJECT_NAME                    OBJECT_TYPE                    STATUS\n------------------------------ ------------------------------ -------\nD_1F00271080000195             INDEX                          VALID\nD_1F00271080000241             INDEX                          VALID\nDMI_CHANGE_RECORD_S            TABLE                          VALID\nD_1F002710800001A8             INDEX                          VALID\nDMI_DD_ATTR_INFO_R             TABLE                          VALID\n...\nDM_INDEXES                     VIEW                           VALID\nDM_RESYNC_DD_ATTR_INFO         VIEW                           VALID\nDM_RESYNC_DD_TYPE_INFO         VIEW                           VALID\nDMI_DD_ATTR_INFO_DDEN          VIEW                           VALID\n\n1931 rows selected.\n<\/pre><\/div>\n\n\n<p>For a PostgreSQL RDBMS, things are much less complicated. The server port is adapted and the server started. Next, the names of the schema, database and user are adapted and the ownership of each of the schema\u2019s objects is displayed as a verification. Example of output:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: sql; gutter: false; highlight: [6,13,16,18,20,21,22,24,29,46,51]; title: ; notranslate\" title=\"\">\n  datname  \n-----------\n postgres\n template1\n template0\n repo02\n(4 rows)\n\n                                   List of roles\n Role name |                         Attributes                         | Member of \n-----------+------------------------------------------------------------+-----------\n dmadmin   | Superuser, Create role, Create DB, Replication, Bypass RLS | {}\n repo02    | No inheritance                                             | {}\n\nYou are now connected to database &quot;repo02&quot; as user &quot;dmadmin&quot;.\nALTER SCHEMA\nYou are now connected to database &quot;postgres&quot; as user &quot;dmadmin&quot;.\nALTER DATABASE\nNOTICE:  MD5 password cleared because of role rename\nALTER ROLE\nALTER ROLE\nALTER ROLE\n\nYou are now connected to database &quot;repo03&quot; as user &quot;repo03&quot;.\n                                   List of roles\n Role name |                         Attributes                         | Member of \n-----------+------------------------------------------------------------+-----------\n dmadmin   | Superuser, Create role, Create DB, Replication, Bypass RLS | {}\n repo03    | No inheritance                                             | {}\n\n current_user \n--------------\n repo03\n(1 row)\n\n                                                version                                                \n-------------------------------------------------------------------------------------------------------\n PostgreSQL 15.1 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, 64-bit\n(1 row)\n\n  datname  \n-----------\n postgres\n template1\n template0\n repo03\n(4 rows)\n\n schemaname |              objectname               | len | objectowner | objecttype \n------------+---------------------------------------+-----+-------------+------------\n repo03     | adm_turbo_size                        |  14 | repo03      | TABLE\n repo03     | creation_date_message_id_ui           |  27 | repo03      | INDEX\n repo03     | d_1f00271280000001                    |  18 | repo03      | INDEX\n repo03     | d_1f00271280000002                    |  18 | repo03      | INDEX\n...\n repo03     | dm_federation_log                     |  17 | repo03      | TABLE\n repo03     | dm_federation_r                       |  15 | repo03      | TABLE\n repo03     | dm_federation_rp                      |  16 | repo03      | VIEW\n repo03     | dm_federation_rv                      |  16 | repo03      | VIEW\n repo03     | dm_federation_s                       |  15 | repo03      | TABLE\n...\n repo03     | status_no_idx                         |  13 | repo03      | INDEX\n(1932 rows)\n<\/pre><\/div>\n\n\n<p>The above output shows the <code>repo03<\/code> account and its roles, a database named <code>repo03<\/code> and docbase&#8217;s objects owned by user <code>repo03<\/code>. Also, <code>repo03<\/code> was instantiated from <code>repo02<\/code> as the seed.<\/p>\n\n\n\n<p>As for Oracle, the connectivity is also adapted here but instead of the SQL*Net\u2019s <code>tnsnames.ora<\/code>, the installation owner\u2019s <code>~\/.odbc.ini<\/code> file is adapted to match the target docbase\u2019s settings and the reference to it in the <code>server.ini<\/code> file is adapted too. To accommodate instantiation concurrency,  the file <code>~\/.odbc.ini<\/code> must be protected against simultaneous editions by a mutex. We apply the simple trick based on the atomicity of the <code>mkdir<\/code> command:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; gutter: false; highlight: [5,8,17]; title: ; notranslate\" title=\"\">\n   bodbc_done=0\n   mutex=\/tmp\/odbc_mutex_in_instantiate_docbase\n   mutext_iterations=10\n   while &#x5B;&#x5B; ${mutext_iterations} -gt 0 ]]; do\n      if mkdir ${mutex}; then\n         # edit ~\/.odbc.ini\n...\n         rmdir ${mutex}\n         bodbc_done=1\n         break\n      else\n         sleep 1\n         ((mutext_iterations--))\n      fi\n   done\n   if &#x5B;&#x5B; ${bodbc_done} -ne 1 ]]; then\n      echo &quot;could not get a mutex on ~\/.odbc.ini, aborting current instance of $0 ...&quot;\n      exit 1\n   fi\n<\/pre><\/div>\n\n\n<p>So, the script attempts to get the mutex for up to 20s, which should be enough as the editions are very fast. That concludes the RDBMS part.<\/p>\n\n\n\n<p>The new instance\u2019s password is also saved using the documentum\u2019s <code>dm_encrypt_password<\/code> utility, and tested using <code>dmdbtest<\/code>. At this point, the Migration Utility step can be started.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">The Migration Utility<\/h4>\n\n\n\n<p>The Migration Utility is located in <code>${DOCUMENTUM}\/product\/22.2\/install\/external_apps\/MigrationUtil<\/code>. This tool takes its instructions from the xml configuration file <code>${DM_HOME}\/install\/external_apps\/MigrationUtil\/config.xml<\/code>. The following relevant attributes\u2019 values are edited to match the target docbase\u2019s settings:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>the type of RDBMS, the listener\u2019s (for Oracle) or the server\u2019s port (for PostgreSQL)<\/li>\n\n\n\n<li>the database host name<\/li>\n\n\n\n<li>the install owner\u2019s password<\/li>\n\n\n\n<li>the docbase\u2019s name and database\u2019s password<\/li>\n\n\n\n<li>the old and new docbase ids<\/li>\n\n\n\n<li>the new docbase server name (this is not a machine name but the server object\u2019s one in <code>dm_server_config<\/code>)<\/li>\n\n\n\n<li>the docbase\u2019s machine name<\/li>\n\n\n\n<li>the installation owner\u2019s name<\/li>\n<\/ul>\n\n\n\n<p>Here is an example of the config.xml file generated while instantiating <code>repo02<\/code> into <code>bookstore<\/code>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: xml; gutter: false; title: ; notranslate\" title=\"\">\n&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\n&lt;!DOCTYPE properties SYSTEM &quot;http:\/\/java.sun.com\/dtd\/properties.dtd&quot;&gt;\n&lt;properties&gt;\n   &lt;comment&gt;Database connection details&lt;\/comment&gt;\n   &lt;entry key=&quot;dbms&quot;&gt;postgres&lt;\/entry&gt; &lt;!-- This would be either sqlserver, oracle, db2 or postgres --&gt;\n   &lt;entry key=&quot;tgt_database_server&quot;&gt;localhost&lt;\/entry&gt; &lt;!-- Database Server host or IP --&gt;\n   &lt;entry key=&quot;port_number&quot;&gt;6000&lt;\/entry&gt; &lt;!-- Database port number --&gt;\n   &lt;entry key=&quot;InstallOwnerPassword&quot;&gt;dmadmin&lt;\/entry&gt;\n   &lt;entry key=&quot;isRCS&quot;&gt;no&lt;\/entry&gt; &lt;!-- set it to yes, when running the utility on secondary CS --&gt;\n   &lt;entry key=&quot;TomcatPath&quot;&gt;&lt;\/entry&gt; &lt;!-- Optional. set it to appropriate tomcat path if DM_JMS_HOME environment variable is not set --&gt;\n   &lt;!-- &lt;comment&gt;List of docbases in the machine&lt;\/comment&gt; --&gt;\n   &lt;entry key=&quot;DocbaseName.1&quot;&gt;repo02&lt;\/entry&gt;\n   &lt;entry key=&quot;DocbaseName.2&quot;&gt;Docbase2&lt;\/entry&gt;\n   &lt;entry key=&quot;DocbaseName.3&quot;&gt;&lt;\/entry&gt;\n   &lt;!-- &lt;comment&gt;docbase owner password&lt;\/comment&gt; --&gt;\n   &lt;entry key=&quot;DocbasePassword.1&quot;&gt;bookstore&lt;\/entry&gt;\n   &lt;entry key=&quot;DocbasePassword.2&quot;&gt;Docbase owner password2&lt;\/entry&gt;\n   &lt;entry key=&quot;DocbasePassword.3&quot;&gt;&lt;\/entry&gt;\n   &lt;entry key=&quot;ChangeDocbaseID&quot;&gt;yes&lt;\/entry&gt; &lt;!-- To change docbase ID or not --&gt;\n   &lt;entry key=&quot;Docbase_name&quot;&gt;repo02&lt;\/entry&gt; &lt;!-- has to match with DocbaseName.1 --&gt;\n   &lt;entry key=&quot;NewDocbaseID&quot;&gt;20000&lt;\/entry&gt; &lt;!-- New docbase ID --&gt;\n   &lt;entry key=&quot;ChangeServerName&quot;&gt;yes&lt;\/entry&gt;\n   &lt;entry key=&quot;NewServerName.1&quot;&gt;bookstore&lt;\/entry&gt;\n   &lt;entry key=&quot;NewServerName.2&quot;&gt; &lt;\/entry&gt;\n   &lt;entry key=&quot;ChangeDocbaseName&quot;&gt;yes&lt;\/entry&gt;\n   &lt;entry key=&quot;NewDocbaseName.1&quot;&gt;bookstore&lt;\/entry&gt;\n   &lt;entry key=&quot;NewDocbaseName.2&quot;&gt; &lt;\/entry&gt;\n   &lt;entry key=&quot;ChangeHostName&quot;&gt;no&lt;\/entry&gt;\n   &lt;entry key=&quot;HostName&quot;&gt;Old Host name &lt;\/entry&gt;\n   &lt;entry key=&quot;NewHostName&quot;&gt;New Host name &lt;\/entry&gt;\n   &lt;entry key=&quot;ChangeInstallOwner&quot;&gt;no&lt;\/entry&gt;\n   &lt;entry key=&quot;InstallOwner&quot;&gt;Old Install Owner &lt;\/entry&gt;\n   &lt;entry key=&quot;NewInstallOwner&quot;&gt; New Install Owner &lt;\/entry&gt;\n   &lt;entry key=&quot;NewInstallOwnerPassword&quot;&gt;New Install Owner password &lt;\/entry&gt;\n   &lt;entry key=&quot;DockerSeamlessUpgrade&quot;&gt;no&lt;\/entry&gt;\n   &lt;entry key=&quot;PrimaryHost&quot;&gt;Primary Host name &lt;\/entry&gt;\n   &lt;entry key=&quot;SecondaryHost&quot;&gt;Secondary Host name &lt;\/entry&gt;\n   &lt;entry key=&quot;PrimaryServerConfig&quot;&gt;Primary Server name &lt;\/entry&gt;\n   &lt;entry key=&quot;SecondaryServerConfig&quot;&gt;Secondary Server name &lt;\/entry&gt;\n   &lt;entry key=&quot;DocbaseService&quot;&gt;Docbase Service name &lt;\/entry&gt;\n&lt;\/properties&gt;\n<\/pre><\/div>\n\n\n<p>Since the Migration Utility is a java application, it uses JDBC to connect to the database; thus, prior to launching it, a JDBC connection to the database is attempted in order to check the connectivity parameters. To this effect, a simple but generic utility has been specially written for this project, <code>jdbc_tester_generic.java<\/code> (see article <a href=\"https:\/\/www.dbi-services.com\/blog\/a-generic-jdbc-tester-part-i\/\" target=\"_blank\" rel=\"noreferrer noopener\">A Generic JDBC Tester<\/a>), located in <code>${scripts_dir}<\/code>. Its usage is:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; gutter: false; highlight: [1,3,5,21,25,41,42]; title: ; notranslate\" title=\"\">\n$ java -cp jdbc_driver_jar:path_to_the_tester jdbc_tester_generic jdbc_driver user_name password jdbc_url sql_statement\n\n# Example for a PostgreSQL database:\n$ export CLASSPATH=${dctm_software}\/${postgresql_jdbc_package}:$CLASSPATH\n$ java -cp $CLASSPATH:${scripts_dir} jdbc_tester_generic org.postgresql.Driver dmadmin xxx jdbc:postgresql:\/\/localhost:6000\/bookstore &quot;select &#039;now in postgresql db: &#039; || to_char(current_timestamp(0), &#039;DD\/MM\/YYYY HH24:MI:SS&#039;) as now;&quot;\nThe command-line parameters are:\narg 0 = org.postgresql.Driver\narg 1 = dmadmin\narg 2 = xxx\narg 3 = jdbc:postgresql:\/\/localhost:6000\/bookstore\narg 4 = select &#039;now in postgresql db: &#039; || to_char(current_timestamp(0), &#039;DD\/MM\/YYYY HH24:MI:SS&#039;) as now;\nLoading driver &#x5B;org.postgresql.Driver]:\nJDBC Driver org.postgresql.Driver successfully loaded\nConnecting to url &#x5B;jdbc:postgresql:\/\/localhost:6000\/bookstore] as user &#x5B;dmadmin]:\nSuccessful connection to database\nExecuting SQL query &#x5B;select &#039;now in postgresql db: &#039; || to_char(current_timestamp(0), &#039;DD\/MM\/YYYY HH24:MI:SS&#039;) as now;]:\nRetrieving the result set:\nnow in postgresql db: 08\/01\/2023 19:00:53\nJDBC connection successfully tested, quitting ...\n\n# Example for an Oracle database;\n$ ln -s ${ORACLE_HOME}\/ojdbc8.jar ${ORACLE_HOME}\/ojdbc.jar\n$ export CLASSPATH=${ORACLE_HOME}\/ojdbc.jar:$CLASSPATH\n# using Oracle thin:\n$ java -cp $CLASSPATH:${scripts_dir} jdbc_tester_generic oracle.jdbc.driver.OracleDriver seed seed jdbc:oracle:thin:@\/\/db:1521\/pdb1 &quot;select &#039;now in Oracle db: &#039; || to_char(sysdate, &#039;DD\/MM\/YYYY HH24:MI:SS&#039;) as now from dual&quot;\nThe command-line parameters are:\narg 0 = oracle.jdbc.driver.OracleDriver\narg 1 = seed\narg 2 = seed\narg 3 = jdbc:oracle:thin:@\/\/db:1521\/pdb1\narg 4 = select &#039;now in Oracle db: &#039; || to_char(sysdate, &#039;DD\/MM\/YYYY HH24:MI:SS&#039;) as now from dual\nLoading driver &#x5B;oracle.jdbc.driver.OracleDriver]:\nJDBC Driver oracle.jdbc.driver.OracleDriver successfully loaded\nConnecting to url &#x5B;jdbc:oracle:thin:@\/\/db:1521\/pdb1] as user &#x5B;seed]:\nSuccessful connection to database\nExecuting SQL query &#x5B;select &#039;now in Oracle db: &#039; || to_char(sysdate, &#039;DD\/MM\/YYYY HH24:MI:SS&#039;) as now from dual]:\nRetrieving the result set:\nnow in Oracle db: 08\/01\/2023 18:51:51\nJDBC connection successfully tested, quitting \u2026\n\n# using Oracle thick, OCI-based drivers and the SQL*Net alias:\n$ java -cp $CLASSPATH:${scripts_dir} jdbc_tester_generic oracle.jdbc.driver.OracleDriver seed seed jdbc:oracle:oci:@pdb1 &quot;select &#039;now in Oracle db: &#039; || to_char(sysdate, &#039;DD\/MM\/YYYY HH24:MI:SS&#039;) as now from dual&quot;\n\nThe command-line parameters are:\narg 0 = oracle.jdbc.driver.OracleDriver\narg 1 = seed\narg 2 = seed\narg 3 = jdbc:oracle:oci:@pdb1\narg 4 = select &#039;now in Oracle db: &#039; || to_char(sysdate, &#039;DD\/MM\/YYYY HH24:MI:SS&#039;) as now from dual\nLoading driver &#x5B;oracle.jdbc.driver.OracleDriver]:\nJDBC Driver oracle.jdbc.driver.OracleDriver successfully loaded\nConnecting to url &#x5B;jdbc:oracle:oci:@pdb1] as user &#x5B;seed]:\nSuccessful connection to database\nExecuting SQL query &#x5B;select &#039;now in Oracle db: &#039; || to_char(sysdate, &#039;DD\/MM\/YYYY HH24:MI:SS&#039;) as now from dual]:\nRetrieving the result set:\nnow in Oracle db: 08\/01\/2023 18:52:37\nJDBC connection successfully tested, quitting ...\n<\/pre><\/div>\n\n\n<p>This utility works for any RDBMS as long as its JDBC drivers are provided. Note how simpler the syntax for Oracle JDBC Thick is compared to Oracle Thin\u2019s or PosgreSQL\u2019s, as its required parameters are actually read from the <code>tnsnames.ora<\/code> using the service name as an index, which allows to reuse an existing configuration instead of extracting each required piece of information from it. Unfortunately, but understandably since it is Oracle-specific, it is not used by the Migration Utility in favor of the more universal, pure java one that works with any RDBMS.<\/p>\n\n\n\n<p>Finally, the Migration Utility is launched and the requested changes are performed. Each one has its own log file so it is easy to check them for any error. As an example, here is the log for the change docbase id step:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Reading config.xml from path: config.xmlReading server.ini parameters\nRetrieving server.ini path for docbase: repo02\nFound path: \/u01\/dctm\/bookstore\/documentum\/dba\/config\/repo02\/server.ini\nSet the following properties:\nDocbase Name:repo02\nDocbase ID:10002\nNew Docbase ID:20000\nDBMS: postgres\nDatabaseName: bookstore\nSchemaOwner: bookstore\nServerName: localhost\nPortNumber: 6000\nDatabaseOwner: bookstore\n-------- PostgreSQL JDBC Connection Testing ------\njdbc:postgresql:\/\/localhost:6000\/bookstore\nConnected to database\nUtility is going to modify Objects with new docbase ID\nFri Jan 06 13:52:47 UTC 2023\n-----------------------------------------------------------\nProcessing tables containing r_object_id column\n-----------------------------------------------------------\n-------- PostgreSQL JDBC Connection Testing ------\njdbc:postgresql:\/\/localhost:6000\/bookstore\nConnected to database\n-----------------------------------------------------------\nUpdate the object IDs of the Table: dm_replication_events with new docbase ID:4e20\n-----------------------------------------------------------\nProcessing objectID columns\n-----------------------------------------------------------\nGetting all ID columns from database\n-----------------------------------------------------------\nProcessing ID columns in each documentum table\nColumn Name: job_id\nUpdate the ObjectId columns of the Table: with new docbase ID\n-----------------------------------------------------------\nUpdate the object IDs of the Table: dm_state_extension_s with new docbase ID:4e20\n-----------------------------------------------------------\nProcessing objectID columns\n-----------------------------------------------------------\nGetting all ID columns from database\n-----------------------------------------------------------\nProcessing ID columns in each documentum table\nColumn Name: r_object_id\nUpdate the ObjectId columns of the Table: with new docbase ID\n...<\/code><\/pre>\n\n\n\n<p>where ID 4e20 is the hexadecimal representation of the bookstore\u2019s docbase id 20000. We can deduce that all the columns containing ids of all the tables of the <code>bookstore<\/code> schema are scanned for the old value as a substring and replaced with the new value as a substring. It is understandable that these changes can put quite a heavy load on the database and are quite touchy since any failure can corrupt its integrity. Hopefully, they are done in an efficient manner. However, in our case with an out of the box seed docbase, there are very few objects to change so this is not a concern and the utility completes very quickly.<\/p>\n\n\n\n<p>Although the resulting docbase is perfectly usable, the migration utility leaves lots of things unchanged, e.g. the <code>dm_location<\/code>\u2019s root directories on disk (they still contain the seed docbase\u2019s hexadecimal id), the name of the index tablespace (if Oracle is used), the ACLs\u2019 owner (i.e. the ACLs\u2019 <code>domain<\/code> is still the seed\u2019s database owner; this does not jeopardize the database but is not justified in an empty docbase; actually, by keeping them unchanged, potential applications that refer to <code>acl_domain<\/code>\/<code>object_name<\/code> pairs are protected), etc. Thus, the documentum services are started and a final corrective pass is executed to normalize all those remaining traces of the prior incarnation.<\/p>\n\n\n\n<p>A few jobs, such as the <code>dm_ContentWarning<\/code>, <code>dm_StateOfDocbase<\/code> and <code>dm_ConsistencyChecker<\/code>, are forced to be executed as soon as possible so some more post-instantiation checks can be done. The <code>db-crawler<\/code> script presented in the article <a href=\"https:\/\/www.dbi-services.com\/blog\/db-crawler-a-database-search-utility-for-documentum\/\" target=\"_blank\" rel=\"noreferrer noopener\">db-crawler, a database search utility for Documentum<\/a> is also launched in the background at the end against the Oracle schema to check if there are still remains of the former seed docbase. Likewise, for PostgreSQL schemas, the <code>pg_dump<\/code> utility is launched and the resulting text file is grepped for any occurrence of the former seed docbase which is basically what the <code>db-crawler<\/code> does, except much quicker.<\/p>\n\n\n\n<p>Like with <code>create_docbase.sh<\/code>, and for the same reason, multiple concurrent instantiations may be launched simultaneously, as follows:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; gutter: false; highlight: [1,7]; title: ; notranslate\" title=\"\">\n# Example:\nfor i in {1..10}; do\n   time .\/instantiate_docbase.sh SEED &quot;DCTM${i}&quot; &amp;amp;\ndone\nwhere SEED and DCTM1_* to DCTM10_* are the respective docbases&#039;s stem &quot;pointing&quot; to the settings defined in the global_properties file.\n\n# Another example:\n.\/instantiate_docbase.sh DCTM2 bookstore &amp;amp;\n.\/instantiate_docbase.sh SEED sales &amp;amp;\n.\/instantiate_docbase.sh PUBLICATIONS research_papers &amp;amp;\n<\/pre><\/div>\n\n\n<p>See Part V <a href=\"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-v\/\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to create a documentum repository in under a minute.<br \/>\nInstantiating a new docbase, the Migration Utility.<\/p>\n","protected":false},"author":40,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[525],"tags":[129,96,77],"type_dbi":[],"class_list":["post-21853","post","type-post","status-publish","format-standard","hentry","category-enterprise-content-management","tag-documentum","tag-oracle","tag-postgresql"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>A quick repository creation utility (part IV) - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"A quick repository creation utility (part IV)\" \/>\n<meta property=\"og:description\" content=\"How to create a documentum repository in under a minute. Instantiating a new docbase, the Migration Utility.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2023-01-28T11:51:16+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-10-24T07:38:32+00:00\" \/>\n<meta name=\"author\" content=\"Middleware Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Middleware Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/\"},\"author\":{\"name\":\"Middleware Team\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1\"},\"headline\":\"A quick repository creation utility (part IV)\",\"datePublished\":\"2023-01-28T11:51:16+00:00\",\"dateModified\":\"2025-10-24T07:38:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/\"},\"wordCount\":1214,\"commentCount\":0,\"keywords\":[\"Documentum\",\"Oracle\",\"PostgreSQL\"],\"articleSection\":[\"Enterprise content management\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/\",\"name\":\"A quick repository creation utility (part IV) - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"datePublished\":\"2023-01-28T11:51:16+00:00\",\"dateModified\":\"2025-10-24T07:38:32+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"A quick repository creation utility (part IV)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1\",\"name\":\"Middleware Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g\",\"caption\":\"Middleware Team\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/middleware-team\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"A quick repository creation utility (part IV) - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/","og_locale":"en_US","og_type":"article","og_title":"A quick repository creation utility (part IV)","og_description":"How to create a documentum repository in under a minute. Instantiating a new docbase, the Migration Utility.","og_url":"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/","og_site_name":"dbi Blog","article_published_time":"2023-01-28T11:51:16+00:00","article_modified_time":"2025-10-24T07:38:32+00:00","author":"Middleware Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Middleware Team","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/"},"author":{"name":"Middleware Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1"},"headline":"A quick repository creation utility (part IV)","datePublished":"2023-01-28T11:51:16+00:00","dateModified":"2025-10-24T07:38:32+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/"},"wordCount":1214,"commentCount":0,"keywords":["Documentum","Oracle","PostgreSQL"],"articleSection":["Enterprise content management"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/","url":"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/","name":"A quick repository creation utility (part IV) - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2023-01-28T11:51:16+00:00","dateModified":"2025-10-24T07:38:32+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/a-quick-repository-creation-utility-part-iv\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"A quick repository creation utility (part IV)"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d8563acfc6e604cce6507f45bac0ea1","name":"Middleware Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ddcae7ba0f9d1a0e7ae707f0e689e4a9c95bb48ec49c8e6d9cc86d43f4121cb6?s=96&d=mm&r=g","caption":"Middleware Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/middleware-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/21853","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=21853"}],"version-history":[{"count":16,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/21853\/revisions"}],"predecessor-version":[{"id":22217,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/21853\/revisions\/22217"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=21853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=21853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=21853"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=21853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}