36
Contents Backup Summary:...................................................... 1 How to call the Backup:.............................................2 Essbase export file size............................................2 Archive the log file with the rest of the backup files..............2 Outputting to console and log file..................................2 Essbase ASO vs. BSO exports.........................................2 LOGGING.............................................................2 Essbase PARALLEL EXPORT.............................................2 What if there are hung threads when we try to stop essbase for the backup of the bin directory?........................................3 BACKING UP THE FOLLOWING FILE EXTENSIONS............................3 DEFRAG..............................................................3 ESSBASE.SEC – DO WE NEED TO STOP ESSBASE AGENT......................4 “Archive.txt”.......................................................4 Documentation from Essbase Backup and Recovery Guide................4 LCM Packages:........................................................ 4 Overview including discussion on xml “migration definitions” and the Utility.sh..........................................................4 List of the current migration packages..............................5 Directories used:.................................................... 6 To run the partition utility:.......................................7 TBD...............................................................7 The Partition export file.........................................8 Appendix :........................................................... 9 Actual Shell Script.................................................9

€¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

Embed Size (px)

Citation preview

Page 1: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

ContentsBackup Summary:........................................................................................................................................1

How to call the Backup:...........................................................................................................................2

Essbase export file size............................................................................................................................2

Archive the log file with the rest of the backup files...............................................................................2

Outputting to console and log file...........................................................................................................2

Essbase ASO vs. BSO exports...................................................................................................................2

LOGGING.................................................................................................................................................2

Essbase PARALLEL EXPORT......................................................................................................................2

What if there are hung threads when we try to stop essbase for the backup of the bin directory?.......3

BACKING UP THE FOLLOWING FILE EXTENSIONS....................................................................................3

DEFRAG....................................................................................................................................................3

ESSBASE.SEC – DO WE NEED TO STOP ESSBASE AGENT..........................................................................4

“Archive.txt”............................................................................................................................................4

Documentation from Essbase Backup and Recovery Guide....................................................................4

LCM Packages:.............................................................................................................................................4

Overview including discussion on xml “migration definitions” and the Utility.sh....................................4

List of the current migration packages....................................................................................................5

Directories used:.........................................................................................................................................6

To run the partition utility:......................................................................................................................7

TBD......................................................................................................................................................7

The Partition export file.......................................................................................................................8

Appendix :...................................................................................................................................................9

Actual Shell Script....................................................................................................................................9

Page 2: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

DisclaimerNot everything is complete (i.e. ASO files not handled sufficiently yet) but there is a very large amount of reusable code here. There are no guarantees, implied or explicit, about the implementation or usage of the following code snippets. The code herein is intended as sample code only.

Backup Summary:

How to call the Backup:

BackupMaster.sh calls the Backup process and sends the output to a log. The Backup process lives in Backup.sh

Essbase export file size

