public class RestoreFromBackup extends CommonShell implements UpgConstants
This runs independently of MXServer. MXServer should NOT be running at the same time as this program, otherwise the database may be changing at the same time that this program is trying to determine what to output.
This program is also run as part of the upgrade process, when called by Upgrade
.
The commandline parameters for RestoreFromBackup are as follows, in addition to those in the superclass
CommonShell
.
Parameter ID | Parameter Value | Description |
---|---|---|
-g | (none) | This is optional. It indicates that this class has been instanciated by the Upgrade. |
-r | (none) | This is optional. It indicates that the backup tables will be
dropped by this program after the tables have been restored. If not
specified, then the backup table must be dropped in a separate step by the
DropBackup program.
|
-t | Table names delimited by commas | This is optional. If this parameter is
used, then the names of the Maximo tables to be restored
will appear after this parameter, delimited by commas.
For example: -tITEM,TOOL,WORKORDER
If not specified, then all tables that are eligible to be restored will be restored. |
-z | (none) | The -z parameter is used ONLY for DB2. When the -z parameter is used and this
is DB2, then the logic that enables text search for all tables is not performed from
RestoreFromBackup. Instead, RestoreFromBackup will output a script containing all the relevant commands.
The script name is db2text_restorefrombackup.bat, and it is output to the same directory as the logfile.
A second script, db2text_restorefrombackup.sh, is output for Unix shell script.
The reason this parameter is provided is because in DB2, text search procedures cannot be initiated from a remote machine. If RestoreFromBackup is run on a different machine than the machine where the database is located, it cannot run the text search commands. They will have to be run manually by a user on the database's machine by using the script output by RestoreFromBackup. |
CommonShell
,
ConfigDB
,
DropBackup
listStream
DB2, doNotUpdateACTION, doNotUpdateALNDOMAIN, doNotUpdateAPPLICATIONAUTH, doNotUpdateAUTOKEY, doNotUpdateCONDITION, doNotUpdateCONTRACTPROPERTY, doNotUpdateCONTRACTTYPE, doNotUpdateCROSSOVERDOMAIN, doNotUpdateDOCTYPES, doNotUpdateLANGUAGE, doNotUpdateMAXAPPS, doNotUpdateMAXCONDDETAIL, doNotUpdateMAXCONTROLVALUE, doNotUpdateMAXDOMAIN, doNotUpdateMAXLOGAPPENDER, doNotUpdateMAXLOGGER, doNotUpdateMAXMENU, doNotUpdateMAXMESSAGES, doNotUpdateMAXMODULES, doNotUpdateMAXPROP, doNotUpdateMAXPROPVALUE, doNotUpdateMAXROLE, doNotUpdateMAXSEQUENCE, doNotUpdateMAXSERSECURITY, doNotUpdateMAXSERVICE, doNotUpdateMAXTABLEDOMAIN, doNotUpdateMAXVARS, doNotUpdateMAXVARTYPE, doNotUpdateMXCOLLAB, doNotUpdateMXCOLLABREF, doNotUpdateNUMERICDOMAIN, doNotUpdateNUMRANGEDOMAIN, doNotUpdatePORTLET, doNotUpdatePRICALC, doNotUpdateSECURITYRESTRICT, doNotUpdateSIGOPTION, doNotUpdateSYNONYMDOMAIN, doNotUpdateTAXTYPE, doNotUpdateWORKPRIORITY, doNotUpdateWORKTYPE, doNotUpdateWPEDITSETTING, messageCache, NEWONLY, OLDANDNEW, OLDONLY, ORACLE, SQLINET, SQLMICROSOFT, SQLSERVER, SYSDATATABLES, SYSTEMTABLES, UNKNOWN
Constructor and Description |
---|
RestoreFromBackup()
This constructor does nothing.
|
RestoreFromBackup(MXServer server)
This constructor accepts parameter for MXServer and
sets value for
mxs . |
Modifier and Type | Method and Description |
---|---|
void |
addMTPermissions(java.lang.String tablename,
java.lang.String uniqueColumnName,
MTStorageType storageType)
Add MT permissions and activate row access to table if MT Enabled.
|
void |
doLastSql()
Some final sql to attempt.
|
void |
dropTemp(java.lang.String tempTbName)
Drop the temp table.
|
void |
endProcessInstance()
At start of
endProcess ,
call endProcess for dropClass . |
void |
endSetupInstance(java.lang.String outdir,
java.lang.String outfile,
java.util.HashMap params)
Process
-g, -r, -t, -z parameters,
set values for upgrade , dropbackup , tbnames ,
db2TextScript , instanciate dropClass . |
void |
loadMaximoTable(java.lang.String tbname,
java.lang.String tempTbName)
Copy data from backup table to Maximo table.
|
static void |
main(java.lang.String[] argv)
Main
|
void |
process()
Main processing method for this program.
|
void |
setBypassTextSearchForUpgrade(boolean value)
This method is provided for the Upgrade.
|
void |
setUpgradeCallout(java.lang.String val)
This is called from
Upgrade so that
upgradeCallout can determine which subdirectory
contains the class files that indicate special processing for this upgrade. |
void |
showMsg(java.lang.String str)
Call super, then add message in ConfigureService, if appropriate.
|
void |
updateMeta(java.lang.String tbname)
Set restoredata = False on maxtables and maxtablescfg.
|
boolean |
upgradeCallout(java.lang.String methodName,
java.lang.String methodPlace,
java.lang.String tbname)
If this is running in Upgrade mode, then various points
in RestoreFromBackup provide hooks for calling specialized methods to perform any
complex upgrade processing that is not supported by the regular RestoreFromBackup
logic.
|
createOutfile, doCall, doDB2TextSearchCall, doSql, doSql, doSql, doSql, doWait, endProcess, endSetup, execRuntime, getDisplayMessage, getDisplayMessage, getOutfile, getOutstream, getProperty, getRootDirName, logSql, reformatForDB2, reformatForSqlsvr, setConnection, setDB2TextOutput, setup, setupFromPropfile, setupInstance, setupNested, setupNestedInstance, setUserLangCode, showMXException, showMXException
public RestoreFromBackup()
public void setUpgradeCallout(java.lang.String val)
Upgrade
so that
upgradeCallout
can determine which subdirectory
contains the class files that indicate special processing for this upgrade.
Sets value of calloutSubdir
.public void process() throws java.lang.Exception
If MXServer is running, then report an error and return without restoring anything.
Selects from maxtablescfg where
restoredata = True, and calls loadMaximoTable
for each such table.
However, if this is being run as part of the Upgrade, and there is special processing required
for a particular table, then upgradeCallout
is called
with params ("loadMaximoTable", null, tbname)
. If the class named
"UpgResLoadMaximoTable" + tbname
exists, then its process method can do one of the following:
loadMaximoTable
after whatever the custom class specifies.
loadMaximoTable
.
After the custom class returns, this method will call
updateMeta
and dropTemp
(depending on dropbackup parameter).
process
in class CommonShell
java.lang.Exception
Util.mxServerIsUp(java.lang.String)
,
Util.getUnrestoredTables(java.lang.String)
,
loadMaximoTable(java.lang.String, java.lang.String)
,
doLastSql()
public void loadMaximoTable(java.lang.String tbname, java.lang.String tempTbName) throws java.lang.Exception
IMPORTANT NOTE... The ConfigDB program already should have updated
any data where a string is being shortened, or a column has become "not null."
See rebuildTable
in the ConfigDB class.
If this is being run with the "drop backup" parameter, it calls
dropTempTable
in the DropBackup class.
upgradeCallout
is called in the following places:
("loadMaximoTable", "01", tbname)
("loadMaximoTable", "02", tbname)
("loadMaximoTable", "03", tbname)
("loadMaximoTable", "04", tbname)
("loadMaximoTable", "05", tbname)
tbname
- The name of the empty Maximo table (e.g. ITEM)tempTbName
- The name of the temp table containing the data (e.g. XXITEM)java.lang.Exception
Util.getColumnNamesNative(java.lang.String)
,
Util.getEnableDisableTriggersAll(java.lang.String, boolean)
,
Util.buildInsertStatementPrefix(java.lang.String, java.util.TreeMap, boolean, boolean)
,
Util.buildSelectStatementForRestore(java.lang.String, java.util.TreeMap, boolean, java.lang.String, boolean)
,
Util.getRowstampTriggerSql(java.lang.String, boolean)
,
TextSearch.adjustTextSearchOneTable(java.util.HashMap)
,
updateMeta(java.lang.String)
,
dropTemp(java.lang.String)
public void addMTPermissions(java.lang.String tablename, java.lang.String uniqueColumnName, MTStorageType storageType) throws java.lang.Exception
java.lang.Exception
Util.createPermission(java.lang.String, java.lang.String, java.lang.String, java.lang.String, com.ibm.tivoli.maximo.dbmanage.connection.MTStorageType)
public void updateMeta(java.lang.String tbname) throws java.lang.Exception
tbname
- Table name.java.lang.Exception
public void dropTemp(java.lang.String tempTbName) throws java.lang.Exception
tempTbName
- The name of the temp table ("XX" + tbname).java.lang.Exception
DropBackup.dropTempTable(java.lang.String)
public void setBypassTextSearchForUpgrade(boolean value)
value
- True to bypass native text search commands, False to perform them normally.bypassTextSearchForUpgrade
public void doLastSql() throws java.lang.Exception
java.lang.Exception
public void showMsg(java.lang.String str)
showMsg
in class CommonShell
str
- The one-line message to be displayed.ConfigureService.addConfigMsg(java.lang.String)
public boolean upgradeCallout(java.lang.String methodName, java.lang.String methodPlace, java.lang.String tbname) throws java.lang.Exception
The name of the class being called is "UpgRes" + methodName + methodPlace + tbname.
For example, if this is called from method loadMaximoTable
, place 01
,
table Item
, then the name of this class would be:
UpgResLoadMaximoTable01ITEM
The subdirectory containing these classes is identified by calloutSubdir
.
The class should be extended from UpgTemplate. If the class is not found, there is no error. If the class needs to exit the Restore program, it should throw an error.
methodName
- The name of the method that is invoking this hook. Required.methodPlace
- If the method provides more than one hook, each hook
needs an identifier. If the method provides only one hook,
this will be null.tbname
- The table name currently being processed.
If table name is not relevant to the calling method, this
will be null.java.lang.Exception
UpgTemplate
public void endSetupInstance(java.lang.String outdir, java.lang.String outfile, java.util.HashMap params) throws java.lang.Exception
-g, -r, -t, -z
parameters,
set values for upgrade
, dropbackup
, tbnames
,
db2TextScript
, instanciate dropClass
.endSetupInstance
in class CommonShell
outdir
- Output directory, used when instanciating dropClass
.outfile
- Not used.params
- Parameters (see class javadocs).java.lang.Exception
public void endProcessInstance() throws java.lang.Exception
endProcess
,
call endProcess for dropClass
.endProcessInstance
in class CommonShell
java.lang.Exception
public static void main(java.lang.String[] argv)