Apress.Expert.Oracle.Database.Architecture.9i.and.10g.Programming.Techniques.and.Solutions.Sep.2005
CHAPTER 3 ■ FILES 113 tkyte@ORA10G> select * 2 from nls_database_parameters 3 where parameter = 'NLS_CHARACTERSET'; PARAMETER VALUE ------------------------------ ----------------- NLS_CHARACTERSET WE8MSWIN1252 Oracle has the ability now to recognize the differing character sets due to the Data Pump file format and deal with them. Character-set conversion can be performed on the fly as needed to make the data “correct” in each database’s representation. Again, we’ll come back to the Data Pump file format in Chapter 15, but this section should give you an overall feel for what it is about and what might be contained in the file. Flat Files Flat files have been around since the dawn of electronic data processing. We see them literally every day. The alert log described previously is a flat file. I found these definitions for “flat file” on the Web and feel they pretty much wrap it up: An electronic record that is stripped of all specific application (program) formats. This allows the data elements to be migrated into other applications for manipulation. This mode of stripping electronic data prevents data loss due to hardware and proprietary software obsolescence. 1 A computer file where all the information is run together in a signal character string. 2 A flat file is simply a file whereby each “line” is a “record,” and each line has some text delimited, typically by a comma or pipe (vertical bar). Flat files are easily read by Oracle using either the legacy data-loading tool SQLLDR or external tables—in fact, I will cover this in detail in Chapter 15 (external tables are also covered in Chapter 10). Flat files, however, are not something produced so easily by Oracle—for whatever reason, there is no simple commandline tool to export information in a flat file. Tools such as HTMLDB and Enterprise Manager facilitate this process, but there are no official command-line tools that are easily usable in scripts and such to perform this operation. That is one reason I decided to mention flat files in this chapter: to propose a set of tools that is capable of producing simple flat files. Over the years, I have developed three methods to accomplish this task, each appropriate in its own right. The first uses PL/SQL and UTL_FILE with dynamic SQL to accomplish the job. With small volumes of data (hundreds or thousands of rows), this tool is sufficiently flexible and fast enough to get the job done. However, it must 1. See http://osulibrary.oregonstate.edu/archives/handbook/definitions. 2. See http://www.oregoninnovation.org/pressroom/glossary.d-f.html.
114 CHAPTER 3 ■ FILES create its files on the database server machine, which is sometimes not the location we’d like for them. To that end, I have a SQL*Plus utility that creates flat files on the machine that is running SQL*Plus. Since SQL*Plus can connect to an Oracle server anywhere on the network, this gives us the ability to unload to a flat file any data from any database on the network. Lastly, when the need for total speed is there, nothing but C will do (if you ask me). To that end, I also have a Pro*C command-line unloading tool to generate flat files. All of these tools are freely available at http://asktom.oracle.com/~tkyte/flat/index.html, and any new tools developed for unloading to flat files will appear there as well. Summary In this chapter, we explored the important types of files used by the Oracle database, from lowly parameter files (without which you won’t even be able to get started) to the all important redo log and data files. We examined the storage structures of Oracle from tablespaces to segments, and then extents, and finally down to database blocks, the smallest unit of storage. We reviewed how checkpointing works in the database, and we even started to look ahead at what some of the physical processes or threads of Oracle do.
- Page 107 and 108: 62 CHAPTER 2 ■ ARCHITECTURE OVERV
- Page 110 and 111: CHAPTER 3 ■ ■ ■ Files In this
- Page 112 and 113: CHAPTER 3 ■ FILES 67 Without a pa
- Page 114 and 115: CHAPTER 3 ■ FILES 69 and even dat
- Page 116 and 117: CHAPTER 3 ■ FILES 71 all operatio
- Page 118 and 119: CHAPTER 3 ■ FILES 73 *.cluster_da
- Page 120 and 121: CHAPTER 3 ■ FILES 75 ops$tkyte@OR
- Page 122 and 123: CHAPTER 3 ■ FILES 77 • To maint
- Page 124 and 125: CHAPTER 3 ■ FILES 79 • Resource
- Page 126 and 127: CHAPTER 3 ■ FILES 81 3 l_dummy nu
- Page 128 and 129: CHAPTER 3 ■ FILES 83 Trace Files
- Page 130 and 131: CHAPTER 3 ■ FILES 85 _qerixAlloca
- Page 132 and 133: CHAPTER 3 ■ FILES 87 6 ( 7 TYPE O
- Page 134 and 135: CHAPTER 3 ■ FILES 89 A Brief Revi
- Page 136 and 137: CHAPTER 3 ■ FILES 91 Redundant Ar
- Page 138 and 139: CHAPTER 3 ■ FILES 93 (data from m
- Page 140 and 141: CHAPTER 3 ■ FILES 95 dictionary t
- Page 142 and 143: CHAPTER 3 ■ FILES 97 ■Note df i
- Page 144 and 145: CHAPTER 3 ■ FILES 99 “accidenta
- Page 146 and 147: CHAPTER 3 ■ FILES 101 So, at the
- Page 148 and 149: CHAPTER 3 ■ FILES 103 Password Fi
- Page 150 and 151: CHAPTER 3 ■ FILES 105 USER is "SY
- Page 152 and 153: CHAPTER 3 ■ FILES 107 Flashback L
- Page 154 and 155: CHAPTER 3 ■ FILES 109 of the requ
- Page 156 and 157: CHAPTER 3 ■ FILES 111 IMPDP, howe
- Page 160 and 161: CHAPTER 4 ■ ■ ■ Memory Struct
- Page 162 and 163: CHAPTER 4 ■ MEMORY STRUCTURES 117
- Page 164 and 165: CHAPTER 4 ■ MEMORY STRUCTURES 119
- Page 166 and 167: CHAPTER 4 ■ MEMORY STRUCTURES 121
- Page 168 and 169: CHAPTER 4 ■ MEMORY STRUCTURES 123
- Page 170 and 171: CHAPTER 4 ■ MEMORY STRUCTURES 125
- Page 172 and 173: CHAPTER 4 ■ MEMORY STRUCTURES 127
- Page 174 and 175: CHAPTER 4 ■ MEMORY STRUCTURES 129
- Page 176 and 177: CHAPTER 4 ■ MEMORY STRUCTURES 131
- Page 178 and 179: CHAPTER 4 ■ MEMORY STRUCTURES 133
- Page 180 and 181: CHAPTER 4 ■ MEMORY STRUCTURES 135
- Page 182 and 183: CHAPTER 4 ■ MEMORY STRUCTURES 137
- Page 184 and 185: CHAPTER 4 ■ MEMORY STRUCTURES 139
- Page 186 and 187: CHAPTER 4 ■ MEMORY STRUCTURES 141
- Page 188 and 189: CHAPTER 4 ■ MEMORY STRUCTURES 143
- Page 190 and 191: CHAPTER 4 ■ MEMORY STRUCTURES 145
- Page 192 and 193: CHAPTER 4 ■ MEMORY STRUCTURES 147
- Page 194 and 195: CHAPTER 4 ■ MEMORY STRUCTURES 149
- Page 196 and 197: CHAPTER 4 ■ MEMORY STRUCTURES 151
- Page 198 and 199: CHAPTER 4 ■ MEMORY STRUCTURES 153
- Page 200 and 201: CHAPTER 5 ■ ■ ■ Oracle Proces
- Page 202 and 203: CHAPTER 5 ■ ORACLE PROCESSES 157
- Page 204 and 205: CHAPTER 5 ■ ORACLE PROCESSES 159
- Page 206 and 207: CHAPTER 5 ■ ORACLE PROCESSES 161
114<br />
CHAPTER 3 ■ FILES<br />
create its files on the database server machine, which is sometimes not the location we’d like<br />
for them. To that end, I have a SQL*Plus utility that creates flat files on the machine that is<br />
running SQL*Plus. Since SQL*Plus can connect to an <strong>Oracle</strong> server anywhere on the network,<br />
this gives us the ability to unload to a flat file any data from any database on the network.<br />
Lastly, when the need for total speed is there, nothing but C will do (if you ask me). To that<br />
end, I also have a Pro*C comm<strong>and</strong>-line unloading tool to generate flat files. All of these tools<br />
are freely available at http://asktom.oracle.com/~tkyte/flat/index.html, <strong>and</strong> any new tools<br />
developed for unloading to flat files will appear there as well.<br />
Summary<br />
In this chapter, we explored the important types of files used by the <strong>Oracle</strong> database, from<br />
lowly parameter files (without which you won’t even be able to get started) to the all important<br />
redo log <strong>and</strong> data files. We examined the storage structures of <strong>Oracle</strong> from tablespaces to segments,<br />
<strong>and</strong> then extents, <strong>and</strong> finally down to database blocks, the smallest unit of storage. We<br />
reviewed how checkpointing works in the database, <strong>and</strong> we even started to look ahead at what<br />
some of the physical processes or threads of <strong>Oracle</strong> do.