File: datamigration.html

package info (click to toggle)
db 5.1.29-9
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 150,348 kB
  • sloc: ansic: 400,169; java: 94,399; tcl: 70,967; sh: 37,399; cs: 30,758; cpp: 21,132; perl: 14,227; xml: 9,854; makefile: 3,777; yacc: 1,003; awk: 942; sql: 801; erlang: 461; python: 216; php: 24; asm: 14
file content (330 lines) | stat: -rw-r--r-- 11,631 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Data Migration</title>
    <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Getting Started with the Oracle Berkeley DB SQL APIs" />
    <link rel="up" href="admin.html" title="Chapter 4. Administrating Berkeley DB SQL Databases" />
    <link rel="prev" href="sync.html" title="Syncing with Oracle Databases" />
    <link rel="next" href="dbsql_replicate.html" title="Replicating Berkeley DB SQL Databases" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">Data Migration</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="sync.html">Prev</a> </td>
          <th width="60%" align="center">Chapter 4. Administrating Berkeley DB SQL Databases</th>
          <td width="20%" align="right"> <a accesskey="n" href="dbsql_replicate.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="sect1" lang="en" xml:lang="en">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title" style="clear: both"><a id="datamigration"></a>Data Migration</h2>
          </div>
        </div>
      </div>
      <div class="toc">
        <dl>
          <dt>
            <span class="sect2">
              <a href="datamigration.html#shellmigrate">Migration Using the Shells</a>
            </span>
          </dt>
          <dt>
            <span class="sect2">
              <a href="datamigration.html#migratedataschema">Supported Data and Schema</a>
            </span>
          </dt>
        </dl>
      </div>
      <p>
                If you have a database created by SQLite, you can migrate
                it to a Berkeley DB database for use with the BDB SQL interface. For
                production applications, you should do this only when your
                application is shutdown. 
            </p>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="shellmigrate"></a>Migration Using the Shells</h3>
            </div>
          </div>
        </div>
        <p>
                    To migrate your data from SQLite to a Berkeley DB database:
                </p>
        <div class="orderedlist">
          <ol type="1">
            <li>
              <p>
                            Make sure your application is shutdown.
                        </p>
            </li>
            <li>
              <p>
                            Open the SQLite database within the
                            <span class="command"><strong>sqlite3</strong></span> shell.
                        </p>
            </li>
            <li>
              <p>
                            Execute the <code class="literal">.output</code> command to
                            specify the location where you want to dump data.
                        </p>
            </li>
            <li>
              <p>
                            Dump the database using the SQLite
                            <code class="literal">.dump</code> command.
                        </p>
            </li>
            <li>
              <p>
                            Close the <span class="command"><strong>sqlite3</strong></span> shell and open
                            the Berkeley DB <a href="../api_reference/C/dbsql.html" class="olink">dbsql</a> shell. Note that if you build the
                            BDB SQL interface with the compatibility option, you can
                            alternatively use Berkeley DB's <a href="../api_reference/C/sqlite3.html" class="olink">sqlite3</a> utility.
                        </p>
            </li>
            <li>
              <p>
                            Load the dumped data using the
                            <code class="literal">.read</code> command.
                        </p>
            </li>
          </ol>
        </div>
        <p>
                    Note that you can migrate in the reverse direction as well.
                    Dump the Berkeley DB database by calling <code class="literal">.dump</code>
                    from within the <a href="../api_reference/C/dbsql.html" class="olink">dbsql</a> shell, and load it into SQLite by calling
                    <code class="literal">.read</code> from within SQLite's
                    <span class="command"><strong>sqlite3</strong></span> shell.
                </p>
      </div>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="migratedataschema"></a>Supported Data and Schema</h3>
            </div>
          </div>
        </div>
        <p>
                    You can migrate data between SQLite and Berkeley DB that uses the UTF-8 
                    character encoding.
                </p>
        <p>
                    The following data types can be migrated between
                    SQLite and Berkeley DB:
                </p>
        <div class="itemizedlist">
          <ul type="disc">
            <li>
              <p>
                            CHAR, TEXT , VARCHAR, NVARCHAR, STRING
                        </p>
            </li>
            <li>
              <p>
                            REAL, DOUBLE, FLOAT
                        </p>
            </li>
            <li>
              <p>
                            INTEGER, BOOLEAN, BIG INTEGER, NUMBER
                        </p>
            </li>
            <li>
              <p>
                            NUMERIC
                        </p>
            </li>
            <li>
              <p>
                            BLOB, CLOB
                        </p>
            </li>
            <li>
              <p>
                            NULL, NOT NULL
                        </p>
            </li>
            <li>
              <p>
                            COLLATE BINARY, COLLATE RTRIM, COLLATE NOCASE
                        </p>
            </li>
            <li>
              <p>
                            DATETIME, CURRENT_TIME, CURRENT_DATE,
                            CURRENT_TIMESTAMP
                        </p>
            </li>
          </ul>
        </div>
        <p>
                    The following schema can be migrated between  SQLite
                    and Berkeley DB:
                </p>
        <div class="itemizedlist">
          <ul type="disc">
            <li>
              <p>
                            PRAGMA writable_schema=ON/OFF
                        </p>
            </li>
            <li>
              <p>
                            PRAGMA foreign_keys=ON/OFF
                        </p>
            </li>
            <li>
              <p>
                            PRAGMA cache_size
                        </p>
            </li>
            <li>
              <p>
                            CREATE TABLE
                        </p>
              <div class="itemizedlist">
                <ul type="circle">
                  <li>
                    <p>
                                    PRIMARY KEY
                                </p>
                  </li>
                  <li>
                    <p>
                                    UNIQUE
                                </p>
                  </li>
                  <li>
                    <p>
                                    CONFLICT IGNORE, FAIL, REPLACE, ABORT,
                                    ROOLBACK
                                </p>
                  </li>
                  <li>
                    <p>
                                    REFERENCE ON ... CASECADE, ON ... NO
                                    ACTION, DEFERRABLE INITIALLY DEFERRED,
                                    and so forth.
                                </p>
                  </li>
                  <li>
                    <p>
                                    AUTOINCREMENT
                                </p>
                  </li>
                  <li>
                    <p>
                                    Static DEFAULT value, dynamic DEFAULT
                                    value
                                </p>
                  </li>
                  <li>
                    <p>
                                    Functions such as datetime, typeof, and
                                    so forth.
                                </p>
                  </li>
                  <li>
                    <p>
                                    ASC, DESC
                                </p>
                  </li>
                  <li>
                    <p>
                                    HIDDEN
                                </p>
                  </li>
                  <li>
                    <p>
                                    CHECK
                                </p>
                  </li>
                </ul>
              </div>
            </li>
            <li>
              <p>
                            CREATE INDEX, UNIQUE INDEX
                        </p>
            </li>
            <li>
              <p>
                            CREATE VIEW
                        </p>
              <div class="itemizedlist">
                <ul type="circle">
                  <li>
                    <p>
                                    SELECT statement, ANALYZE
                                </p>
                  </li>
                  <li>
                    <p>
                                    JOIN
                                </p>
                  </li>
                  <li>
                    <p>
                                    UNION
                                </p>
                  </li>
                </ul>
              </div>
            </li>
            <li>
              <p>
                            CREATE TRIGGER AFTER/BEFORE BEGIN
                        </p>
            </li>
            <li>
              <p>
                            CREATE VIRTUAL TABLE USING
                        </p>
            </li>
            <li>
              <p>
                            INSERT
                        </p>
            </li>
          </ul>
        </div>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="sync.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="admin.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="dbsql_replicate.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">Syncing with Oracle Databases </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> Replicating Berkeley DB SQL Databases</td>
        </tr>
      </table>
    </div>
  </body>
</html>