DatabaseExistsAndIsOnline() public static method

public static DatabaseExistsAndIsOnline ( IDbExecutor dbExecutor, string restoreName ) : bool
dbExecutor IDbExecutor
restoreName string
return bool
Esempio n. 1
0
        private void WaitForBackupCopy(
            SqlExecutor masterDbExecutor,
            string restoreDbName)
        {
            var timeToGiveUp = DateTime.UtcNow.AddHours(1).AddSeconds(30);

            while (DateTime.UtcNow < timeToGiveUp)
            {
                if (Util.DatabaseExistsAndIsOnline(
                        masterDbExecutor,
                        restoreDbName))
                {
                    Log.Info("Copy is complete.");
                    return;
                }
                Thread.Sleep(1 * 60 * 1000);
            }
        }
        private void WaitForBackupCopy(
            SqlExecutor dbExecutor,
            string destinationDbServerName,
            string copyDbName)
        {
            var timeToGiveUp = DateTime.UtcNow.AddHours(1).AddSeconds(30);

            while (DateTime.UtcNow < timeToGiveUp)
            {
                if (WhatIf || Util.DatabaseExistsAndIsOnline(
                        dbExecutor,
                        copyDbName))
                {
                    Log.Info("Copied {0} to {1}.", copyDbName, destinationDbServerName);
                    return;
                }

                Log.Trace("Database {0} on {1} is not yet ready and online. Waiting for 5 minutes (will give up in {2} minutes).", copyDbName, destinationDbServerName, Math.Round(timeToGiveUp.Subtract(DateTime.UtcNow).TotalMinutes));
                Thread.Sleep(5 * 60 * 1000);
            }
        }