Пример #1
0
        public static string GetDatabaseClass(SQLInstance.SQLDatabaseInfo db)
        {
            if (db.IsSystemDatabase) return "system";
            if (db.State == DatabaseStates.Restoring) return "restoring";

            return db.MonitorStatus.Class();
        }
Пример #2
0
        public ActionResult Active(string node, SQLInstance.ActiveSearchOptions options,
                                   SQLInstance.ActiveSearchOptions.ShowSleepingSessionOptions? sleeping = null,
                                   bool? system = false,
                                   bool? details = false)
        {
            if (sleeping.HasValue) options.IncludeSleepingSessions = sleeping.Value;
            if (system.HasValue) options.IncludeSystemSessions = system.Value;
            if (details.HasValue) options.GetAdditionalInfo = details.Value;

            var vd = new DashboardModel
                {
                    View = DashboardModel.Views.Active,
                    CurrentInstance = SQLInstance.Get(node),
                    ActiveSearchOptions = options
                };
            return View("Dashboard", vd);
        }
Пример #3
0
        public ActionResult Top(string node, SQLInstance.TopSearchOptions options, bool? detailed = false)
        {
            var i = SQLInstance.Get(node);
            options.SetDefaults();

            var vd = new DashboardModel
            {
                View = SQLViews.Top,
                Detailed = detailed.GetValueOrDefault(),
                CurrentInstance = i,
                TopSearchOptions = options
            };
            return View("Operations.Top", vd);
        }
