Sage 100

 View Only
Expand all | Collapse all

SQL error - Unhandled exception ALTER DATABASE FAILED

  • 1.  SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 03-16-2023 20:09
      |   view attached

    Upgrading from Premium v2017 to v2022. I have another error that I have no idea what is causing it. This the four time I have tried to migrate this data from one server to another server. The anti-virus has been disabled when I was running the parallel migration. It just gives the option to select ok and it closes out the whole wizard. Has anyone seen this error? Any suggestions on what I need to do? This has been the worst migration so far that I have had! See attachment. TIA.



    ------------------------------
    Shannon Stanley
    Sage 100 Consultant
    Ardent Consulting LLC
    ------------------------------


  • 2.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 03-16-2023 22:28

    @Shannon Stanley see this thread (https://community.90minds.com/discussion/premium-2019-to-2022-migration-problem) for an updated migration program that Jane posted.

    I am not sure if that is  the fix because I had already brute forced it in my case (manual copy of MAS_XXX folders and backup/restore  of MAS_XXX databases, plus reset the owner to MAS_User and reset MAS_Reports permissions).  In my case, the MAS_System had actually been migrated - check this in SQL Manager in your 2022.

    2022 is really starting to feel like 4.10 reborn...

    Phil



    ------------------------------
    Phil McIntosh
    President
    Friendly Systems, Inc.
    ------------------------------



  • 3.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 03-17-2023 10:13

    Shannon - 

    I just went through one of these as well.  My observation is that there is a slew of errors, most of which are related to (a) using the migrate option and (b) migration of MAS_SYSTEM.

    In short, here's what I had to do: 

    1. Make backups of MAS_SYSTEM and MAS_XXX and \MAS90 very regularly (this is ABSOLUTELY MANDATORY as there are a whole slew of issues which appear to render MAS_SYSTEM unreadable, and if you don't have a copy to restore the Sage KB only advises "too bad/so sad - have fun reinstalling". I kid you not.
    2. I had to do one migration that included MAS_SYSTEM
    3. Once I did the initial migration, I tested and went live by backing up MAS_XXX from the initial install of premium ( in my case, v2018). Then I went to the v2022 Premium, and I dropped ( deleted ) the MAS_XXX  -- KEEP MAS_SYSTEM - and restored the v2018 MAS_XXX to SQL. Then I converted the data through regular Sage company maintenance.
    4. This leaves a few issues - if they have added users, UDFS, screen customizations, or changed security, you'll need to add those to v2022 manually. You'll also need to deal with the paperless office files that are in MAS_SYSTEM - in my case, I (or rather Jim Woodhead ) used a query to move the table data from 2018 to 2022 for the PLJournalPDFLog. I then could move the source paperless PDF files and change their location (paths) using the regular tools we have for paperless migration to new location.

    Carmen did a GREAT session on this and has a set of handouts which document the steps.

    The biggest advice I can give is to protect MAS_SYSTEM by backing up frequently. I had several instances where my MAS_SYSTEM got hosed -- including once during go-live -- and restoring the MAS_SYSTEM absolutely saved the installation. This is especially critical if the customer has multiple integrations since you probably have been having at least some third-parties doing advance work to prepare their portion before the upgrade.




    ------------------------------
    Wayne Schulz
    wayne@s-consult.com
    Schulz Consulting
    (860) 516-8990
    Moodus, CT
    ------------------------------



  • 4.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 03-17-2023 10:18

    PS - I do not think this issue is fully explained by incorrect rights to the service running Sage. In my case, I could fully migrate without issue using the same credentials. It was sporadic, and I feel like at least some of the errors are just wildly unhelpful as to what might be happening. In some cases, I saw that the SQL logs had grown enormous, which kicked off a cryptic error. In another, I found that when migration crashed, it left the backup BAK in a space that the next instance of running Sage migration didn't expect and kicked off an error.

    All of this is recoverable with backups. Without backups, it is a pull-your-hair-out experience. As I'm sure you know, Sage does not have many resources online that are helpful to resolve these issues. 

    PPS - What was enormously helpful is that I did 3 or 4 test migrations before go-live. So by the time I got to go live, I had a pretty good idea that premium migrations using the Sage migration were problematic and that I had to use a workaround or cross my fingers that from 7 pm to 2 am when I was re-migrating that things would go well.



    ------------------------------
    Wayne Schulz
    wayne@s-consult.com
    Schulz Consulting
    (860) 516-8990
    Moodus, CT
    ------------------------------



  • 5.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 03-23-2023 08:36
    Edited by Shannon Stanley 03-23-2023 08:37

    Thanks @Wayne Schulz and I could not agree with you more!
    My error was linked to the same issue that @Jane Scanlan had on a previous case with Sage. The migration tool is failing on v2022 SP2. Sage Support sent me the pre-release of the fix for the migration folder. I did inquire when they would have this available to everyone and no eta from Sage at this time. I can tell you that this issue has not happened to me on v2022 SP1 so far. Maybe this will help someone else when migrating to this version. I really appreciate the group MOTM because you guys have helped me out with several troubleshooting issues. 



    ------------------------------
    Shannon Stanley
    Sage 100 Consultant
    Ardent Consulting LLC
    ------------------------------



  • 6.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 08-10-2023 07:13

    Hello

    If i get this error but see that the mas_system database has been restored to the new sql server, are you saying i can manually restore the company databases and then try to convert?    I asked Sage for a patch this week for this (2018 to 2022 pu2), it was labeled 2023 migrate.zip but he said it was for 2022 but it errored as soon as i chose the source sql database.   The KB is not listed anymore for this.     TIA  Christine



    ------------------------------
    Christine Kuhn
    Consultant
    RKL eSolutions, LLC
    ------------------------------



  • 7.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 08-10-2023 08:11

    x-ref to one KB possibly related - Error: "ALTER DATABASE failed because a lock could not be placed on database " during migration

    In my view there may be more than one issue causing these problems. I definitely ran into this and I definitely ran into multiple differently worded error messages. I found no better resolution than backup, backup, backup. This is the only time I've ever seen where a Sage upgrade has completed hosed the new system during the migration process and there was no known cure aside from reinstall.

    Maybe Sage solved this and maybe not.

    Summary

    Error: ALTER DATABASE failed because a lock could not be placed on database 'MAS_SYSTEM' appears when migrating between Sage 100 ERP Premium installations

    Resolution

    Sage Engineering resolved this issue on Sage 100 2023

    1. Upgrade to Sage 100 2023
    2. If unable to upgrade to Sage 100 2023, contact Sage Support for a Program fix for Sage 100 Premium 2020 - 2022

    Note: After the migration fails you will have to rename the MIGRATE_ACTIVATE.PVX file in MAS90\HOME\LIB\KEYS back to ACTIVATE.PVX.



    ------------------------------
    Wayne Schulz
    wayne@s-consult.com
    Schulz Consulting
    (860) 516-8990
    Moodus, CT
    ------------------------------



  • 8.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 08-10-2023 09:57

    You need the Sage migration to do the MAS_System copy fully and completely because there is more involved than just the database copy from the source system.  (Basically, it updates the old database with changes required to run the new version...).  Premium to Premium migrations cannot be done manually.

    Make sure the SQL services are running using domain accounts with local admin permissions to the server(s).  Stop everything that might be using SQL (services, external queries, scheduled tasks...).  Restarting the SQL services just before starting the migration is one way to break connections you can't find.

    This might also help:



    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    Toronto ON
    ------------------------------



  • 9.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 08-10-2023 12:19

    thanks Kevin, 

    i did run the Migration, it just failed with the Alter error.  the mas_system database did restore.   I was interpreting Wayne's post as saying that he was able to manually restore the company databases after this point?       or was he saying he did that after fulling completing the migration once?     



    ------------------------------
    Christine Kuhn
    Consultant
    RKL eSolutions, LLC
    ------------------------------



  • 10.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 08-10-2023 12:22

    You have to do the System migration at least one, fully, without errors.  Then you can re-copy company data manually if you really want to... but I usually redo the system migration if it isn't a data center change or anything else super complicated (where the source server is unavailable directly from the target server).



    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    Toronto ON
    ------------------------------



  • 11.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 08-10-2023 12:30

    Here's what I did: 

    Once you get your new/upgraded copy of Sage 100 staged but before you migrate anything - backup the \MAS90 and any SQL databases on the new server(s). Repeat this process anytime you are going to refresh the data. If the customer is using Azure or some hosting that makes it difficult to expand and contract storage on the main drive I have had good luck asking them to create a temporary additional drive just to hold the backups during this upgrade process.

    1. As Kevin notes, you need at least one clean migration of MAS_SYSTEM - I usually also have MAS_XXX migrated and converted at this point
    2. For subsequent conversion to refresh the data - if it's an existing Premium I backup only the MAS_XXX from the prior Premium install and restore to the Sage 100 ( noted in step 1 above ). But this is only after I have one clean migration.
    3. I make a full backup of \MAS90 and any SQL databases before attempting to do any second or subsequent updating of data
    4. Then reconvert the data


    ------------------------------
    Wayne Schulz
    wayne@s-consult.com
    Schulz Consulting
    (860) 516-8990
    Moodus, CT
    ------------------------------



  • 12.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 08-10-2023 12:42

    Not redoing the system migration has risks... you'll miss UDF / UDT changes, new users, changed passwords, Paperless records... anything done at the system level in the source system has to be redone in the new system (or copied manually) if you skip the system re-migration. 

    It's up to you to determine what's a bigger headache: redo the system migration or skip it and deal with all those extra details manually.



    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    Toronto ON
    ------------------------------



  • 13.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 08-10-2023 14:31

    I make a point of telling the customer that during the test period they have to make any system changes to both systems, as an incentive to STOP MAKING EXCUSES AND DO THE DAMN TESTING...



    ------------------------------
    Phil McIntosh
    President
    Friendly Systems, Inc.
    ------------------------------



  • 14.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 08-12-2023 01:40
    Hi Kristine,
    Have you gotten farther with this premium upgrade or do you still need help?  Call me Monday 215-287-7322 if you would like to discuss options.



    Carmen Cruz
    Sage Consultant
    carmen.cruz@compudata.com
    215-969-1000 Ext. 279
    www.compudata.com
    Work Smarter... Together 

    CompuData, Inc. • 325 Chestnut St, Ste 700 • Philadelphia • PA • 19106





  • 15.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 03-17-2023 11:16

    I've been doing this for Premium upgrades... as a part of our internal checklist.



    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    ------------------------------



  • 16.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 03-17-2023 11:35

    Not sure if this was mentioned previously: Always check the SQL version on the source instance and the destination instance and make sure the versions are exactly the same.  This is a Sage requirement that doesn't make sense.  Since certain versions of SQL are only compatible with certain versions of Sage 100 then how does one migrate from Sage 100 version 2016 / SQL 2014 (most recent compatible version) to Sage 100 version 2022 SQL 2019 (least recent compatible version)?  The only way to do it is to first migrate using the SQL 2014 then upgrade to SQL 2019 later.  We're having fun now!



    ------------------------------
    Doug Higgs
    Midwest Commerce Solutions, Inc
    (312) 315-0960
    Chauffeur, Chef, and Personal Assistant to Sprinkles
    ------------------------------



  • 17.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 03-17-2023 11:44

    Doug,

    You can restore a database to a higher version of SQL, so it is perfectly fine if the new SQL instance is a newer version.

    If you want to use the original SQL instance for the Live upgrade system, (eg. because of existing setups that are too hard to redo), then the instances do have to be exactly the same (down to the patch level) because you have to do the upgrade migration, then copy the databases back, and that only works if the instances match exactly.



    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    ------------------------------



  • 18.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 03-17-2023 11:46

    @Kevin Moyes   That's using a manual backup and restore, correct?  Using the Sage migration tool I believe, you have to have the exact version and patches.



    ------------------------------
    Doug Higgs
    Midwest Commerce Solutions, Inc
    (312) 315-0960
    Chauffeur, Chef, and Personal Assistant to Sprinkles
    ------------------------------



  • 19.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 03-17-2023 11:49
    Edited by Kevin Moyes 03-17-2023 11:50

    No, the regular migration programming only requires that the new SQL instance is no lower than the source SQL instance.  It (new instance) can be the same, or higher.  (This is actually a SQL requirement due to how backup and restore works in SQL, not a Sage requirement). 

    Where did you get the idea they had to be the same?



    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    ------------------------------



  • 20.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 03-17-2023 12:03
      |   view attached

    @Kevin Moyes   I believe you are correct on the higher version, although I have had issues in the past.  See the attached KB. I believe the issue I typically have seen that causes a failure is the patch level.  IT says "SQL 2019 is installed on both servers".  If SQL 2019 doesn't have the exact same patch level then the migration fails.



    ------------------------------
    Doug Higgs
    Midwest Commerce Solutions, Inc
    (312) 315-0960
    Chauffeur, Chef, and Personal Assistant to Sprinkles
    ------------------------------

    Attachment(s)



  • 21.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 03-17-2023 12:09

    That happens if the source system is a higher level.  Even a higher patch level in the source system will cause it to fail.  100%, no way around that. 

    The target system being a higher patch level is perfectly fine.  I've done dozens of Premium migrations... this is one of the first things I check (along with the SQL Collation method).  The only time you need to match the SQL patch level, is when you want to copy the post-migration databases back to the original instance (manually).



    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    ------------------------------



  • 22.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 03-17-2023 11:55

    First, my experience is the Sage migration tool is problematic. I don't know if versions caused the issue. 

    I got at least two error-free test migrations (system and data ) going from SQL 2016 to SQL 2019.

    After receiving and reading about various error messages - I abandoned the migration tool for my final go-live migration ( so far as I know, you need to use migrate at least once to get all the system files over and updated )

    I'm uncertain Sage will resolve what I see as a problematic migration of Premium to Premium so for now I just keep good notes and watch the 90 Minds messages for workarounds and experience.



    ------------------------------
    Wayne Schulz
    wayne@s-consult.com
    Schulz Consulting
    (860) 516-8990
    Moodus, CT
    ------------------------------



  • 23.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 03-17-2023 12:01

    I still use the Sage migration tool, but always take good backups at every stage.

    If re-migrating system files gives me an error, I do the extra checking (looking for UDF / UDT changes, new users...) and just re-migrate company data.  (If you don't use the Sage migration tool, you'll be missing the updated Paperless records...).

    Yes, the migration tool is extraordinarily sensitive to a number of issues, but if you can change the SQL Service accounts to a domain account that is a local admin to all servers involved (source SQL, new SQL, new Sage...), and run the backup I mentioned above (to verify folder permissions?) it usually works.

    The real problems happen when you don't have control over the SQL Service accounts.  That makes some things almost impossible.  (Windows Credentials Manager can help, but not always).



    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    ------------------------------



  • 24.  RE: SQL error - Unhandled exception ALTER DATABASE FAILED

    Posted 03-17-2023 12:28

    Oh, and I am not sure Sage truly understands how much of a nightmare these issues can be, so every time you encounter Premium migration issues, please try to make Sage aware.  If you aren't creating a Sage case, perhaps add your voice to the choir of such complaints on Sage City.

    They know what they should do (because I've described the issues in detail)... but I'm not convinced they are motivated enough to get it done.



    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    ------------------------------