How would you restore a backup generated by this batch file? Questions 17 – 20 p
ID: 3911024 • Letter: H
Question
How would you restore a backup generated by this batch file?
Questions 17 – 20 pose questions from the following Windows batch file.
set dbUser=root
set dbPassword=password
set backupDir="C:Documents and SettingsuserDesktopackupmysql"
set mysqldump="C:Program FilesMySQLMySQL Workbench 5.2 CEmysqldump.exe"
set mysqlDataDir="C:Documents and SettingsAll UsersApplication DataMySQLMySQL Server 5.1data"
set zip="C:Program Files-Zipz.exe"
: get date
for /F "tokens=1-3 delims=- " %%i in ('date /t') do
(
set yy=%%i
set mon=%%j
set dd=%%k
)
:: get time
for /F "tokens=5-8 delims=:. " %%i in ('echo.^| time ^| find "current" ') do
(
set hh=%%i
set min=%%j
)
echo dirName=%yy%%mon%%dd%_%hh%%min%
:: switch to the "data" folder
pushd %mysqlDataDir%
:: iterate over the folder structure in the "data" folder to get the databases
for /d %%f in (*) do
(
if not exist %backupDir%%dirName%
(
mkdir %backupDir%%dirName%
)
%mysqldump% --host="localhost" --user=%dbUser% --single-transaction --add-drop-table --databases %%f > %backupDir%%dirName%%%f.sql
%zip% a -tzip %backupDir%%dirName%%%f.sql.gz %backupDir%%dirName%%%f.sql
del %backupDir%%dirName%%%f.sql
)
popd
a
The batch file does automatic restoration when the database server is down.
b
Run mysqldump -e .zip
c
Unzip the archive and then run mysqldump
d
Unzip the archive and then run the SQL file in Workbench
a
The batch file does automatic restoration when the database server is down.
b
Run mysqldump -e .zip
c
Unzip the archive and then run mysqldump
d
Unzip the archive and then run the SQL file in Workbench
Explanation / Answer
Option d
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.