Resolving OS Compilation Failures and Error -321 Opening SFC Databank in PCS 7

Resolving OS Compilation Failures and Error -321 Opening SFC Databank in PCS 7

The error 'Error -321 while opening the SFC databank' during OS runtime startup or OS compilation in SIMATIC PCS 7 indicates corrupted or desynchronized SFC runtime database index files located within the OS project folder. SFC visualization data is compiled into database tables inside the SfcRtBase directory. To permanently resolve the error and restore normal runtime startup speed, deactivate WinCC Runtime, navigate to the OS project directory path wincproj\OS\SfcRtBase, delete the corrupted files (or clear the folder contents), and perform a complete OS compilation from SIMATIC Manager with SFC visualization selected.

Table of Contents

Architecture of the SFC Runtime Database (SfcRtBase)

In SIMATIC PCS 7, Sequential Function Charts (SFC) compiled for Operator Station visualization generate specialized runtime data structures. When the OS is compiled from SIMATIC Manager, the SFC compiler extracts step definitions, transitions, operating modes, and setpoints from the AS charts and compiles them into a structured dBase/FoxPro database.

This database resides in the OS project directory under wincproj\OS\SfcRtBase\ and consists of three essential files:

  1. SfcRtBase.dbf: Master database table containing SFC step and transition definitions.
  2. SfcRtBase.mdx: Compound index file maintaining fast runtime lookup pointers.
  3. SfcRtBase.fpt: Memo file containing variable-length text strings and step comments.

Root Causes of Error -321 and Slow Runtime Initialization

The error code -321 represents a low-level database engine fault indicating Index or Table Corruption:

  • Desynchronized Index Pointers: If the index file (.mdx) and data table (.dbf) become mismatched in timestamp or record count, the WinCC SFC visualization runtime server (SFC_Server.exe) fails to bind the table.
  • Abrupt System Termination: Virtual machine power loss, host hypervisor resets, or aborting an OS compilation while writing to SfcRtBase leaves partial, corrupted file headers.
  • Severe Startup Delays: When WinCC Runtime starts, the SFC subsystem attempts extensive retry loops to recover corrupted pointers, causing the OS Server startup sequence to freeze or take over 20 minutes to load.

Step-by-Step Database Purge and Recompilation Workflow

Follow this exact sequence to regenerate a pristine SFC runtime database:

  1. Deactivate WinCC Runtime: Close OS Runtime completely on the target OS Server and Engineering Station.
  2. Navigate to the Project Folder:
    - Open Windows File Explorer and navigate to your PCS 7 project path:
    C:\...\<Multiproject>\<OS_Server_Station>\wincproj\OS\SfcRtBase\
  3. Inspect and Remove Corrupted Files:
    - Check file timestamps. Often, only one file exists or dates diverge by months.
    - Select all files within SfcRtBase and delete them (or move them to a backup folder).
  4. Execute Full OS Compilation:
    - Open SIMATIC Manager, right-click the OS Server, and select Compile.
    - Ensure the compile option SFC Visualization is checked, and select Entire OS.
    - The compiler will recreate fresh, consistent SfcRtBase.dbf, .mdx, and .fpt files.
  5. Restart WinCC Runtime: Activate OS Runtime; verify clean, immediate startup.

Impact of Virtual Machine Snapshots and Crashes on SFC Tables

Engineering PCS 7 within virtualization platforms (VMware ESXi, Workstation) presents unique hazards regarding database locks. Reverting snapshots while WinCC SQL or SFC databases are mounted can cause file-system inconsistencies. Always stop WinCC processes and close SIMATIC Manager before taking or restoring VM snapshots.

Troubleshooting Matrix for SFC Database Errors

The table below details symptoms, root causes, and remedies for SFC visualization errors:

Error Message / SymptomRoot CauseFile LocationCorrective ActionError -321 Opening SFC DatabankCorrupted SfcRtBase.mdx indexwincproj\OS\SfcRtBaseDelete SfcRtBase contents and recompile Entire OSOS Runtime startup takes >20 minDatabase retry loops on corrupt SFC tablewincproj\OS\SfcRtBasePurge SfcRtBase folder and compile OSSFC faceplate shows 'No Data'OS compiled without SFC visualizationSIMATIC Manager > OS CompileRecompile OS with 'SFC Visualization' enabledOS Compile error 'SFC generation'AS chart compilation out of dateAS Chart folderCompile CFC/SFC with memory reset prior to OS compileError -301 Table Not FoundMissing SfcRtBase directorywincproj\OSCreate empty SfcRtBase folder and recompile OS

Verification

Verify that SFC database corruption is fully resolved:

  1. Open the directory wincproj\OS\SfcRtBase\ and confirm that all three files (.dbf, .mdx, .fpt) are present with identical modification timestamps.
  2. Start WinCC OS Runtime; confirm runtime initializes rapidly without error popups.
  3. In runtime, open an SFC block icon or navigate to an SFC type instance faceplate.
  4. Confirm that the SFC step sequence, active step highlighting, and transition logic display accurately in real time.
  5. Confirm that no SFC database error entries appear in the WinCC diagnostic file WinCC_Sys_01.log.

Limitations and Operational Precautions

Observe the following precautions regarding SFC runtime files:

  • Never Delete During Runtime: Never attempt to delete or edit files in SfcRtBase while WinCC Runtime is active, as active file locks will crash the WinCC database manager.
  • Multiproject Backup Mandatory: Always create a complete multiproject backup (File > Archive...) before manual file deletions.
  • Redundant Server Pairs: If purging database files on redundant servers, perform an identical purge and full download to both Server 1 and Server 2 to prevent database checksum divergence.

Engineer FAQ

What happens if I delete all files inside the SfcRtBase folder?

Deleting all files in the SfcRtBase directory is completely safe while WinCC Runtime is deactivated. The next full OS compilation automatically regenerates clean, uncorrupted database and index files from the AS SFC charts.

Why does WinCC Runtime startup freeze on systems with Error -321?

The SFC runtime service (SFC_Server.exe) attempts repeated internal recovery routines to re-index the damaged database. These retry loops block other WinCC startup components, delaying runtime initialization by 15 to 30 minutes.

Does recompiling changes recreate the SfcRtBase files?

Compiling changes only appends modified records to existing tables. If the index file (.mdx) is already corrupted, compiling changes will fail. You must delete the files and perform an 'Entire OS' compilation to rebuild the database.

Technical References

Related Articles

Related Tags

  • SFC Visualization
  • SfcRtBase
  • Error -321
  • OS Compilation
  • PCS 7 V8.2
  • WinCC Database
6 respuestas