Exemplo n.º 1
0
        /// <summary>Restores all schema tables, procedures and functions from content found in the specified restoration folder</summary>
        public void RestoreSchema(VEDelegate taskCompletion)
        {
            DateTime startTime = DateTime.Now;

            Memo("Memo", string.Format("/*\r\n**\t{0}\r\n**\tRestore Schema {1} - All Objects\r\n*/\r\n",
                                       BackupTimeStamp, targetObject.DatabaseSchema));

            DropTables();

            if (!Abort)
            {
                RestoreProcedures();
            }

            if (!Abort)
            {
                RestoreFunctions();
            }

            if (!Abort)
            {
                RestoreTables(taskCompletion);
            }

            Memo("Memo", string.Format("/*\r\n**\tRestore Schema {0} - All  Objects: {1}\r\n*/\r\n",
                                       targetObject.DatabaseSchema, abort ? "ABORTED" : VETimeStamp.ElapsedTime(startTime)));
        }
Exemplo n.º 2
0
        public override void RestoreTables(VEDelegate taskCompletion)
        {
            DateTime startTime = DateTime.Now;
            int      count = 0, schemaCount = 0;
            bool     failed = false;

            Memo("Memo", string.Format("//\r\n//\t{0}\r\n//\tRestore User Tables: From {1}...\r\n" +
                                       "//\tRestore User Tables:   To {2}...\r\n//\r\n",
                                       BackupTimeStamp, restoreObject.Tables, targetObject.ServerIDDatabaseSchema));          //.ServerIDDatabaseUser));

            try
            {
                schemaCount = RestoreTableSchema();

                if (!(failed = schemaCount <= 0))
                {
                    count = RestoreTableObjects();
                }
            }
            catch (Exception e)
            {
                Memo("Memo", "VEAdmin.RestoreTables.Exception:\r\n\t" + e.Message);
                failed = true;
            }
            finally
            {
                Memo("Memo", string.Format("\r\n//\r\n//\tRestore User Tables: {0, 7:n0} Of {1:n0} Tables Restored" +
                                           "\r\n//\tRestore User Tables: {2, 7} {3}\r\n//\r\n",
                                           count, schemaCount, "**",
                                           Abort ? "Restoration Aborted" : failed ? "Restoration Failed" : VETimeStamp.ElapsedTime(startTime)));

                taskCompletion();
            }
        }
Exemplo n.º 3
0
        public override void RestoreTables(VEDelegate taskCompletion)
        {
            DateTime startTime = DateTime.Now;
            int      count = 0, schemaCount = 0;
            bool     failed  = false;
            string   process = "Restore User Tables";

            Memo("Start", string.Format("//\r\n//\t{0}\r\n//\t{1}: From {2}\r\n//\t{1}:      [{3}]\r\n//\r\n//\t{1}:   To {4}\r\n//\t{1}:      [{5}]\r\n//\r\n",
                                        BackupTimeStamp, process,
                                        ZipFile.DatabaseSchema, ZipFile.FullFilename,
                                        targetObject.DatabaseSchema, targetObject.Server));

            try
            {
                if (zipFile.HasSchemaTables())
                {
                    zipFile.Objects("Tables");
                    schemaCount = RestoreTableSchema();

                    if (!(failed = schemaCount <= 0))
                    {
                        count = RestoreTableObjects();
                    }
                }
                else
                {
                    VELog.Error("VEAdminZip.RestoreTables: database = " + zipFile.Database + "; schema = " + zipFile.Schema + "; HasNoTables");
                }
            }
            catch (Exception e)
            {
                Error("VEAdminZip.RestoreTables Exception: ", e);
                failed = true;
            }
            finally
            {
                Memo(Abort || failed ? "Error" : "Totals", string.Format("\r\n//\r\n//\t{0}: {1, 7:n0} Of {2:n0} Tables Restored\r\n//\t{0}: {3, 7} {4}\r\n//\r\n",
                                                                         process, count, schemaCount, "**",
                                                                         Abort ? "Restoration Aborted" : failed ? "Restoration Failed" : VETimeStamp.ElapsedTime(startTime)));

                taskCompletion();

                VELog.Error(string.Format("VEAdminZip.RestoreTables: min = {0}; max = {1}; max1024 = {2}; max2048 = {3} ", minCommand, maxCommand, maxCommand1024, maxCommand2048));
            }
        }
Exemplo n.º 4
0
 /// <summary>Drops all schema tables and restores all tables specified in schema table '[selected path]\Tables\.veTableDependencies.dat'.
 /// Scripts for each table specified in the schema table must be found in the '[selected path]\Tables' folder to restore the table and
 /// a corresponding data content '.dat' file must be found in '[selected path]\Tables\Data' to repopulate the restored table</summary>
 public virtual void RestoreTables(VEDelegate taskCompletion)
 {
 }