SQWareProduction:sybase:bin:sqwsyb LoadDatabase.ksh

From Wiki_dbSQWare
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Presentation

Script $gvsqw_SybBin/sqwsyb_LoadDatabase.ksh :


Standard database Load sybase
script dynamically find dump files to Load
You can choose type of Load (by default full):

  • full -> Load full dump
  • inc -> Load dump tran
  • stb -> Load dump tran for standby
  • fstb -> Load full dump plus dump tran for standby


You can choose to online database or not(default on):

  • on -> online
  • off -> not online
  • ostb -> online for standby access


The script can also:

  • kill connected sessions on the database to Load
  • make a synchronisation of syslogins/sysusers
  • run shell script before Load
  • run shell script after Load



Online help

The online help is available for most scripts with the -h option.
Ex: $gvsqw_SybBin/sqwsyb_LoadDatabase.ksh -h
Content of this assistance :

Sourcing sqwsyb_Global.lib v2025.06 SQWareProduction for Sybase (dbSQWare) ... 

Usage: sqwsyb_LoadDatabase.ksh [[-h]] -I <dataserver> -DT <DatabaseTarget> [[+ options]]

DESCRIPTION
   sqwsyb_LoadDatabase.ksh load $lvsqw_LoadType 
SUPPORT
   Sybase supported versions: 12.5 <= v <= 16.0

PARAMETERS
     -I  dataserver     : Target dataserver.
     -DT DatabaseTarget : Target database.
OPTIONS
     -h                 : Display the full usage.
     -s                 : Display samples of usage.
     -NoMail            : Deactivate sendmail on error demo-sqwarebox@dbsqware.com (by default, send on error).
     -AddMail   email   : Email address to add at 'demo-sqwarebox@dbsqware.com'.
     -SendReport        : Send execution log report.
     -DS DatabaseSource : Source database (by default same than -DT).
     -O on,off,ostb     : Type online (by default on).
     -F file            : Dump file to load (by default take the latest).
     -DD date_dump      : Dump date to load (by default take the latest).
     -RD directory      : Directory holding dump file (by default /$(echo ${HOME}|cut -d/ -f2)/syb_dump/$DSQUERY).
     -FRT       code    : Force return code value on error.
     -Before  script    : Script to execute before load.
     -After   script    : Script to execute after load.
     -Type type         : Type de load full,inc,stb,fstb (by default full).
     -Chk               : Check database size before load.
     -Lock              : Lock all logins during load.
     -Kill              : Kill connexion on loaded database.
     -Shut              : Run "dbcc dbreboot('shutdown_load',dbname)" before load database (12.5.4 ESD1 and 15.0.2).
     -Rsync             : Synchronize sysusers and sysalternates with master..syslogins (by default no).
     -LtmIgnore         : Execute 'dbcc settrunc (ltm,ignore)' after load.
     -CrossPlatform     : Execute sp_post_xpload after load.
     -AddFlagName mflag : Search dumps with '.mflag' at end of name.
     -Upgrade           : Execute sp_checkreswords,sp_checksource,dbcc upgrade_object after load.
     -Locale    locale  : Force Locale for help display (fr,en).
     -Exec              : Run load $lvsqw_LoadType (by default, display generated commands).

Note:
To be sure the aid is accurate, refer directly to the online help script -h option.


Error management

Errors passing arguments

This type of message is generated:

Lack 'dataserver' parameter, Usage: sqwsyb_LoadDatabase.ksh [[-h]] -I <dataserver> -DT <DatabaseTarget> [[+ options]]
For full help : sqwsyb_LoadDatabase.ksh -h

If you are connecting through a terminal, no mail will be sent and you will have more this kind of message:

Not sending mail because you are in connected mode !!!
Lack 'dataserver' parameter

If you are not connected to a terminal, the error message appears and is sent by mail to the address contained in the variable $gvsqw_GlobalMail (See help customize this variable). The subject line will always start by "$gvsqw_MailMsg_sybase : " (See help customize this variable).

Note:
Sending mail can be disabled by the option -NoMail for one execution.


Execution errors

Whether you are or not connected to a terminal, the error message appears and an email containing a summary of treatment errors is sent to the address contained in the variable $gvsqw_Mail_sybase (See help customize this variable). The subject line will always start by "$gvsqw_MailMsg_sybase : " (See help customize this variable).

