If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Batch file Cube builds. Auto.exe and rumac32.exe hang

Started by Skidly, 21 Nov 2005 11:00:36 AM

Previous topic - Next topic

Skidly

I have created batch files for cube builds. They test fine and run fine when I run them manually.
Automating them through Windows Scheduler or in a SQL Server DTS package, I see the runmac32.exe and
auto.exe hang preventing the rest of the batch file from completing.

Basically the cubes build (log files say they did) but the processes hang preventing the disable, enable, copy.
Oh, and this happens sporadically.

Batch file steps.
Backup
Build - Macro
Disable
Copy
Enable


SueC

skidly,

I had a similar problem awhile ago.  I never could solve it so I modified the batch file:

Backup production cube - rename it to 'old'
Create new cube and name it 'build'
Delete production cube
Copy 'build' cube to production cube name (rename used to work but doesn't on the latest Windows server version so I had to put in two steps, delete and copy).

This does a couple of things - it backs up yesterday's cube and keeps the newly built cube in case there is a problem getting it in to production.

The disable/enable never really worked for me, I still had the sproadic problem.  I haven't had an issue since I started with the 3 copies version.

Hope this helps!

Sue

Draoued

If you are running the Windows scheduler, check the following.
check which windows account is used to run the macro.
If this is a system_account , changed it to a named user account.
And check if this named user account is having a OS signon associated with it in access manager.

If this is running fine , with your personal account  , when running it manually , associate your personal account with the job in scheduler ( for testing purpose) . If it s then running fine , create a generic account .

cognostechie

Its is also a good idea to stop and start the Powerplay Service before the cube build. This will ensure that no sessions are connected to the cube other than the one the batch file is using.

Darek

Share the part that replaces the cube so we can take an educated guess what might be wrong.

CoginAustin

Below is VB.net code that builds all your cubes into a staging area, stops the powerplay server, moves live data to a backup directory, moves the staging area to live, restarts the powerplay server.
It also logs everything to a SQL server table and emails you when the build is complete.

Thought this may help you or someone else. I fire this off using the Job Agent in SQL server and it has run flawlessly for over a year. You will have to modify it slightly and compile.

Imports System.IO
Imports System.Data.SqlClient
Imports System.ServiceProcess
Imports System.Web.Mail


Module DWH_Builds
    Dim myCommand As SqlCommand
    Dim sqlInsert As SqlCommand
    Dim strSQL As String
    Dim boolError As Boolean
    Dim myController As ServiceController
    Dim mailText As String

    Dim myConnection = New SqlConnection("server=cognos;database=mydb;uid=user;pwd=password;")

    Sub Main()
        ' Grab control of the PP service.
        myController = New ServiceController("Cognos PowerPlay Enterprise Server (cer4)")

        'Build the models
        CallProcess("model.mdl")

        'Create a backup before copying new model to live directory
        BackupLiveMDC()

        'Stop service here
        If myController.CanStop Then
            Try
                myController.Stop()
                Console.WriteLine("Stopping - " & myController.Status.ToString)
            Catch ex As Exception
                boolError = True
                InsertError("Error - Failed Stopped PP service")
                InsertError("Error - " & ex.ToString)
            End Try
        Else
            boolError = True
            InsertError("Error - Service cannot be stopped")
        End If

        ' Even if it did not stop we need to try and publish what we can publish
        MoveToLive()
        myController.WaitForStatus(ServiceControllerStatus.Stopped)
        'Start the service back up
        Try
            myController.Start()
        Catch exp As Exception
            boolError = True
            InsertError("Error - Service cannot be started")
        End Try
        SendEmail()
    End Sub

    Sub BackupLiveMDC()
        Dim fromDirectory As String
        Dim backupDirectory As String
        fromDirectory = "\\cognos\D$\LiveData\"
        backupDirectory = "\\cognos\D$\LiveData\Backup\"
        Try
            File.Copy(fromDirectory & "cube.mdc", backupDirectory & "cube.mdc", True)
        Catch ex As Exception
            boolError = True
            InsertError("Error - Copying cube.mdc to backup")
            InsertError("Error - " & ex.ToString)
        End Try
    End Sub

    Private Sub MoveToLive()
        Dim fromDirectory As String
        Dim liveDirectory As String

        fromDirectory = "\\cognos\D$\StagingArea\"
        liveDirectory = "\\cognos\D$\LiveData\"

        Try
            File.Copy(fromDirectory & "cube.mdc", liveDirectory & "cube.mdc", True)
        Catch ex As Exception
            boolError = True
            InsertError("Error - Copying cube.mdc to live")
            InsertError("Error - " & ex.ToString)
        End Try
    End Sub

    Private Sub InsertError(ByVal errorText As String)
        If (errorText.Length > 255) Then
            errorText = errorText.Substring(0, 255)
        End If
        myConnection.Open()
        strSQL = "Insert into dwh_Errors(errorText,errorTime) values('" & errorText + "',GETDATE())"
        mailText &= errorText

        sqlInsert = New SqlCommand(strSQL, myConnection)
        sqlInsert.ExecuteNonQuery()
        myConnection.Close()
    End Sub

    Private Sub CallProcess(ByVal modelFile As String)
        Dim p As New System.Diagnostics.Process
        InsertError("Build Start --- " & modelFile)
        Try
            p.StartInfo.UseShellExecute = False
            p.StartInfo.RedirectStandardOutput = True
            p.StartInfo.CreateNoWindow = False
            p.StartInfo.RedirectStandardError = True
            p.StartInfo.ErrorDialog = True

            p.StartInfo.FileName = "d:\path\to\trnsfrmr.exe"
            p.StartInfo.Arguments = "-n2 -s -i -nologo D:\path\to\StagingArea\" & modelFile


            p.StartInfo.WindowStyle = ProcessWindowStyle.Minimized
            p.Start()

            'Wait until the process passes back an exit code
            p.WaitForExit()
            If (p.ExitCode = "1") Then
                InsertError("Error - Failed Build " & modelFile)
            End If
            p.Close()

        Catch ex As Exception
            boolError = True
            InsertError("Error - " & ex.ToString)
        End Try
        InsertError("Build End --- " & modelFile)
    End Sub

    Private Sub SendEmail()
        Try
            Dim smtp As System.Web.Mail.SmtpMail
            Dim Attachment As System.Web.Mail.MailAttachment
            Dim Mailmsg As New System.Web.Mail.MailMessage

            smtp.SmtpServer = "mail.server.com"
            ' add TO's using ; to seperate addressses
            Mailmsg.To = "me@here.com"
            Mailmsg.From = "transformer@here.com"

            Mailmsg.BodyFormat = MailFormat.Text
            If (boolError = True) Then
                'If there is an error in the build then send it to a cell phone
                Mailmsg.Subject = "DW Build Status - with errors"
                ' can add a cell phone pager here as well.
                Mailmsg.To = "me@here.com;5125551212@mms.mycingular.com"
            Else
                Mailmsg.Subject = "DW Build Status - Good"
            End If
            Mailmsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "0")
            Mailmsg.Body = mailText

            smtp.Send(Mailmsg)

        Catch ex As Exception
            InsertError("Error - " & ex.ToString)
        End Try
    End Sub
