The SAS Metadata Server holds all of the metadata for a given SAS EBI installation.
- For most SAS administrators, the sole view into the Metadata Server is through SAS Management Console. This is a very limited perspective out of the box, as much of the metadata is not surfaced by default in the Management Console.
- For most SAS programmers, the view into the Metadata Server is through tools such as Data Integration Studio or Enterprise Guide. These BI tools are useful, but like SAS Management Console, they come with limitations in surfacing the entirety of the metadata.
- Seasoned SAS programmers may also have experience interacting with the Metadata Server using programming commands such as METABROWSE and METAFIND.
In fact, there is a METABROWSE and METAFIND tool built into Foundation SAS. METABROWSE and METAFIND are the key to a deeper review of the metadata, but they do not offer edit or delete functions that may be needed by SAS administrators in managing metadata.
Problem: Finding and editing deeply-nested metadata
Recently a FQDN change within a client domain was ordered that directly impacted the EBI environment I manage and administer. SAS 9.2 (latest releases only) and SAS 9.3 come bundled with a handy host renaming tool for situations just like these. However, the client was working under an earlier version of SAS 9.2, so the tool was not available and a manual update of the hostname was required across all SAS servers and throughout the SAS Metadata Server.
Can this tedious task be accomplished? Only if you have the SAS EBI Metadata Utility or you enable editing with the METABROWSE tool in Foundation SAS!
Dozens of hard-coded hostname references are located in easily edited, flat configuration (mostly .xml, .config, and .ini) files on the server, and others are located directly in metadata that is easy to view and update using nodes and trees within the SAS Management Console standard plug-ins. However, many other hostname references are buried in metadata field properties that don't surface by default in the Console.
Important:If you don't find and update all hostname references, the SAS applications (particularly the web applications) are subject to failure. Either they don't start, or they start but crash with errors.
In this post, I want to introduce you to metadata editing using the METABROWSE and METAFIND tools within Foundation SAS as well as the Metadata Utility within SAS Management Console.
It can be difficult and tedious to locate objects (and their attributes) that are three or four levels deep in the metadata trees using the Metadata Utility because you must query by ID. For this reason, if you’ve a lot of metadata to update (especially when you’re not sure exactly where the object may be located), it’s better to use the METABROWSE tool within Foundation SAS if you have access.
Method One: Using the METABROWSE tool within Foundation SAS to identify and edit metadata.
Note: METABROWSE can be executed with BASE SAS programming, but since I'm addressing SAS administrators, I'll focus on using the built-in METABROWSE tool within SAS Foundation.
- Open a session of Foundation SAS.
- Open the METABROWSE tool (Solutions→Accessories→Metadata Browser). You will be prompted for your SAS credentials.
- The Metadata Browser window will display a metadata tree and attributes.
- Once you are successfully logged into the METABROWSE tool, open the Explorer tool to enable EDIT mode (Tools→Options→Explorer).
Note: You must have the METABROWSE tool window open to do this.
- Enable browsing in EDIT mode by unchecking the radio box on the General tab of the Explorer labeled ‘Metadata Browse Mode’.
- Switch back to the METABROWSE tool window. You can now select fields for editing. For example, you can expand the ServerComponent Tree, browse through the various SAS Server Components and change their properties, including hostname.
Method Two: Using the Metadata Utility within SAS Management Console to identify and edit metadata.
- By default, the Metadata Utility in SAS 9.2 is disabled. You must move the omitoolsmc dir up from the SAS Management Console plugins advanced folder in your installed directory on the file system (Note:Typically at Program Files/SAS/SAS Management Console/SAS_version#/plugins/advanced) to the SAS Management Console plugins folder and restart SAS Management Console to enable the Metadata Utility.
- Open the Metadata Utility (Tools→XML Metadata Interface).
- The top of the Metadata Utility is comprised of radio checkboxes and dropdown selectors that are used to narrow the scope of your browsing or enable special options. The bottom of the Metadata Utility has an XML input field used to enter search or update strings and an output field that displays the results of your search, update, or delete action.Once the Metadata Utility is open, click on the Get Metadata Objects tab. To edit or delete metadata for a metadata object, you must must know the metadata ID associated with the object. (You can skip this step if you’ve obtained the metadata ID through other means).
For our example, we will edit a hostname associated with a Server Component object. Select ServerComponent from the object type dropdown and click on the Execute button.
- A list of all Server Component objects registered in the Metadata Server is displayed along with their IDs. Select and copy the entire line that references the server Component object you wish to query for editing (including the <>, signs).
- Paste the XML line into the Input XML: box. Clear the Output XML: box using the Clear button on the right side of the Output XML:box. Switch to the Get Metadata tab and click the Execute button. Detailed property results are displayed in the Output XML: box for this object. The attributes of the object are displayed in the Output XML: box. One of these properties is the machine Id and hostname (labeled Name in our graphic and redacted for security).
- Clear the contents of the Input XML: box using the Clear button on the right side of the Input XML: box. Select, copy, and paste the entirety of the Output XML: box contents into the Input XML:box. Note:If you fail to copy part of the attribute list, the object can become irreversibly corrupted within the Metadata Server. Carefully edit the attribute lines you wish to update.
- Switch to the Update Metadata tab and click on the Execute button. The updated metadata should appear in the Output XML: box. It should match the Input XML: box exactly.
For further verification, you can switch back to the Get Metadata tab and perform another query for the Server Component object you just edited, checking the Output XML: box for the correct values.
In SAS 9.2, the SAS Deployment Manager can also be used to correct an issue cause by a change in the FQDN. Read an Overview of Updating Host Name References for more information on this topic.
2 Comments
Hi Jennifer,
Thanks for posting such useful information. Personaly, I didn't know about the METAFIND tool until now so I am really grateful. The doc also mentions a third one, METACON (a font-end GUI to manage the Metadata Connection Profiles used by Metabrowser and Metafind) :
http://support.sas.com/documentation/cdl/en/lrmeta/63180/HTML/default/viewer.htm#n19pqa08iiu0c2n1l8ulhp7z7jj4.htm
A few comments:
- It seems (and remains officially unconfirmed) that the Metabrowser edit mode requires to be logged in as "sasadm@saspw". No other accounts, even Unrestricted users, *would* be allowed to be given modification privilege with the Metabrowser. The 'browse mode' is available to every other accounts.
- changing a single value with the Metabrowser is sometimes useful, even required in order to perform post-installation tasks with some HotFixes. However, since (as far as I know) the metabrowser doesn't log its transactions or return codes, I' rather advise the admins to write down a little sas code instead when the query modifies several metadata objects. It helps to track down the error, think up twice before running the code and record somewhere the modification once applied.
- the metadata utility is especially helpful as a OMI XML generating tool. The OMI requests in plain XML are easily generated with a few clicks. Great. But, I remember the same tool back in 9.1 used to carry out large queries against the referential made crash without notice the metadata server (on Windows). No errors or warning left in the metadata server log file or even in the server log (metadata running as a windows service) . So I strongly advise the potential users to run this tool only in sandboxed or private Metadata installments, never in a production area. The authors have wisely put this warning message which pops up when you open the Metadata utility 'Manipulation of repository metadata using the XML Metadata Interface is an advanced feature that could result in inacessible or invalid metadata". This is real warning, not a formal disclaimer of responsibility.
Ronan
Reply from Jennifer Parks
I am able to utilize the Metabrowse tool using my SAS Administrator account (which is part of the SAS Administrators group in our 9.2 installation but not an unrestricted user).
As i noted at the beginning of the post, I'm writing toward the perspective of a SAS Administrator, versus a SAS Programmer and so I wanted to focus on non-programmatic approaches. Many SAS Administrators (such as myself) have a background in system and application administration and are not SAS programmers.
I agree with you about the tremendous power that is vested in the Metadata Utility and that its use should be highly limited in production environments and monitored carefully. The situation that I presented - needing to update hundreds of hostnames buried inside the metadata in a production environment and lacking any other practical tools for doing so - is one such instance where the tool is the best choice for making these changes.