Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    [Windows] Errore Backup MySQL

    Buonasera a tutti, su un server Windows Server 2008 ho un problema con il backup dei database presenti su MySQL 5.1.68

    Per effettuare il backup ho schedulato in piccolo batch:

    codice:
    @echo off:: Set some variables
    set backupdir="o:\databasebck"
    set mysqldir="C:\Program Files\MySQL\MySQL Server 5.1"
    set mysqldatadir="C:\ProgramData\MySQL\MySQL Server 5.1\data"
    set logdir="C:\ProgramData\MySQL\MySQL Server 5.1\Log"
    set dbuser=xxx
    set dbpass=xxx
    rem set zip="ENTER_VALUE_HERE"
    rem set mailer="ENTER_VALUE_HERE"
    rem set to="ENTER_VALUE_HERE"
    rem set from="ENTER_VALUE_HERE"
    rem set server="ENTER_VALUE_HERE"
    set endtime=0
    
    
    :DODIR
    
    
    :: Do DIR of backupdir to establish network
    DIR %backupdir%
    
    
    :GETTIME
    
    
    :: get the date and then parse it into variables
    for /F "tokens=2-4 delims=/ " %%i in ('date /t') do (
    set mm=%%i
    set dd=%%j
    set yy=%%k
    )
    
    
    :: get the time and then parse it into variables
    for /F "tokens=5-8 delims=:. " %%i in ('echo.^| time ^| find "current" ') do (
    set hh=%%i
    set ii=%%j
    set ss=%%k
    )
    
    
    :: If this is the second time through then go to the end of the file
    if "%endtime%"=="1" goto END
    
    
    :: Create the filename suffix
    set fn=_%dd%-%mm%-%yy%_%hh%-%mm%-%ss%
    
    
    :: Switch to the data directory to enumerate the folders
    pushd %mysqldatadir%
    
    
    :: Write to the log file
    echo Beginning mysqldump Process > %logdir%\MySQL_LOG%fn%.txt
    echo Start Time = %yy%-%mm%-%dd% %hh%:%ii%:%ss% >> %logdir%\MySQL_LOG%fn%.txt
    echo --------------------------- >> %logdir%\MySQL_LOG%fn%.txt
    echo. >> %logdir%\MySQL_LOG%fn%.txt
    
    
    :: Loop through the data structure in the data dir to get the database names
    for /d %%f in (*) do (
    
    
    :: Create the backup sub-directory is it does not exist
    if not exist %backupdir%\%%f\ (
    echo Making Directory %%f
    echo Making Directory %%f >> %logdir%\MySQL_LOG%fn%.txt
    mkdir %backupdir%\%%f
    ) else (
    echo Directory %%f Exists
    echo Directory %%f Exists >> %logdir%\MySQL_LOG%fn%.txt
    )
    
    
    :: Run mysqldump on each database and compress the data by piping through gZip
    rem echo Backing up database %%f%fn%.sql.gz
    rem echo Backing up database %%f%fn%.sql.gz >> %logdir%\MySQL_LOG%fn%.txt
    %mysqldir%\bin\mysqldump.exe --user=%dbuser% --password=%dbpass% --databases %%f --opt --quote-names --allow-keywords --complete-insert > %backupdir%\%%f\%%f%fn%.sql
    rem echo Done...
    rem echo Done... >> %logdir%\MySQL_LOG%fn%.txt
    )
    
    
    :: Write to the log file
    echo. >> %logdir%\MySQL_LOG%fn%.txt
    echo --------------------------- >> %logdir%\MySQL_LOG%fn%.txt
    echo Analyzing, optimising and repairing databases
    echo Analyzing, optimising and repairing databases >> %logdir%\MySQL_LOG%fn%.txt
    %mysqldir%\bin\mysqlcheck.exe --all-databases --medium-check --auto-repair --force --use-frm --optimize --analyze --check-only-changed --user=%dbuser% --password=%dbpass%
    echo Done...
    echo Done... >> %logdir%\MySQL_LOG%fn%.txt
    
    
    :: Go back and get the end time for the script
    set endtime=1
    goto :GETTIME
    
    
    :END
    :: Write to the log file
    echo. >> %logdir%\MySQL_LOG%fn%.txt
    echo --------------------------- >> %logdir%\MySQL_LOG%fn%.txt
    echo MySQLDump Process Finished >> %logdir%\MySQL_LOG%fn%.txt
    echo End Time = %yy%-%mm%-%dd% %hh%:%ii%:%ss% >> %logdir%\MySQL_LOG%fn%.txt
    echo. >> %logdir%\MySQL_LOG%fn%.txt
    
    
    :: Return to the scripts dir
    popd
    
    
    :: Send the log file in an e-mail
    rem %mailer%\blat.exe %logdir%\MySQL_LOG%fn%.txt -to %to% -f %from% -server %server%
    rem EXIT
    Il problema è questo, alcuni database me li backuppa e altri no..
    Presumo che il problema sia nel nome del database stesso perché i db contenenti dei segni nei nomi non me li salva

    L'errore è questo:

    codice:
    Making Directory database@002dtest
    mysqldump: Got error: 1049: Unknown database 'database@002dtest' when selecting
    the database
    Il database si chiamerebbe database-test

    Come potrei risolvere?

  2. #2
    Qualche idea sull'errore?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.