Resolving WinCCOLEDBProvider Error 7320 After Computer Rename

David Krause13 min read
HMI / SCADASiemensTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Resolving WinCCOLEDBProvider Error 7320 After Computer Rename in WinCC V7 SP3

This technical reference documents the root cause, diagnosis, and remediation of Msg 7320, Level 16, State 2 errors raised by the WinCCOLEDBProvider OLE DB linked server in SIMATIC WinCC V7.0 SP3 Update 5 following a Windows Server upgrade and a host computer rename. The procedure recovers archive query access without requiring a SQL Server or WinCC reinstall.

1. Problem Summary

After upgrading a WinCC runtime environment from SIMATIC WinCC V7.0 SP2 on Windows Server 2003 to SIMATIC WinCC V7.0 SP3 Update 5 on Windows Server 2008 R2 Standard (x64), the WinCCOLEDBProvider stops returning results. The error originates in the SQL Server linked-server layer that the WinCC Connectivity Pack provisions automatically when the stored procedure CC_SP_ReadTags is invoked.

The exact failure observed in SQL Server Management Studio (SSMS) against the WinCC runtime database:

OLE DB provider "WinCCOLEDBProvider" for linked server "CA_95" reported an error.
The provider did not give any information about the error.
Msg 7320, Level 16, State 2, Line 1
Cannot execute the query
"Tag:R,(5006),'2013-08-12 06:00:00','2013-08-12 07:59:59',TIMESTEP=30,2,0"
against OLE DB provider "WinCCOLEDBProvider" for linked server "CA_95".

Earlier releases (V7.0 SP2) returned rows. Connectivity Pack was installed and licensed, the ODBC layer was present, and the same C# application code path remained unchanged. The only environmental differences were the WinCC update level, the operating system, and a hostname change applied during the upgrade.

2. Affected Versions and Components

Component Version / Build Status
SIMATIC WinCC V7.0 SP2 (Windows Server 2003) Working baseline
SIMATIC WinCC V7.0 SP3 Update 5 (Windows Server 2008 R2 x64) Affected
SIMATIC WinCC V7.0 SP3 (newer patch levels) Affected if host renamed
SIMATIC Net Bundled with WinCC V7 SP3 Installation fails on hostname with underscore
WinCC Connectivity Pack V7.0 SP3 Update 5 Required for WinCCOLEDBProvider
SQL Server 2005/2008 R2 instance installed by WinCC Linked server topology affected
Windows Server 2008 R2 Standard SP1 x64 Target platform
Compatibility constraint: SIMATIC Net refuses to install when the Windows hostname contains an underscore (_). WinCC itself installs successfully, which masks the failure and leaves the SQL Server @@SERVERNAME registered against the temporary name used during install.

3. Symptoms and Error Catalog

3.1 Primary Symptom

Any call into CC_SP_ReadTags — whether issued from a C# application, a PowerShell script, or directly in SSMS — returns:

Code Severity Source Meaning
Msg 7320 Level 16 SQL Server OLE DB provider layer Query could not be executed against the linked provider
(No provider error code) WinCCOLEDBProvider Provider did not return an information message

The call syntax in the failure case was:

CC_SP_ReadTags '5006','2013-8-12 6:0:0','2013-8-12 7:59:59','','Timestamp ASC','TIMESTEP=30,2'

The CA_95 suffix is a Connectivity Pack convention: CA_ denotes a Computer-Archive linked server and the numeric suffix is the project number. Each new project that calls the stored procedure will create a CA_<NN> linked server entry under the current @@SERVERNAME.

3.2 Secondary Symptoms

  • Linked servers of the form CA_51, CA_95, etc. appear in Server Objects > Linked Servers in SSMS.
  • ODBC Data Sources in Administrative Tools > Data Sources (ODBC) on Windows Server 2008 R2 do not show the WinCC archives that were visible on Server 2003. This is a UI visibility artifact of 64-bit ODBC administration, not a runtime failure.
  • The DataSource property of the linked server still references the original Windows hostname used when WinCC was first run.
  • SQL Server @@SERVERNAME differs from SERVERPROPERTY('ServerName'), a Microsoft-documented sign of a renamed server instance.

4. Root Cause Analysis

The issue is a divergence between three name spaces used by the SQL Server instance that hosts the WinCC archive databases:

  1. Windows NT hostname — read from the OS at process start.
  2. SQL Server @@SERVERNAME — captured at SQL Server install or last sp_addserver.
  3. WinCC linked-server DataSource — set the first time CC_SP_ReadTags is called against the running WinCC project.

