Tuesday 13 September 2011

Maxl Overview

Maxl is a powerful command line language for controlling database settings, security and operations. Maxl has intellisense feature, so no need to remember complete syntax.

Maxl has two Domains

1) Maxl DDL (Data Definition Language)
2) Maxl DML (Data Manipulation Language) Known as MDX 

Maxl is a language, so it has its own grammar.

Verbs

Alter 
Ex:- alter application 'GShriPC' set lock_timeout after $lock_time seconds;

Create
Ex:- create application $newappname comment $comment_string;

Drop
Ex:-  drop application 'dbname' cascade force;

Display
Ex:-  display application 'dbname';
Grant
Ex:- grant designer on application 'dbname' to 'admin';

Maxl Script Editor 


Maxl Statement Elements

Keyword- intellisense (Word recognized by Maxl)
Each Maxl statement has combination of Keywords like.""

Strings- Strings are used in Maxl statements to represent the text of passwords, comments, member expressions, and calculation scripts and file references. Strings containing white space or special characters must be enclosed in single quotation marks.

Number- Value used for changing an Essbase database setting
          b=bytes, kb=kilobytes mb=megabytes
                  gb=gigabytes tb=terabytes
 
Special characters- Special characters like(. , ; $ + {} [] () | @ ) has its own meaning
    
Maxl Object Qualification


appname
Create application Test;
appname.dbname
Create application Test.GShriPC;
appname.dbname.objname
Create application Test.GShriPC.calcEast;

Cube Automation
 Step1-- Script for Loading Metadata

/* Creates log file */
spool on to 'C:\Practise\AutoMxl\Log\Dim.txt';

/* Logs in as Administrator */
login 'jim' 'password' on 'localhost';

/* Drops active connections, stops and starts applications */
alter system unload application 'GShriPCPR';
alter system load application 'GShriPCPR';

/* Copies shell app (GShriPCSH) and replaces then start Alloc_St  */
create or replace application 'GShriPCST' as 'GShriPCPR';
create or replace database 'GShriPCST' .'GShriPCSTD' comment 'Staging data';

/*alter application 'GShriPCST' load database 'GShriPCPR';*/
/*Reset Staging Application*/
alter database 'GShriPCST'.'GShriPCSTD' reset;

/* Load metadata into staging cube */
import database 'GShriPCST' .'GShriPCSTD' dimensions from text data_file 'C:\Practise\Metadata\Brand.txt' using rules_file
'C:\Practise\Metadata\Brand.rul' on error write to 'C:\e1.txt';
import database 'GShriPCST' .'GShriPCSTD' dimensions from text data_file 'C:\Practise\Metadata\Comparability.txt' using rules_file
'C:\Practise\Metadata\Comparability.rul' on error write to 'C:\e2.txt';
import database 'GShriPCST' .'GShriPCSTD' dimensions from text data_file 'C:\Practise\Metadata\Market.txt' using rules_file
'C:\Practise\Metadata\Market.rul' on error write to 'C:\e3.txt';
import database 'GShriPCST' .'GShriPCSTD' dimensions from text data_file 'C:\Practise\Metadata\Measures.txt' using rules_file
'C:\Practise\Metadata\Measures.rul' on error write to 'C:\e4.txt';
import database 'GShriPCST' .'GShriPCSTD' dimensions from text data_file 'C:\Practise\Metadata\Organisation.txt' using rules_file
'C:\Practise\Metadata\Organisation.rul' on error write to 'C:\e5.txt';
import database 'GShriPCST' .'GShriPCSTD' dimensions from text data_file 'C:\Practise\Metadata\Ownership.txt' using rules_file
'C:\Practise\Metadata\Ownership.rul' on error write to 'C:\e6.txt';

import database 'GShriPCST' .'GShriPCSTD' dimensions from text data_file 'C:\Practise\Metadata\Product.txt' using rules_file
'C:\Practise\Metadata\Product.rul' on error write to 'C:\e7.txt';
import database 'GShriPCST' .'GShriPCSTD' dimensions from text data_file 'C:\Practise\Metadata\Scenario.txt' using rules_file
'C:\Practise\Metadata\Scenario.rul' on error write to 'C:\e8.txt';
import database 'GShriPCST' .'GShriPCSTD' dimensions from text data_file 'C:\Practise\Metadata\Stock.txt' using rules_file
'C:\Practise\Metadata\Stock.rul' on error write to 'C:\e9.txt';
import database 'GShriPCST' .'GShriPCSTD' dimensions from text data_file 'C:\Practise\Metadata\Year.txt' using rules_file
'C:\Practise\Metadata\Year.rul' on error write to 'C:\e10.txt';
import database 'GShriPCST' .'GShriPCSTD' dimensions from text data_file 'C:\Practise\Metadata\view.txt' using rules_file
'C:\Practise\Metadata\view.rul' on error write to 'C:\e11.txt';

logout;

Exit;

Step2-- Loading Data

/* Creates log file */
spool on to 'C:\Practise\AutoMxl\Log\loaddata.txt';
/*Login into user*/
login 'jim' 'password' on 'localhost';

alter system load application 'GShriPCST';
alter application 'GShriPCST' load database 'GShriPCSTD';

/*Load Data*/
import database 'GShriPCST' .'GShriPCSTD' data from text data_file 'C:\Practise\Metadata\dataload.txt' on error write to 'C:\Practise\Logfile\loaderror.txt';

/*execute calculation default on 'GShriPC_ST'.'GShriPC';*/

grant read on database 'GShriPCST' .'GShriPCSTD' to 'Kim';
logout;
exit;

Step3-- Drop the Backup Cube and Rename operation

/*Creating Logfile*/
spool on to 'C:\Practise\AutoMxl\Log\dataload.txt';

/* Logs in as Administrator */
login 'jim' 'password' on 'localhost';

/* Drops active connections */
alter system logout session on database 'GShriPCST' .'GShriPCSTD' force;
alter system kill request on database 'GShriPCST' .'GShriPCSTD';

/* Renames Production Cube to Backup Cube and then rename to Staging Cube to Production Cube */

alter application 'GShriPCPR' rename to 'GShriPCBK';
alter application 'GShriPCST' rename to 'GShriPCPR';

 grant designer on application 'GShriPCST' to 'kim';
drop application 'GShriPCST' cascade force;

logout;
exit;

Step4-- Drop Staging cube

/*Creating Logfile*/
spool on to 'C:\Practise\AutoMxl\Log\logout.txt';

/* Logs in as Administrator */
login 'jim' 'password' on 'localhost';

drop application 'GShriPCST' force;

logout;
exit;



 

No comments:

Post a Comment