This post was kindly contributed by Business Intelligence Notes for SAS® BI Users - go there to comment and to read the full post. |
When I think of corruption, it usually is more about government. Certainly, I don’t picture myself slipping a C-Note to the metadata server for favors, such as giving me special access or maybe ensuing my jobs have priority (wink). Stig Eide, a SAS BI administrator, reminds me that corruption does occur in the metadata – but not exactly what I was picturing. When metadata corruption occurs, he has found a way to make it easier on himself – mostly by controlling the metadata backup [no kroners required]. Better if I let him explain …
Get Control of Your Backup
You (or the platform administrator) has probably set up your site’s metadata server backup. In SAS Management Console 9.3, the metadata server does it by default – so that is great!
One problem you will find when you want to restore a backup, is that (by design, of course) it will restore everything to a specific point in time. But, what if the developers have made many changes that they would not like to lose? They only want to restore that one job that got corrupted? This is the most common scenario for restore requests, in my experience.
Export Changed Objects to Keep It Simple
In order to restore a single metadata object, you can set up a scheduled export of all the changed objects. That way, you can select the objects you want to restore.
SAS has made a tool for this, called the Batch Export and Import Tools. It creates SPK files, the same that you use when promoting content between environments. But, it works from the command line and it is available on all platforms since 9.2.
For Windows installations, the utility is called ExportPackage.exe. In UNIX installations, the utility is called ExportPackage.sh. Using the command line interface, you can better control what is exported from the metadata.
The command that I use to export all objects that have changed in the last month is as follows:
"D:\Program Files\SAS\SASPlatformObjectFramework\9.3\ExportPackage.exe" -host metadataserver -port 8561 -user sasadm@saspw -password pwd -objects / -types Job -modified -since "Current day of last month" -package "Jobs.spk" -log "Jobs.log"
You can find the documentation for this command here, but I will describe the parameters that I use:
Parameter |
Description |
-host |
Metadata server host name |
-port |
Metadata server port |
-user |
User that has permissions to read the metadata objects. If you export stored processes and want to include the physical files, you should use a “real” user, not sasadm. |
-password |
Password of the user |
-objects |
Top level folder that is exported. Use a “/” to indicate everything. |
-types |
Objects that you want to export. You can omit it, or specify a comma separated list, like this: Job,Cube,InformationMap,Report,ExternalFile,GeneratedTransform,StoredProcess |
-modified |
Specifies that you want the modified date to be used when evaluating the since criterion |
-since |
Period you want to export changed objects from. For example, I use “current day of last month”, which will export the same object many times, creating duplicates. But, it will be easier to find it later. |
-package |
Name of the SPK file that gets created. |
-log |
Log file name |
If you use this command to schedule the backup, you can be sure that you can restore a single object the next time something gets corrupted.
Restoring a Single Object from the Backup
After you have created your backup package, you are ready to restore an object when a user runs into trouble. Here’s how:
- Log in to SAS Management Console as a user with write permissions to the metadata object.
- Right-click on the top-level folder you specified in the Objects parameter in your package and select Import SAS package.
- Browse to the SPK file that was created by the backup process.
- In the Import SAS Package window, select Clear All and Collapse All. Then select the object you want to import.
- Complete the import and your issue is resolved.
Author Information
The post Admins – Need to Restore One Metadata Object from a Backup? appeared first on Business Intelligence Notes for SAS® BI Users. Written by Tricia Aanderud.
This post was kindly contributed by Business Intelligence Notes for SAS® BI Users - go there to comment and to read the full post. |