The following sequence of events creates the divergence:

  1. Operator builds the WinCC V7 SP3 server with a hostname containing an underscore, e.g. ENG_STATION, because the engineering naming convention requires it.
  2. WinCC setup proceeds, but SIMATIC Net setup fails silently when the underscore is detected. WinCC itself completes, including the SQL Server instance and the Connectivity Pack database.
  3. Operator renames the machine to ENGSTATION, reruns the SIMATIC Net setup, completes installation, then renames the host back to ENG_STATION for production use.
  4. SQL Server was installed and the WinCC runtime database was first opened while the host was named ENGSTATION. SQL Server caches @@SERVERNAME = ENGSTATION\WINCC at startup.
  5. WinCC creates the linked server entries (CA_51, CA_95, etc.) using the cached @@SERVERNAME as the DataSource. The Windows OS now reports ENG_STATION, but the OLE DB and SQL Server metadata still points at ENGSTATION.
  6. After WinCC SP3 Update 5 install or after the next WinCC runtime restart, the DataSource for the OLE DB call resolves to a network name that no longer exists, and the OLE DB provider fails with no descriptive error.
Siemens official guidance: From SIMATIC WinCC V6.0 onward, the computer name must not be changed after the WinCC installation and the first call of the SQL Server. If a rename is unavoidable, SQL Server must be reinstalled. The documented behavior is reproduced in entry ID 47354369 of the Siemens Industry Online Support FAQ.

5. Diagnostic Procedure

Before applying the fix, run the following diagnostic block in SSMS against the WinCC runtime database. The query exposes the three name values that must agree for the OLE DB provider to function.

DECLARE @old_name           varchar(128),
        @win_nt_server_name varchar(128),
        @server_name        varchar(128)

SELECT @old_name           = CONVERT(VARCHAR(128), @@SERVERNAME),
       @win_nt_server_name = CONVERT(VARCHAR(128), SERVERPROPERTY('ServerName')),
       @server_name        = (SELECT TOP (1) name FROM master.sys.servers)

PRINT 'Local SQL Server name : ' + @old_name
PRINT 'WindowsNT Server name : ' + @win_nt_server_name
PRINT 'Server name           : ' + @server_name

Expected output on a broken system:

Local SQL Server name : ENGSTATION\WINCC
WindowsNT Server name : ENG_STATION\WINCC
Server name           : CA_51

Any mismatch between the first two lines confirms the issue. In SSMS, right-click the linked server CA_51, choose Properties > General and verify that Data Source matches @@SERVERNAME rather than the current Windows hostname.

6. Step-by-Step Resolution

The remediation realigns SQL Server's stored server identity with the current Windows hostname and rebuilds the WinCC-generated linked server entries.

Step 1 — Stop WinCC Runtime

Open the WinCC Explorer and click Stop Runtime, or use the command line:

net stop "CCAgentHost"
net stop "SIMATIC WinCC Runtime"

Confirm that no WinCC services or CCWrite.exe processes are active in Task Manager before proceeding.

Step 2 — Re-register the SQL Server Local Identity

Open a query window in SSMS connected to the WinCC runtime instance and execute:

EXEC sp_dropserver 'ENGSTATION\WINCC';
GO
EXEC sp_addserver 'ENG_STATION\WINCC', 'local';
GO

Substitute the actual old SQL Server name (the value reported by @@SERVERNAME) and the new Windows host name (the value reported by SERVERPROPERTY('ServerName')). The local keyword is mandatory; it tells SQL Server that this is the local instance.

Verify the change with the diagnostic block from Section 5. The first two PRINT lines must now read identically.

Step 3 — Delete Stale Linked Servers

In SSMS, expand Server Objects > Linked Servers and delete every CA_ entry created by WinCC. Right-click the linked server, choose Delete, confirm. Alternatively from T-SQL:

EXEC sp_dropserver 'CA_51', 'droplogins';
EXEC sp_dropserver 'CA_95', 'droplogins';

The droplogins argument removes any associated remote and linked-server login mappings. Repeat for every CA_<NN> linked server that points at the old DataSource.

Step 4 — Restart the Server

A full Windows restart is required. The sp_addserver '...', 'local' change does not take effect on the running sqlservr.exe process. After restart, re-verify with the diagnostic block from Section 5.

Step 5 — Recreate the Linked Servers Automatically

Linked server entries are not persisted across SQL Server restarts in a static manner. They are created on demand the first time a WinCC query is executed in the runtime database. Re-issue the original query:

USE <WinCC_RT_DB>;
EXEC CC_SP_ReadTags '5006','2013-8-12 6:0:0','2013-8-12 7:59:59','','Timestamp ASC','TIMESTEP=30,2';

The Connectivity Pack will recreate the CA_<NN> linked servers, this time bound to the corrected SQL Server local identity.

7. Verification

