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 |
_). 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
DataSourceproperty of the linked server still references the original Windows hostname used when WinCC was first run. - SQL Server
@@SERVERNAMEdiffers fromSERVERPROPERTY('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:
- Windows NT hostname — read from the OS at process start.
-
SQL Server
@@SERVERNAME— captured at SQL Server install or lastsp_addserver. -
WinCC linked-server
DataSource— set the first timeCC_SP_ReadTagsis called against the running WinCC project.
The following sequence of events creates the divergence:
- Operator builds the WinCC V7 SP3 server with a hostname containing an underscore, e.g.
ENG_STATION, because the engineering naming convention requires it. - 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.
- Operator renames the machine to
ENGSTATION, reruns the SIMATIC Net setup, completes installation, then renames the host back toENG_STATIONfor production use. - SQL Server was installed and the WinCC runtime database was first opened while the host was named
ENGSTATION. SQL Server caches@@SERVERNAME = ENGSTATION\WINCCat startup. - WinCC creates the linked server entries (
CA_51,CA_95, etc.) using the cached@@SERVERNAMEas theDataSource. The Windows OS now reportsENG_STATION, but the OLE DB and SQL Server metadata still points atENGSTATION. - After WinCC SP3 Update 5 install or after the next WinCC runtime restart, the
DataSourcefor the OLE DB call resolves to a network name that no longer exists, and the OLE DB provider fails with no descriptive error.
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.
- Diagnostic block from Section 5 shows
@@SERVERNAME = SERVERPROPERTY('ServerName')after restart. - Linked-server
DataSourceproperty of anyCA_<NN>entry matches the current Windows hostname. -
CC_SP_ReadTagsreturns rows within 2-3 seconds for a one-hour window with 30-second time step. - C# application that was failing with
Msg 7320resumes producingDataTableresults. - Querying the
CC_ExternalBrowsingview 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'
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
- 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.
-
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. -
Document the host naming convention before commissioning. Use a hyphen or a numeric suffix if a separator is required, e.g.
ENG-STATION-01. -
Verify
@@SERVERNAMEmatches the OS hostname immediately after WinCC install and after every Windows Server patch cycle that may touch network identity. -
Back up the
masterand WinCC runtime databases before any change to SQL Server metadata. Whilesp_dropserver/sp_addserveris non-destructive to user data, a backup allows recovery in seconds. - 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.
-
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. - 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 tomasterwhen a new query window is opened. - The
sp_dropservercall may fail withMsg 15190if there are still remote logins mapped to the old name. Usesp_droplinkedsrvloginfirst, or usesp_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 runningsqlservr.exeprocess. - 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
- WinCC OLE DB Provider (RT Professional) — Siemens TIA Portal documentation for the OLE DB provider architecture and analysis functions.
- Establishing the Connection to the Archive Database (RT Professional) — Connection-string parameters and provider registration.
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.