If Exalytics supports export files larger than 2GB AND the “EXPORTFILESIZELIMIT [appname [dbname]] n” command is not present in the essbase.cfg file (see https://docs.oracle.com/cd/E12825_01/epm.111/esb_techref/frameset.htm?exportfilesizelimit.htm for details on this essbase.cfg setting), then this is NOT an issue. However, if exalytics does not support export files larger than 2GB OR this setting is in your essbase.cfg, then you could – for large databases – create multiple export files during an export. You need to be aware of this because, if you have to restore and there were multiple export files created, you will have to make sure to incorporate all the export files in your restore process (and not miss any).

Archive the log file with the rest of the backup files

Once the log file is created, it needs to be copied into the appropriate backup folder with all the backup files from that backup process. This should be done in the BackupMaster.sh but we need to confirm that it is working correctly b/c it hasn’t been tested yet.

Outputting to console and log file

This is not urgent b/c the process is outputting correctly to a log file but it would be nice to have it output to the console too. The current call to output to the BackupLogs.log file is in the BackupMaster.sh. The syntax currently looks like this:

./Backup.sh >> BackupLogs.log 2>&1

Essbase ASO vs. BSO exports. It is preferable with BSO to have a column format. This way, a load rule can be paired with a data file and errors can be trapped if there are any. For ASO, column format exports are not supported. This is why you will find two export functions in the script :

Page 3: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

exportDatabase and exportDatabaseASO. They each use a different “ApplicationList”. So, it’s up to the admin to list the ASO and BSO databases separately. In an ideal world, we’d check for the type of application using maxl (“display application all;” and then check the column “Storage Type”. Based on that, the MAXL for export would either include or exclude the text “in columns”.

LOGGING If we want to spool output of shell script to file and also keep it routing to the command line (black) screen, call the shell script like this : ./backupWIP.sh >> spool.log 2>&1

Essbase PARALLEL EXPORT If you want to enable parallel data exports, the MAXL call to export in the “ExportDatbase” function can be adjusted to do a parallel backup. Then, on the restore side, the files can be restored using MAXL which supports the * character for the filenames used on the import. See following from essbase tech ref:

import database <dbs-name> data from...

Specify whether the data import file(s) are local or on the server, and specify the type of import file(s).

To import from multiple files in parallel, use the wildcard characters * and/or ? in the IMP-FILE name so that all intended import files are matched.

* substitutes any number of characters, and can be used anywhere in the pattern. For example, day*.txt matches an entire set of import files ranging from day1.txt - day9.txt.

?* substitutes one occurrence of any character, and can be used anywhere in the pattern. For example, 0?-*-2011.txt matches data source files named by date, for the single-digit months (Jan to Sept).

Example:

import database Sample.Basicdata from local data_file '/nfshome/data/foo*.txt'using local rules_file '/nfshome/data/foo.rul'on error abort;

If you wish to change the number of threads created on a parallel export, you can change this variable in the Backup.sh script : ParallelThread=1

If you wish to turn off Parallel export, you can set the ParallelThread variable to 1. TBD – this needs to be tested to confirm that this will turn off parallel export thereby creating (assuming that exalytics can create export files greater than 2 GB where necessary) only one export file per cube.

What if there are hung threads when we try to stop essbase for the backup of the bin directory?

Code could be added after stopEssbase.sh to check for hung threads and kill them if they exist. This would provide two benefits:

Page 4: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

1) This would ensure that the backup of the bin directory is successful 2) Kill any existing hung threads every night. This would be a benefit b/c hung threads are not

good to have “hanging around”.

BACKING UP THE FOLLOWING FILE EXTENSIONS - Currently, we copy all these files:

otl csc rul rep eqd sel lro esm tct ind db TBD – need to add ddb and dbb

DEFRAG - this process does NOT defrag. Based on the global user-base, it is recommended that a defrag is NOT run nightly b/c the aggregations would likely take too long. However, it is strongly recommended that a defrag is run every weekend. A defrag once a week is minimum recommendation for writeback intensive applications.

ESSBASE.SEC – DO WE NEED TO STOP ESSBASE AGENT – It is said that, between LCM, MAXL, and file system backups employing “begin archive”, we should be able to back up everything without stopping essbase. However, a) to be on the safe side and b) because it’s convenient to have a working copy of essbase.sec, we will make sure that .sec is backed up properly. It has been confirmed that we do in fact have to stop the essbase agent in order to ensure a non-corrupted version of the essbase.sec file. Yes, it is possible to get a copy of that file without shutting down the Essbase server but it is documented and confirmed by Essbase product management that this approach has risk.

“Archive.txt” - this appears in the Begin archive portion of the script. This file is not needed so it can be ignored.

Documentation from Essbase Backup and Recovery Guide – used this to determine important files : http://docs.oracle.com/cd/E57185_01/EPMBK/ch04s01s02s04.html

From this documentation, see these important pieces:

Output of MAXL statement display application all :

Page 5: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

LCM Packages:

Overview including discussion on xml “migration definitions” and the Utility.shThese “migration packages” (XML files) are created using the LCM user interface in the Shared Services admin console. When the LCM utility is called, an xml file is passed to it so that the utility knows what to backup. The utility file is here :

/u01/app/oracle/product/EPM_QA/Middleware/user_projects/epmsystem1/bin/Utility.sh

The xml file contains :

1) Instructions about which components to backup. In all cases except Planning, we take all possible components. In the case of Planning, we take all but data b/c it is better to backup data using MAXL

2) Login information. TBD- this currently uses my ID but that needs to be replace with an admin ID. The password is automatically encrypted the first time an XML file is used by the Utility.

3) The name of the backup folder that will be created. For example, from the EPMA backup package, we define the “filePath” here :

<Target type="FileSystem" filePath="/DailyBkp_EPMA_ALL"/>

This will put all the backup files from this “migration / backup package” in a folder called “DailyBkp_EPMA_ALL” and it will create this folder in the same directory where the xml “migration package” resides.