Note:
Sending mail can be disabled by the option -NoMail for one execution.


Usage examples

Sourcing sqwsyb_Global.lib v2025.06 SQWareProduction for Sybase (dbSQWare) ... 

#Standard help for script sqwsyb_LoadDatabase.ksh:


$gvsqw_SybBin/sqwsyb_LoadDatabase.ksh -h
#Display online help for this script

$gvsqw_SybBin/sqwsyb_LoadDatabase.ksh -Locale en -h
#Display online help for this script with forcing of the 'en' locale (by default locale managed by $gvsqw_Locale)

$gvsqw_SybBin/sqwsyb_LoadDatabase.ksh -s
#Display usage examples for this script

$gvsqw_SybBin/sqwsyb_LoadDatabase.ksh -I $DSQUERY -DT <DbName>
#Generate commands but don't execute them !

$gvsqw_SybBin/sqwsyb_LoadDatabase.ksh -I $DSQUERY -DT <DbName> -Exec
#Load the dump for only one database

$gvsqw_SybBin/sqwsyb_LoadDatabase.ksh -I $DSQUERY -DT <DbName> -RD <DirName> -O <Type> -Exec
#Specifies the dump path, and the type of target database (on/off/ostb. By default, on)

$gvsqw_SybBin/sqwsyb_LoadDatabase.ksh -I $DSQUERY -DT <DbName> -DS <DataserverSource> -Exec
#Spedifies dataserver source of dump

$gvsqw_SybBin/sqwsyb_LoadDatabase.ksh -I $DSQUERY -DT <DbName> -DD <Date> -After <script> -Exec
Specifies the date of the dump to be loaded (by default, the lastest), then executes a script after loading. 

$gvsqw_SybBin/sqwsyb_LoadDatabase.ksh -I $DSQUERY -DT <DbName> -Chk -Before <script> -Exec
#Check the database size, and executes a script before loading the dump

$gvsqw_SybBin/sqwsyb_LoadDatabase.ksh -I $DSQUERY -DT <DbName> -Lock -Exec
#Lock all logins during dump's loading

$gvsqw_SybBin/sqwsyb_LoadDatabase.ksh -I $DSQUERY -DT <DbName> -Shut -Exec
#Execute \"dbcc dbreboot('shutdown_load',dbname)\" before loading

$gvsqw_SybBin/sqwsyb_LoadDatabase.ksh -I $DSQUERY -DT <DbName> -CrossPlatform -Exec
#Execute sp_post_xpload after loading

$gvsqw_SybBin/sqwsyb_LoadDatabase.ksh -I $DSQUERY -DT <DbName> -AddFlagName -Exec
#Load dump file whose name end by '.mflag'

$gvsqw_SybBin/sqwsyb_LoadDatabase.ksh -I $DSQUERY -DT <DbName> -Upgrade -Exec
Execute sp_checkreswords,sp_checksource,dbcc upgrade_object after loading

$gvsqw_SybBin/sqwsyb_LoadDatabase.ksh -I $DSQUERY -DT <DbName> -Type <TypedeDump> -F <File> -Exec
#Execute a load database of type <TypedeDump> of the target database with the specified file <File>.

$gvsqw_SybBin/sqwsyb_LoadDatabase.ksh -I $DSQUERY -DT <DbName> -Kill -Rsync -Exec
#Kill users connection before Load and made synchronisation of syslogins/sysusers

$gvsqw_SybBin/sqwsyb_LoadDatabase.ksh -I $DSQUERY -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_SybBin/sqwsyb_LoadDatabase.ksh -I $DSQUERY -DT <DbName> -SendReport -Exec
#Send the log by email at the end of the treatment even if there is no error

$gvsqw_SybBin/sqwsyb_LoadDatabase.ksh -I $DSQUERY -DT <DbName> -NoMail -Exec
#Disables sending an email on error to $gvsqw_GlobalMail (by default, send on error)

$gvsqw_SybBin/sqwsyb_LoadDatabase.ksh -I $DSQUERY -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_sqwsyb_LoadDatabase=<NumericValue>
#in configuration file $gvsqw_SybBin/../etc_cust/sqwsyb_GlobalVar.cfg

Note:
To be sure the examples are accurate, refer directly to the online help script -s option.