db2 history file

Upload: udaykiranrajitha-kammala

Post on 05-Apr-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/31/2019 Db2 History File

    1/4

  • 7/31/2019 Db2 History File

    2/4

    LIST HISTORY

    [ALL | SINCE [Timestamp] |CONTAINING ObjectName]FOR [DATABASE | DB] [DatabaseName]where:

    Timestamp:Identifies a timestamp that is to be used as search criteria

    when retrieving entries from the recovery history file; onlyentries with timestamps that are greater than or equal to thetimestamp provided are retrieved and displayed.

    SchemaName:Identifies the name assigned to the schema that is to be used

    as search criteria when retrieving entries from the recoveryhistory file; only entries that are associated with the schemaname specified are retrieved and displayed.ObjectName:Identifies the name assigned to an object that is to be used as

    search criteria when retrieving entries from the recovery historyfile; only entries that are associated with the object specifiedare retrieved and displayed.

    DatabaseName:Identifies the name assigned to the database that recovery

    history file information is to be retrieved and displayed for.

    So, if you wanted to display all entries found in the recoveryhistory file for a database named SAMPLE, you could do so byexecuting a LIST HISTORY command that looks something likethis:

    LIST HISTORY ALL FOR DATABASE SAMPLEAnd when such a LIST HISTORY command is executed, outputthat looks something like the following might be produced(assuming the SAMPLE database has been backed up):

    List History File for SAMPLE

    Number of matching file entries = 1

  • 7/31/2019 Db2 History File

    3/4

    Op Obj Timestamp+Sequence Type Dev Earliest Log CurrentLog Backup ID-- --- ------------------ ---- --- ------------ ------------ ------------

    B D 20030817204927001 F D S0000000.LOGS0000000.LOG-------------------------------------------------------------------------Contains 2 tablespace(s):

    00001 SYSCATSPACE00002 USERSPACE1-------------------------------------------------------------------------Comment: DB2 BACKUP SAMPLE OFFLINEStart Time: 20030817204927End Time: 20030817204957

    -------------------------------------------------------------------------00001 Location:

    C:\Backup\SAMPLE.0\DB2\NODE0000\CATN0000\20030817You can delete a recovery history file entry by executing thePRUNE HISTORY command. The basic syntax for this commandis:

    PRUNE HISTORY [Timestamp]where:

    TimestampIdentifies a timestamp that is to be used as search criterion

    when removing entries from the recovery history file; onlyentries with timestamps that are less than or equal to thetimestamp provided are deleted, provided they are not part ofthe most recent restore set.

    If the WITH FORCE OPTION option is specified, entries withtimestamps that are less than or equal to the timestampspecified are deleted regardless of whether or not they are part

    of the most recent restore set.

    Thus, if you wanted to remove all recovery history log fileentries that were made prior to and including January 1, 2002,regardless of whether or not they are part of the most recentrestore set, you could do so by executing a PRUNE HISTORYcommand that looks something like this:

  • 7/31/2019 Db2 History File

    4/4

    PRUNE HISTORY 20020101 WITH FORCE OPTIONIt is important to note that where the LIST HISTORY commandrequires you to provide the name of the database whoserecovery history file is to be queried, the PRUNE HISTORYcommand requires that you establish a connection to the

    appropriate database before attempting to remove one or moreof its recovery history file entries.