logo资料库

FireBird数据库教程.pdf

第1页 / 共1128页
第2页 / 共1128页
第3页 / 共1128页
第4页 / 共1128页
第5页 / 共1128页
第6页 / 共1128页
第7页 / 共1128页
第8页 / 共1128页
资料共1128页,剩余部分请下载后查看
2794fm.qxd 7/2/04 12:36 PM Page i The Firebird Book: A Reference for Database Developers HELEN BORRIE
2794fm.qxd 7/2/04 12:36 PM Page ii The Firebird Book: A Reference for Database Developers Copyright © 2004 by Helen Borrie and IBPhoenix All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN (pbk): 1-59059-279-4 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. Lead Editor: Chris Mills Technical Reviewer: Geoff Worboys Editorial Board: Steve Anglin, Dan Appleman, Ewan Buckingham, Gary Cornell, Tony Davis, Chris Mills, Steve Rycroft, Dominic Shakeshaft, Jim Sumser, Karen Watterson, Gavin Wray, John Zukowski Project Manager: Kylie Johnston Production Manager: Kari Brooks Production Editor: Janet Vail Compositor: Molly Sharp, Content Works Proofreaders: Patrick Vincent and Katie Stence Indexer: Valerie Perry Cover Designer: Kurt Krames Manufacturing Manager: Tom Debolski Distributed to the book trade in the United States by Springer-Verlag New York, Inc., 175 Fifth Avenue, New York, NY 10010 and outside the United States by Springer-Verlag GmbH & Co. KG, Tiergartenstr. 17, 69112 Heidelberg, Germany. In the United States: phone 1-800-SPRINGER, email orders@springer-ny.com, or visit http://www.springer-ny.com. Outside the United States: fax +49 6221 345229, email orders@springer.de, or visit http://www.springer.de. For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley, CA 94710. Phone 510-549-5930, fax 510-549-5939, email info@apress.com, or visit http://www.apress.com. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at http://www.apress.com in the Downloads section.
2794fm.qxd 7/2/04 12:36 PM Page iii Contents at a Glance About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii Part One Chapter 1 Chapter 2 Chapter 3 Chapter 4 Part Two Chapter 5 Chapter 6 Chapter 7 Part Three Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 Chapter 13 Part Four Chapter 14 Chapter 15 Chapter 16 Chapter 17 Chapter 18 Part Five Chapter 19 Chapter 20 Chapter 21 Chapter 22 Boot Camp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Network Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Configuring Firebird . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Operating Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Client/Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Introduction to Client/Server Architecture . . . . . . . 75 Firebird Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Firebird Clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Firebird Data Types and Domains . . . . . . . . . . . 111 About Firebird Data Types . . . . . . . . . . . . . . . . . . . . . . . 113 Number Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 Date and Time Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Character Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 BLOBs and Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 Domains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 A Database and Its Objects . . . . . . . . . . . . . . . . . 205 From Drawing Board to Database . . . . . . . . . . . . . . . . . . 207 Creating and Maintaining a Database . . . . . . . . . . . . . 231 Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 Referential Integrity . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315 Firebird SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 Firebird’s SQL Language . . . . . . . . . . . . . . . . . . . . . . . . . 347 DML Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 Expressions and Predicates . . . . . . . . . . . . . . . . . . . . . . 387 Querying Multiple Tables . . . . . . . . . . . . . . . . . . . . . . . . 431 iii
2794fm.qxd 7/2/04 12:36 PM Page iv Contents at a Glance Chapter 23 Chapter 24 Part Six Chapter 25 Chapter 26 Chapter 27 Part Seven Chapter 28 Chapter 29 Chapter 30 Chapter 31 Chapter 32 Part Eight Chapter 33 Chapter 34 Chapter 35 Chapter 36 Part Nine Chapter 37 Chapter 38 Chapter 39 Chapter 40 Ordered and Aggregated Sets . . . . . . . . . . . . . . . . . . . . . 467 Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485 Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503 Overview of Firebird Transactions . . . . . . . . . . . . . . . 505 Configuring Transactions . . . . . . . . . . . . . . . . . . . . . . . . 521 Programming with Transactions . . . . . . . . . . . . . . . . . . . 535 Server Programming . . . . . . . . . . . . . . . . . . . . . . . . . . 561 Introduction to Firebird Programming . . . . . . . . . . . . 563 Developing PSQL Modules . . . . . . . . . . . . . . . . . . . . . . . . . 573 Stored Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601 Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641 Error Handling and Events . . . . . . . . . . . . . . . . . . . . . . . 665 Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687 Security in the Operating Environment . . . . . . . . . . . 689 Server Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697 Database-Level Security . . . . . . . . . . . . . . . . . . . . . . . . . 713 Configuration and Special Features . . . . . . . . . . . . . . 739 Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 777 Interactive SQL Utility (isql) . . . . . . . . . . . . . . . . . . 779 Database Backup and Restore (gbak) . . . . . . . . . . . . . . 813 Housekeeping Tool (gfix) . . . . . . . . . . . . . . . . . . . . . . . . 835 Understanding the Lock Manager . . . . . . . . . . . . . . . . . . 855 Appendices External Function Summary . . . . . . . . . . . . . . . . . . . . . . . 881 Appendix I Solving Network Problems . . . . . . . . . . . . . . . . . . . . . . . . 915 Appendix II Application Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . 923 Appendix III Database Repair How-to . . . . . . . . . . . . . . . . . . . . . . . . . . 933 Appendix IV Administration Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . 937 Appendix V The Sample Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 943 Appendix VI Firebird Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 945 Appendix VII Character Sets and Collations . . . . . . . . . . . . . . . . . . . 951 Appendix VIII System Tables and Views . . . . . . . . . . . . . . . . . . . . . . . . 957 Appendix IX Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 981 Appendix X Reserved Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1011 Appendix XI Readings and Resources . . . . . . . . . . . . . . . . . . . . . . . . . 1015 Appendix XII Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1021 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1047 iv
2794fm.qxd 7/2/04 12:36 PM Page v Contents About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii Part One Boot Camp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Chapter 1 System Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 How to Get an Installation Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Linux Kits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Windows Kits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Testing Your Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Installing an Embedded Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Other Things You Need to Know . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Default Disk Locations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Up Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Chapter 2 Network Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Network Protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Named Pipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Local Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Mixed Platforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 A Network Address for the Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 HOSTS File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Server Name and Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Configuring the TCP/IP Port Service . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Testing the Connection with ping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Up Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 Chapter 3 Configuring Firebird . . . . . . . . . . . . . . . . . . . . . . . 45 Database-Level Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Environment Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 The Firebird Configuration File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 Up Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 v
2794fm.qxd 7/2/04 12:36 PM Page vi Contents Chapter 4 Operating Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Running Firebird on Linux/UNIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Running Firebird Server on Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Database Aliasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Administering Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Introducing isql . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 Up Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 Part Two Client/Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Chapter 5 Introduction to Client/Server Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 Client/Server vs. File-Served Databases . . . . . . . . . . . . . . . . . . . . . . . 76 Characteristics of a Client/Server DBMS . . . . . . . . . . . . . . . . . . . . . . . 76 Designing for Client/Server Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Up Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 Chapter 6 Firebird Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 The Role of the Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 Operating System Platforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 Examples of Topologies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Server-Side Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Multi-database Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 Server Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Database Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Up Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Chapter 7 Firebird Clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 What Is a Firebird Client? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 The Firebird Client Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 Application Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 Installing Clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 Up Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 vi
2794fm.qxd 7/2/04 12:36 PM Page vii Part Three Firebird Data Types and Domains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 Chapter 8 About Firebird Data Types . . . . . . . . . . . . . . . . 113 Where to Specify Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 Supported Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 Booleans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 SQL “Dialects” . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 Optional SQL-92 Delimited Identifiers . . . . . . . . . . . . . . . . . . . . . . . . 114 Context Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Pre-Defined Date Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 Domains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 Converting Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 Changing Column and Domain Definitions . . . . . . . . . . . . . . . . . . . . . . . 121 Keywords Used for Specifying Data Type . . . . . . . . . . . . . . . . . . . . . . . 122 Up Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 Chapter 9 Number Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 Operations on Number Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 Integer Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 Fixed-Decimal (Scaled) Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 Floating-Point Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 Up Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 Chapter 10 Date and Time Types . . . . . . . . . . . . . . . . . . . . . . . 143 DATE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 TIMESTAMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 TIME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Date Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 Recognized Date/Time Literal Formats . . . . . . . . . . . . . . . . . . . . . . . . . 144 Pre-Defined Date Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 Implicit Type-Casting of Date/Time Literals . . . . . . . . . . . . . . . . . 149 Date and Time Context Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 Operations Using Date and Time Values . . . . . . . . . . . . . . . . . . . . . . 150 Using CAST( ) with Date/Time Types . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 The EXTRACT( ) Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 Up Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 Contents vii
2794fm.qxd 7/2/04 12:36 PM Page viii Contents Chapter 11 Character Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 String Essentials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Character Sets and Collation Sequences . . . . . . . . . . . . . . . . . . . . . . . 165 Up Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 BLOBs and Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 Chapter 12 BLOB Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 Array Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 Up Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 Chapter 13 Domains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 Creating a Domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 Using a Domain in a Column Definition . . . . . . . . . . . . . . . . . . . . . . . 198 Defining a BOOLEAN Domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 Changing Domain Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 Dropping a Domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 Up Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 Part Four A Database and Its Objects . . . . . . . . . 205 Chapter 14 From Drawing Board to Database . . . . . . . . . 207 The SYSDBA User and Password . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 Designing a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 Schema Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 Up Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 Chapter 15 Creating and Maintaining a Database . . . 231 Physical Storage for a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 About Security Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 Creating a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 Single and Multi-file Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 Creating a Multi-file Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 The Database Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 Read-Only Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 Database Shadows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 Database “Hygiene” . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 Dropping a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 Up Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 viii
分享到:
收藏