• 大小: 1.58MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-11-16
  • 语言: 数据库
  • 标签: oracle  

资源简介

oracle dg监控程序、归档日志监控程序,里面有详细的代码,可以自动运行,配置化参数,来判断oracle是否正常运行dg和归档日志的rac

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.xml;
using System.Data;
using System.Drawing.Imaging;
using System.Text.Regularexpressions;
using System.Windows.Forms;
using System.Drawing;
using System.Reflection;
using System.Runtime.InteropServices;
using Tamir.SharpSsh;
using System.Diagnostics;
using System.Management;
using WEEK_MONITOR.DATA;
using System.Threading;

namespace WEEK_MONITOR
{
    public class Common
    {
        public static object obj = new object();
        public static string defaultFileName = ““;
        public static void WriteLog(string dest string txtName string text)
        {
            lock (obj)
            {
                try
                {
                    try
                    {

                        if (string.IsNullOrEmpty(txtName))
                        {
                            txtName = defaultFileName;
                        }

                        dest = AppDomain.CurrentDomain.baseDirectory + “log\\“ + txtName + “log“ + “.txt“;

                        string dirPath = Path.GetDirectoryName(dest);
                        if (!Directory.Exists(dirPath))
                        {
                            Directory.CreateDirectory(dirPath);
                        }

                        using (StreamWriter sw = new StreamWriter(dest true Encoding.Default))
                        {
                            sw.WriteLine(text);
                        }
                    }
                    catch (Exception ec)
                    {
                        //MessageBox.Show(“写记录出错!“ + ec.Message);
                    }
                }
                catch (Exception ec)
                {
                    //MessageBox.Show(“写记录出错!“ + ec.Message);
                }
            }
        }


        public static string ssh_conn(string ip string root string pass string command)
        {

            //ip = “10.15.14.81“;
            //root = “root“;
            //pass = “rootroot“;
            //command = “df -h“;

            List commands = command.Split(“|“.ToArray() StringSplitOptions.RemoveEmptyEntries).ToList();

            string response = ““;

            List newText = new List();
            SshStream ssh = new SshStream(ip root pass);

            foreach (string item in commands)
            {
                ssh.Write(item);
                Thread.Sleep(1500);
                ssh.Flush();
                response += ssh.ReadResponse();
            }



            //string[] texts = response.Split(“\r\n“.ToCharArray());


            //foreach (string item in texts)
            //{
            //    if(item.Contains(“#“)&&item)
            //}




            //ssh.Prompt = “#“;
            //ssh.RemoveTerminalEmulationCharacters = true;
          

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        894  2018-05-08 15:27  WEEK_MONITOR\.git\config

     文件         73  2018-05-08 15:26  WEEK_MONITOR\.git\description

     文件         23  2018-05-08 15:26  WEEK_MONITOR\.git\HEAD

     文件        177  2018-05-08 15:26  WEEK_MONITOR\.git\hooks\README.sample

     文件       2120  2018-05-08 15:27  WEEK_MONITOR\.git\index

     文件        113  2018-05-08 15:26  WEEK_MONITOR\.git\info\exclude

     文件        341  2018-05-08 15:27  WEEK_MONITOR\.git\logs\HEAD

     文件        341  2018-05-08 15:27  WEEK_MONITOR\.git\logs\refs\heads\master

     文件        128  2018-05-08 15:27  WEEK_MONITOR\.git\logs\refs\remotes\origin\master

     文件        155  2018-05-08 15:27  WEEK_MONITOR\.git\ms-persist.xml

     文件       3430  2018-05-08 15:27  WEEK_MONITOR\.git\objects\1d\ba51494ebe096a79254b1ec389d8f7d1dead32

     文件        751  2018-05-08 15:26  WEEK_MONITOR\.git\objects\1f\f0c423042b46cb1d617b81efb715defbe8054d

     文件        158  2018-05-08 15:27  WEEK_MONITOR\.git\objects\2f\a132a79c57cbc326a9e35560c20fcb1d153901

     文件     416563  2018-05-08 15:27  WEEK_MONITOR\.git\objects\32\543d0f02cd3266aef0dc814d961bd9697c4149

     文件        186  2018-05-08 15:27  WEEK_MONITOR\.git\objects\39\645652af62950ebf3b28ec3a5400dcec30b1c4

     文件        581  2018-05-08 15:27  WEEK_MONITOR\.git\objects\44\f9a1b7aa3b651f11d8c934d84d2a5d5a1c9fee

     文件         89  2018-05-08 15:26  WEEK_MONITOR\.git\objects\51\260a2e88b22b13a389924d3b535f8b70b80abb

     文件         86  2018-05-08 15:27  WEEK_MONITOR\.git\objects\56\47893e8d7d351a79db3c83e9a8aaeb728cea03

     文件       1685  2018-05-08 15:27  WEEK_MONITOR\.git\objects\65\c5c7d3b01f9585d600c52420fcaa805a735430

     文件        310  2018-05-08 15:27  WEEK_MONITOR\.git\objects\6b\6ac3e1ca03e61dd284c82150a184664bdc9582

     文件       1186  2018-05-08 15:27  WEEK_MONITOR\.git\objects\85\ef6570916551eb0b78e35e3d0e70cb8dbd750a

     文件        461  2018-05-08 15:27  WEEK_MONITOR\.git\objects\8a\6d1bbe7e609447f7d166ab73a603a330bab5c1

     文件        188  2018-05-08 15:27  WEEK_MONITOR\.git\objects\8b\91dbfcfb48ca06fe9c29ee89c24d8889abbcf6

     文件        403  2018-05-08 15:27  WEEK_MONITOR\.git\objects\8b\ad64d5fadc331bd82d886bc9430b003952a6d9

     文件      20995  2018-05-08 15:27  WEEK_MONITOR\.git\objects\aa\3105110d3963b20d2171355c88d5f6b93bad66

     文件       1604  2018-05-08 15:27  WEEK_MONITOR\.git\objects\af\7dbebbacef595e3089c01c05671016c21a8304

     文件        166  2018-05-08 15:27  WEEK_MONITOR\.git\objects\af\c52705ef599b0c4bc640e5c9f2295e091c76f3

     文件       1613  2018-05-08 15:26  WEEK_MONITOR\.git\objects\b0\6e864a31d9a809c20147bd0a5b22e90b5e7e4c

     文件        226  2018-05-08 15:27  WEEK_MONITOR\.git\objects\b2\1ed6c5604cc20935c5cf6434ce5517b314f731

     文件       1563  2018-05-08 15:27  WEEK_MONITOR\.git\objects\b5\44cd35e8637da4930a82333cc72e8e35cfd450

............此处省略127个文件信息

评论

共有 条评论