113 lines
7.7 KiB
HTML
113 lines
7.7 KiB
HTML
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<!DOCTYPE html
|
||
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html lang="en-us" xml:lang="en-us">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<meta name="security" content="public" />
|
||
|
<meta name="Robots" content="index,follow" />
|
||
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
||
|
<meta name="DC.Type" content="concept" />
|
||
|
<meta name="DC.Title" content="Create Physical File (CRTPF) command and SQL CREATE TABLE statement" />
|
||
|
<meta name="abstract" content="This topic provides information about creating a distributed physical file by using the Create Physical File (CRTPF) command or the SQL CREATE TABLE statement." />
|
||
|
<meta name="description" content="This topic provides information about creating a distributed physical file by using the Create Physical File (CRTPF) command or the SQL CREATE TABLE statement." />
|
||
|
<meta name="DC.subject" content="distributed physical file, creating, using Create Physical File (CRTPF) command, using SQL CREATE TABLE statement, distributed file, distributed physical file, example, distributed physical file, creating, CREATE TABLE, node group example, CREATE TABLE statement used to specify node group" />
|
||
|
<meta name="keywords" content="distributed physical file, creating, using Create Physical File (CRTPF) command, using SQL CREATE TABLE statement, distributed file, distributed physical file, example, distributed physical file, creating, CREATE TABLE, node group example, CREATE TABLE statement used to specify node group" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="crtdf.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="restrict.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="restrict.htm" />
|
||
|
<meta name="DC.Relation" scheme="URI" content="../ddp/rbal1kickoff.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="createdisfile" />
|
||
|
<meta name="DC.Language" content="en-us" />
|
||
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
||
|
<!-- US Government Users Restricted Rights -->
|
||
|
<!-- Use, duplication or disclosure restricted by -->
|
||
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
||
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
||
|
<title>Create Physical File (CRTPF) command and SQL CREATE TABLE statement</title>
|
||
|
</head>
|
||
|
<body id="createdisfile"><a name="createdisfile"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Create Physical File (CRTPF) command and SQL CREATE TABLE statement</h1>
|
||
|
<div><p>This topic provides information about creating a distributed physical
|
||
|
file by using the Create Physical File (CRTPF) command or the SQL CREATE TABLE
|
||
|
statement.</p>
|
||
|
<p>When you want to create a partitioned file, you need to specify the following
|
||
|
parameters on the CRTPF command:</p>
|
||
|
<ul><li>A node group name for the NODGRP parameter</li>
|
||
|
<li>The field or fields that are to be used as the partitioning key (use the
|
||
|
PTNKEY parameter)</li>
|
||
|
</ul>
|
||
|
<p>The partitioning key determines where (on what node) each record of data
|
||
|
physically resides. You specify the partitioning key when the CRTPF command
|
||
|
is run or when the SQL CREATE TABLE statement is run. The values of the fields
|
||
|
that make up the partitioning key for each record are processed by the HASH
|
||
|
algorithm to determine where the record is located.</p>
|
||
|
<p>If you have a single-field partitioning key, all records with the same
|
||
|
value in that field reside on the same system.</p>
|
||
|
<p>If you want to create a distributed physical file, your user profile must
|
||
|
exist on every node within the node group, and your user profile must have
|
||
|
the authority needed to create a distributed file on every node. If you need
|
||
|
to create a distributed file in a specific library, that library must exist
|
||
|
on every node in the node group, and your user profile must have the necessary
|
||
|
authority to create files in those libraries. If any of these factors are
|
||
|
not true, the file is not created.</p>
|
||
|
<p>The way that the systems are configured can influence the
|
||
|
user profile that is used on the remote system. To ensure that your user profile
|
||
|
is used on the remote system, that system should be configured as a secure
|
||
|
location. To determine if a system is configured as a secure location, use
|
||
|
the Work with Configuration Lists (WRKCFGL) command.</p>
|
||
|
<div class="p">The following example shows how to create a physical file named PAYROLL
|
||
|
that is partitioned (specified by using the NODGRP parameter) and has a single
|
||
|
partitioning key on the employee number (EMPNUM) field: <pre>CRTPF FILE(PRODLIB/PAYROLL) SCRFILE(PRODLIB/DDS) SRCMBR(PAYROLL)
|
||
|
NODGRP(PRODLIB/PRODGROUP) PTNKEY(EMPNUM)</pre>
|
||
|
</div>
|
||
|
<p>When the CRTPF command is run, the system creates a distributed physical
|
||
|
file to hold the local data associated with the distributed file. The CRTPF
|
||
|
command also creates physical files on all of the remote systems specified
|
||
|
in the node group.</p>
|
||
|
<p>The ownership of the physical file and the public authority on all the
|
||
|
systems is consistent. This consistency also includes any authority specified
|
||
|
on the AUT parameter of the CRTPF command.</p>
|
||
|
<div class="p">The SQL CREATE TABLE statement also can be used to specify the node group
|
||
|
and the partitioning key. In the following example, an SQL table called PAYROLL
|
||
|
is created. The example uses the IN <em>nodgroup-name</em> clause and the PARTITIONING
|
||
|
KEY clause. <pre> CREATE TABLE PRODLIB/PAYROLL
|
||
|
(EMPNUM INT, EMPLNAME CHAR(12), EMPFNAME CHAR (12))
|
||
|
IN PRODLIB/PRODGROUP
|
||
|
PARTITIONING KEY (EMPNUM)</pre>
|
||
|
</div>
|
||
|
<p>When the PARTITIONING KEY clause is not specified, the first column of
|
||
|
the primary key, if one is defined, is used as the first partitioning key.
|
||
|
If no primary key is defined, the first column defined for the table that
|
||
|
does not have a data type of date, time, timestamp, or floating-point numeric
|
||
|
is used as the partitioning key.</p>
|
||
|
<p>To see if a file is partitioned, use the Display File Description (DSPFD)
|
||
|
command. If the file is partitioned, the DSPFD command shows the name of the
|
||
|
node group, shows the details of the node group stored in the file object
|
||
|
(including the entire partition map), and lists the fields of the partitioning
|
||
|
key.</p>
|
||
|
<p>For a list of restrictions you need to know when using distributed files
|
||
|
with DB2<sup>®</sup> Multisystem,
|
||
|
see Restrictions when creating or working with distributed files with DB2 Multisystem.</p>
|
||
|
</div>
|
||
|
<div>
|
||
|
<ul class="ullinks">
|
||
|
<li class="ulchildlink"><strong><a href="restrict.htm">Restrictions when creating or working with distributed files with DB2 Multisystem</a></strong><br />
|
||
|
You need to be aware of some restrictions when creating or working with distributed files.</li>
|
||
|
</ul>
|
||
|
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="crtdf.htm" title="A distributed file is a database file that is spread across multiple iSeries servers.">Distributed files with DB2 Multisystem</a></div>
|
||
|
</div>
|
||
|
<div class="relconcepts"><strong>Related concepts</strong><br />
|
||
|
<div><a href="restrict.htm" title="You need to be aware of some restrictions when creating or working with distributed files.">Restrictions when creating or working with distributed files with DB2 Multisystem</a></div>
|
||
|
<div><a href="../ddp/rbal1kickoff.htm">Distributed database programming</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|