Use the following checks to confirm the fix is complete and stable across a WinCC runtime restart.

  1. Diagnostic block from Section 5 shows @@SERVERNAME = SERVERPROPERTY('ServerName') after restart.
  2. Linked-server DataSource property of any CA_<NN> entry matches the current Windows hostname.
  3. CC_SP_ReadTags returns rows within 2-3 seconds for a one-hour window with 30-second time step.
  4. C# application that was failing with Msg 7320 resumes producing DataTable results.
  5. Querying the CC_ExternalBrowsing view on the runtime database returns the expected archive configuration metadata.

8. Calling CC_SP_ReadTags Correctly

The CC_SP_ReadTags stored procedure is the standard entry point for T-SQL archive access via the WinCC OLE DB Provider. Signature:

Position Parameter Type Description
1 TagList NVARCHAR(MAX) Semicolon-separated list of tag IDs (numeric) or fully qualified tag names
2 TimeFrom DATETIME Start of query window
3 TimeTo DATETIME End of query window
4 Aggregate NVARCHAR(32) Optional aggregation function (e.g. AVG, MAX, MIN, SUM)
5 SortOrder NVARCHAR(64) e.g. 'Timestamp ASC' or 'Timestamp DESC'
6 Options NVARCHAR(MAX) e.g. 'TIMESTEP=30,2' (step in seconds, mode)

8.1 By Tag ID

CC_SP_ReadTags '5006','2013-08-12 06:00:00','2013-08-12 07:59:59','','Timestamp ASC','TIMESTEP=30,2'

8.2 By Fully Qualified Tag Name

CC_SP_ReadTags 'TAG:R,(ArchiveName\TagName),'2013-08-12 06:00:00','2013-08-12 07:59:59'','','Timestamp ASC','TIMESTEP=30,2'

Multiple tags are passed in the first argument using a semicolon:

CC_SP_ReadTags '5006;5007;5008', '2013-08-12 06:00:00', '2013-08-12 07:59:59', '', 'Timestamp ASC', 'TIMESTEP=30,2'
Note: In V7.0 SP3 and later, the CC_SP_ReadTags stored procedure is encrypted. The implementation is no longer visible from SSMS. Use the Connectivity Pack documentation as the authoritative reference for parameter semantics.

9. WinCC OLE DB Provider Connection Reference

The OLE DB provider is registered by the Connectivity Pack installer. The programmatic identifier is WinCCOLEDBProvider.1 for 32-bit consumers and WinCCOLEDBProvider.1 for 64-bit consumers on 64-bit installations of WinCC V7. Standard connection parameters are:

Property Typical Value Notes
Provider WinCCOLEDBProvider Case-sensitive match required
Data Source <ServerName>\WINCC Must match @@SERVERNAME
Catalog CC_OpenArch_<NN>_<YYYY-MM-DD hh.mm.ss> or current RT DB name WinCC runtime database name
User ID WinCCAdmin or configured user Connectivity Pack credentials
Password ****** Per Connectivity Pack configuration

For more information on establishing the OLE DB connection from external applications, see the Siemens TIA Portal documentation for WinCC OLE DB Provider (RT Professional) and Establishing the Connection to the Archive Database (RT Professional).

10. Prevention and Best Practices

  1. Never rename a host after SIMATIC WinCC and its bundled SQL Server have been installed. Siemens explicitly states that a rename requires a full SQL Server reinstall.
  2. Avoid underscore characters in hostnames on WinCC servers. The SIMATIC Net installer rejects _ characters; a workaround by temporary rename is a documented root cause of this failure mode.
  3. Document the host naming convention before commissioning. Use a hyphen or a numeric suffix if a separator is required, e.g. ENG-STATION-01.
  4. Verify @@SERVERNAME matches the OS hostname immediately after WinCC install and after every Windows Server patch cycle that may touch network identity.
  5. Back up the master and WinCC runtime databases before any change to SQL Server metadata. While sp_dropserver / sp_addserver is non-destructive to user data, a backup allows recovery in seconds.
  6. Run Connectivity Pack on a 64-bit OS using the matching x64 installer. Mixing 32-bit OLE DB providers with 64-bit SQL Server is a common cause of provider not registered variants of this error.
  7. Use the SQL Server Configuration Manager (not services.msc) to manage the WinCC instance. Configuration Manager is the only Microsoft-supported way to start the instance with the correct startup parameters after a rename.
  8. Read the relevant section of the WinCC Information System (Start > SIMATIC > WinCC > Information System) before any upgrade. The manual contains the explicit hostname restriction and the linked-server topology description.

11. Troubleshooting Matrix