Пример #4
0
            public static Dictionary <string, int> GetDefaults(SQLInstance i)
            {
                var dict = new Dictionary <string, int>
                {
                    { "access check cache bucket count", 0 },
                    { "access check cache quota", 0 },
                    { "Ad Hoc Distributed Queries", 0 },
                    { "affinity I/O mask", 0 },
                    { "affinity mask", 0 },
                    { "affinity64 I/O mask", 0 },
                    { "affinity64 mask", 0 },
                    { "Agent XPs", 0 },
                    { "allow updates", 0 },
                    { "awe enabled", 0 },
                    { "blocked process threshold", 0 },
                    { "c2 audit mode", 0 },
                    { "clr enabled", 0 },
                    { "contained database authentication", 0 },
                    { "cost threshold for parallelism", 5 },
                    { "cross db ownership chaining", 0 },
                    { "cursor threshold", -1 },
                    { "Database Mail XPs", 0 },
                    { "default full-text language", 1033 },
                    { "default language", 0 },
                    { "default trace enabled", 1 },
                    { "disallow results from triggers", 0 },
                    { "fill factor (%)", 0 },
                    { "ft crawl bandwidth (max)", 100 },
                    { "ft crawl bandwidth (min)", 0 },
                    { "ft notify bandwidth (max)", 100 },
                    { "ft notify bandwidth (min)", 0 },
                    { "index create memory (KB)", 0 },
                    { "in-doubt xact resolution", 0 },
                    { "lightweight pooling", 0 },
                    { "locks", 0 },
                    { "max degree of parallelism", 0 },
                    { "max full-text crawl range", 4 },
                    { "max server memory (MB)", 2147483647 },
                    { "max text repl size (B)", 65536 },
                    { "max worker threads", 0 },
                    { "media retention", 0 },
                    { "min memory per query (KB)", 1024 },
                    { "min server memory (MB)", 0 },
                    { "nested triggers", 1 },
                    { "network packet size (B)", 4096 },
                    { "Ole Automation Procedures", 0 },
                    { "open objects", 0 },
                    { "optimize for ad hoc workloads", 0 },
                    { "PH timeout (s)", 60 },
                    { "precompute rank", 0 },
                    { "priority boost", 0 },
                    { "query governor cost limit", 0 },
                    { "query wait (s)", -1 },
                    { "recovery interval (min)", 0 },
                    { "remote access", 1 },
                    { "remote admin connections", 0 },
                    { "remote login timeout (s)", 10 },
                    { "remote proc trans", 0 },
                    { "remote query timeout (s)", 600 },
                    { "Replication XPs", 0 },
                    { "RPC parameter data validation", 0 },
                    { "scan for startup procs", 0 },
                    { "server trigger recursion", 1 },
                    { "set working set size", 0 },
                    { "show advanced options", 0 },
                    { "SMO and DMO XPs", 1 },
                    { "SQL Mail XPs", 0 },
                    { "transform noise words", 0 },
                    { "two digit year cutoff", 2049 },
                    { "user connections", 0 },
                    { "user options", 0 },
                    { "Web Assistant Procedures", 0 },
                    { "xp_cmdshell", 0 }
                };

                // some defaults were different before 2012
                if (i.Version < SQLServerVersions.SQL2012.RTM)
                {
                    dict["remote login timeout (s)"] = 20;
                }
                return(dict);
            }
            public static Dictionary<string, int> GetDefaults(SQLInstance i)
            {
                var dict = new Dictionary<string, int>
                {
                    {"access check cache bucket count", 0},
                    {"access check cache quota", 0},
                    {"Ad Hoc Distributed Queries", 0},
                    {"affinity I/O mask", 0},
                    {"affinity mask", 0},
                    {"affinity64 I/O mask", 0},
                    {"affinity64 mask", 0},
                    {"Agent XPs", 0},
                    {"allow updates", 0},
                    {"awe enabled", 0},
                    {"blocked process threshold", 0},
                    {"c2 audit mode", 0},
                    {"clr enabled", 0},
                    {"contained database authentication", 0},
                    {"cost threshold for parallelism", 5},
                    {"cross db ownership chaining", 0},
                    {"cursor threshold", -1},
                    {"Database Mail XPs", 0},
                    {"default full-text language", 1033},
                    {"default language", 0},
                    {"default trace enabled", 1},
                    {"disallow results from triggers", 0},
                    {"fill factor (%)", 0},
                    {"ft crawl bandwidth (max)", 100},
                    {"ft crawl bandwidth (min)", 0},
                    {"ft notify bandwidth (max)", 100},
                    {"ft notify bandwidth (min)", 0},
                    {"index create memory (KB)", 0},
                    {"in-doubt xact resolution", 0},
                    {"lightweight pooling", 0},
                    {"locks", 0},
                    {"max degree of parallelism", 0},
                    {"max full-text crawl range", 4},
                    {"max server memory (MB)", 2147483647},
                    {"max text repl size (B)", 65536},
                    {"max worker threads", 0},
                    {"media retention", 0},
                    {"min memory per query (KB)", 1024},
                    {"min server memory (MB)", 0},
                    {"nested triggers", 1},
                    {"network packet size (B)", 4096},
                    {"Ole Automation Procedures", 0},
                    {"open objects", 0},
                    {"optimize for ad hoc workloads", 0},
                    {"PH timeout (s)", 60},
                    {"precompute rank", 0},
                    {"priority boost", 0},
                    {"query governor cost limit", 0},
                    {"query wait (s)", -1},
                    {"recovery interval (min)", 0},
                    {"remote access", 1},
                    {"remote admin connections", 0},
                    {"remote login timeout (s)", 10},
                    {"remote proc trans", 0},
                    {"remote query timeout (s)", 600},
                    {"Replication XPs", 0},
                    {"RPC parameter data validation", 0},
                    {"scan for startup procs", 0},
                    {"server trigger recursion", 1},
                    {"set working set size", 0},
                    {"show advanced options", 0},
                    {"SMO and DMO XPs", 1},
                    {"SQL Mail XPs", 0},
                    {"transform noise words", 0},
                    {"two digit year cutoff", 2049},
                    {"user connections", 0},
                    {"user options", 0},
                    {"Web Assistant Procedures", 0},
                    {"xp_cmdshell", 0}
                };

                // some defaults were different before 2012
                if (i.Version < SQLServerVersions.SQL2012.RTM)
                {
                    dict["remote login timeout (s)"] = 20;
                }
                return dict;
            }
Пример #6
0
        public ActionResult Top(string node, SQLInstance.TopSearchOptions options, bool? detailed = false)
        {
            var i = SQLInstance.Get(node);
            options.SetDefaults();


            var vd = new OperationsTopModel
            {
                View = SQLViews.Top,
                Detailed = detailed.GetValueOrDefault(),
                CurrentInstance = i,
                TopSearchOptions = options
            };

            if (i != null)
            {
                var cache = i.GetTopOperations(options);
                vd.TopOperations = cache.SafeData(true);
                vd.ErrorMessage = cache.ErrorMessage;
            }

            return View("Operations.Top", vd);
        }