Post on 18-Apr-2020
transcript
2 Working with an Enterprise GeoDatabase DISCLAIMER STATEMENT © 2016 - World Food Programme Information presented in this training document may be considered public information and may be reproduced, distributed or copied freely, exclusively for non-commercial purposes and unless identified as being subject to third parties’ copyright protection. World Food Programme (“WFP”) should be cited as the source of the information and any photo credits should be similarly credited to the author or source, as appropriate. If a third party copyright is indicated on a photo, graphic, or on any other material, permission to copy these materials must be obtained from the original source. WFP declines all responsibility for errors or deficiencies in this training document or in the documentation accompanying it, for the update of the data as well as for any damage that may arise from them. Information in the GIS Training Package is provided without warranty of any kind, either express or implied, including, without limitation, warranties as to fitness for a specific purpose, non-infringement, accuracy or completeness. Under no circumstances shall WFP be liable for any direct or consequential loss, personal injury, property damage, or expense of any nature directly or indirectly incurred or suffered by any person that is claimed to have resulted from the use of this training document or information included therein. This training document contains advice, opinions, and statements of several individuals and information providers. WFP does not necessarily share, represent or endorse any advice, opinion, statement or other information provided by any individual or information provider. Reliance upon any such advice, opinion, statement, or other information shall also be at the user’s own risk. WFP shall not be liable to any person for any inaccuracy, error, omission, deletion, defect, failure, alteration or use of any content herein, regardless of cause, nor for any damages resulting therefrom. This training document also contains links to third-party websites. These links are provided for the user’s convenience only. WFP is not responsible for the contents of any linked website and do not control or guarantee the accuracy, relevance, timeliness, or completeness of any linked information. Further, the inclusion of links is not intended to assign importance to those sites and the information contained therein, nor is it intended to endorse or recommend any views expressed, commercial products or services offered on these external sites that are not controlled by WFP. Reference in the GIS Training Package to any specific commercial products, processes, or services, or the use of any trade, firm or corporation name is only for the information and convenience of the user and does not constitute an endorsement, recommendation, or judgment by WFP. WFP is not liable for any infringements of third party rights as a result of any form of publication by the users of this training document, or sections thereof, and they alone will be liable. The designations employed and the presentation of material in maps contained in this document do not imply the expression of any opinion on the part of WFP concerning the legal or constitutional status of any country, territory, city or sea , or concerning the delimitation of its frontiers or boundaries. Nothing related to this statement or this training document may be construed as a waiver, express or implied, by WFP, the United Nations, and the Food and Agricultural Organization of the United Nations of the privileges and immunities enjoyed by them pursuant to the 1946 Convention on the Privileges and Immunities of the United Nations, the 1947 Convention on the Privileges and Immunities of the Specialized Agencies or otherwise under any international or national law, convention or agreement. All queries on rights and licenses should be addressed to the Geospatial Support Unit, World Food Programme, Via C.G. Viola, 68-70, Rome 00148, Italy; e-mail: hq.gis@wfp.org.
Working with an Enterprise GeoDatabase 3
Introduction .............................................................................................. 4
Software needed ....................................................................................... 4
1 Installation and configuration of an Enterprise GeoDatabase ............... 5 1.1 Install and configure PostgreSql ................................................................................................................................................ 5 1.2 Download and install PostGIS .................................................................................................................................................. 11 1.3 PostgreSQL configuration .......................................................................................................................................................... 17 1.3.1 Creation of the ArcSDE super user ...................................................................................................................................... 17 1.3.2 Configuring PostgreSQL to accept external connections .......................................................................................... 18 1.3.3 Set up PostgreSQL to use ESRI Geometry standard ..................................................................................................... 19 1.3.4 PostgreSQL Tuning .................................................................................................................................................................... 20
1.4 Creation of an ESRI Enterprise GeoDatabase .................................................................................................................... 21 1.4.1 Create a connection file to connect to the Enterprise Geodatabase ..................................................................... 23
1.5 Users and groups creation ......................................................................................................................................................... 25 1.5.1 Create Database Users through the Arctoolbox ............................................................................................................ 27
2 Administration and maintenance of an Enterprise GeoDatabase ......... 29 2.1 Granting and revoking privileges on datasets .................................................................................................................. 29 2.2 View users connected to the geo-‐database and manage locks ................................................................................ 31 2.2.1 View and close user connections .......................................................................................................................................... 31
2.3 Geo-‐database locks ....................................................................................................................................................................... 33 2.4 Maintenance of an Enterprise GeoDatabase ...................................................................................................................... 35 2.4.1 Database backup and recovery ............................................................................................................................................ 36 2.4.2 Database performance improvement ................................................................................................................................ 40
Annex A - Installation of ArcGIS Desktop 10.3.1 ..................................... 43 A.1 Installation of .NET Framework 3.5 SP1 .................................................................... Error! Bookmark not defined.
Annex B - Installation of ArcGIS for Server Enterprise ............................ 44
4 Working with an Enterprise GeoDatabase
Introduction
The GIS training “Working with an Enterprise Geodatabase” is part of the collection
of trainings on geodatabase management produced by the Geospatial Support Unit
(GSU) at the Emergency Preparedness and Response branch to support the
implementation of the GIS Infrastructure within the World Food Programme.
This specific training module has been designed with the aim of guiding the user
through the installation of an ESRI Enterprise Geodatabase on a physical or virtual
server as well as its configuration and management.
The manual is divided into 2 main sections: in the first part the user will follow the
steps needed to install a Postgres instance, configure it, create a geodatabase and
manage users and permissions; in the second section the necessary administration
and maintenance tasks are described in order to enable users who take this
training to independently manage an Enterprise Geodatabase built with the ESRI
technology.
Software needed
During this course you will run some installations that require software packages
that can be downloaded from the ESRI portal. In case you don’t have access to the
ESRI portal, you can request such software from your regional GIS officer or from
the GSU unit at the HQ, by sending an email to wfp.esriservices@wfp.org.
Here the list of necessary software:
o Postgres 9.4.5 DBMS for Windows
o PostgreSQL 9.4.5 Client Libraries (Windows)
o ArcGIS Desktop 10.4
o ArcGIS for Server Enterprise 10.4 (for Windows)
Working with an Enterprise GeoDatabase 5 Over this course you will create users accounts and database users for which
credentials must be kept in a safe place. It’s strongly suggested to use a password
manager called Keepass to save username and passwords, it can be downloaded
for free from this website: http://keepass.info/download.html
1 Installation and configuration of an Enterprise
GeoDatabase This training module has been designed as a complete set of instructions to help
the user in getting started with an enterprise geodatabase based on Postgres 9.4.5
on a Windows server.
It assumes that ArcGIS for Desktop and ArcGIS for Server have been already
installed. If needed, instructions for installation of ArcGIS for Desktop and Server
can be found in Annexes A and B.
We will initially install an instance of Postgres, enable its access on a network and
add the necessary libraries to enable geospatial capabilities. Later on we will create
a geodatabase in Postgres, add users to it and grant editing access and editing
permissions.
1.1 Install and configure PostgreSql To start the installation double click on the “Postgres 9.4.5 DBMS for Windows”
executable file and the image below will appear. You will need to first extract the
compressed DBMS installation files into any specific folder of your choice.
Figure 1: Extract the PostgreSql installation files
6 Working with an Enterprise GeoDatabase Select the appropriate path and click Ok.
Then tick the box “Launch the setup program” and click on Close and the window
below should open automatically. In case this doesn’t happen navigate to the
temporary folder selected at the previous step and click on the “Setup” file.
Figure 3: Postgres installation wizard
Just click on “Next” button at this step.
Figure 2: Installation launch
Working with an Enterprise GeoDatabase 7
Figure 4: PostgreSQL Installation directory
In this step you have to specify the directory where you want to install PostgreSQL.
In most cases the default directory would be fine. In the event that you wish to
install the software in a different location or drive available on your machine, you
can specify the directory of your choice.
Once done click Next.
Figure 5 PostgreSQL data directory
8 Working with an Enterprise GeoDatabase This window let you decide the location where you want the PostgreSQL data to be
saved. Browse to you favorite location and click Next.
The next step allows you to select a password for the Superuser account for
PostgreSQL, which is called postgres. This user is allowed to perform some
extraordinary configuration and maintenance tasks on the database, so please save
the password in a safe place and back it up.
In the following window type the communication port number through which the
DBMS works; the default is 5432. Interaction with your network manager can help
in defining the correct port according to your network settings.
Working with an Enterprise GeoDatabase 9
Select the international options for your installation; the default is a good option.
Just click on “Next” in order to let the machine perform the installation.
10 Working with an Enterprise GeoDatabase
A confirmation window acknowledges the successful installation.
Working with an Enterprise GeoDatabase 11 1.2 Download and install PostGIS In case you want to create in PostgreSQL additional geodatabase accessible
through Open Source client software, it might be useful to store that information in
Open Source geometry types, by means of PostGIS, which is the PostgreSQL
spatial extension. This training document with guide you through the installation
and usage of an ESRI enterprise geodatabase but we would suggest following these
steps to be able to install PostGIS databases at a later stage. In any case, this will
not influence your workflows.
Taking advantage of the PostgreSQL Stack Builder is the easiest way to download
and installing PostGIS.
12 Working with an Enterprise GeoDatabase The Stack Builder allows you to select among a list of available applications the
ones that you need. Select the right PostGIS version from the list, according to
your machine hardware (v2.0 of PostGIS is supported by ESRI).
A temporary folder is used by the system as a download repository; insert a
temporary path at the following step.
Working with an Enterprise GeoDatabase 13
After the download, the PostGIS installation wizard starts automatically.
14 Working with an Enterprise GeoDatabase At this step you have the option to let the installation process create a new
spatially enabled database; it is more convenient to do it at this step rather than
generating it manually at a later step.
Provide username and password for the “postgres” user:
Working with an Enterprise GeoDatabase 15 In the following window insert the name of the spatially enabled database that is
going to be created into the DBMS.
PostGIS takes advantage of some open source libraries in order to perform spatial
processing; therefore enabling this software is required for PostGIS to work
smoothly. In particular the registration of some environmental variables is the key
for this software to work correctly: therefore click on “Yes” in the following three
screens.
16 Working with an Enterprise GeoDatabase
A window acknowledges when the installation of PostGIS is complete.
Working with an Enterprise GeoDatabase 17
1.3 PostgreSQL configuration
Immediately after the installation of PostgreSQL DBMS and optionally of its spatial
extension, some preliminary steps are necessary, before creating an ESRI
Enterprise Geodatabase.
1.3.1 Creation of the ArcSDE super user This step outlines the creation of a DBMS user for geodatabase administration,
which must be named sde.
It can be created either by means of the Windows power shell or executing the
instruction in PgAdmin (the most used client software for PostgreSQL that has been
installed with the PostgreSQL installation).
18 Working with an Enterprise GeoDatabase
Follow these steps to create the sde user through the Windows power shell:
1. Open a Powershell Window or command prompt
2. Browse to the location of the bin folder located in the PostgreSQL installation
folder through this command:
cd “PostgreSQL installation path”\bin
Example: cd c:\Program Files\PostgreSQL\9.4\bin
3. Connect to postgreSQL running this instruction:
.\psql –U postgres
4. Provide the password for the postgres user.
5. Once you are in postgres, run the command below (please remember to
create a new password for the sde user and end the instruction with a
semicolon symbol “;”).
To exit from the PostgreSQL shell type \q and then click enter.
1.3.2 Configuring PostgreSQL to accept external connections
At this step your PostgreSQL DMBS is only accessible from the server.
CREATE ROLE sde WITH SUPERUSER CREATEDB LOGIN PASSWORD 'password';
Please remember to store the password for the “sde” user in a safe place.
Working with an Enterprise GeoDatabase 19 In order to allow connections to other machines, you have to properly configure the
configuration file pg_hba.conf, which can be found in the location specified for the
PostgreSQL data (by default C:\Program Files\PostgreSQL\9.4\data).
This is needed in order to let ArcGIS Desktop (ESRI client) connect to the
PostgreSQL server.
Open this file and add a new entry for each class of IP addresses you want to allow
access by following the example below:
# TYPE DATABASE USER ADDRESS METHOD
host all all 192.168.12.10/32 md5
If you want to enable access to all IP addresses add the following row (it’s not
recommended in a production environment but can be useful to perform some
initial tests of connectivity to the PostgreSQL instance).
# TYPE DATABASE USER ADDRESS METHOD
host all all 0.0.0.0/0 md5
Specific documentation can be found on the PostgreSQL website. http://www.postgresql.org/docs/9.4/static/auth-pg-hba-conf.html
1.3.3 Set up PostgreSQL to use ESRI Geometry standard
Another important step towards the creation of an Enterprise Geodatabase is to
enable PostgreSQL to store layers using the ESRI geometry format, called
20 Working with an Enterprise GeoDatabase ST_geometry. In order to achieve this, you have to copy the ESRI standard
geometry libraries into the PostgreSQL installation folder (lib).
These libraries are stored originally in a dll file called st_geometry.dll, which can be
found in the DatabaseSupport folder, within the ArcGIS Desktop installation folder.
In case ArcGIS desktop has been installed into the C drive, copy the following file
C:\Program Files (x86)\ArcGIS\Desktop10.4\DatabaseSupport\PostgreSQL\
9.4\Windows64\st_geometry.dll
Into the folder:
C:\Program Files\PostgreSQL\9.4\lib\
1.3.4 PostgreSQL Tuning
Better performance can be achieved by properly setting some parameters in the
PostgreSQL configuration file. This file (postgresql.conf) can be usually found in the
data directory (C:\Program Files\PostgreSQL\9.4\data)
Here the list of parameters with related values:
max_connections= 128
shared_buffers = 512MB
autovacuum= on
log_statement = 'none'
In case there is a sharp symbol (#) at the beginning of the line, remove it to
uncomment the configuration parameter.
Once these parameters are configured, restart the PostgreSQL service through the
Server Manager. Select Tools à Services and restart the postgresql-x64-9.4
service.
Working with an Enterprise GeoDatabase 21
1.4 Creation of an ESRI Enterprise GeoDatabase
You can create an enterprise geodatabase in PostgreSQL using the Create
Enterprise Geodatabase geo-processing tool. Follows the steps below.
1. Start ArcCatalog or ArcMap
2. Open the tool’s dialog box (ArcToolbox)
3. Select Database Management tool
4. Select Geodatabase Administration
5. Launch the Create Enterprise geodatabase tool
6
22 Working with an Enterprise GeoDatabase
6. Follow instructions below to provide information needed:
Database Platform: PostgreSQL
Instance: “IP address of your server”
Database: “database name”
Database Administrator: postgres
Database Administrator Password: “password for the postgres user”
Geodatabase Administrator: sde
Geodatabase Administrator Password: “password for the sde user”
Tablespace Name: leave it blank
Authorization file: browse the keycodes file created after the installation of
ArcGIS for Server. It can be found in the directory C:\Program
Files\ESRI\License10.3\sysgen.
In case you have not installed ArcGIS for Server yet, please refer to the guide
in the Annex B.
7. Click Ok to launch the tool and complete the creation of your Enterprise
Geodatabase
Working with an Enterprise GeoDatabase 23
1.4.1 Create a connection file to connect to the Enterprise Geodatabase In order to connect to the newly created Enterprise Geodatabase you need to
create a connection file through ArcCatalog. Follow the process below to create a
connection file with the administrative user sde, You’ll need it to administer your
Enterprise Geodatabase.
1. Open ArcCatalog
2. Search for the Database Connections folder
3. Double-click on Add Database Connection
24 Working with an Enterprise GeoDatabase
“user”__”db name”__”ipaddress”.sde
Example: hq__wfp__10_11_40_221.sde
4. Follow instructions below to provide information needed:
Database Platform: PostgreSQL
Instance: “IP address of your server”
Authentication Type: “Database Authentication”
User Name: “Type the username” (sde)
Password: “Type the password” (password for sde)
Tick the Save username and password box.
Click on the arrow at the end of the field Database and a list of geo-
databases will appear. Select the one you want to connect with.
5. Click Ok to finalize the process
1.4.1.1 Standard for connection files Each connection files contains specific information to let a user connect to a certain
database. Unfortunately after creating a connections file it is saved with a default
name, which doesn’t contain such information, therefore it is not easy to identify
whether or not the connection file can be used to perform specific tasks according
to the user permissions
For this reason we strongly suggest to rename connection files right after their
creation, reporting in its name the user, the database and IP address of the
server where the database is stored, separated by a double underscore.
Working with an Enterprise GeoDatabase 25
1.5 Users and groups creation Until this point of the Enterprise Geodatabase set-up there is only an administrative
user for PostgreSQL (postgres) and an administrative user for the Enterprise
GeoDatabase (sde).
An appropriate number of login roles must be created into the DBMS in order to
grant users access to the Enterprise Geodatabase. Moreover, specific privileges
must be granted on these login roles in order to assure that the users can perform
their everyday activities successfully and correctly.
Due to the fact that usually some users have similar profiles in terms of geospatial
data usage, it is suggested to create groups into the DBMS and assign the login
roles to the right groups, respecting users’ specific responsibilities. Furthermore,
granting privileges to groups can make the work of a database administrator
easier.
ESRI documentation suggests creating at least three basic groups:
● Data viewer group, for users who only need to visualize and analyze the
data;
● Data editor group, for users who need also to add, modify or delete
geospatial features;
● Data creator group, for users who need also to create new feature classes.
Running the SQL script provided with this training document can create the basic
set of users and groups needed.
26 Working with an Enterprise GeoDatabase Before running it, please change usernames and passwords in the script according
to your environment.
To run the script, save it on the server and follow instructions below.
1. Open a Powershell Window
2. Browse to the location of the bin folder located in the PostgreSQL installation
folder through this command:
cd “PostgreSQL installation path”\bin
Example: cd c:\Program Files\PostgreSQL\9.4\bin
3. Run the command below and provide the password for the postgres user
.\psql –U postgres –d “database name” –a –f “script path”
Example:
.\psql –U postgres –d “cairo” –a –f “C:\GIS\script_users_creation.psql”
Please remember to modify the database name and script path accordingly
Working with an Enterprise GeoDatabase 27 Once the basic set of groups and users has been created, you can create additional
users, assign them to groups or assign privileges using geo-processing tools
described in the following section.
1.5.1 Create Database Users through the Arctoolbox
You can create additional users into your database using the Create Database User
geo-processing tool. It creates a database user with privileges sufficient to create
data in the database.
1. Start ArcCatalog or ArcMap
2. Open the ArcToolBox.
3. Select Database Management tool
4. Select Geodatabase Administration
28 Working with an Enterprise GeoDatabase
5. Launch the Create Database User tool
6. Follow instructions below to provide information needed:
Input Database Connection: Specify the connection file to the enterprise
geodatabase, which is made as a database administrator (the connection file
created with sde user)
Database User: “Type the name you want to give to the user”
Database User Password: “Type the password you want to assign to the
user”
Role: “type the name of the group to which you want to associate the user
(creator, editor or viewer)
Working with an Enterprise GeoDatabase 29
7. Click Ok to launch the tool and complete the creation of a new user
2 Administration and maintenance of an Enterprise
GeoDatabase
There are some geodatabase administration and maintenance tasks that must be
performed once and others to perform on a regular basis to preserve the geo-
database and its existing performance levels. Most of them are standard
maintenance you would perform for any database management system (DBMS),
such as granting privileges, database backups and regenerating database statistics.
Others, such as compression and synchronizing geodatabase replicas, are specific
to geo-databases.
In this chapter we’ll describe how to grant or revoke privileges to existing users, kill
locks, backup and restore an enterprise geodatabase and perform some
maintenance tasks such as compress and analyze the geodatabase.
2.1 Granting and revoking privileges on datasets You must grant specific privileges to other database users if you want to let them
view or modify the content of any data in the database. In order to do so you have
to connect to the database using a connection file with the user privileges of the
owner of the specific layers or feature datasets you want to modify.
30 Working with an Enterprise GeoDatabase
1. Open ArcMap or ArcCatalog and in the Catalog window double-click the
Database Connections folder in the Catalog tree.
2. Connect to the database or geodatabase that contains the data for which you
want to alter privileges. Be sure to connect as the owner of the data.
3. Right-click the feature class or feature dataset, point to Manage, then
click Privileges and the privileges dialog box opens.
4. If the user whose privileges you want to change is already in the list, check
or uncheck the boxes to grant or revoke the privileges you want.
5. In case the user or role is not already in the list
click Add to open the User/Role dialog box.
6. You can choose the database users or roles you
want to add from the list by checking the box next
to their names.
Working with an Enterprise GeoDatabase 31
7. Click OK to close the User/Role dialog box.
8. Check the boxes of the privileges you want each new user or role to have and
click OK.
Through the process we have just described you can alter privileges on one feature
class of feature dataset at a time. To alter privileges on multiple datasets at once
you can use the Change Privileges geo-processing tool. Please have a look at this
guide on the ESRI portal for further information
http://resources.arcgis.com/en/help/main/10.2/index.html#/Change_Privileges/00170000
00n3000000/
2.2 View users connected to the geo-database and manage
locks
Enterprise geo-databases are typically accessed by many users making updates to
features and tables while editing. As a result, the geo-database administrator has a
number of maintenance tasks to perform to ensure the geodatabase is running
smoothly and users can access the data with which they need to work.
This topic offers an overview of the Geodatabase Administration dialog box within
ArcCatalog and ArcMap, a very helpful tool for managing user connections and
locks.
2.2.1 View and close user connections
Geodatabase administrators can use the Connections tab on the Geodatabase
Administration dialog box to view all users connected to ArcSDE geo-databases.
32 Working with an Enterprise GeoDatabase From this dialog box, an administrator can view user connections and also
disconnect users from the geodatabase.
This has to be done for example in case a user might be holding a lock on an
object, preventing another user to perform edits or run synchronization or just to
improve database performance when there are many pending connections.
The following steps explain how you access the list of connected user sessions
from ArcGIS for Desktop:
1. Start ArcMap or ArcCatalog and create a database connection to your
geodatabase. Remember to use the connection file with the administrator user (sde)
2. Right-click the database connection in the Catalog tree, point
to Administration, then click Administer Geodatabase.
3. Click the Connections tab.
Working with an Enterprise GeoDatabase 33
4. A list of all user sessions that are currently connected to the geodatabase is
displayed. Your session is displayed in gray, italic text. If necessary, you can
disconnect user sessions by right-clicking a session and clicking Disconnect
User.
2.3 Geo-database locks As users edit and query data, ArcGIS automatically applies and releases locks on
datasets in the geodatabase to help users manage changes without causing
conflicts with other users.
The Locks tab on the Geodatabase Administration dialog box allows you to view
and manage locks in the geodatabase. Through this dialog box, you can see active
locks on datasets and versions and which user has acquired the lock. This lets you
identify who may be blocking you from editing operations on specific datasets and
versions, which can help you coordinate editing processes with other users.
In a geodatabase there are two different lock modes, shared locks and exclusive
locks.
A shared lock is created on an individual dataset when it is in use; for example,
any time a user is editing or querying the contents of a feature class or table. This
mechanism is used so other users cannot change the schema of a dataset while it
is in use.
An exclusive lock is used to lock a dataset in the geodatabase from use by others
to make necessary changes to it, for example, a schema change or even delete the
dataset from the geo-database. Once a user with proper permissions starts to
34 Working with an Enterprise GeoDatabase make such changes to a dataset in the geodatabase, ArcGIS automatically
establishes an exclusive lock on the individual attribute table, feature class table,
raster table, or other dataset. However, if a shared lock exists on that dataset, an
exclusive lock cannot be established.
You can see who is holding schema, version, and state locks held in a geodatabase
using the Locks tab of the Geodatabase Administration dialog box.
1. Start ArcMap or ArcCatalog and connect to the Enterprise Geodatabase for
which you want to see the locks using the administrative user (sde).
2. Right-click the database connection in the Catalog tree, point
to Administration, and then click Administer Geodatabase.
3. Click the Locks tab.
Working with an Enterprise GeoDatabase 35
4. A list of locks on all objects in the geodatabase is displayed.
You can disconnect a user sessions, thereby dropping the locks held by that
session, by right-clicking a session and clicking Disconnect User.
2.4 Maintenance of an Enterprise GeoDatabase
Blocking new connections from being made to an Enterprise geodatabase before
running certain maintenance operations is considered a good practice as well as
removing any existing connections. In the previous paragraph we described how to
disconnect connected users and kill locks, while to block new connections to the
geodatabase follow the steps below:
1. In ArcMap or ArcCatalog connect to the geodatabase as the geodatabase
administrator.
2. Right-click the database connection in the Catalog tree and click Properties.
3. Click the Connections tab.
4. Uncheck Geodatabase is accepting connections.
It’s recommended to disconnect users only when you are sure that they are not performing important tasks because their work will be lost. In general locks should be dropped only if a session was left open even when not being used (for example, during the weekend).
36 Working with an Enterprise GeoDatabase
5. No new connections can be made to the geodatabase. Existing user
connections remain active.
2.4.1 Database backup and recovery
The data stored in your geodatabase must be protected from loss or corruption. To
achieve this, the database administrator makes backups, periodic copies or
snapshots of the database. The database administrator must also be able to use
these backups to recover the data in the event of hardware failure or data
corruption.
The recommended method to backup and recover an Enterprise Geodatabase
running on PostgreSQL is to use a tool provided by PostgreSQL called pg_dump to
create a backup file, drop the database, recreate the database with the same name
and finally restore to the re-created database using another tool called
pg_restore.
All these operations only block other activities on the geodatabase that require an
exclusive lock.
Note that the geodatabase administrator can always make a new connection to the geodatabase regardless of how this property is set.
Working with an Enterprise GeoDatabase 37 To create a backup of an ArcSDE geodatabase for PostgreSQL using pg_dump,
execute the pg_dump command as a superuser from a PowerShell window. It will
create an archive file that can be used to re-create a database.
1. Open a Powershell Window
2. Browse to the location of the bin folder located in the PostgreSQL installation
folder through this command:
cd “PostgreSQL installation path”\bin
Example: cd c:\Program Files\PostgreSQL\9.3\bin
3. Run the command below and provide the password for the postgres user to
create a backup of your database.
.\pg_dump –U postgres –Fc –f “path where you want to save the backup” dbname
Example:
.\pg_dump –U postgres -Fc -f “C:\GIS\PostgreSQL\cairo_backup_10012015.dump”
cairo
The pg_dump command can only create a backup of a single database at a time, and it
doesn’t include information about roles and tablespaces. For this reason, in case your problem is not limited to the single database but to the entire PostgreSQL, you have to create a backup for each geodatabase and then recreate roles and tablespaces before restoring your geodatabases.
38 Working with an Enterprise GeoDatabase
.\dropdb –U sde “databasename” Example: .\dropdb –U sde test_geodb
.\createdb –U sde –E UTF8 –O sde “databasename” Example: .\createdb –U sde –E UTF8 –O sde test_geodb
.\psql –U sde “database name” Example: .\psql –U sde test_geodb CREATE SCHEMA sde AUTHORIZATION sde; GRANT USAGE ON SCHEMA sde TO creator; GRANT USAGE ON SCHEMA sde TO editor;
To restore a database from an archive file created using the pg_dump command,
use the pg_restore command.
In this section we’ll describe how to restore a malfunctioning database from a
previous backup and then some additional step needed in case you have to reinstall
the entire PostgreSQL Server.
2.4.1.1 Restoring a geodatabase in the same PostgreSQL Server
If you are restoring into the same PostgreSQL server, you must drop the existing
database before restoring because database names in a PostgreSQL instance must
be unique.
1. After you have created a dump of your geodatabase, drop the geodatabase
running the instruction below:
2. Re-create the geodatabase using the createdb command line tool:
3. Log in into your database and create an sde schema owned by the sde user
and grant usage on the sde schema to all login roles or groups that will
access the geodatabase.
Working with an Enterprise GeoDatabase 39
.\pg_restore –U sde –d “database name” –n public “path to the dump”
.\pg_restore –U sde –d “database name” –n sde “path to the dump”
.\pg_restore –U sde –d “database name” “path to the dump” Example: .\pg_restore –U sde –d test_geodb –n public C:\cairo_backup_10012015.dump .\pg_restore –U sde –d test_geodb –n sde C:\cairo_backup_10012015.dump .\pg_restore –U sde –d test_geodb C:\cairo_backup_10012015.dump
ALTER DATABASE “database name” SET SEARCH_PATH=”$user”,sde,public; Example: ALTER DATABASE test_geodb SET SEARCH_PATH=”$user”,sde,public;
4. Run the instruction below:
5. Using the command line, restore the public schema and data using the
pg_restore command. When you restore a geodatabase, you must restore
schemas in a specific order: first the public schema, then the sde schema,
then the remaining schemas. Run the commands as a user with superuser
privileges, such as the postgres or sde user.
40 Working with an Enterprise GeoDatabase
4. Once the database restoration is complete, test the database by connecting to it
using ArcGIS for Desktop, examining existing data and importing new one.
2.4.1.2 Restoring a geodatabase after installing a new PostgreSQL server
In case you had to reinstall the PostgreSQL server before restoring the
geodatabase you have backed up, you have to recreate the sde user, all groups
and roles and configure again the PostgreSQL server following the process
described in the first chapter.
After having created the Enterprise GeoDatabase, you can restore the data from
your backup using the procedure described above, starting from the third step in
the previous paragraph.
2.4.2 Database performance improvement
In an Enterprise GeoDatabase data can be versioned to facilitate concurrent editing
over long periods of time. Without versioning, editors would lock data and prevent
other users from editing or even viewing the data. When versioning is used, edits
are saved in delta tables and as edits are made, the number of states and rows in
the delta tables grows, slowing database performance. Compressing the
geodatabase removes the states that are no longer referenced by a version and
can move rows in the delta tables to the base table.
The larger the tables and the more states, the more data ArcGIS must process
every time you display or query a version. Therefore, the greatest impact on
performance is not the number of versions but the amount of changes contained in
the delta tables for each version. As a result, versions can have different query
response times.
To maintain database performance, the geodatabase administrator must
periodically run a compress operation to remove unused data.
Working with an Enterprise GeoDatabase 41 The frequency with which you need to perform a compress operation is based on
the amount of editing that takes place in your geodatabase. If you have a high
volume of edits, you should probably compress the geodatabase once a day. For
average or low edit volumes, you should compress at least once a week.
2.4.2.1 Database compression
You can run the database compression through ArcMap or ArcCatalog following the
steps below.
1. Connect to your geodatabase using the administrative user (sde)
2. Right-click the database connection in the Catalog tree, point
to Administration, then click Compress Database
3. Click Yes to confirm that you want to run the compression operation on the
selected geodatabase
2.4.2.2 Database statistics
Database management systems determine the most efficient way to execute the
queries sent to them based on database statistics. Therefore, for optimal
performance of datasets created within Enterprise geo-databases, you need to
keep the database statistics current by frequently updating them.
When a feature class is registered as versioned, adds and deletes tables are
created to hold the records that are added to and deleted from a business table.
When a version is registered, the process automatically updates the statistics for all
the required tables. After that, as changes are made to the feature class, the
distribution of information in the tables and indexes changes, causing the database
statistics to become outdated.
It’s good practice update statistics after running a compression.
You can update the statistics of feature classes and tables you own from
within ArcGIS for Desktop.
42 Working with an Enterprise GeoDatabase To open the Analyze Datasets tool from the Catalog tree in ArcCatalog or ArcMap
and update dataset statistics, do the following:
1. Start ArcMap or ArcCatalog and connect to the database as the owner of the
data for which you want to update statistics.
2. Navigate to the Analyze Datasets geoprocessing tool in the Geodatabase
Administration toolset in the Data Management toolbox.
3. Use the database connection file created with the owner of the datasets you
want to analyze.
4. From the Datasets to Analyze list, choose the tables, feature classes, feature
datasets, raster catalogs, raster datasets, or mosaic datasets for which you
want to update statistics.
5. Leave the three checkboxes checked.
6. Click OK to run the tool.
Working with an Enterprise GeoDatabase 43
Annex A - Installation of ArcGIS Desktop 10.4
In this section we’ll report some preliminary steps to install ArcGIS Desktop 10.4
on a server running Windows Server 2012. In case your server runs a different
operating system, please get in touch with your regional GIS officer or with the
GSU unit at the HQ, by sending an email to wfp.esriservices@wfp.org.
The installation of ArcGIS Desktop is a multistep process:
1) Install ArcGIS for Desktop;
2) Authorize ArcGIS for Desktop using a provisioning file.
To complete the ArcGIS for Desktop installation you will need the following
software components and license files:
o ArcGIS Desktop 10.4
In this training manual we don’t describe the 2 steps, which are part of the typical
ArcGIS for Desktop installation. For any specific need please refer to the specific
documentation on the ESRI portal or get in touch with the GSU unit at HQ.
http://desktop.arcgis.com/en/arcmap/latest/get-‐started/installation-‐guide/introduction.htm
44 Working with an Enterprise GeoDatabase
Annex B - Installation of ArcGIS for Server Enterprise
and Web Adaptor This section guides you through the ArcGIS for Server installation process on a
server running Windows Server 2012.
In order to complete successfully this process, you need the following software
components and license files:
o ArcGIS for Server Enterprise 10.4 (for Windows)
o Provisioning file for ArcGIS for Server Advanced Enterprise
As for the ArcGIS for Desktop software, these files can be requested to the GSU
unit at HQ. Furthermore make sure your user has Administrator rights and close all
applications on your server before starting.
Once preparation is completed:
1. Double-click on the installation file and extract it in you preferred path;
2. Go to the path specified in the previous step and double-click on the Setup to
start the installation wizard;
3. Click Next
4. Click Next.
Working with an Enterprise GeoDatabase 45
5. Specify the account to be used by ArcGIS for Server to perform a variety of GIS
functions. Choose the first option by directly specifying the account name and
password. You can leave the default account name (arcgis).
Please remember to save these credentials in a safe place.
46 Working with an Enterprise GeoDatabase
6. Click Next and follow the directions on the screen.
7. After the installation completes, the Software Authorization Wizard is
launched. In case it doesn’t happen, launch it by clicking the launcher that
can be found in the programs directory at: Start > Program Files >
ArcGIS > Software Authorization
8. Select the 3rd option and browser to the ArcGIS for Server provisioning file,
follow the directions on the screen to complete the authorization.
9. After completing the authorization, the ArcGIS for Server Manager should
appear automatically. You will be asked weather you want to create a new
site or join an existing one. Choose the first option to add your machine as
the first GIS server in your configuration.
In case the Server Manager doesn’t appear, open a different browser (install
Chrome if it’s not available yet) and type this url:
http://localhost:6080/arcgis/manager
10. When you create a new site you’ll be prompted to enter an account that will
act as the primary site administrator. You will use this account to initially log
in to Manager and configure security. This account has unrestricted access to
the ArcGIS Server site. Enter a user name and password and click next.
11. Click Next to choose the default server directories and configuration store.
12. Examine the details about the site you are going to create and click Finish.
Please remember to save these credentials in a safe place.