End Module

Skidly

Here is the code that was used.
I am thinking the solution is to change the user that is running the dts.  Currently system is running the dts job.

Rem BACKUP Ent Balance Sheet Cube
Rem COPY "D:\PPES\Published Cubes\Enterprise\ENT Balance Sheet.mdc" "D:\PPES\Published_Cubes_Backup\Enterprise\ENT Balance Sheet.mdc" /Y

Rem BUILD Balance Sheet Cubes from mdl with macro
Rem "d:\Program Files\Cognos\cer4\bin\runmac32.exe" D:\PPES\Macros\Enterprise\ENT_FIN_BAL_SHT.MAC

Rem DISABLE Balance Sheet Cubes on both app servers

Rem "d:\program files\cognos\cer4\bin\ppadmtool.exe" connect ETNMEM2AP101T:8010 USER JDECubeBuilder PASSWORD wshdev kill "/Published Cubes/Enterprise/JD Edwards/ENT Balance Sheet"

Rem COPY Balance Sheet Cube To both Servers

Rem COPY "D:\PPES\Published Cubes\Enterprise\ENT Balance Sheet.mdc" "\\etnmem2ap101t.bizt.est.svmt.com\Published Cubes\Enterprise\JD Edwards\ENT Balance Sheet.mdc" /Y

Rem ENABLE Balance Sheet Cubes on both app servers

Rem "d:\program files\cognos\cer4\bin\ppadmtool.exe" connect ETNMEM2AP101T:8010 USER JDECubeBuilder PASSWORD wshdev enable "/Published Cubes/Enterprise/JD Edwards/ENT Balance Sheet"

rem pause

COGNOiSe administrator

If you are using OSSignOns then you have to run it under a specific account. Or add the LocalSystem account as one of your Administrator OSSignOns.

Skidly

Thanks.  I will pass this info along.
This is for a client. 
They also had some other things to fix.
Transformer, Decision Stream and SQL Server all on the same box.

They spaced out the cube builds to not occur during their etl and this seemed to alleviate the problem.

We can close this.  Not sure how to close a topic.

Thanks
Chad