Subject | Re: [Firebird-Java] unprofessional question |
---|---|
Author | Rick Fincher |
Post date | 2004-01-07T20:12:20Z |
Sorry,
I should have used the term "shadow" instead of "mirror." The pertinent
docs from the IB 6 manuals are below.
Rick
CREATE SHADOW
Creates one or more duplicate, in-sync copies of a database. Available in
SQL, DSQL, and
isql.
Syntax CREATE SHADOW set_num [AUTO | MANUAL] [CONDITIONAL]
' filespec' [LENGTH [=] int [PAGE[S]]]
[ <secondary_file>];
<secondary_file> = FILE ' filespec' [ <fileinfo>] [ <secondary_file>]
<fileinfo> = LENGTH [=] int [PAGE[S]] | STARTING [AT [PAGE]] int
[ <fileinfo>]
IMPORTANT In SQL statements passed to DSQL, omit the terminating semicolon.
In embedded
applications written in C and C++, and in isql, the semicolon is a
terminating symbol for
the statement, so it must be included.
Argument Description
rolename Name associated with the role; must be unique among role names
in the database
CHAPTER 2 SQL STATEMENT AND FUNCTION REFERENCE
70 INTERBASE 6
Description CREATE SHADOW is used to guard against loss of access to a
database by establishing one
or more copies of the database on secondary storage devices. Each copy of
the database
consists of one or more shadow files, referred to as a shadow set. Each
shadow set is
designated by a unique positive integer.
Disk shadowing has three components:
g A database to shadow.
g The RDB$FILES system table, which lists shadow files and other information
about the
database.
g A shadow set, consisting of one or more shadow files.
Argument Description
set_num Positive integer that designates a shadow set to which all
subsequent files listed in the statement belong
AUTO Specifies the default access behavior for databases in the event no
shadow is available
. All attachments and accesses succeed
. Deletes all references to the shadow and detaches the shadow file
MANUAL Specifies that database attachments and accesses fail until a shadow
becomes available, or until all references to the shadow are removed
from the database
CONDITIONAL Creates a new shadow, allowing shadowing to continue if the
primary shadow becomes unavailable or if the shadow replaces the
database due to disk failure
'filespec' Explicit path name and file name for the shadow file; must be a
local
filesystem and must not include a node name or be on a neworked
filesystem
LENGTH [=] int [PAGE[S]] Length in database pages of an additional shadow
file; page size is
determined by the page size of the database itself
secondary_file Specifies the length of a primary or secondary shadow file;
use for
primary file only if defining a secondary file in the same statement
STARTING [AT [PAGE]] int Starting page number at which a secondary shadow
file begins
CREATE SHADOW
LANGUAGE REFERENCE 71
When CREATE SHADOW is issued, a shadow is established for the database most
recently
attached by an application. A shadow set can consist of one or multiple
files. In case of
disk failure, the database administrator (DBA) activates the disk shadow so
that it can
take the place of the database. If CONDITIONAL is specified, then when the
DBA activates
the disk shadow to replace an actual database, a new shadow is established
for the
database.
If a database is larger than the space available for a shadow on one disk,
use the
secondary_file option to define multiple shadow files. Multiple shadow files
can be
spread over several disks.
Tip To add a secondary file to an existing disk shadow, drop the shadow with
DROP SHADOW
and use CREATE SHADOW to recreate it with the desired number of files.
Examples The following isql statement creates a single, automatic shadow
file for employee.gdb:
CREATE SHADOW 1 AUTO 'employee.shd';
The next isql statement creates a conditional, single, automatic shadow file
for
employee.gdb:
CREATE SHADOW 2 CONDITIONAL 'employee.shd' LENGTH 1000;
The following isql statements create a multiple-file shadow set for the
employee.gdb
database. The first statement specifies starting pages for the shadow files;
the second
statement specifies the number of pages for the shadow files.
CREATE SHADOW 3 AUTO
'employee.sh1'
FILE 'employee.sh2'
STARTING AT PAGE 1000
FILE 'employee.sh3'
STARTING AT PAGE 2000;
CREATE SHADOW 4 MANUAL 'employee.sdw'
LENGTH 1000
FILE 'employee.sh1'
LENGTH 1000
FILE 'employee.sh2';
See Also DROP SHADOW
For more information about using shadows, see the Operations Guide or the
Data
Definition Guide.
I should have used the term "shadow" instead of "mirror." The pertinent
docs from the IB 6 manuals are below.
Rick
CREATE SHADOW
Creates one or more duplicate, in-sync copies of a database. Available in
SQL, DSQL, and
isql.
Syntax CREATE SHADOW set_num [AUTO | MANUAL] [CONDITIONAL]
' filespec' [LENGTH [=] int [PAGE[S]]]
[ <secondary_file>];
<secondary_file> = FILE ' filespec' [ <fileinfo>] [ <secondary_file>]
<fileinfo> = LENGTH [=] int [PAGE[S]] | STARTING [AT [PAGE]] int
[ <fileinfo>]
IMPORTANT In SQL statements passed to DSQL, omit the terminating semicolon.
In embedded
applications written in C and C++, and in isql, the semicolon is a
terminating symbol for
the statement, so it must be included.
Argument Description
rolename Name associated with the role; must be unique among role names
in the database
CHAPTER 2 SQL STATEMENT AND FUNCTION REFERENCE
70 INTERBASE 6
Description CREATE SHADOW is used to guard against loss of access to a
database by establishing one
or more copies of the database on secondary storage devices. Each copy of
the database
consists of one or more shadow files, referred to as a shadow set. Each
shadow set is
designated by a unique positive integer.
Disk shadowing has three components:
g A database to shadow.
g The RDB$FILES system table, which lists shadow files and other information
about the
database.
g A shadow set, consisting of one or more shadow files.
Argument Description
set_num Positive integer that designates a shadow set to which all
subsequent files listed in the statement belong
AUTO Specifies the default access behavior for databases in the event no
shadow is available
. All attachments and accesses succeed
. Deletes all references to the shadow and detaches the shadow file
MANUAL Specifies that database attachments and accesses fail until a shadow
becomes available, or until all references to the shadow are removed
from the database
CONDITIONAL Creates a new shadow, allowing shadowing to continue if the
primary shadow becomes unavailable or if the shadow replaces the
database due to disk failure
'filespec' Explicit path name and file name for the shadow file; must be a
local
filesystem and must not include a node name or be on a neworked
filesystem
LENGTH [=] int [PAGE[S]] Length in database pages of an additional shadow
file; page size is
determined by the page size of the database itself
secondary_file Specifies the length of a primary or secondary shadow file;
use for
primary file only if defining a secondary file in the same statement
STARTING [AT [PAGE]] int Starting page number at which a secondary shadow
file begins
CREATE SHADOW
LANGUAGE REFERENCE 71
When CREATE SHADOW is issued, a shadow is established for the database most
recently
attached by an application. A shadow set can consist of one or multiple
files. In case of
disk failure, the database administrator (DBA) activates the disk shadow so
that it can
take the place of the database. If CONDITIONAL is specified, then when the
DBA activates
the disk shadow to replace an actual database, a new shadow is established
for the
database.
If a database is larger than the space available for a shadow on one disk,
use the
secondary_file option to define multiple shadow files. Multiple shadow files
can be
spread over several disks.
Tip To add a secondary file to an existing disk shadow, drop the shadow with
DROP SHADOW
and use CREATE SHADOW to recreate it with the desired number of files.
Examples The following isql statement creates a single, automatic shadow
file for employee.gdb:
CREATE SHADOW 1 AUTO 'employee.shd';
The next isql statement creates a conditional, single, automatic shadow file
for
employee.gdb:
CREATE SHADOW 2 CONDITIONAL 'employee.shd' LENGTH 1000;
The following isql statements create a multiple-file shadow set for the
employee.gdb
database. The first statement specifies starting pages for the shadow files;
the second
statement specifies the number of pages for the shadow files.
CREATE SHADOW 3 AUTO
'employee.sh1'
FILE 'employee.sh2'
STARTING AT PAGE 1000
FILE 'employee.sh3'
STARTING AT PAGE 2000;
CREATE SHADOW 4 MANUAL 'employee.sdw'
LENGTH 1000
FILE 'employee.sh1'
LENGTH 1000
FILE 'employee.sh2';
See Also DROP SHADOW
For more information about using shadows, see the Operations Guide or the
Data
Definition Guide.
----- Original Message -----
> Hi,
>
> You could also let the Firebird server handle this by using a mirror. The
> server will keep two copies of the database for you.
>
> For extra backup you can put the mirror db file on a second hard drive in
> the server. That helps if you have a drive failure. It also reduces the
> chance that an error like you describe will occur because the data isn't
> transmitted twice over the net.
>
> Rick
>
> ----- Original Message -----
> From: "Lester Caine" <lester@...>
> To: <Firebird-Java@yahoogroups.com>
> Sent: Wednesday, January 07, 2004 3:04 AM
> Subject: Re: [Firebird-Java] unprofessional question
>
>
> > Gerevich Janos wrote:
> >
> > > try{...
> > > int chk=st_check.executeUpdate(toinsert); //insert into check db,
later
> > > into normal db
> > > if(st_normal.executeUpdate(toinsert)!=1) do all sorts of error
messages
> > > and such
> > > ...}catch {error messages and such}
> >
> > My 'quick' reaction would be - how do you know that BOTH
> > st_check and st_normal have been updated. From my
> > experience, it is quite possible that just occasionally the
> > 'normal flow' has been interrupted, so that only the first
> > insert has completed - which is exactly what you are seeing.
> >
> > I suspect that the 'problem' is actually the fact that you
> > ARE using two copies, and that scraping the 'check' would
> > actually fix the problem.
> >
> > IF you need to know that records ARE missing, simply use a
> > generator, and look for missing numbers. ( 'Deleted' records
> > are simply retained and MARKED deleted ;) )
> >
> > --
> > Lester Caine
> > -----------------------------
> > L.S.Caine Electronic Services
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> > To visit your group on the web, go to:
> > http://groups.yahoo.com/group/Firebird-Java/
> >
> > To unsubscribe from this group, send an email to:
> > Firebird-Java-unsubscribe@yahoogroups.com
> >
> > Your use of Yahoo! Groups is subject to:
> > http://docs.yahoo.com/info/terms/
> >
> >
>
>
>
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/Firebird-Java/
>
> To unsubscribe from this group, send an email to:
> Firebird-Java-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>