DataPump Export
Export scripts are used for downloading spatial tables into spatial files. It needs at the least one file to export the data.
- *.script – THIS FILE IS MANDATORY and in the single file scenario it contains all information about a source and destination for data export,
- *.source – contains common information about the destination of the export job (this is usually the Main Repository connection string from Earthlight web.config file),
- *.destination – contains common information about all sources of the data listed in the script file.
All of these files must have the same names to be treated by Data Pump as a single script – e.g. my_export.script, my_export.source, my_export.destination.
Single file scenario
You can include all necessary information about the source and the destination of export in the .script file, in which case there is no need to create .source or .destination files. An example of a self contained my_export.script file can be found below:
1 2 3 4 5 6 7 8 9 | <?xml version="1.0"?> <Script xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Actions> <Action xsi:type="Load"> <Source>database=statmap;user id=USER;password=PASSWORD;timeout=15;pooling=True;enlist=False;integrated security=False;initial catalog=EarthlightDB;data source=dbserver\sqlexpress;table name=Code_Point;cartridge=SqlServer;schema=dbo</Source> <Destination>d:\SDrive\OS Code Point.tab</Destination> </Action> </Actions> </Script> |
As you can see both <Source> and <Destination> provide complete location details. In some cases however you may want to use the additional files.
Two files scenario
Imagine a situation where more than one table is exported via script to the same folder. In this case it is advisable to use .source file where the connection string is provided and place the names of the tables in the <Source> tags in the .script file. Data Pump will read content of the .source file and add it to the <Source> from the .script file to create the full location details.
An example of this approach is shown below:
- my_export.script file1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<?xml version="1.0"?>
<Script xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Actions>
<Action xsi:type="Load">
<Source>TABLE_A</Source>
<Destination>d:\Downloaded Tables\TABLE_1.tab</Destination>
</Action>
<Action xsi:type="Load">
<Source>TABLE_B</Source>
<Destination>d:\Downloaded Tables\TABLE_2.shp</Destination>
</Action>
<Action xsi:type="Load">
<Source>TABLE_C</Source>
<Destination>d:\Downloaded Tables\TABLE_3.mid</Destination>
</Action>
</Actions>
</Script> - my_export.source file1database=statmap;user id=USER;password=PASSWORD;timeout=15;pooling=True;enlist=False;integrated security=False;initial catalog=EarthlightDB;data source=dbserver\sqlexpress;cartridge=SqlServer;schema=dbo
Three files scenario
To expand even further on this let’s see an example of an import script where all three files are separated. This scenario is not uncommon. As you can see in my_export.destination file:
- the data source points to a single folder
- the cartridge declares all files to be ESRI Shapefiles
In this scenario, the my_import.script file contains the names of the database tables in the <Source> tags and the names of the files without extension in <Destination> tags.
- my_export.script file1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<?xml version="1.0"?>
<Script xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Actions>
<Action xsi:type="Load">
<Source>TABLE_A</Source>
<Destination>TABLE_1</Destination>
</Action>
<Action xsi:type="Load">
<Source>TABLE_B</Source>
<Destination>TABLE_2</Destination>
</Action>
<Action xsi:type="Load">
<Source>TABLE_C</Source>
<Destination>TABLE_3</Destination>
</Action>
</Actions>
</Script> - my_export.source file1database=statmap;user id=USER;password=PASSWORD;timeout=15;pooling=True;enlist=False;integrated security=False;initial catalog=EarthlightDB;data source=dbserver\sqlexpress;cartridge=SqlServer;schema=dbo
- my_export.destination file1data source="d:\Downloaded Tables\";cartridge=ESRI Shapefile