Sunday, 21 February 2016

DB2 Normal Backup, Online Backup and Restore Commands

Normal Backup Process : 
     1. Connect to Database    
         $db2 connect to DataBase_Name
     2. Create Backup Folder (backup-current date)
         $mkdir backup-01012016
     3. Stop All Applications which are accessing the DataBase.
     4. Restart DataBase
         $db2stop force
         $db2start
      5. Command for DataBase Backup
         $db2 backup database RAMADB to /opt/backup/backup_01012016/
      Output :

           Backup successful. The timestamp for this backup image is : 20160101718316
      6. Backup Image checking Command
           $db2ckbkp /opt/backup_01012016/RAMADB.0.db2inst2.NODE0000.CATN0000.20160101314605.001
Online Backup Process :
       1. Online Backup Command
           $db2 -v "backup database RAMADB online to /opt/backup-01012015 compress  include logs"
       Output : 
         backup database RAMADB online to /opt/backup-01012016/RAMADB compress  include logs
         Backup successful. The timestamp for this backup image is : 20160101404321
DataBase Restore Process :
       1. Restore Command
          $db2 restore database RAMADB from /opt/backup-01012016 taken at 20160101404321
             SQL2539W  Warning!  Restoring to an existing database that is the same as the
             backup image database.  The database files will be deleted.
             Do you want to continue ? (y/n) y
  Output :
             DB20000I  The RESTORE DATABASE command completed successfully.
       2. Rollforward Command
          $db2 rollforward db RILDDB to end of backup and complete
 Output : 
                                          Rollforward Status

 Input database alias                   = ramadb
 Number of nodes have returned status   = 1

 Node number                            = 0
 Rollforward status                     = not pending
 Next log file to be read               =
 Log files processed                    = S0001390.LOG - S0001391.LOG
 Last committed transaction             = 2016-01-01-16.30.00.000000 Local

DB20000I  The ROLLFORWARD command completed successfully.
      3. Connect to DataBase
         $ db2 "connect to RAMADB"

Reference  : 
https://www-01.ibm.com/support/knowledgecenter/SSEPGG_9.5.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0001933.html




No comments:

Post a Comment