 |
» |
|
|
|
This section gives examples of the use of raw files. Creating a Log with Raw Files |  |
Assume you wish to use a raw data file as a log file.
Based on calculations from the DBA Guide, you find you need
about 96,000 512-byte pages (49,152,000 bytes or 48000 fragments) of space. Your system uses
7937 drives, and the /etc/checklist file contains the following
entries:
/dev/dsk/c0d0s0 / hfs rw 0 0 # root disk # 7937
/dev/dsk/c0d0s1 /swap swap rw 0 0 # swap area # 7937
/dev/dsk/c0d0s3 /tmp hfs rw 0 1 # /tmp directory # 7937
/dev/dsk/c0d0s9 /extra hfs rw 0 2 # /usr directory # 7937
/dev/dsk/c0d0s10 /mnt hfs rw 0 4 # /mnt directory # 7937
/dev/dsk/c1d0s7 /swap1 swap rw 0 0 # swap area drive1 # 7937
/dev/dsk/c1d0s11 /usr hfs rw 0 1 # extra space drive1 # 7937
/dev/dsk/c2d0s13 /users hfs rw 0 1 # /users drive2 # 7937
|
From the entry for the 7937 in /etc/newconfig/disktab,
we see two sections of about the right size
that would be good candidates for use as raw files: s1 - 48560 fragments (97120 pages)
s15 - 48560 fragments (97120 pages)
Let's test both of these potential sections for each of the three drives
on the system (c0, c1, and c2). First, let's try s1:
c0d0s1 is already in use on drive 0 as
swap space; c1d0s1 is not in
use on drive 1, but it overlaps with c1d0s7, which is in use as swap space;
c2d0s1 overlaps with c2d0s13 on drive2. So s1 is not available. How about s15? c0d0s15 overlaps with c0d0s1 on drive 0, and
c1d0s15 on drive 1 overlaps with c1d0s7. But c2d0s15 on
drive 2 does not overlap
with c2d0s13, so c2d0s15 is available for use as a raw file. You can use a raw file to define a log in the SQL START DBE or START DBE NEWLOG
commands, and in the SQLUtil ADDLOG and SETUPRECOVERY commands.
Assume you need a 96,000-page log. Creating a Database ObjectUse the raw file in your data definition command. The following example
shows the creation of a hash structure using 12140 pages. Start
with the BEGIN WORK command:
Then create the DBEFile, as follows.
CREATE DBEFILE AcctHash WITH PAGES=12140,
NAME= '/dev/rdsk/c2d0s15', TYPE=TABLE;
|
Then add the file to a DBEFileSet and create a table with hashing:
ADD DBEFILE AcctHash TO DBEFILESET CustAccts;
CREATE PUBLIC TABLE Receiving.Customer
(AccountNo INTEGER NOT NULL,
Name CHAR(60),
Balance DECIMAL (10,2))
UNIQUE HASH ON (AccountNo) PAGES=12140
IN CustAccts;
COMMIT WORK;
|
Notice that the CREATE DBEFILE and CREATE TABLE commands are parts
of the same transaction. This ensures that no other use will be
made of the raw file space in the DBEFileSet before the hash
structure is created. Expandable Raw Files |  |
If you create an expandable DBEFile using an HP-UX raw device,
be sure to specify a DBEFileMaxSize, and make
certain that, after rounding, it does not exceed the
capacity of the raw section you have chosen. The following example shows a raw file created
using a 7937 drive mounted as logical
device 2, section 15:
CREATE DBEFILE DBEFile1 WITH PAGES=2100, NAME='/dev/rdsk/c2d0s15',
INCREMENT=1000, MAXPAGES=11750, TYPE=TABLE
|
Because this section contains 48,560 fragments, or
12,140 data pages, the maximum after rounding
cannot exceed 12,140 pages. In the example,
MAXPAGES is set to 11,750, which is rounded up and recorded in the
system catalog as 12,000 pages (the next higher multiple of INCREMENT size).  |  |  |  |  | CAUTION:
Failure to specify a DBEFileMaxSize in the MAXPAGES clause when creating an expandable DBEFile on a raw device can result in expansion of the file beyond
the section you have chosen, with potential destruction of mounted file systems. Be sure to consult a knowledgeable HP-UX system administrator
for assistance in configuring expandable DBEFiles on raw devices.
|  |  |  |  |
 |  |  |  |  | NOTE:
If you specified a maximum of more than 12,000, say, 12,100,
the value would be rounded up and stored as 13,000 in the
system catalog. This could cause the file to exceed the
section size and overwrite data on the succeeding disk
section. Be sure the value you select for MAXPAGES
does not exceed the section size after rounding.
|  |  |  |  |
For More Information |  |
Additional information about raw files can be found in the
following places: /etc/newconfig/disktab file on your system.
/etc/checklist file on your system.
/etc/mnttab file on your system.
man pages for disktab(4), checklist(4), mnttab(4),
mknod(1m), newfs(1m), mount(1m).
|