Difference between revisions of "Template:SQWareProduction sqwmys RestoreDatabase.ksh example"
m (Updated by BatchUser) |
m (Updated by BatchUser) |
||
Line 1: | Line 1: | ||
<pre> | <pre> | ||
− | Sourcing sqwmys_Global.lib v2024. | + | Sourcing sqwmys_Global.lib v2024.03 SQWareProduction for MySQL (dbSQWare) ... |
#Standard help for script sqwmys_RestoreDatabase.ksh: | #Standard help for script sqwmys_RestoreDatabase.ksh: | ||
# restore \$lvsqw_CopyType | # restore \$lvsqw_CopyType | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
$gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -h | $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -h | ||
Line 23: | Line 14: | ||
#Display usage examples for this script | #Display usage examples for this script | ||
− | $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -AddMail 'mymail1@mydomaine.com,mymail2@mydomaine.com' | + | $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> |
+ | #Generate commands but don't execute them ! | ||
+ | |||
+ | $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -Exec | ||
+ | #Restore database <DbName> \$lvsqw_CopyType | ||
+ | |||
+ | $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -DS <DbsName> -F <FileName> -Exec | ||
+ | #Restore database <DbName> from the backup <FileName> (lastest by default) of database source <DbsName> | ||
+ | |||
+ | $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -RD <DirName> -Exec | ||
+ | #Directory holding dump file | ||
+ | |||
+ | $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -DD <Date> -Exec | ||
+ | #Select the dump to restore dy date (by default take the latest) | ||
+ | |||
+ | $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -NoDrop -Exec | ||
+ | #Do not drop database before load (by default locale managed by $gvsqw_DropDb) | ||
+ | |||
+ | $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -Drop -Create -Exec | ||
+ | #Drop database before load, use locale from instance $MYSQL_SID for all create commands (by default locale managed by $gvsqw_CreateDb) | ||
+ | |||
+ | $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -Drop -NoCreate -Exec | ||
+ | #Drop database before load, use locale from mysqldump for all create commands (by default locale managed by $gvsqw_CreateDb) | ||
+ | |||
+ | $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -OptionsMySQL <option> -Exec | ||
+ | #Additional options during mysql command | ||
+ | |||
+ | $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> OptionsBeforeMySQL <option> -Exec | ||
+ | #Additional options before mysql command | ||
+ | |||
+ | $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -Verbose -Exec | ||
+ | #Add -vv option to mysql cmd when restore | ||
+ | |||
+ | $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -AddMail 'mymail1@mydomaine.com,mymail2@mydomaine.com' -Exec | ||
#Add the mail list to the default address managed by the variable gvsqw_GlobalMail | #Add the mail list to the default address managed by the variable gvsqw_GlobalMail | ||
− | $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -SendReport | + | $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -SendReport -Exec |
#Send the log by email at the end of the treatment even if there is no error | #Send the log by email at the end of the treatment even if there is no error | ||
− | $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -NoMail | + | $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -NoMail -Exec |
#Disables sending an email on error to $gvsqw_GlobalMail (by default, send on error) | #Disables sending an email on error to $gvsqw_GlobalMail (by default, send on error) | ||
− | $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName | + | $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -FRT <NumericValue> -Exec |
− | |||
− | |||
− | |||
#Force return code to '<NumericValue>' on error (if no error, "exit 0!") | #Force return code to '<NumericValue>' on error (if no error, "exit 0!") | ||
#You can also force return code of this script on all your | #You can also force return code of this script on all your | ||
#environnement if you set the variable: $gvsqw_ForcedReturnCodeScript_sqwmys_RestoreDatabase=<NumericValue> | #environnement if you set the variable: $gvsqw_ForcedReturnCodeScript_sqwmys_RestoreDatabase=<NumericValue> | ||
#in configuration file $gvsqw_MysBin/../etc_cust/sqwmys_GlobalVar.cfg | #in configuration file $gvsqw_MysBin/../etc_cust/sqwmys_GlobalVar.cfg | ||
− | |||
</pre> | </pre> |
Revision as of 15:14, 26 April 2024
Sourcing sqwmys_Global.lib v2024.03 SQWareProduction for MySQL (dbSQWare) ... #Standard help for script sqwmys_RestoreDatabase.ksh: # restore \$lvsqw_CopyType $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -h #Display online help for this script $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -Locale en -h #Display online help for this script with forcing of the 'en' locale (by default locale managed by $gvsqw_Locale) $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -s #Display usage examples for this script $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> #Generate commands but don't execute them ! $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -Exec #Restore database <DbName> \$lvsqw_CopyType $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -DS <DbsName> -F <FileName> -Exec #Restore database <DbName> from the backup <FileName> (lastest by default) of database source <DbsName> $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -RD <DirName> -Exec #Directory holding dump file $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -DD <Date> -Exec #Select the dump to restore dy date (by default take the latest) $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -NoDrop -Exec #Do not drop database before load (by default locale managed by $gvsqw_DropDb) $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -Drop -Create -Exec #Drop database before load, use locale from instance $MYSQL_SID for all create commands (by default locale managed by $gvsqw_CreateDb) $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -Drop -NoCreate -Exec #Drop database before load, use locale from mysqldump for all create commands (by default locale managed by $gvsqw_CreateDb) $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -OptionsMySQL <option> -Exec #Additional options during mysql command $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> OptionsBeforeMySQL <option> -Exec #Additional options before mysql command $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -Verbose -Exec #Add -vv option to mysql cmd when restore $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -AddMail 'mymail1@mydomaine.com,mymail2@mydomaine.com' -Exec #Add the mail list to the default address managed by the variable gvsqw_GlobalMail $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -SendReport -Exec #Send the log by email at the end of the treatment even if there is no error $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -NoMail -Exec #Disables sending an email on error to $gvsqw_GlobalMail (by default, send on error) $gvsqw_MysBin/sqwmys_RestoreDatabase.ksh -I $MYSQL_SID -DT <DbName> -FRT <NumericValue> -Exec #Force return code to '<NumericValue>' on error (if no error, "exit 0!") #You can also force return code of this script on all your #environnement if you set the variable: $gvsqw_ForcedReturnCodeScript_sqwmys_RestoreDatabase=<NumericValue> #in configuration file $gvsqw_MysBin/../etc_cust/sqwmys_GlobalVar.cfg