Quantcast
Channel: Ivanti User Community : Document List - Inventory
Viewing all articles
Browse latest Browse all 397

How to Increase the Width of FilePath in the Data_Files table to prevent some scans from throwing an error

$
0
0

How to Increase the Width of FilePath in the Data_Files table to prevent some scans from throwing an error.

 

 

Problem

Some files have a path that exceeds the length of 255 characters when including the file name. In those cases the scans where data files include exceedingly long paths may error out. The default column width in the database is 255 characters for the column where this data is stored.

 

An error similar to this will appear in the windows application event log:

Database exception: SCA####.SCN, LDInv.dll

-2147467259

Data provider or other service returned an E_FAIL status.

 

Error comitting on table DATA_FILES:   DATA PROVIDER OR OTHER SERVICE RETURNED AN E_FAIL STATUS.

Increased column size might be necessary, Thread ID: 13204.


Solution

Increase the width of the filepath column. Note this is more challanging than simply running an alter table statement due to column design.

Warning: Backup your database before making any changes.

Warning: Stop the Inventory Service on the Core. Once the three statements below complete successfully you may resume normal operation and turn the Inventory Service back on.


/*Run First*/

 

--Change to your Database Name--

USE [ulddb]

GO

 

/****** Object:  Index [XPKDATAFiles]    Script Date: 09/03/2015 09:50:43 ******/

IF  EXISTS(SELECT*FROMsys.indexesWHEREobject_id=OBJECT_ID(N'[dbo].[Data_Files]')AND name =N'XPKDATAFiles')

ALTERTABLE [dbo].[Data_Files] DROPCONSTRAINT [XPKDATAFiles]

GO

 

------------------------------------------

/*Run Second*/

--We cannot use nvarchar(max) because this column is part of the primary key. Length of 400 is about as long as we should go before we exceed maximum index length.

--Change to your Database Name--

USE [ulddb]

GO

altertable data_files altercolumn filepath nvarchar(400)notnull

GO

 

------------------------------------------

/*Run Third*/

--Change to your Database Name--

USE [ulddb]

GO

/****** Object:  Index [XPKDATAFiles]    Script Date: 09/03/2015 09:50:43 ******/

ALTERTABLE [dbo].[Data_Files] ADDCONSTRAINT [XPKDATAFiles] PRIMARYKEYCLUSTERED

(

      [Computer_Idn] ASC,

      [FilePath] ASC

)WITH (PAD_INDEX  =OFF,STATISTICS_NORECOMPUTE  =OFF,SORT_IN_TEMPDB=OFF,IGNORE_DUP_KEY=OFF,ONLINE=OFF,ALLOW_ROW_LOCKS  =ON,ALLOW_PAGE_LOCKS  =ON)ON [PRIMARY]

GO



Viewing all articles
Browse latest Browse all 397

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>