⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rm_ch2.htm

📁 db.* (pronounced dee-be star) is an advanced, high performance, small footprint embedded database fo
💻 HTM
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"><meta name="Generator" content="Microsoft Word 97"><title>db.* Reference Manual Chapter 2</title></head><body><h1><a name="Utility" id="Utility"></a>Chapter 2<br>Utility Descriptions</h1><h2><a name="Introduction" id="Introduction"></a>2.1Introduction</h2><p><font size="2">This chapter contains descriptions of thestandard <b><i>db.*</i></b> utilities in alphabetical order. Eachpage header contains the name of the utility for easy reference.The Prototype section contains the command-line syntax showing allpossible parameters and options. The Description section explainsthe purpose of the utility and any command-line parameters. TheOptions section explains each command-line option. The descriptionsof the <b>ddlp</b>, <b>dbedit</b> and <b>dbimp</b> utilities alsocontain a Language Summary section.</font></p><p>The interactive database access utility (<b>ida</b>), filetransfer utilities (<b>dbimp</b> and <b>dbexp</b>), and thedatabase editor (<b>dbedit</b>) are all explained in detail inchapters of their own in the <b><i>db.*</i></b> <i>User'sGuide</i>. The remaining maintenance and administration utilitiesare also found in the <b><i>db.*</i></b> <i>User's Guide</i>,summarized in the chapter called, "Maintenance Utilities." The lockmanager utilities are described in detail in a separate<b><i>db.*</i></b> publication, entitled <b><i>db.*</i></b><i>Multi-User Guide.</i></p><p>&nbsp;</p><hr><h3><a name="dal" id="dal"></a>dal</h3><p><font size="2">Database access language utility</font></p><h4>Prototype</h4><pre><font color="#0000FF">dal [-m<i>x</i>] [<em>procfile</em>]</font></pre><h4>Description</h4><p><font size="2">This utility is used for interactive or batchmanipulation of a <b><i>db.*</i></b> database. The commands thatyou can use with this utility are a subset of the<b><i>db.*</i></b> API, using C syntax. If a processing file isspecified, utility commands are read from that file. Otherwise, youneed to supply commands interactively.</font></p><p>Use this utility only as an educational or prototyping tool.</p><h4>Options</h4><p><font size="2">-m<i>x</i><br>Selects a lock manager type. See the <b><i>db.*</i></b><i>Multi-User Guide</i> for details.</font></p><p>&nbsp;</p><hr><h3><a name="datdump" id="datdump"></a>datdump</h3><p><font size="2">Dump data file utility</font></p><h4>Prototype</h4><pre><font color="#0000FF">datdump [-h] [-x] [-f] [-r<i>slotno</i>] <i>dbname datfile</i></font></pre><h4>Description</h4><p><font size="2">The <b>datdump</b> utility produces a formatteddump of the contents of a <b><i>db.*</i></b> data file. In additionto the data field contents, <b>datdump</b> also displays all of theinformation in the record header, including the record ID, databaseaddress, record lock bit setting, stored optional keys, timestampvalues, set pointers and member pointers.</font></p><p>This utility is particularly useful in gaining an understandingof the structure of a <b><i>db.*</i></b> data file as described insection 14.3, "Database Dictionary Table Structure," of the<b><i>db.*</i></b> <i>User's Guide</i>.</p><p>File <i>datfile</i> in database <i>dbname</i> is the data filewhose contents are to be displayed. If no options are specified,the result is a full dump, including header, data fields, and hexrecord dump. The report is written to file <i>stdout</i> and can beredirected as needed.</p><h4>Options</h4><p><font size="2">-h<br>Prints only the record header information.</font></p><p>-x<br>Prints only a hex dump of each record (no formatted report).</p><p>-f<br>Prints only the formatted report (no hex dump).</p><p>-r<i>slotno</i><br>Dumps only the contents of the record at the specified slot number,<i>slotno</i>, in <i>datfile</i>.</p><p>&nbsp;</p><hr><h3><a name="dbcheck" id="dbcheck"></a>dbcheck</h3><p><font size="2">Database consistency check utility</font></p><h4>Prototype</h4><pre><font color="#0000FF">dbcheck [-s] [-k] [-dk] [-kd] [-ts] [-a] [-r#] [-p#] [-f#] [-t] [-c] <i>dbname</i> [<i>dbfile</i>[ <i>dbfile</i>]...]</font></pre><h4>Description</h4><p><font size="2">This utility checks the consistency of alldatabase files in database <i>dbname</i>. If any database files(<i>dbfile</i>) are specified, only those files are checked.Otherwise, all files in the database are checked.</font></p><p>The <b>dbcheck</b> utility checks database consistency byvalidating the position of each record occurrence and checking theintegrity of the delete chains. Options perform more completeconsistency checks. Use of these options slows down <b>dbcheck</b>execution.</p><p>With the -s option, the <b>dbcheck</b> utility can perform setconsistency checking. Set membership consistency verifies thefollowing:</p><ol><li>Member and owner record types are valid</li><li>Membership count is correct</li><li>Doubly linked lists are properly formed</li></ol><p>The -k option causes <b>dbcheck</b> to verify the B-treestructure of the key files. This ensures that each node (except theroot node) is at least half full, that the number of filled slotsis correct, that the key slots on each node are properly sorted,and that each leaf node is at the correct level in the B-tree. Notethat if the -dk option does not result in any errors, it is veryunlikely that the -k option will result in any inconsistencies.</p><p>The -dk option validates the existence of the key valuesassociated with each record and key field in the data files.Optional keys are only checked if the key has been stored. The -kdoption will, for each key in a key file, read the associated recordand check to ensure that the key's data field contents matches thatstored in the key file. If the key is optional, the "key stored"bit in the record header is also checked.</p><p>Inconsistencies are reported with a message indicating thenature of the inconsistency and the file and location of theoffending record or key. If the -t option is specified, a traceback of the B-tree is printed when a key file inconsistency isdetected.</p><h4>Options</h4><p><font size="2">-s<br>Performs a complete consistency check of sets.</font></p><p>-k<br>Performs B-tree structure consistency check. This checks to ensurethat the key file adheres to all of the rules for a B-tree. If -dkis also specified, this check is unnecessary.</p><p>-dk<br>Checks the existence of each key from each record occurrence. Whilescanning a data file, a <b>d_keyfind</b> is performed on each keyto ensure that it exists.</p><p>-kd<br>Checks the existence of each record from each key. While scanning akey file, a <b>d_recread</b> function call is performed and theassociated key field value is checked against the key to ensurethat it matches.</p><p>-ts<br>Performs timestamp consistency checks.</p><p>-a<br>Performs all of the above consistency checks (that is, -s, -dk,-kd, and -ts).</p><p>-r<i>#</i><br>Reports every # percentage completed to <b>stderr</b>.</p><p>-p<i>#</i><br>Sets to <i>#</i> the number of pages in the <b><i>db.*</i></b>cache for use by <b>dbcheck</b>. For example, -p128 specifies thatdbcheck is to allocate 128 pages for the cache. The default is 64pages. If an insufficient memory error (S_MEMORY) occurs whenstarting <b>dbcheck</b>, use the -p option to specify a value lessthan 64.</p><p>-f<i>#<br></i>Sets to <i>#</i> the number of open files for<b>dbcheck</b>. The specified value is passed by <b>dbcheck</b> tofunction <b>d_setfiles</b> prior to opening the database. Thedefault is 8 files.</p><p>-t<br>Prints a trace back of the B-tree when a key file inconsistency isdetected.</p><p>-c<br>Prints a count of objects scanned in the check.</p><p>&nbsp;</p><hr><h3><a name="dbclrlb" id="dbclrlb"></a>dbclrlb</h3><p><font size="2">Lock bit clearing utility</font></p><h4>Prototype</h4><pre><font color="#0000FF">dbclrlb <i>dbname</i> [<i>datfile1</i>[ <i>datfile2</i>]...]</font></pre><h4>Description</h4><p><font size="2">The <b>dbclrlb</b> utility clears any set lockbits in the specified data files. If no data files are specified,all database lock bits, from both deleted and non-deleted records,are cleared.</font></p><h4>Options</h4><p><font size="2">None.</font></p><p>&nbsp;</p><hr><h3><a name="dbedit" id="dbedit"></a>dbedit</h3><p><font size="2">Database editor</font></p><h4>Prototype</h4><pre><font color="#0000FF">dbedit <i>dbname</i></font></pre><h4>Description</h4><p><font size="2">Anyone with experience using <b><i>db.*</i></b>can use the low-level database editor, <b>dbedit</b>, to changeand/or repair any <b><i>db.*</i></b> database. This utility workswithout using the runtime library and is single-user only. Anyonewho uses <b>dbedit</b> must be familiar with the binary format ofthe <b><i>db.*</i></b> data files as described in Chapter 14, "FileFormats and Dictionary Tables," of the <b><i>db.*</i></b> <i>User'sGuide</i>.</font></p><blockquote><b><i>Caution:</i></b> Improper use of <b>dbedit</b>can cause severe damage to a database.</blockquote><p><font size="2">The <b>dbedit</b> utility, together with<b>dbcheck</b>, is most useful for finding and correcting errors inset pointers. Also, if there is any kind of corruption in the firstpage of a data file where data about the file is stored,<b>dbedit</b> can be used to correct it. All other areas ofdatabase update or repair should be handled through the runtimelibrary, or through <b>ida</b>, <b>dchain</b>, or <b>keybuild</b>.For example, <b>dbedit</b> can alter the value of a data field, butit is best to use <b>ida</b> for this kind of task, because<b>ida</b> will maintain database consistency (for example, bychanging a key value to match the changed field).</font></p><p>The <b>dbedit</b> utility can perform updates to a data fileregardless of the internal consistency of the file. While theruntime library and <b>ida</b> need to be able to successfully opena full database, <b>dbedit</b> can operate on a file-by-file basis,and will not assume that any fields in the data file are valid.</p><p>The <b>dbedit</b> utility is line-oriented, instead offull-screen-oriented like <b>ida</b>. It is driven by a set ofcommands that are read from standard input, and will print allinformation to standard output.</p><p>To edit a database, the database must reside in the currentdirectory. If <b>dbedit</b> finds a file named&lt;<b>dbname</b>&gt;<b>.dbd</b>, it will read the dictionary intomemory. If a system record exists, it will become the initialcurrent record. If no system record exists, the initial currentrecord will be database address [0:1]. If no records exist in file0, there will be no initial current record.</p><p>Because of the low level nature of <b>dbedit</b>, it will notuse <b><i>db.*</i></b> environment variables, such asDBDPATH<font face="palitino" size="2">, and it will not usethe</font> <b><font size="2">db.star.ini</font></b> <font face="palitino" size="2">file.</font></p><p><font size="2">The <b>dbedit</b> utility operates in one of twomodes: interpreted or non-interpreted (hexadecimal). In theinterpreted mode, <b>dbedit</b> displays a record's contentsaccording to its type. It displays set and member pointers in ourstandard database address representation. It indicates whetheroptional keys are set, and displays field values in the format usedby <b>ida</b>. Navigation with <b>dbedit</b> means moving from onerecord to another. There will usually be a "current record." Editsmade to a record will be written to the file when the editor movesto a new current record.</font></p><h4>Options</h4><p><font size="2">None.</font></p><h4>Language Summary</h4><p><font size="2"><b><u>b</u>ase</b> {10 | 16}</font></p><p><b><u>di</u>splay</b> [<b><u>ty</u>pe</b> | <b><u>db</u>a</b> |<b><u>ts</u></b> | <b><u>op</u>t</b>]<br><b><u>di</u>splay</b> {<b><u>se</u>t</b> [<i>setname</i>] |<b><u>m</u>em</b> [<i>setname</i>] | <b><u>fl</u>d</b>[<i>fldname</i>]}</p><p><b><u>ed</u>it</b> <b><u>ty</u>pe</b><br><b><u>ed</u>it</b> {<b><u>fir</u>st</b> | <b><u>l</u>ast</b> |<b><u>c</u>ount</b>} <i>setname</i><br><b><u>ed</u>it</b> {<b><u>ow</u>n</b> | <b><u>prev</u></b> |<b><u>next</u></b>} <i>setname</i><br><b><u>ed</u>it</b> {<b><u>db</u>a</b> | <b><u>op</u>t</b> |<b><u>dc</u>hain</b> | <b><u>nexts</u>lot</b>}<br><b><u>ed</u>it <u>hex</u></b></p><p>exit</p><p><u>fie</u>lds</p><p><u>g</u>oto {<i>dba</i> | <b><u>nextr</u>ec</b> |<b><u>prevr</u>ec</b>}<br><b><u>g</u>oto</b> {<b><u>fir</u>st</b> | <b><u>l</u>ast</b> |<b><u>ow</u>n</b> | <b><u>pre</u>v</b> | <b><u>next</u></b>}<i>setname</i><br><b><u>g</u>oto</b> {<b><u>fil</u>e</b> {<i>filenum</i> |<i>filename</i>}}</p><p><b><u>hel</u>p</b> | ?</p><p><b><u>nof</u>ields</b></p><p><u>not</u>itles</p><p><u>rer</u>ead</p><p><u>sh</u>ow {<b><u>fl</u>d</b> [<i>fieldname</i>] |<b><u>fil</u>e</b> [<i>filename</i>] | <b><u>k</u>ey</b>[<i>keyname</i>]}<br><b><u>sh</u>ow</b> {<b><u>rec</u>ord</b> [<i>recordname</i>] |<b><u>se</u>t</b> [<i>setname</i>]}</p><p><b><u>so</u>urce</b> <i>filename</i></p><p><b><u>ti</u>tle</b></p><p><u>v</u>erify <i>setname</i></p><p align="center"><b>Table 2-1. Hex Mode Commands</b></p><table cellspacing="0" border="0" cellpadding="7" width="542"><tr><td width="19%" valign="top"><p><b><font size="2">Command</font></b></p></td><td width="81%" valign="top"><p><b><font size="2">Description</font></b></p></td></tr><tr><td width="19%" valign="top"><p><b><font size="2">print</font> [<i>N</i>]</b></p></td><td width="81%" valign="top"><p><font size="2">Print <i>N</i> lines (both hexadecimal and ASCIIrepresentation). If <i>N</i> is absent, print one line.</font></p></td></tr><tr><td width="19%" valign="top"><p><font size="2">+[<i>N</i>]</font></p></td><td width="81%" valign="top"><p><font size="2">Move forward <i>N</i> characters. If <i>N</i> isabsent, move one character.</font></p></td></tr><tr><td width="19%" valign="top"><p><font size="2">-[<i>N</i>]</font></p></td><td width="81%" valign="top"><p><font size="2">Move backward <i>N</i> characters. If <i>N</i> isabsent, move one character.</font></p></td></tr><tr><td width="19%" valign="top"><p><font size="2">=<i>N</i></font></p></td><td width="81%" valign="top"><p><font size="2">Move to address <i>N</i>, where <i>N</i> is ahexadecimal number between 0 and FFFFFFFF.</font></p></td></tr><tr><td width="19%" valign="top"><p><font size="2">&gt;[<i>N</i>]</font></p></td><td width="81%" valign="top"><p><font size="2">Move forward <i>N</i> lines. If <i>N</i> isabsent, move one line.</font></p></td></tr><tr><td width="19%" valign="top"><p><font size="2">&lt;[<i>N</i>]</font></p></td><td width="81%" valign="top"><p><font size="2">Move backward <i>N</i> lines. If <i>N</i> isabsent, move one line.</font></p></td></tr><tr><td width="19%" valign="top"><p><font size="2">&gt;&gt;<i>STRING</i></font></p></td><td width="81%" valign="top"><p><font size="2">Search forward for <i>STRING</i>, which can beeither an ASCII string within quotes ("string"), or hexadecimalbytes (73 74 72 69 6E 67).</font></p></td></tr><tr><td width="19%" valign="top">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -