XG

Hallo everyone,

I'm writing a report about create a backup for a selected database via backupDatabase().

Here is my code:

var g_startTime = new Date();

function main()

{

    var ADB   = ArisData.getActiveDatabase();

    var oFile;

    var oDbAdmin;

    var sPath = "C://Userdata";

    var sFile = "WorkDB_"+getTimeStampAsString();

    Context.setSelectedPath(sPath);

    Context.setSelectedFile(sFile);

    oFile     = new java.io.File(sPath, sFile);

    dbAdmin  = Context.getComponent("ServerAdmin");

    if(dbAdmin.backupDatabase(ADB,oFile)){

             Dialogs.MsgBox("Work DB"+" was backed up on "+new Date());

         }else{

             Dialogs.MsgBox("Work DB"+" could not be backed up on "+new Date());

         }      

    return;

}

function getTimeStampAsString() {

    var date = g_startTime;

    return date.getFullYear() + "_" +

                ((parseInt(date.getMonth())+1)>9 ? '' : '0') + (parseInt(date.getMonth())+1) + "_" +

                (date.getDate()>9 ? '' : '0') + date.getDate() + "_" +

                (date.getHours()>9 ? '' : '0') + date.getHours() + "_" +

                (date.getMinutes()>9 ? '' : '0') + date.getMinutes() + "_" +

                (date.getSeconds()>9 ? '' : '0') + date.getSeconds()

                }

               

main();

 

But somehow the function backupDatabase() always return false. Could anyone give some suggestions?

Thanks a lot.

by M. Zschuckelt
Posted on Mon, 09/09/2019 - 16:39

Are you sure, the user running the report has permissions to backup the database? E. g. "Database backup"

0
by Ariene Kroeze
Posted on Mon, 09/09/2019 - 17:30

Are you sure that the user account that runs the ARIS server has access rights to folder "C://Userdata"; (on the server!)?

0
by M. Zschuckelt
Posted on Mon, 09/09/2019 - 21:07

In reply to by Ariene Kroeze

Very good point, Ariene. Also, if you are running a multi-node server the report might be executed on any of the nodes, so a local file system like C:\ may not be a good place for your backup.

0
by Ye Ding
Posted on Thu, 09/12/2019 - 12:52

In reply to by M. Zschuckelt

Hello,

I have exactly the same problem . I run my code on the local server.

If I backup the database manually, the backup can be successfully created. I want to save the backup into this folder "C:\UserData\Documents\ARIS 10", where all the Aris created files (doc, xls) are saved. Aris client should have access to the folder since it can write doc files into this folder.

Thank you very much in advance!

0
by Ariene Kroeze
Posted on Thu, 09/12/2019 - 15:28

Try the following changed script:

var g_startTime = new Date();

function main()

{

    var ADB   = ArisData.getActiveDatabase();

    var oFile;

    var oDbAdmin;

    var lOutput = Context.createOutputObject()

    var sPath = lOutput.getCurrentPath().getPath();  

    lOutput.WriteReport()

    Context.deleteFile(Context.getSelectedFile())


   

    var sFile = "WorkDB_"+getTimeStampAsString();

    //Context.setSelectedPath(sPath);

    //Context.setSelectedFile(sFile);


    oFile     = new java.io.File(sPath, sFile);

    dbAdmin  = Context.getComponent("ServerAdmin");

    if(dbAdmin.backupDatabase(ADB,oFile)){

             Dialogs.MsgBox("Work DB"+" was backed up on "+new Date());

            Context.addOutputFileName(sFile)            

         }else{

             Dialogs.MsgBox("Work DB"+" could not be backed up on "+new Date());

         }     

    return;

}

function getTimeStampAsString() {

    var date = g_startTime;

    return date.getFullYear() + "_" +

                ((parseInt(date.getMonth())+1)>9 ? '' : '0') + (parseInt(date.getMonth())+1) + "_" +

                (date.getDate()>9 ? '' : '0') + date.getDate() + "_" +

                (date.getHours()>9 ? '' : '0') + date.getHours() + "_" +

                (date.getMinutes()>9 ? '' : '0') + date.getMinutes() + "_" +

                (date.getSeconds()>9 ? '' : '0') + date.getSeconds()

                }

main();

Kind regards, Ariene Kroeze

0
by Ye Ding
Posted on Fri, 09/13/2019 - 10:18

In reply to by Ariene Kroeze

Thank you very much Ariene Kroeze, the backup function works. However I can't find the  backup file in the folder where all the files are saved. Do I need to do anything extra to get this file?

0
by Ye Ding
Posted on Fri, 09/13/2019 - 10:32

In reply to by Ariene Kroeze

Hi Ariene,

I have tried to restore the backup database to Aris. However the backup is encrypted and I need to enter a password for the database file. Do you know why the backup data is encrypted and how can I decrypt it? 

Thank you very much!

0
by Ariene Kroeze
Posted on Fri, 09/13/2019 - 13:05

I'm so sorry, but I have no idea. In my case it works good, without any encryption.

Kind regards, Ariene

0
by Ye Ding
Posted on Fri, 09/13/2019 - 13:47

In reply to by Ariene Kroeze

Hi Ariene,

thank you very much. I have tried your method and it works to backup the database. But I can't find the file and it's not stored in the location where other Aris output files are stored. Do you have any idea how to retrieve this file?

Best

0
by Ariene Kroeze
Posted on Fri, 09/13/2019 - 15:02

??? In my case the backup is stored in the same directory as I input in the "Save output as" field in the ui.

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock