BI Tools

Tips and tricks for building information maps, OLAP cubes, reports, and dashboards

BI Admin

Learn your way around a SAS BI installation.

Visual Analytics

Learn your way around the SAS Visual Analytics tool

Coding & Data

Extract, transform, and load your data into the SAS BI toolset

Stored Processes

Create and design stored processes like a rock star

Home » BI Admin

Admins – Need to Restore One Metadata Object from a Backup?

Submitted by on 2013-03-11 – 10:48 AM

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: 

  1. Log in to SAS Management Console as a user with write permissions to the metadata object.
  2. Right-click on the top-level folder you specified in the Objects parameter in your package and select Import SAS package.

metadata_backup_01

  1. Browse to the SPK file that was created by the backup process.

metadata_backup_02

  1. In the Import SAS Package window, select Clear All and Collapse All. Then select the object you want to import.

metadata_backup_03

  1. Complete the import and your issue is resolved.

Author Information

Stig Eide

 

Stig Eide works for KLP insurance as a platform administrator. He has many years of experience with SAS EBI and DI from an administrators perspective. He holds the highest possible “Certified Platform Administrator for SAS 9”, Level 4. In addition, he considers himself an expert in BASE coding 😉

 

Learn all about SAS BI

You can learn more about SAS Business Intelligence from the "SAS BI Bible." Take a peek inside the Building Business Intelligience with SAS book.

 

The following two tabs change content below.

Tricia Aanderud

Director of Data Visualization at Zencos Consulting
Tricia Aanderud is a SAS Business Intelligence and Visual Analytics consultant based in Raleigh, NC who works for Zencos Consulting. She has written several books about SAS, presented papers at many SAS conferences, and has been using SAS since 2001. Contact her for assistance with your next project.
Spread the love

Tags: