# How to reset WorkflowGen runtime content

**URL:** <https://discuss.workflowgen.com/t/how-to-reset-workflowgen-runtime-content/499>\
**Category:** Database\
**Created:** [July 20, 2013, 8:51pm UTC](https://discuss.workflowgen.com/t/how-to-reset-workflowgen-runtime-content/499 "2013-07-20T20:51:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wfg-admin](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/wfg-admin/32/714_2.png) [@wfg-admin](https://discuss.workflowgen.com/u/wfg-admin)\
**Post date:** [July 20, 2013, 8:51pm UTC](https://discuss.workflowgen.com/t/how-to-reset-workflowgen-runtime-content/499/1 "2013-07-20T20:51:59Z")

</div>

### Question

How do I reinitialize WorkflowGen while keeping my web forms, web services and users? I would like the request count and the history of past requests to reinitialize.

### Solution

These three SQL queries will remove all existing requests and reset the counters back to `0` while keeping all process definitions and users.

You’ll also need to manually delete all requests file data in `\wfgen\App_Data\Files\DataSet\runtime` as indicated below.

#### Delete all requests and actions

```auto
DELETE FROM WFPROCESS_INST; 

```

#### Delete all request and action data

For all the data files stored in the file system, you’ll need to manually delete the `\wfgen\App_Data\Files\DataSet\runtime` folder.

```auto
DELETE FROM WFDATASET WHERE RUNTIME = 'Y';  

```

#### Reset all processes’ relative IDs and request IDs

```auto
UPDATE WFCOUNTER SET COUNTER_VALUE = 0 WHERE ID_COUNTER <> 'WFPROCESS.ID_PROCESS' AND ID_COUNTER <> 'WFDATASET.ID_DATASET';

```

### Removing users and groups

If you want to remove all users and groups (except the `wfgen_admin` account), you’ll have to execute the following SQL queries as well:

#### Delete all regular users’ information (not admin)

- `USERS_PREFS` and `USERS_VIEWS` are preserved for administrators.

- Delegations (`WFDELEGATE`) are preserved for admins if the delegation are made between administrator accounts

```auto
DELETE FROM USERS WHERE ID_USER NOT IN (SELECT ID_USER FROM USERS_PROFILE WHERE ID_PROFILE = 1);  

```

#### Delete all groups that have no members

```auto
DELETE FROM GROUPS WHERE ID_GROUP NOT IN (SELECT ID_GROUP FROM USERS_GROUPS, USERS WHERE USERS_GROUPS.ID_USER = USERS.ID_USER);  

```

#### Delete all directories that have no users and groups

```auto
DELETE FROM DIRECTORY WHERE ID_DIRECTORY NOT IN (SELECT ID_DIRECTORY FROM USERS) AND ID_DIRECTORY NOT IN (SELECT ID_DIRECTORY FROM GROUPS);  

```

### Important notes

- After deleting most of the users, groups and directories, it’s possible that some participants have no associations at all.

- Use the following query to get a list of participants without associations:

- The following Transact-SQL block will create a new association for those participants with the first administrator account (compatible with MS SQL Server only).
