Create Local Database from Static Copy of AACT

If you would like to work with the complete set of clinical trials on your own computer... install PostgreSQL locally, download a static copy of the AACT database, and populate a local PostgreSQL AACT database instance with the data. This page provides the instructions.


Install PostgreSQL Database Platform

The standard PostgreSQL installation includes a number of related tools that you'll need, such as pSQL, createdb & pg_restore. These tools are mentioned throughout the documentation provided on this site; they should all be available to you once PostgreSQL is installed.

AACT is currently running on version 9.5.4 of PostgreSQL; it's recommended you install this version or higher. Refer to PostgreSQL Downloads for free software and installation instructions.


Download Package Containing Static Copy of AACT Database

Download a zip file that contains the AACT database file. With a single command (see below), this file can be used to automatically configure the database & populate it with the clinical trials dataset. The zip file also contains documentation that describes the database at the time the static copy was created. (The download typically takes 3-7 minutes, depending on your network speed.)

[{:name=>"", :date_created=>"11/02/2017", :size=>"721 MB", :url=>""}, {:name=>"", :date_created=>"10/16/2017", :size=>"717 MB", :url=>""}, {:name=>"", :date_created=>"09/06/2017", :size=>"701 MB", :url=>""}, {:name=>"", :date_created=>"08/11/2017", :size=>"684 MB", :url=>""}, {:name=>"", :date_created=>"07/25/2017", :size=>"681 MB", :url=>""}, {:name=>"", :date_created=>"07/03/2017", :size=>"671 MB", :url=>""}, {:name=>"", :date_created=>"06/18/2017", :size=>"670 MB", :url=>""}, {:name=>"", :date_created=>"06/13/2017", :size=>"661 MB", :url=>""}, {:name=>"", :date_created=>"05/08/2017", :size=>"655 MB", :url=>""}, {:name=>"", :date_created=>"05/02/2017", :size=>"649 MB", :url=>""}, {:name=>"", :date_created=>"04/16/2017", :size=>"647 MB", :url=>""}, {:name=>"", :date_created=>"04/03/2017", :size=>"632 MB", :url=>""}, {:name=>"", :date_created=>"03/09/2017", :size=>"628 MB", :url=>""}, {:name=>"", :date_created=>"02/18/2017", :size=>"625 MB", :url=>""}, {:name=>"", :date_created=>"01/31/2017", :size=>"620 MB", :url=>""}, {:name=>"", :date_created=>"01/05/2017", :size=>"610 MB", :url=>""}]
Downloadable File Date Created Size 11/02/2017 721 MB 10/16/2017 717 MB 09/06/2017 701 MB 08/11/2017 684 MB 07/25/2017 681 MB 07/03/2017 671 MB 06/18/2017 670 MB 06/13/2017 661 MB 05/08/2017 655 MB 05/02/2017 649 MB 04/16/2017 647 MB 04/03/2017 632 MB 03/09/2017 628 MB 02/18/2017 625 MB 01/31/2017 620 MB 01/05/2017 610 MB


Populate Local PostgreSQL Database from the Static Copy

Once PostgreSQL is installed on your local machine and you have downloaded an AACT database package, you can create and populate your own database. You have two alternatives for installing it: 1) via a terminal session using command lines or 2) via a graphical user interface (GUI) such as pgAdmin. The command line option is somewhat simpler, so we've highlighted instructions for this below and provided guidance for using the GUI here.

Database Creation Via Command Line

Open a terminal session
  • On a Mac: press [Command] [Spacebar] and enter 'Terminal' in the 'Spotlight Search' dialog that pops up.
  • On a PC: press [Start] and enter 'CMD' in the command input box.

This should open a terminal session where you can enter the following commands.

Initialize empty postgres database: aact

After postgres is installed on your local machine, enter the following command to initialize the AACT database. (You might get the error message 'already exists' if the database was already created; no harm done.)


-> createdb aact createdb: database creation failed: ERROR: database "aact" already exists

Locate and unzip the database package/zipfile

Verify the location of the database package you downloaded in step 2 - both the path and the file name. You'll need to unzip this package and use the data dump file it contains to create and populate your own, local instance of the database.

  • On a Mac: The zip package is probably here: ~/Downloads/ (where YYYYMMDD is the date the database was copied).


-> unzip ~/Downloads/

This will unpack the files contained in the zip package and save them to the directory where the zip file exists. These files include:

  • schema_diagram.png Database schema diagram that illustrates the relationships between tables.
  • postgres_data.dmp Postgres dump file containing all the instructions and data required to create a local copy of the AACT database.
  • data_dictionary.xlsx Spreadsheet that describes all tables and columns in the AACT database.
  • nlm_protocol_definitions.htmlCopy of the National Library of Medicine: protocol-related documentation
  • nlm_result_definitions.htmlCopy of the National Library of Medicine: results-related documentation
Create and populate your local database instance

Enter the following command to create all database tables in aact and then populate them with clinical trials data.

This typically takes 10-20 minutes, depending on the speed of your machine.


-> pg_restore -e -v -O -x --dbname=postgres --no-owner --clean --create ~/Downloads/postgres_data.dmp

Verify the database

Confirm the download was successful by logging into the database and perusing the data.


-> psql aact psql (9.6.1) Type "help" for help. aact=# _

The aact=> prompt indicates that you're in a pSQL console session and can enter SQL queries against the AACT database. A simple example:


aact=> select count(*) from studies; count -------- 259453 (1 row) aact=> _

PostgreSQL provides helpful instructions on their website. For Windows, the certified Interactive Installer by EnterpriseDB is a good option. It includes a graphical interface for PostgreSQL (pgAdmin). The following instructions are for Postgres Version 9.5.4, pgAdmin III, and SQL Shell (psql).

Using pgAdmin III

  • Connect to the local Postgres server.
  • Using pgAdmin, select a Server, right-click and select Connect, and enter the password to connect to the Postgres server. (The PostgresSQL selection no longer contains a red X.)
  • Create an empty Postgres database and create/populate it from the static copy of AACT.
  • Using pgAdmin, select Databases, right-click and select New Database.
    • Under the Properties tab, enter a name for the Database and click OK
    • Select the new Database, right-click and select Restore
    • In the File Options section, select the name of the AACT database package as the Filename and select postgres as the Rolename
    • In the Restore Options #1 section, under the Don’t save header, select Owner and Privilege and click Restore.

The restore is complete when the Restore database window shows “Process returned exit code 0.”

Execute a sample query Using pgAdmin, select the Database and select SQL from the top menu.

In the SQL window, type...


select count(*) from studies

Click the right-arrow in the top menu to execute the sql. The result shows in the results window.

Using psql

  • Connect to the local Postgres server.
  • Using psql, click Enter to confirm:
  • Server [localhost] : (Press [Enter]}
  • Database [postgres] :
  • Port [5432] : (Press [Enter])
  • Username [postgres] : aact
  • Enter the password you created for Password for user postgres:
  • psql (9.5.4)
  • Type "help" for help.
  • postgres=#

We are compiling a list of commonly encountered problems...

Error Possible Resolution

"pg_restore: [archiver (db)] could not execute query: ERROR: unrecognized configuration parameter "row_security"

Upgrade your version of PostgreSQL to 9.5.4.

pg_restore: connecting to database for restore

pg_restore: creating DATABASE "aact"

pg_restore: [archiver (db)] Error while PROCESSING TOC:

pg_restore: [archiver (db)] Error from TOC entry 3543; 1262 1525913 DATABASE aact dbadmin

pg_restore: [archiver (db)] could not execute query: ERROR: database "aact" already exists

Make sure to include --clean in the command to drop the table before creating it.