Return-Path: X-Original-To: apmail-db-derby-user-archive@www.apache.org Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6E00E9B91 for ; Thu, 29 Mar 2012 15:25:38 +0000 (UTC) Received: (qmail 8537 invoked by uid 500); 29 Mar 2012 15:25:38 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 8429 invoked by uid 500); 29 Mar 2012 15:25:38 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 8421 invoked by uid 99); 29 Mar 2012 15:25:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Mar 2012 15:25:38 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [213.199.154.139] (HELO db3outboundpool.messaging.microsoft.com) (213.199.154.139) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Mar 2012 15:25:31 +0000 Received: from mail74-db3-R.bigfish.com (10.3.81.236) by DB3EHSOBE005.bigfish.com (10.3.84.25) with Microsoft SMTP Server id 14.1.225.23; Thu, 29 Mar 2012 15:25:10 +0000 Received: from mail74-db3 (localhost [127.0.0.1]) by mail74-db3-R.bigfish.com (Postfix) with ESMTP id 10D144E0066 for ; Thu, 29 Mar 2012 15:25:10 +0000 (UTC) X-SpamScore: -11 X-BigFish: VPS-11(zz9371I542M1418Mzz1202hzz8275dhz2dh2a8h668h839h944hd25h) X-Forefront-Antispam-Report: CIP:74.62.37.82;KIP:(null);UIP:(null);IPV:NLI;H:CPHUB1.canoga.com;RD:rrcs-74-62-37-82.west.biz.rr.com;EFVD:NLI Received: from mail74-db3 (localhost.localdomain [127.0.0.1]) by mail74-db3 (MessageSwitch) id 1333034707185832_15181; Thu, 29 Mar 2012 15:25:07 +0000 (UTC) Received: from DB3EHSMHS006.bigfish.com (unknown [10.3.81.238]) by mail74-db3.bigfish.com (Postfix) with ESMTP id 1CD6D1400C2 for ; Thu, 29 Mar 2012 15:25:07 +0000 (UTC) Received: from CPHUB1.canoga.com (74.62.37.82) by DB3EHSMHS006.bigfish.com (10.3.87.106) with Microsoft SMTP Server (TLS) id 14.1.225.23; Thu, 29 Mar 2012 15:25:02 +0000 Received: from CPHUB2.canoga.com (172.16.1.94) by CPHUB1.canoga.com (172.16.1.93) with Microsoft SMTP Server (TLS) id 8.2.213.0; Thu, 29 Mar 2012 08:26:49 -0700 Received: from vserver1.canoga.com ([169.254.2.24]) by CPHUB2.canoga.com ([172.16.1.94]) with mapi; Thu, 29 Mar 2012 08:26:49 -0700 From: "Bergquist, Brett" To: Derby Discussion Date: Thu, 29 Mar 2012 08:25:01 -0700 Subject: RE: Can someone explain the use of logged archive backup? Thread-Topic: Can someone explain the use of logged archive backup? Thread-Index: Ac0NuNuGAyCcbIhoSWO0372c+WK2LgABL3rQ Message-ID: <97EB699F861AD841B5908C7CA9C9565602065E174AD9@VSERVER1.canoga.com> References: <97EB699F861AD841B5908C7CA9C9565602065E174AB1@VSERVER1.canoga.com> <4F74720A.7000104@gmail.com> In-Reply-To: <4F74720A.7000104@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US X-TM-AS-Product-Ver: SMEX-8.0.0.1307-6.500.1024-18804.005 X-TM-AS-Result: No--13.761800-0.000000-31 X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: canoga.com X-Virus-Checked: Checked by ClamAV on apache.org Thanks Bryan, but I am a little dense on this one and just want to understa= nd the proper procedure to use "SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE= _LOG_ARCHIVE_MODE" so that I can either consider it or not. =20 On one system that uses ZFS, we will probably use the SYS_UTIL.SYSCS_FREEZE= _DATABASE to freeze, perform an ZFS snapshot, and SYS_UTIL.SYSCS_FREEZE_DAT= ABASE to unfreeze the database. I am concerned of a failure in the code b= etween freezing the database and unfreezing the database as I believe if th= e connection is lost, the database will remain frozen with no way to unfree= ze. I need to test that and maybe patch Derby to perform an unfreeze if th= e connection is lost. I have had this happen when I used a script to call I= J to do the freeze, the shell to do the ZFS snapshot, and IJ again to unfre= eze. The last IJ to unfreeze could not get a connection and could not unfr= eeze. And the database was locked up and could not even be shutdown cleanl= y. Another system is an older system that is running UFS so this will not be p= ossible. Back to "SYSCS_UTIL.SYSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE". So= the procedure would be: - use this procedure to create a backup of the database and enable log arc= hiving. Presumably the database would be created on some other media. - if the log directory has not been moved with the from "/log", = what does one do with this? Periodically copy the file in there to the oth= er media? How does one determine the "archive" logs from the "active" logs= used for crash recovery or is even necessary. - time goes on and another full backup is done. Does one use SYSCS_UTIL.S= YSCS_BACKUP_DATABASE_AND_ENABLE_LOG_ARCHIVE_MODE again? I assume that the = new archive logs need to be kept with this backup now, right? - I guess I confused by the archive logs and where they are located, what = they look like, and what to do with them Now there is a disk crash that contains the database, a new disk is put in = place, formatted, etc. and is available to the OS. So the procedure to rec= over this is to issue a connect like: - connect 'jdbc:derby:;rollForwardRecoveryFrom=3D'; Is that correct? Is that any different than physically copying the databas= e and all of the logs to the new disk simply connecting like: - connect 'jdbc:derby:' Any light you can shed on this will be helpful. I think the Administration= guide should go through this. I t starts to, but the part about handling = the "archive logs" is not really presented. -----Original Message----- From: Bryan Pendleton [mailto:bpendleton.derby@gmail.com]=20 Sent: Thursday, March 29, 2012 10:31 AM To: Derby Discussion Subject: Re: Can someone explain the use of logged archive backup? > confused here on the archived logs and the active logs. In general, there can be multiple logs covering the time between one backup= and the next backup, and those logs must be applied, serially, in the corr= ect order, to recover the database fully. Once you take that "next" backup, you no longer need the previous backup/lo= gs, though it's probably wise to establish a reasonable holding period depe= nding on your resources (e.g., backup weekly, keep 3 months of backups and logs, destroy the oldest set when you complete the = most recent backup, etc.) > I need to protect against a media crash and it is not so important to go = back to specific periods of time for the database. Perhaps you can entirely use lower-level mechanisms, then, such as RAID or = other redundant storage hardware, or a modern filesystem which automaticall= y replicates the underlying data against the failure of the storage, such a= s ZFS (http://en.wikipedia.org/wiki/ZFS) I think it's still wise to have an application-level backup strategy, becau= se sometimes logical recovery is necessary (e.g., to recover from an applic= ation bug or an administrative mistake), so I think that the exercise you'r= e going through about documenting your backup and recovery strategies is an= excellent one. And don't forget to test those backup/restore practices, since an untested = restore is no better than no restore at all. I've found that one useful technique is to provision a secondary machine, w= hich can be MUCH smaller in terms of CPU, memory, networking, etc., and jus= t has to have enough disk space, and automate things so that every time I t= ake a backup, my scripts automatically copy the backup to this spare machin= e, restore the backup and apply all the logs, and then run a few queries to= satisfy myself that the database is correctly recovered. thanks, bryan