8 Replies Latest reply on Sep 30, 2011 1:03 PM by SafeBoot

    Safeboot database cleanup help

      Hello all,

       

      I am trying to design a script which

      1) takes as input, a Safeboot Reporting CSV file which lists all machines that haven't synched with the database for > 90 days

      2) For each machine in the input, save the recovery data (SDB file) and then delete the machine from the database

       

      I have the script written but the problem I'm running into is that although I'm able to save the SDB file for each machine, when the script attempts to delete the machine, it fails saying that the machine object is locked.  Please have a look at the below output log and let me know if you see the reason for the lock:

       

      ================================================
      Safeboot - Archive Machines that haven't synced in 90 Days - 9/30/2011 9:52:32 AM
      ================================================


      ***** Establishing the database connection *****
      9/30/2011 9:54:20 AM - Connection Ref: 000005c8-01C668B8
      Reading machine names from input file: input.csv

       

      Attempting to export recovery file for machine USWPMVVICHNIN1
      Command:
      <SafeBoot>
      <SbAdminScripting>
      <SBAdminConnection>
      <ConnectionType>Persistent.Use</ConnectionType>
      <ConnectionRef>000005c8-01C668B8</ConnectionRef>
      <AuthType>Usernamepassword</AuthType>
      <AdminUser>sbaac</AdminUser>
      <adminauth>blahblahblahblah</adminauth>
      </SBAdminConnection>
      <SbAdminCommand>
      <Command>ExportMachine</Command>
      <Machine>USWPMVVICHNIN1</Machine>
      <File>USWPMVVICHNIN1.sdb</File>
      <IncludeUsers>No</IncludeUsers>
      <IncludeFiles>No</IncludeFiles>
      <CommandRef>my_reference_string</CommandRef>
      <ResultCode>0x00000000</ResultCode> <ResultDescription>Success</ResultDescription>
      </SbAdminCommand>
      </SbAdminScripting>
      </SafeBoot>

       

      Result:
      <?xml version="1.0"?>
        <SafeBoot>
          <SbAdminScripting>
            <SbAdminConnectionResult>
              <ResultCode>0x00000000</ResultCode>
              <ResultDescription>The operation completed successfully.
      </ResultDescription>
              <ConnectionRef>000005c8-01C668B8</ConnectionRef>
            </SbAdminConnectionResult>
            <SbAdminCommandResult>
              <Command>ExportMachine</Command>
              <CommandRef>my_reference_string</CommandRef>
              <ResultCode>0x00000000</ResultCode>
              <ResultDescription>The operation completed successfully.
      </ResultDescription>
            </SbAdminCommandResult>
          </SbAdminScripting>
        </SafeBoot>


      Recovery file for machine USWPMVVICHNIN1 exported successfully.

       


      Deleting machine USWPMVVICHNIN1 from the database.
      Command:
      <SafeBoot>
      <SbAdminScripting>
      <SBAdminConnection>
      <ConnectionType>Persistent.Use</ConnectionType>
      <ConnectionRef>000005c8-01C668B8</ConnectionRef>
      <AuthType>Usernamepassword</AuthType>
      <AdminUser>sbaac</AdminUser>
      <adminauth>blahblahblahblah</adminauth>
      </SBAdminConnection>
      <SbAdminCommand>
      <Command>DeleteMachine</Command>
      <Machine>USWPMVVICHNIN1</Machine>
      <Recycle>true</Recycle>
      <CommandRef>my_reference_string</CommandRef>
      <ResultCode>0x00000000</ResultCode> <ResultDescription>Success</ResultDescription>
      </SbAdminCommand>
      </SbAdminScripting>
      </SafeBoot>

       

      Result:
      <?xml version="1.0"?>
        <SafeBoot>
          <SbAdminScripting>
            <SbAdminConnectionResult>
              <ResultCode>0x00000000</ResultCode>
              <ResultDescription>The operation completed successfully.
      </ResultDescription>
              <ConnectionRef>000005c8-01C668B8</ConnectionRef>
            </SbAdminConnectionResult>
            <SbAdminCommandResult>
              <Command>DeleteMachine</Command>
              <CommandRef>my_reference_string</CommandRef>
              <ResultCode>0xdb010000</ResultCode>
              <ResultDescription>The object is locked</ResultDescription>
            </SbAdminCommandResult>
          </SbAdminScripting>
        </SafeBoot>


      ERROR - Unable to delete machine USWPMVVICHNIN1

       

      I'm attaching the full script for your reference.  It works great except for the fact that the machines are locked! 

      Thanks in advance for your help!

        • 1. Re: Safeboot database cleanup help

          By the way, in case you don't want to skim through the output, the specific sbadmcom error is:

           

          0xdb010000 - The object is locked

          • 2. Re: Safeboot database cleanup help

            Is it reporting that for every machine, and, is the machine indeed locked (ie it's syncronizing, or something has a connection open to it?)

             

            Curious. I expect your script user is level 32 with all rights and no group restrictions?

            • 3. Re: Safeboot database cleanup help

              The account is indeed level 32; basically equivalent to sbadmin.

               

              Interestingly, it was behaving this way for every machine until I stopped the Safeboot Database service.  After doing that, the CPU utilization dropped from hovering around 100% to about 10% and the script began to export & delete machines relatively quickly.  As soon as the database service is started back up and clients begin checking in again, the problem returned.

               

              I'm wondering if those machine objects weren't actually locked, but that the command was simply timing out due to the database being so swamped.  What do you think?

              • 4. Re: Safeboot database cleanup help

                it sounds as if you have more than one entity connected to the DB - really the only thing which should be accessing the database is the SBDBServer task - everything else should be communicating to the server.

                 

                you don't have the database set in your script, so you might have bypassed the server and gone direct, which may cause the server some heartache, especially if it's trying to build a name cache at the same time you're deleting objects.

                 

                It would help to add timestamps in your script so you can see how long particular processes take - that will give you an indication if it's a workload problem (you'll find a transaction will error out exactly at the timeout period, say 30sec).

                1 of 1 people found this helpful
                • 5. Re: Safeboot database cleanup help

                  Thanks..  So even if you only have 1 Safeboot database in the environment, it is beneficial to specify the database name in the script command?  I wasn't aware of that; I'll give that a try.

                   

                  Will add the timestamps as well...

                  • 6. Re: Safeboot database cleanup help

                    you may only have one DB, but you probably have at least two ways of connecting to it - how many entries are listed in sdmcfg.ini?

                    • 7. Re: Safeboot database cleanup help

                      There are 3 entries at the top of sdmcfg.ini:

                       

                      [Databases]

                      Database1=SbFileDB.dll

                      Database2=fde.contoso.com

                      Database3=USWSAP2292.merck.com

                       

                      I modified my script so that it is leveraging Database1 by adding "<Database>Safeboot Administration Database</Database>" to the XML.  It sounds like I'm still connecting to the server directly, but the script is moving along swimmingly now (more than likely due to the Friday afternoon drop-off in activity).

                       

                      By the way, when I tried specifying "fde.contoso.com", I got back an unknown database exception.  Are the names case sensitive?

                      • 8. Re: Safeboot database cleanup help

                        you need to connect to the server, not the files (a remote connection) - connecting locally will be fast, but you break all the rights access rules.

                         

                        It's not the address you need to specify - it's the descriptive name (from the "description" node in the ini file).