List of the current migration packages. In each case below, first the functional name is listed, then the name of the directory we are outputting is listed:

1) CalcManager: Export Package DailyBkp_CALC_MGR_PLN_n_ESSB

2) Deployment Metadata – “DailyBkp_Deployment_Metadata”

3) EPMA – “DailyBkp_EPMA_ALL”

4) Shared Services – “DailyBkp_SS_ALL”

5) Planning a. APP=ASC_PLNN – Export name : “DailyBkp_PLN_ASC_PLNN”

b. App - FOO_AH ; Export name – “DailyBkp_PLN_FOO_AH”

i. All except “Essbase Data”(as pictured above for ASC_PLNN)c. App – FOO_CAO ; export name – “DailyBkp_PLN_FOO_CAO”

Page 6: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

i. All except “Essbase Data”(as pictured above for ASC_PLNN)d. FOO_CC – export – DailyBkp_PLN_FOO_CC

i. All except “Essbase Data”(as pictured above for ASC_PLNN)e. FOO_CCn – export – DailyBkp_PLN_FOO_CCn

i. All except “Essbase Data”(as pictured above for ASC_PLNN)f.g. FOO_MC – export name : DailyBkp_PLN_FOO_MC

i. All except “Essbase Data”(as pictured above for ASC_PLNN)h. FOO_PH – export name : DailyBkp_PLN_FOO_PH

i. All except “Essbase Data”(as pictured above for ASC_PLNN)i. FOO_PS – export name : DailyBkp_PLN_FOO_PS

i. All except “Essbase Data”(as pictured above for ASC_PLNN)j. DMD_PLNN – export name : DailyBkp_PLN_DMD_PLNN

i. All except “Essbase Data”(as pictured above for ASC_PLNN)6) Reporting and Analysis – export name – “DailyBkp_Reporting”

Directories used:LCM packages are written here : /u01/app/oracle/product/EPM_QA/Middleware/user_projects/epmsystem1/import_export/

Created a place to store packages that were used in development : devbackupand created a script that will restore into the import_export directort called

Scripts (which need to be backed up) live here :/u01/app/oracle/product/EPM_QA/ODIDATA/

We are running backup scripts in this directory:/u01/app/oracle/product/EPM_QA/ODIDATA/Backups

MAXL writes Essbase data files here :/u01/app/oracle/product/EPM/Middleware/user_projects/epmsystem1/EssbaseServer/essbaseserver1/app

to start or stop essbase ... you can go to the  cd /u01/app/oracle/product/EPM/Middleware/user_projects/epmsystem1/bin ./stopEssbase.shstartEssbase.sh

Page 7: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup
Page 8: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

To run the partition utility:Run PartitionLauncher.sh in the Backups directory. This passes the following parameters to the java class:

Set the Classpath so that the Partition class and the Java platform can find the jar files it needs to use. This is similar to the concept of a program needing to find DLLs in a windows environment.

export JAVA_CLASSPATH="/u01/app/oracle/product/EPM_QA/Middleware/EPMSystem11R1/common/EssbaseJavaAPI/11.1.2.0/lib/ess_es_server.jar:/u01/app/oracle/product/EPM_QA/Middleware/EPMSystem11R1/common/EssbaseJavaAPI/11.1.2.0/lib/ess_japi.jar:/u01/app/oracle/product/EPM_QA/Middleware/EPMSystem11R1/common/EssbaseJavaAPI/11.1.2.0/lib/ess_maxl.jar:/u01/app/oracle/product/EPM_QA/ODIDATA/Backups/Partition.jar"

Here, we call the java class – using the classpath we just set up above. bash.Partition is the name of the class file. Then the parameters are in the following order :

<user> <password> <essbase server name> <Provider services (aps) URL for the Java api> <app name> <cube name>

java -cp $JAVA_CLASSPATH bash.Partition UserName Password EssbaseServerName ServerWithAPS:13080/aps/JAPI APPName CubeName

TBDTo finalize the Partition backup functionality, we need to make sure it exports all the partitions per database and puts all the partitions per database in the correct database folder. Once it looks like it is working correctly as a standalone (calling it from PartitionLauncher.sh with just one database at a time), we can then call it from inside the Backup.sh. I put comments in the Backup.sh which can be turned on once we are ready. Here is what the comments look like inside the Backup.sh file:

