Пример #1
0
        private static Exception MoveDatabase(FailedSuspendedCatalogRebuildWorkflow workflow)
        {
            Exception result = null;

            try
            {
                AmDatabaseMoveResult amDatabaseMoveResult = null;
                AmDbActionCode       actionCode           = new AmDbActionCode(AmDbActionInitiator.Admin, AmDbActionReason.CatalogFailureItem, AmDbActionCategory.Move);
                string serverName;
                AmRpcClientHelper.MoveDatabaseEx(workflow.Context.Database, 0, 16, 0, null, workflow.Context.TargetServerName.Fqdn, false, 2, actionCode, ReplayStrings.AutoReseedMoveActiveBeforeRebuildCatalog, out serverName, ref amDatabaseMoveResult);
                AmRpcExceptionWrapper.Instance.ClientRethrowIfFailed(amDatabaseMoveResult.DbName, serverName, amDatabaseMoveResult.ErrorInfo);
            }
            catch (AmReplayServiceDownException ex)
            {
                result = ex;
            }
            catch (AmServerException ex2)
            {
                result = ex2;
            }
            catch (AmServerTransientException ex3)
            {
                result = ex3;
            }
            return(result);
        }
        internal static AmDatabaseMoveResult PerformDatabaseFailover(string componentName, string comment, Database database)
        {
            AmDbActionCode       actionCode = new AmDbActionCode(AmDbActionInitiator.Automatic, AmDbActionReason.FailureItem, AmDbActionCategory.Move);
            AmDatabaseMoveResult result     = null;
            string text;

            AmRpcClientHelper.MoveDatabaseEx(ADObjectWrapperFactory.CreateWrapper(database), 0, 16, -1, AmServerName.LocalComputerName.Fqdn, null, true, 0, actionCode, comment, out text, ref result);
            return(result);
        }
        private void MoveSingleDatabase()
        {
            AmDatabaseMoveResult result = null;

            try
            {
                int            mountDialOverride      = (int)this.MountDialOverride;
                bool           tryOtherHealthyServers = !this.TargetServerSpecified;
                AmDbActionCode actionCode             = new AmDbActionCode(AmDbActionInitiator.Admin, AmDbActionReason.Cmdlet, AmDbActionCategory.Move);
                AmRpcClientHelper.MoveDatabaseEx(ADObjectWrapperFactory.CreateWrapper(this.m_database), 0, 16, mountDialOverride, null, this.TargetServerSpecified ? this.m_targetServer.Fqdn : null, tryOtherHealthyServers, (int)this.GetSkipFlags(), actionCode, this.MoveComment, out this.m_lastServerContacted, ref result);
                this.m_output.WriteProgress(Strings.ProgressStatusCompleted, this.GetRpcDoneProgressString(), 100);
                this.WriteMoveResult(this.DataObject, this.m_startingServer, result, null);
            }
            catch (AmReplayServiceDownException ex)
            {
                TaskLogger.Trace("MoveMdbMaster.MoveSingleDatabase raised exception while moving database: {0}", new object[]
                {
                    ex
                });
                this.WriteMoveResult(this.DataObject, this.m_startingServer, result, ex);
                this.m_output.WriteError(new InvalidOperationException(Strings.ErrorActiveManagerIsNotReachable(ex.ServerName, ex.RpcErrorMessage)), ErrorCategory.InvalidOperation, this.m_database.Identity);
            }
            catch (AmServerException ex2)
            {
                TaskLogger.Trace("MoveMdbMaster.MoveSingleDatabase raised exception while moving database: {0}", new object[]
                {
                    ex2
                });
                this.WriteMoveResult(this.DataObject, this.m_startingServer, result, ex2);
                this.m_output.WriteError(ex2, ErrorCategory.InvalidOperation, this.m_database.Identity);
            }
            catch (AmServerTransientException ex3)
            {
                TaskLogger.Trace("MoveMdbMaster.MoveSingleDatabase raised exception while moving database: {0}", new object[]
                {
                    ex3
                });
                this.WriteMoveResult(this.DataObject, this.m_startingServer, result, ex3);
                this.m_output.WriteError(ex3, ErrorCategory.InvalidOperation, this.m_database.Identity);
            }
        }