Symptom Likely Cause Action
Msg 7320 on CC_SP_ReadTags Linked-server DataSource points at an old hostname Run Section 6 procedure
No ODBC entries for WinCC visible in 64-bit ODBC admin Run odbcad32.exe from %systemdrive%\Windows\SysWOW64 to see 32-bit DSNs Use 32-bit ODBC admin tool on x64 OS
@@SERVERNAME <> SERVERPROPERTY('ServerName') Host renamed post-SQL install Apply sp_dropserver / sp_addserver
SIMATIC Net setup fails during WinCC install Hostname contains underscore Reinstall OS with valid hostname; do not rename after install
WinCC starts but CC_SP_ReadTags returns no rows Connectivity Pack not licensed or not installed Verify license key and reinstall Connectivity Pack
Linked server CA_<NN> missing from SSMS First-call creation has not occurred in current session Execute CC_SP_ReadTags once; entry is created on demand
Msg 7311 / Msg 7301 on CC_SP_ReadTags 32-bit OLE DB provider not registered for 64-bit SQL Server Install matching 64-bit Connectivity Pack
Stored procedure not found Wrong database context in SSMS Connect to the WinCC runtime database, not master or model

12. Related SQL Server System Procedures

Procedure Purpose Notes
sp_dropserver Removes a server from the local SQL Server known-servers list Use droplogins argument for linked servers
sp_addserver Defines a local or remote server name 'local' required for the local instance
sp_helpserver Reports all known servers Use to confirm corrections
sp_serveroption Sets server options for remote and linked servers Used to toggle rpc, rpc out, data access
sys.servers Catalog view of registered servers Source for the name lookup in the diagnostic block

13. Field-Proven Caveats

  • The diagnostic block in Section 5 must be run from the WinCC runtime database, not from master. Some versions of SSMS default to master when a new query window is opened.
  • The sp_dropserver call may fail with Msg 15190 if there are still remote logins mapped to the old name. Use sp_droplinkedsrvlogin first, or use sp_dropserver '...', 'droplogins' on linked servers.
  • After sp_addserver, restart the SQL Server service and the SQL Server Agent. The change does not propagate to a running sqlservr.exe process.
  • On Windows Server 2008 R2, the 32-bit ODBC Administrator is C:\Windows\SysWOW64\odbcad32.exe. Launching it from the Start Menu opens the 64-bit tool, which can confuse an operator into thinking the DSNs are missing.
  • If SIMATIC Net refuses to install because of the underscore, do not deselect it and proceed. The absence of SIMATIC Net breaks several WinCC subsystems (S7 communication channels, OPC, redundancy). Plan a reinstall of the OS with a valid hostname.

14. References to Official Documentation

FAQ

What causes Msg 7320 from WinCCOLEDBProvider after upgrading to WinCC V7 SP3?

Msg 7320 is raised when the linked server's DataSource no longer matches the current Windows hostname. This typically happens when the host was renamed after WinCC or SQL Server was installed, causing @@SERVERNAME to diverge from SERVERPROPERTY('ServerName'). Fix it with sp_dropserver and sp_addserver '...', 'local', then delete the stale CA_<NN> linked servers and restart.

Why does SIMATIC Net refuse to install on a host with an underscore in its name?

SIMATIC Net has a documented restriction against the underscore character in Windows hostnames. The installer aborts with no descriptive message during the WinCC V7 setup. Avoid renaming a host to bypass this; instead use a hostname without underscores from the start to prevent @@SERVERNAME / OS hostname divergence downstream.

Do I need to reinstall SQL Server to fix WinCCOLEDBProvider after a computer rename?

Not necessarily. Realigning the SQL Server local identity with sp_dropserver and sp_addserver '...', 'local', deleting the stale linked servers, and restarting the host resolves the issue in the majority of cases. Siemens documents that a full SQL Server reinstall is the strict path, but the T-SQL procedure above is the field-proven workaround that avoids downtime.

How is the CC_SP_ReadTags stored procedure invoked from T-SQL?

Connect to the WinCC runtime database in SSMS and execute CC_SP_ReadTags 'TagList','StartTime','EndTime','','SortOrder','Options'. Example: CC_SP_ReadTags '5006','2013-08-12 06:00:00','2013-08-12 07:59:59','','Timestamp ASC','TIMESTEP=30,2'. Multiple tags are passed semicolon-separated. The procedure is encrypted in WinCC V7 SP3 and later.

Why are the ODBC data sources for WinCC missing after upgrading to Windows Server 2008 R2?

On 64-bit Windows, the default ODBC Data Sources administrative tool is 64-bit and only shows 64-bit DSNs. WinCC's 32-bit ODBC entries remain visible in C:\Windows\SysWOW64\odbcad32.exe. The missing entries in the default tool are a UI artifact, not a runtime issue, and they do not affect WinCCOLEDBProvider operation.

Back to blog