#Here is where we can call the java class to export the partition information. An administrator login will have to be used here

#export JAVA_CLASSPATH="/u01/app/oracle/product/EPM_QA/Middleware/EPMSystem11R1/common/EssbaseJavaAPI/11.1.2.0/lib/ess_es_server.jar:/u01/app/oracle/product/EPM_QA/Middleware/EPMSystem11R1/common/EssbaseJavaAPI/11.1.2.0/lib/ess_japi.jar:/u01/app/oracle/product/EPM_QA/Middleware/EPMSystem11R1/common/EssbaseJavaAPI/11.1.2.0/lib/ess_maxl.jar:/u01/app/oracle/product/EPM_QA/ODIDATA/Backups/Partition.jar"

#java -cp $JAVA_CLASSPATH bash.Partition user Password EsssbaseServerName http://APSServerName :13080/aps/JAPI $APPLICATION $DATABASE

Page 9: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

#cd /u01/app/oracle/product/EPM_QA/ODIDATA/Backups

#This next line will copy the file.dat which contains the partition definitions from the Backups directory into the appropriate app & db folder

#From there, once the backups are all done, all this stuff, including the multiple versions of file.dat that are in their respective folders, will be copied out to D1

#TBD - Once we get a chance to deploy this, after we work through the SR with oracle, I can update the class to give the partition export file a mor meaningful name.

#cp file.dat /BackupExportMigrationDefFiles/DailyBkp_Essbase/$APPLICATION/$DATABASE

The Partition export fileThe partition export class will create a file with the following format :

Source Area 1 : @LEVMBRS("Measures","Lev0,Measures")

Source Area 2 : @LEVMBRS("Product","SKU")

Source Area 3 : @LEVMBRS("Market","Lev0,Market")

Source Area 4 : "Actual"

Target Area 1 : @LEVMBRS("Measures","Lev0,Measures")

Target Area 2 : @LEVMBRS("Product","SKU")

Target Area 3 : @LEVMBRS("Market","Lev0,Market")

Target Area 4 : "Actual"

Page 10: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

Appendix :

Actual Shell Script# The timestamp is used to create a meaningful directory name under the D1, D2, etc. directories.

timestamp=$(date +"%m.%d.%y")

echo $timestamp

echo "start of Backup process : $(date)"

mkdir D1/$timestamp

# this is where we hard-code the parameters instead of taking them in from the command line.

User="envyb"

Password="Ruppert5320"

Server="localhost"

ArborPath="/u01/app/oracle/product/EPM_QA/Middleware/user_projects/epmsystem1/EssbaseServer/essbaseserver1"

BackupDir="/u01/app/oracle/product/EPM_QA/ODIDATA/Backups/BackupExportMigrationDefFiles/DailyBkp_Essbase"

BackupRoot="/u01/app/oracle/product/EPM_QA/ODIDATA/Backups/BackupExportMigrationDefFiles"

rm -fr $BackupRoot/DailyBkp*

Environment_String="EPM_QA"

BackupStartingPoint="/u01/app/oracle/product/EPM_QA/ODIDATA/Backups"

# LCM won't run if there is already a folder with the name your XML file is trying to use

# If you want to run specific (a subset of full backup), you want to comment this out and manually delete the folders yo8u want to replace

Page 11: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

#----------------------------------------------------------------------

# Functions

#----------------------------------------------------------------------

#----------------------------------------------------------------------

# this runs a MAXL statement, formats the result and returns it to the function call as a string. See where it is called for more details.

function _ExecuteMAXL()

{

RefDataset=\$"$1" # Ref of dataset

User=$2 # Value of User

Password=$3 # Value of Password

Server=$4 # Value of Server

Maxl=$5 # Value of maxl statement

Result=`echo "

set column_width 255;

$Maxl

quit;

" \

| essmsh -u $User -p $Password -s $Server -i 2>&1 \

| awk 'BEGIN {

header=0;

}

index($0,"+------") > 0 {

Page 12: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

header=1;

nbFields=gsub("[+]","|") ;

next;

}

header == 1 && length($0) == nbFields * 255 {

line="";

for(i=0; i < nbFields; i++) {

field = substr($0, (i * 255) + 2, (255 - 1));

# Left TRIM

if (match(field,"^[ ]+") > 0 ) {

field = substr(field, RLENGTH + 1)

}

# right TRIM

if (match(field,"[ ]+$") ) {

field = substr(field, 1, length(field) - RLENGTH)

}

# replace all space by "#" inside the field

gsub("[ ]","#",field)

line = line "" field "|"

}

print line

Page 13: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

}

index($0," ERROR - ") > 0 {

print $0;

exit 127

}

'

`

errorcode=$?

eval "$1=\"$Result\""

return $errorcode

}

