示例#1
0
        public static void OracleExpdp(string toolsFolder, string toolsTempFolder, string user, string password, string datasource, string dmpdesc, string exportpath, string remoteIP, string remoteAccount, string remotePassword, List <string> excludeTableList, bool isshow)
        {
            //设置空表导出参数
            setDB setdb = new setDB(user, password, datasource);

            setdb.setEXP();
            DataTable dtPar = new DataTable();

            dtPar.Columns.Add("name", typeof(string));
            dtPar.Columns.Add("value", typeof(string));
            //然后把你想要加的数据加进DataTable 里
            dtPar.Rows.Add(new object[] { "dmpdesc", dmpdesc });
            dtPar.Rows.Add(new object[] { "backupday", exportpath });
            dtPar.Rows.Add(new object[] { "user", user });
            dtPar.Rows.Add(new object[] { "password", password });
            dtPar.Rows.Add(new object[] { "datasource", datasource });

            dtPar.Rows.Add(new object[] { "remoteIP", remoteIP });
            dtPar.Rows.Add(new object[] { "remoteAccount", remoteAccount });
            dtPar.Rows.Add(new object[] { "remotePassword", remotePassword });
            SqlExec(toolsFolder, toolsTempFolder, user, password, datasource, "sys_createdumpdir", new List <string[]>(), isshow);

            if (excludeTableList != null && excludeTableList.Count > 0)
            {
                string tablesString = "";
                foreach (string tablename in excludeTableList)
                {
                    if (tablesString == "")
                    {
                        tablesString += "'" + tablename + "'";
                    }
                    else
                    {
                        tablesString += ",'" + tablename + "'";
                    }
                }
                dtPar.Rows.Add(new object[] { "excludeTable", "EXCLUDE=TABLE:\\\"IN (" + tablesString + ")\\\"" });
            }
            else
            {
                dtPar.Rows.Add(new object[] { "excludeTable", "" });
            }
            setConfig setconfig = new Common.setConfig();

            setconfig.repalceParByDefine(toolsFolder, "Oracle_expdp.bat", toolsTempFolder, dtPar);
            setBAT.RunBat(toolsTempFolder + @"\Oracle_expdp.bat", isshow);
        }
示例#2
0
        public static void OracleExp(string toolsFolder, string toolsTempFolder, string user, string password, string datasource, string dmpdesc, string exportpath, bool isshow)
        {
            //设置空表导出参数
            setDB setdb = new setDB(user, password, datasource);

            setdb.setEXP();
            DataTable dtPar = new DataTable();

            dtPar.Columns.Add("name", typeof(string));
            dtPar.Columns.Add("value", typeof(string));
            //然后把你想要加的数据加进DataTable 里
            dtPar.Rows.Add(new object[] { "dmpdesc", dmpdesc });
            dtPar.Rows.Add(new object[] { "backupday", exportpath });
            dtPar.Rows.Add(new object[] { "user", user });
            dtPar.Rows.Add(new object[] { "password", password });
            dtPar.Rows.Add(new object[] { "datasource", datasource });
            setConfig setconfig = new Common.setConfig();

            setconfig.repalceParByDefine(toolsFolder, "Oracle_exp.bat", toolsTempFolder, dtPar);
            setBAT.RunBat(toolsTempFolder + @"\Oracle_exp.bat", isshow);
        }