1

I've created migration to update values in one column. Migration looks as follow:

public partial class UpdateStatuses : DbMigration
{
    public override void Up()
    {
        var updateSql = @"
            BEGIN
                UPDATE ARTICLE SET STATUS = CASE WHEN STATUS <> -1 THEN STATUS + 1 ELSE STATUS END,
                    STATUSPREV = CASE WHEN STATUSPREV <> -1 THEN STATUSPREV + 1 ELSE STATUSPREV END;
            END;";
        Sql(updateSql, true);
    }

    public override void Down()
    {
        var updateSql = @"
            BEGIN
                UPDATE ARTICLE SET STATUS = CASE WHEN STATUS <> -1 THEN STATUS - 1 ELSE STATUS END,
                    STATUSPREV = CASE WHEN STATUSPREV <> -1 THEN STATUSPREV - 1 ELSE STATUSPREV END;
            END;";
        Sql(updateSql, true);
    }
}

Migration works fine on smaller datasets, but table which this migration is designed to run on has ~11M of records. So when I'm running it it throw me such exception:

Engine task ErrorOracle.ManagedDataAccess.Client.OracleException (0x00001FF1): ORA-08177: can't serialize access for this transaction ORA-06512: at line 3

Can I can do something with this?

Mateusz Rogulski
  • 7,357
  • 7
  • 44
  • 62
  • Is [this answer](https://stackoverflow.com/a/785784/475766) helpful to you? – Ortund Jul 25 '17 at 10:50
  • @Ortund I've seen it earlier but it's not the issue for me, I cannot just change isolation level for one migration, and I don't want to change it for whole project. – Mateusz Rogulski Jul 25 '17 at 12:20

0 Answers0