Goal:

Create a species list that is automatically updated in the same fashion to reflect daily changes to our Biotics database. 


Solution:

Script the desired query and run it as a Scheduled Task to export the results to a .csv file.  NOTE: If spatial data is desired, see this solution.

Requirement:

The Oracle client has been installed (according to this solution) and configured (according to this article) on the machine the Scheduled Task will run.

Batch File:

Create a batch file (.bat) which logs into SQL Plus as the desired Oracle user (biotics_report) and calls the desired query. Following is an example of the text to include in the batch file (.bat) where the query (query.sql) is saved in C:\Temp. Update the file location/name and PASSWORD:

sqlplus.exe biotics_report/PASSWORD@biotics5 @C:\Temp\query.sql

Query File:

Attached is an example query.sql file which queries the element_subnational table. Just update the select statement, as appropriate, to query the desired data.

Create a scheduled task

Create a scheduled task to run the script daily, to automatically update the data.

  1. From the Windows Search on the Taskbar, type in Task Scheduler, and open the Task Scheduler.
    Graphical user interface

Description automatically generated
  2. Within the Task Scheduler, Create Task.
  3. Within Create Task, on the General tab, name the task (ie. Download and Publish Biotics spatial layers).
    Graphical user interface, text, application

Description automatically generated
  4. From the Triggers tab, select New.
  5. Within New Trigger, indicate to run the task Daily (or as often as preferred) and select the time the task should be run. NOTE: The computer has to be on to run the task, so make sure you indicate the time accordingly. Click OK.
    Graphical user interface, text, application

Description automatically generated
  6. From the Actions tab, click New.
  7. Within New Action, Start a program and navigate to the the batch file script. Click OK.
    Graphical user interface, text

Description automatically generated
  8. From the Conditions tab, indicate to Wake the computer to run this task.
    Graphical user interface, text, application, email

Description automatically generated
  9. Click OK to save the scheduled task.