MySQL backup/Restore:
- nota sui parametri da impiegare - update eseguibili x call default - stopwatch esempio tempi esecuzione
This commit is contained in:
@@ -76,10 +76,10 @@ namespace EgtBEAMWALL.DataLayer
|
||||
/// <summary>
|
||||
/// Effettua DUMP del DB dato utente admin + percorso salvataggio
|
||||
/// </summary>
|
||||
/// <param name="mysqlDumpPath">Percorso eseguibile mysqldump</param>
|
||||
/// <param name="outFilePath">Percorso di salvataggio del dump (*.sql)</param>
|
||||
/// <param name="mysqlDumpPath">Nome o Percorso Eseguibile mysqldump (opzionale)</param>
|
||||
/// <returns></returns>
|
||||
public static bool DataBaseDumpToFile(string mysqlDumpPath, string outFilePath)
|
||||
public static bool DataBaseDumpToFile(string outFilePath, string mysqlDumpPath = "mysqldump")
|
||||
{
|
||||
bool fatto = false;
|
||||
// aggiungo sql finale
|
||||
@@ -98,7 +98,7 @@ namespace EgtBEAMWALL.DataLayer
|
||||
{
|
||||
File.Delete(outFilePath);
|
||||
}
|
||||
// chiamo script esterno...
|
||||
// chiamo script esterno... importante parametro "--skip-extended-insert" altrimenti problemi con restore (anche se + verboso e lento in backup...)
|
||||
string callScript = $"\"{mysqlDumpPath}\" -u{DATABASE_USER} -p{DATABASE_PWD} {DATABASE_NAME} --skip-extended-insert > {outFilePath}";
|
||||
ExecuteCommand(callScript);
|
||||
return fatto;
|
||||
@@ -107,10 +107,10 @@ namespace EgtBEAMWALL.DataLayer
|
||||
/// <summary>
|
||||
/// Effettua restore come overwrite del DB di DEFAULT... irreversibile
|
||||
/// </summary>
|
||||
/// <param name="mysqlPath">Percorso eseguibile mysql</param>
|
||||
/// <param name="inFilePath">Percorso di lettura del dump (*.sql)</param>
|
||||
/// <param name="mysqlPath">Nome o Percorso Eseguibile mysql (opzionale)</param>
|
||||
/// <returns></returns>
|
||||
public static bool DataBaseRestoreFromFile(string mysqlPath, string inFilePath)
|
||||
public static bool DataBaseRestoreFromFile(string inFilePath, string mysqlPath="mysql")
|
||||
{
|
||||
bool fatto = false;
|
||||
// aggiungo sql finale
|
||||
|
||||
Reference in New Issue
Block a user