Пример #4
0
        internal static void Move(IADDatabase database, string from, AmDbActionCode actionCode, DatabaseMountDialOverride mountDialOverride)
        {
            Exception            ex = null;
            AmDatabaseMoveResult amDatabaseMoveResult = null;

            DatabaseTasks.Trace("Database '{0}' moved from '{1}'", new object[]
            {
                database.Name,
                from
            });
            try
            {
                string text;
                AmRpcClientHelper.MoveDatabaseEx(database, 0, 16, (int)mountDialOverride, from, null, true, 0, actionCode, null, out text, ref amDatabaseMoveResult);
            }
            catch (AmServerException ex2)
            {
                DatabaseTasks.Trace("MoveDatabase() failed with {0}; Exception: {1}", new object[]
                {
                    amDatabaseMoveResult,
                    ex2
                });
                ex = ex2;
            }
            catch (AmServerTransientException ex3)
            {
                DatabaseTasks.Trace("MoveDatabase() failed with {0}; Exception: {1}", new object[]
                {
                    amDatabaseMoveResult,
                    ex3
                });
                ex = ex3;
            }
            if (ex != null)
            {
                throw new DatabaseFailoverFailedException(database.Name, ex.ToString(), ex);
            }
        }
Пример #5
0
        internal static void HandleSourceLogCorruption(IADDatabase database, string from)
        {
            Exception            ex = null;
            AmDatabaseMoveResult amDatabaseMoveResult = null;

            DatabaseTasks.Trace("HandleSourceLogCorruption for Database '{0}' from '{1}'", new object[]
            {
                database.Name,
                from
            });
            ReplayEventLogConstants.Tuple_CorruptLogRecoveryIsAttempted.LogEvent(null, new object[]
            {
                database.Name
            });
            try
            {
                AmDbActionCode actionCode = new AmDbActionCode(AmDbActionInitiator.Automatic, AmDbActionReason.FailureItem, AmDbActionCategory.Move);
                string         text;
                AmRpcClientHelper.MoveDatabaseEx(database, 0, 0, RegistryParameters.MaxAutoDatabaseMountDial, from, null, true, 0, actionCode, "HandleSourceLogCorruption", out text, ref amDatabaseMoveResult);
            }
            catch (AmServerException ex2)
            {
                ex = ex2;
            }
            catch (AmServerTransientException ex3)
            {
                ex = ex3;
            }
            if (ex != null)
            {
                DatabaseTasks.Tracer.TraceError <Exception>(0L, "HandleSourceLogCorruption: Move failed: {0}", ex);
            }
            bool      flag = false;
            Exception ex4  = null;

            try
            {
                string text2;
                ActiveManagerCore.GetDatabaseMountStatus(database.Guid, out text2);
                if (!string.IsNullOrEmpty(text2) && !Cluster.StringIEquals(text2, Dependencies.ManagementClassHelper.LocalMachineName))
                {
                    flag = true;
                }
            }
            catch (ClusterException ex5)
            {
                ex4 = ex5;
            }
            catch (AmServerException ex6)
            {
                ex4 = ex6;
            }
            if (ex4 != null)
            {
                DatabaseTasks.Tracer.TraceError <Exception>(0L, "HandleSourceLogCorruption: Determine active failed: {0}", ex4);
                if (ex == null)
                {
                    ex = ex4;
                }
            }
            if (flag)
            {
                Exception ex7 = DatabaseTasks.ResumeLocalDatabaseCopy(database);
                if (ex7 != null)
                {
                    DatabaseTasks.Tracer.TraceError <Exception>(0L, "HandleSourceLogCorruption: Resume failed: {0}", ex7);
                    ReplayEventLogConstants.Tuple_ResumeFailedDuringFailureItemProcessing.LogEvent(database.Name, new object[]
                    {
                        database.Name,
                        ex7.Message
                    });
                }
            }
            if (ex != null)
            {
                throw new DatabaseLogCorruptRecoveryException(database.Name, ex.ToString(), ex);
            }
        }