- DC=myco,DC=com
- DC=corp,DC=myco,DC=com
- DC=dev,DC=myco,DC=com
- DC=acquiredco,DC=com
The customer would like to consolidate all of these naming contexts into a unified naming context of "DC=myco,DC=com" for all database entries. In the past, this could be accomplished through a variety of means but all were fraught with a certain degree of risk and complications. However, there is a new manage_tns tool available that handles this use case quite effortlessly. Here is how to accomplish this objective in seven steps with manage_tns:
Step 1: Install python3-ldap and the manage_tns tool on to a Linux host
sudo install python3-ldap
cd /u01
curl -so manage_tns.sh https://raw.githubusercontent.com/oudlabs/manage_tns/refs/heads/main/manage_tns.sh
chmod 0700 manage_tns.sh
cd /u01
curl -so manage_tns.sh https://raw.githubusercontent.com/oudlabs/manage_tns/refs/heads/main/manage_tns.sh
chmod 0700 manage_tns.sh
Step 2: Backup the primary naming context
/u01/manage_tns.sh export -h <dshost> -p <ldaps_port> -f tnsnames.ora --suffix "DC=myco,DC=com"
/u01/manage_tns.sh export -h <dshost> -p <ldaps_port> -f tnsnames.ora --suffix "DC=myco,DC=com"
Step 3: Export the database entries from all other naming contexts
/u01/manage_tns.sh export -h <dshost> -p <ldaps_port> -f tnsnames-corp.ora --suffix "DC=corp,DC=myco,DC=com"
/u01/manage_tns.sh export -h <dshost> -p <ldaps_port> -f tnsnames-dev.ora --suffix "DC=dev,DC=myco,DC=com"
/u01/manage_tns.sh export -h <dshost> -p <ldaps_port> -f tnsnames-other.ora --suffix "DC=acquiredco,DC=com"
/u01/manage_tns.sh export -h <dshost> -p <ldaps_port> -f tnsnames-dev.ora --suffix "DC=dev,DC=myco,DC=com"
/u01/manage_tns.sh export -h <dshost> -p <ldaps_port> -f tnsnames-other.ora --suffix "DC=acquiredco,DC=com"
Step 4: Load the exported database entries into the primary naming context
/u01/manage_tns.sh load -h <dshost> -p <ldaps_port> -D <tns_admin_dn> -f tnsnames-corp.ora --suffix "DC=myco,DC=com"
/u01/manage_tns.sh load -h <dshost> -p <ldaps_port> -D <tns_admin_dn> -f tnsnames-dev.ora --suffix "DC=myco,DC=com"
/u01/manage_tns.sh load -h <dshost> -p <ldaps_port> -D <tns_admin_dn> -f tnsnames-other.ora --suffix "DC=myco,DC=com"
/u01/manage_tns.sh load -h <dshost> -p <ldaps_port> -D <tns_admin_dn> -f tnsnames-dev.ora --suffix "DC=myco,DC=com"
/u01/manage_tns.sh load -h <dshost> -p <ldaps_port> -D <tns_admin_dn> -f tnsnames-other.ora --suffix "DC=myco,DC=com"
Step 5: Update client references to the new naming context in ldap.ora and JDBC connect lookups
Example of ldap.ora:
DEFAULT_ADMIN_CONTEXT = "DC=myco,DC=com"
Example of jdbc reference:
"jdbc:oracle:thin:@ldaps:<ds_host>:<ldaps_port>/<db_alias>,cn=OracleContext,DC=myco,DC=com"
Step 6: Obtain a list of all of the database entries from the legacy naming context
/u01/manage_tns.sh list -h <dshost> -p <ldaps_port> --suffix "DC=acquiredco,DC=com"
Step 7: Un-register database entries from the old contexts once you are certain that clients are no long referencing the old contexts
/u01/manage_tns.sh unregister -n <db_alias> -h <dshost> -p <ldaps_port> -f tnsnames-corp.ora --suffix "DC=corp,DC=myco,DC=com"
I hope you found this information helpful and insightful.
Blessings!

No comments:
Post a Comment