#If parameters are passed to the script from the command line, they must meet certain specs. If they do not, this usage function tells user the format in which the parameters are expected. In our use of this script, it makes more sense to hardcode the parameters in the file so we will not take advantage of this function but the function and the ability to accept command line parameters will remain in case it could be useful in the future

#----------------------------------------------------------------------

function usage() {

echo 1>&2 Usage: $0 '[-p|--parallel n]' User Password Server ArborPath BackupDir [ApplicationList]

echo 1>&2 Usage: $0 '[-p|--parallel n]' User Password Server ArborPath BackupDir [Application Database]

echo 1>&2 Example: $0 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup/ESB1

Page 14: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

echo 1>&2 Example: $0 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup/ESB1 '"Sample Basic"'

echo 1>&2 Example: $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup/ESB1 Sample Demo

}

#This function, one db at a time, exports level 0 data from essbase in columnar format and copies all the db specific files from the essbase db directory. It first kills all requests and sessions and then puts the db in archive mode. Error handling is incorporated.

#----------------------------------------------------------------------

function ExportDatbase() {

# generate list files corresponding to the ParallelThread > 1

destExpFile=""

for i in `seq $ParallelThread`; do

destExpFile=" "$destExpFile"'"$BackupDir"/"$APPLICATION"/"$DATABASE"/"${APPLICATION}"_"${DATABASE}"_"$i".exp'"

if [ $i -lt $ParallelThread ]; then

destExpFile=$destExpFile","

else

destExpFile=$destExpFile

fi

done

_ExecuteMAXL appType $User $Password $Server "display application $APPLICATION;"

echo "AppType : $appType"

errorcode=$?

if [ $errorcode -ne 0 ]; then

Page 15: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

echo "Maxl error $errorcode"

echo "Application : $APPLICATION"

echo "AppType : $appType"

exit 127

fi

for item in $appType

do

APPTYPE=`echo $item | awk 'BEGIN {FS = "|"} {gsub("#"," ",$18); print $18}'`

#`echo $item | awk 'BEGIN {FS = "|"} {gsub("#"," ",$18); print $18}'`

#`echo $line | awk 'BEGIN {FS = "|"} {gsub("#"," ",$1); print $1}'`

done

echo "application type number : $APPTYPE"

#strColumns=""

if [ $APPTYPE -ne 1 ]; then

strColumns=""

echo " this cube $APPLICATION is ASO"

else

strColumns="in columns"

echo " this cube $APPLICATION is BSO"

fi

#--------------------------------------------------------

# Export data in level ???

#--------------------------------------------------------

mkdir -p $BackupDir/$APPLICATION/$DATABASE

echo Begin Archive and export database $APPLICATION.$DATABASE Level 0 data to data_file $destExpFile ... If there are MaXL errors, they will be echoed

Page 16: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

MaxlResult=""

_ExecuteMAXL MaxlResult $User $Password $Server "\

alter system kill request all;

alter system logout session all force;

alter database '$APPLICATION'.'$DATABASE' begin archive to file 'archive.txt';

export database '$APPLICATION'.'$DATABASE' level0 data $strColumns to server data_file $destExpFile;

"

errorcode=$?

if [ $errorcode -ne 0 ]; then

echo "Maxl error $errorcode"

echo "$MaxlResult"

exit 127

fi

ls $BackupDir/$APPLICATION/$DATABASE/${APPLICATION}_${DATABASE}*.exp > "$BackupDir/$APPLICATION/$DATABASE/${APPLICATION}_${DATABASE}.lst"

#--------------------------------------------------------

# Append all other required files into the archive file

#--------------------------------------------------------

# This is where you can add / remove additional file types you want from the DB directory. NOTE - the bin directory is backed up somewhere else.

extensionList="otl csc rul rep eqd sel lro esm tct ind db ddb dbb "

for extension in $extensionList

do

Page 17: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

find $ArborPath/app/$APPLICATION/$DATABASE -name "*.$extension" >> "$BackupDir/$APPLICATION/$DATABASE/${APPLICATION}_${DATABASE}.lst"

cp $ArborPath/app/$APPLICATION/$DATABASE/*.$extension $BackupDir/$APPLICATION/$DATABASE

done

# End archive for the database whose files we just backed up.

echo end archive for $APPLICATION.$DATABASE

_ExecuteMAXL databaseList $User $Password $Server "alter database '$APPLICATION'.'$DATABASE' end archive;"

errorcode=$?

if [ $errorcode -ne 0 ]; then

echo "Maxl error $errorcode"

echo "$applicationList"

exit 127

fi

#Here is where we can call the java class to export the partition information. An administrator login will have to be used here

#export JAVA_CLASSPATH="/u01/app/oracle/product/EPM_QA/Middleware/EPMSystem11R1/common/EssbaseJavaAPI/11.1.2.0/lib/ess_es_server.jar:/u01/app/oracle/product/EPM_QA/Middleware/EPMSystem11R1/common/EssbaseJavaAPI/11.1.2.0/lib/ess_japi.jar:/u01/app/oracle/product/EPM_QA/Middleware/EPMSystem11R1/common/EssbaseJavaAPI/11.1.2.0/lib/ess_maxl.jar:/u01/app/oracle/product/EPM_QA/ODIDATA/Backups/Partition.jar"

#java -cp $JAVA_CLASSPATH bash.Partition user PasswordEsssbaseServerName http://APSServerName :13080/aps/JAPI $APPLICATION $DATABASE

#cd /u01/app/oracle/product/EPM_QA/ODIDATA/Backups

Page 18: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

#This next line will copy the file.dat which contains the partition definitions from the Backups directory into the appropriate app & db folder

#From there, once the backups are all done, all this stuff, including the multiple versions of file.dat that are in their respective folders, will be copied out to D1

#TBD - Once we get a chance to deploy this, after we work through the SR with oracle, I can update the class to give the partition export file a mor meaningful name.

#cp file.dat /BackupExportMigrationDefFiles/DailyBkp_Essbase/$APPLICATION/$DATABASE

}

#----------------------------------------------------------------------

# Default Values

#----------------------------------------------------------------------

ParallelThread=1

applicationList=""

databaseList=""

#----------------------------------------------------------------------

# Test the parameters passed at command line

#----------------------------------------------------------------------

#This is where we test the command line parameters to see if they are in the right format or not. Again, this is not used in this implementation but we will keep it in case it could be useful in the future. If the command line parameters are not in the right format, the “usage†� function is called to explain to the user what format is expected.

OPTS=$( getopt -o h,p: -l help,parallel: -- "$@" )

if [ $? != 0 ]

then

usage

exit 1

Page 19: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

fi

eval set -- "$OPTS"

while true ; do

case "$1" in

-h) usage;

exit 0;;

--help) usage;

exit 0;;

-p) ParallelThread=$2;

shift 2;;

--parallel) ParallelThread=$2;

shift 2;;

--) shift; break;;

esac

done

#----------------------------------------------------------------------

# Test the arguments - this can be turned back on. It wsa turned off b/c I prefer to hardcode parameters in this file so it's quicker to run during dev and testing.

#----------------------------------------------------------------------

#if [ $# -lt 5 ]; then

# usage

# exit 127

#fi

Page 20: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

#----------------------------------------------------------------------

# List all applications - this accepts application + database slists as command line parameters but this was turned off for development. If it is empty (deletedd from my hardcoding and not passed in at the command line, it will loop through all the apps and dbs on a server

#----------------------------------------------------------------------

applicationList="appname1 appname2, etc."

# This is where the list of apps to be backed up is inserted. If you would like to force this utility to loop through all apps (and all dbs) on a given server, please contact [email protected] for more about this functionality. Most of the code is already written for this.

# This (dynamically backup everything without having to explicitly list anything) may be desired in PROD b/c this would take ALL APPS. This way, if a new app is added, this script would automatically pick it up without this script having to be changed (with regard to Essase)

#--------------------------------------------------------

# for each BSO application

#--------------------------------------------------------

# comment - _ExecuteMAXL populates "databaseList" variable. $1 grabs the database name

for line in $applicationList; do

APPLICATION=`echo $line | awk 'BEGIN {FS = "|"} {gsub("#"," ",$1); print $1}'`

if [ "$databaseList" == "" ]; then

_ExecuteMAXL databaseList $User $Password $Server "display database on application $APPLICATION;"

errorcode=$?

Page 21: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

if [ $errorcode -ne 0 ]; then

echo "Maxl error $errorcode"

echo "$databaseList"

exit 127

fi

fi

#--------------------------------------------------------

# for each database in Application

#--------------------------------------------------------

for line2 in $databaseList

do

DATABASE=`echo $line2 | awk 'BEGIN {FS = "|"} {gsub("#"," ",$1); print $2}'`

ExportDatbase

done

databaseList=""

done

#done

#Comment - can we restore without the essbase.sec file?

# TBD - Pending discussions, we may have to stop essbase so that we can back up the essbase.SEC file - that is the one artifact that requires essbase to be stopped before we copy it. Alternatively, we may settle on using LCM and custom partition exports in order to bypass the need to stop the agent.

Page 22: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

# If we do a copy of the bin directory without stopping the essbase server, we may still get the sec file but it won't likely be correct OR we may get an error

echo "Essbase stopping"

cd /u01/app/oracle/product/$Environment_String/Middleware/user_projects/epmsystem1/bin/

./stopEssbase.sh

cd $BackupRoot

mkdir DailyBkp_Essbase

cd DailyBkp_Essbase

mkdir bin

cp $ArborPath/bin/* $BackupRoot/DailyBkp_Essbase/bin

echo "bin folder copied"

cd /u01/app/oracle/product/$Environment_String/Middleware/user_projects/epmsystem1/bin

./startEssbase.sh

echo "Esssbase restarting"

#TBD - incorporate all files created above into the D1 folder

# If you want to run specific (a subset of full backup), you want to comment out the ones you don't want to rerun

# Note – it is assumed in this Shell script that the LCM backup “packages” were already created and placed in the right directory.

cd /u01/app/oracle/product/$Environment_String/Middleware/user_projects/epmsystem1/bin

echo "**************************************************** Calc Manager *************************************"

./Utility.sh $BackupRoot/CALC_MGR_PLN_n_ESSB_Export.xml

echo "**************************************************** Deployment Metadata *************************************"

./Utility.sh $BackupRoot/Deployment_Metadata_Export.xml

Page 23: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

echo "**************************************************** EPMA *************************************"

./Utility.sh $BackupRoot/EPMA_ALL_Export.xml

echo "**************************************************** SS *************************************"

./Utility.sh $BackupRoot/SS_ALL_Export.xml

echo "**************************************************** ASC PLNN *************************************"

./Utility.sh $BackupRoot/PLN_ASC_PLNN_Export.xml

echo "**************************************************** FOO_AH *************************************"

./Utility.sh $BackupRoot/PLN_FOO_AH_Export.xml

echo "**************************************************** FOO_CAO *************************************"

./Utility.sh $BackupRoot/PLN_FOO_CAO_Export.xml

echo "**************************************************** FOO_CC *************************************"

./Utility.sh $BackupRoot/PLN_FOO_CC_Export.xml

echo "**************************************************** FOO_CCn *************************************"

./Utility.sh $BackupRoot/PLN_FOO_CCn_Export.xml

echo "**************************************************** FOO_MC *************************************"

./Utility.sh $BackupRoot/PLN_FOO_MC_Export.xml

echo "**************************************************** FOO_PH *************************************"

./Utility.sh $BackupRoot/PLN_FOO_PH_Export.xml

echo "**************************************************** FOO_PS *************************************"

Page 24: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

./Utility.sh $BackupRoot/PLN_FOO_PS_Export.xml

echo "**************************************************** DMD_PLNN *************************************"

./Utility.sh $BackupRoot/PLN_DMD_PLNN_Export.xml

echo "**************************************************** Reporting *************************************"

./Utility.sh $BackupRoot/Reporting_Export.xml

echo "Utility called"

cd $BackupStartingPoint

#echo Move D13 to D14, D12 to D13, etc. and delete D14

# If you want to run specific (a subset of full backup), you want to comment out this archiving functionality and only run it to move from D1 to D2 once you have a full satisfactory backup

# Note – from the perspective of the utility, each time the utility is run, the folders are all reshuffled to move everything forward a day. This could throw off your sense of time. For example, if the utility were run 3 times in one day, then D1, D2, and D3 will all contain backups from the current day. In this case, D4 would actually be a backup from Day 2 (one day older than the current day)

rm -r D14

mv D13 D14

mv D12 D13

mv D11 D12

mv D10 D11

mv D9 D10

mv D8 D9

mv D7 D8

mv D6 D7

mv D5 D6

Page 25: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

mv D4 D5

mv D3 D4

mv D2 D3

mv D1 D2

mkdir D1

cd D1

mkdir $timestamp

cp -r $BackupRoot/DailyBkp* $timestamp

echo "stop of Backup process : $(date)"

TBD – ASO DB directory is not getting copied… or maybe we need different file extensions?

C:\JythonDEV\Essbase\lib>

java -jar partition.jar admin password localhost http://localhost:13080/aps/JAPI

Here’s how we have to launch it in Linux :

#!/bin/bash

export JAVA_CLASSPATH="/u01/app/oracle/product/EPM_QA/Middleware/EPMSystem11R1/common/EssbaseJavaAPI/11.1.2.0/lib/ess_es_server.jar:/u01/app/oracle/product/EPM_QA/Middleware/EPMSystem11R1/common/EssbaseJavaAPI/11.1.2.0/lib/ess_japi.jar:/u01/app/oracle/product/EPM_QA/Middleware/EPMSystem11R1/common/EssbaseJavaAPI/11.1.2.0/lib/ess_maxl.jar:/u01/app/oracle/product/EPM_QA/ODIDATA/Backups/Partition.jar"

Page 26: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

java -cp $JAVA_CLASSPATH bash.Partition user PasswordEsssbaseServerName http://APSServerName:13080/aps/JAPI  AppName cubeName

C:\JythonDEV\Essbase\lib>java -cp C:\JythonDEV\Essbase\lib\ess_es_server.jar; C:

\JythonDEV\Essbase\lib\ess_japi.jar; C:\JythonDEV\Essbase\lib\ess_maxl.jar; C:\J

ythonDEV\Essbase\lib\Partition.jar bash.Partition admin password localhost http:

//localhost:13080/aps/JAPI demo basic

Must handle when there are no partitions !! - there is an if statement that should handle this

Page 27: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

Docs : this is how the output works. When you point to Sample1 basic, you get the partition definition that is under the “Source Databases” section. This indicates where the external data is going to get pushed from:

When you point to the Sample2 Basic db, you get what’s under “source” for Sample2. Another way to say this is that when pulling partition info from a database, you will get the external dbs that will be pushing their data to the database you are currently querying.

C:\JythonDEV\Essbase\lib>java -cp C:\JythonDEV\Essbase\lib\ess_es_server.jar;C:\

JythonDEV\Essbase\lib\ess_japi.jar;C:\JythonDEV\Essbase\lib\ess_maxl.jar;C:\Jyth

onDEV\Essbase\lib\Partition.jar bash.Partition admin password localhost http://l

Page 28: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

ocalhost:13080/aps/JAPI Sample2 basic

Inside getPartInfo : Sample1.Basic

strSourceArea long appended string :

Source Area 1 : @LEVMBRS("Measures","Lev0,Measures")

Source Area 2 : @LEVMBRS("Product","SKU")

Source Area 3 : @LEVMBRS("Market","Lev0,Market")

Source Area 4 : "Actual"

strTargetArea long appended string :

Target Area 1 : @LEVMBRS("Measures","Lev0,Measures")

Target Area 2 : @LEVMBRS("Product","SKU")

Target Area 3 : @LEVMBRS("Market","Lev0,Market")

Target Area 4 : "Actual"

getPartition Begin

getPartition End

C:\JythonDEV\Essbase\lib>java -cp C:\JythonDEV\Essbase\lib\ess_es_server.jar;C:\

JythonDEV\Essbase\lib\ess_japi.jar;C:\JythonDEV\Essbase\lib\ess_maxl.jar;C:\Jyth

onDEV\Essbase\lib\Partition.jar bash.Partition admin password localhost http://l

ocalhost:13080/aps/JAPI Sample1 basic

Inside getPartInfo : Sample2.Basic

strSourceArea long appended string :

Source Area 1 : "Jan"

Page 29: €¦  · Web viewIn an ideal world, we’d check for the type ... In all cases except Planning, ... $0 --parallel 4 supervisor password localhost $ARBORPATH $HYPERION_HOME/Backup

strTargetArea long appended string :

Target Area 1 : "Jan"

getPartition Begin

getPartition End