SQL query failed

Started by Khushik, January 18, 2015, 09:59:29 AM

Previous topic - Next topic

Khushik

Hello,

I want to install NetXMS 2.0 on Windows machine with remote SQL server Standard 2005, but I got the following error(see attachment). Could you please tell me what was done wrong?

Alex Kirhenshtein

Check this database (netxms_db) for existing tables. Did you run wizard more than once?

Khushik

Thank you for the quick reply.

I have recreated the DB, but now I get the following error:

Alex Kirhenshtein

That's a bug. Filtered indexes (with "WHERE ..." clause) are introduced in SQL Sever 2008.

https://dev.raden.solutions/issues/747

As a workaround - uncheck "initialise database", edit file C:\NetXMS\lib\sql\dbinit_mssql.sql: remove "WHERE ..." part from this "CREATE INDEX" and initialise database by hand:
1) open "cmd" window
2) cd c:\netxms\bin
3) nxdbmgr init C:\NetXMS\lib\sql\dbinit_mssql.sql
4) net start "NetXMS Core"

Khushik

I have done the instantiation successful. Now when I want to start the service - I got the following error:
[22-Jan-2015 01:02:23.114] Log file opened
[22-Jan-2015 01:02:23.122] [INFO ] Database driver "mssql.ddr" loaded and initialized successfully
[22-Jan-2015 01:02:23.541] [ERROR] SQL query failed (Query = "CREATE TABLE idata_100 (item_id integer not null,idata_timestamp integer not null,idata_value varchar(255) null)"): [Microsoft][SQL Server Native Client 10.0][SQL Server]There is already an object named 'idata_100' in the database.
[22-Jan-2015 01:02:23.542] [ERROR] SQL query failed (Query = "CREATE CLUSTERED INDEX idx_idata_100_id_timestamp ON idata_100(item_id,idata_timestamp)"): [Microsoft][SQL Server Native Client 10.0][SQL Server]The operation failed because an index or statistics with name 'idx_idata_100_id_timestamp' already exists on table 'idata_100'.
[22-Jan-2015 01:02:23.548] [ERROR] SQL query failed (Query = "CREATE TABLE tdata_100 (item_id integer not null,tdata_timestamp integer not null,record_id bigint not null,UNIQUE(record_id))"): [Microsoft][SQL Server Native Client 10.0][SQL Server]There is already an object named 'tdata_100' in the database.
[22-Jan-2015 01:02:23.549] [ERROR] SQL query failed (Query = "CREATE TABLE tdata_records_100 (record_id bigint not null,row_id bigint not null,instance varchar(255) null,PRIMARY KEY(row_id),FOREIGN KEY (record_id) REFERENCES tdata_100(record_id) ON DELETE CASCADE)"): [Microsoft][SQL Server Native Client 10.0][SQL Server]There is already an object named 'tdata_records_100' in the database.
[22-Jan-2015 01:02:23.550] [ERROR] SQL query failed (Query = "CREATE TABLE tdata_rows_100 (row_id bigint not null,column_id integer not null,value varchar(255) null,PRIMARY KEY(row_id,column_id),FOREIGN KEY (row_id) REFERENCES tdata_records_100(row_id) ON DELETE CASCADE)"): [Microsoft][SQL Server Native Client 10.0][SQL Server]There is already an object named 'tdata_rows_100' in the database.
[22-Jan-2015 01:02:23.556] [ERROR] SQL query failed (Query = "CREATE CLUSTERED INDEX idx_tdata_100_id_timestamp ON tdata_100(item_id,tdata_timestamp)"): [Microsoft][SQL Server Native Client 10.0][SQL Server]The operation failed because an index or statistics with name 'idx_tdata_100_id_timestamp' already exists on table 'tdata_100'.
[22-Jan-2015 01:02:23.558] [ERROR] SQL query failed (Query = "CREATE INDEX idx_tdata_rec_100_instance ON tdata_records_100(instance)"): [Microsoft][SQL Server Native Client 10.0][SQL Server]The operation failed because an index or statistics with name 'idx_tdata_rec_100_instance' already exists on table 'tdata_records_100'.
[22-Jan-2015 01:02:23.559] [ERROR] SQL query failed (Query = "CREATE INDEX idx_tdata_rec_100_id ON tdata_records_100(record_id)"): [Microsoft][SQL Server Native Client 10.0][SQL Server]The operation failed because an index or statistics with name 'idx_tdata_rec_100_id' already exists on table 'tdata_records_100'.
[22-Jan-2015 01:02:24.062] [INFO ] Listening for SNMP traps on UDP socket 0.0.0.0:162
[22-Jan-2015 01:02:24.065] [INFO ] Listening for client connections on TCP socket 0.0.0.0:4701
[22-Jan-2015 01:02:24.065] [INFO ] Listening for client connections on TCP socket :::4701
[22-Jan-2015 01:02:24.065] [INFO ] NetXMS Server started
[22-Jan-2015 01:02:24.065] [INFO ] NetXMS Server stopped
[22-Jan-2015 01:02:24.065] [INFO ] Listening for mobile device connections on TCP socket 0.0.0.0:4747
[22-Jan-2015 01:02:24.065] [INFO ] Listening for mobile device connections on TCP socket :::4747

Victor Kirhenshtein

Hi,

you can safely ignores these errors - it just tries to re-create tables that are already exist. Normally it shouldn't happen though. Watch if there will be any other SQL errors.

Best regards,
Victor

Khushik

Thank you very much. Finally I have done it.