3
<em>db.copy</em> allows the user to copy a table between two databases.
4
Databases can be connected through different drivers (see examples below).
8
Attribute tables can be copied using <em>db.copy</em> and, when to be
9
associated to a vector map, assigned to the map with
10
<em><a href="v.db.connect.html">v.db.connect</a></em>. Current connection
11
settings are saved in the file <em>$LOCATION/vector_map/dbln</em>.
15
<h3>From DBF to PostgreSQL</h3>
17
<em>Storing table 'geonames.dbf' (in current directory) into PostgreSQL
18
through ODBC:</em><br>
20
<div class="code"><pre>
21
db.copy from_driver=dbf from_database='$GISDBASE/$LOCATION_NAME/PERMANENT/dbf' \
22
from_table=geonames to_driver=pg to_database="host=pgserver,dbname=testdb" \
27
<h3>From PostgreSQL to DBF</h3>
29
<div class="code"><pre>
30
db.copy from_driver=pg from_database="host=pgserver.example.org,dbname=testdb" \
31
from_table=origtable to_driver=dbf \
32
to_database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf' to_table=origtable
36
<h3>From PostgreSQL to PostgreSQL with condition</h3>
38
<div class="code"><pre>
39
db.copy from_driver=pg from_database="host=localhost,dbname=testdb" \
40
from_table=geonames to_driver=pg to_database="host=localhost,dbname=testdb" \
41
to_table=selection where="cat < 500"
45
<h3>From DBF to SQLite</h3>
47
<div class="code"><pre>
48
db.copy from_driver=dbf from_database='$GISDBASE/$LOCATION_NAME/PERMANENT/dbf' \
49
from_table=geonames_features to_driver=sqlite \
50
to_database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db' to_table=geonames_features
53
sqlitebrowser $HOME/grassdata/nc_spm_08/user1/sqlite/sqlite.db
57
<h3>From SQLite to DBF</h3>
59
<div class="code"><pre>
60
db.copy from_driver=sqlite from_database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db' \
61
from_table=ammprv to_driver=dbf to_database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/' \
69
<a href="db.connect.html">db.connect</a>,
70
<a href="db.drivers.html">db.drivers</a>,
71
<a href="db.login.html">db.login</a>,
72
<a href="v.db.connect.html">v.db.connect</a>,
73
<a href="v.clean.html">v.clean</a>
76
<a href="sql.html">GRASS SQL interface</a>
80
Radim Blazek, ITC-irst, Trento, Italy
82
<p><i>Last changed: $Date: 2014-11-28 10:58:18 +0100 (Fri, 28 Nov 2014) $</i>