Removing IAM page %S_PGID failed because someone else is using the object that this IAM page belongs to

-> I was executing DBCC SHRINKFILE as an one time operation on a huge data file to move its data into 4 additional data files using below command,

USE [Financedb]
GO

DBCC SHRINKFILE (N'Finance_Data' , EMPTYFILE)
GO

-> I received below error when executing above command,

Msg 1119, Level 16, State 1, Line 20
Removing IAM page (3:5940460) failed because someone else is using the object that this IAM page belongs to.

-> I executed DBCC CHECKDB and there were no errors,

DBCC results for ‘Financedb‘.
.
.
CHECKDB found 0 allocation errors and 0 consistency errors in database Financedb.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.

-> This is not a corruption issue. I restarted SQL Services and executed below command and it ran through.

USE [Financedb]
GO
DBCC SHRINKFILE (N'Finance_Data' , EMPTYFILE)
GO

Msg 2555, Level 16, State 1, Line 20
Cannot move all contents of file “Finance_Data” to other places to complete the emptyfile operation.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.

-> Above message is due to the fact that System objects cannot be moved.

Thank You,
Vivek Janakiraman

Disclaimer:
The views expressed on this blog are mine alone and do not reflect the views of my company or anyone else. All postings on this blog are provided “AS IS” with no warranties, and confers no rights.

Advertisements

MYSQL Linked server in SQL Server

-> Download the installation file of MySQL Connector/ODBC 5.3 from https://dev.mysql.com/downloads/connector/odbc/5.3.html.

Blog77_1Blog77_2Blog77_3Blog77_4Blog77_5

-> Once installed, create a System DSN in ODBC Data Sources (64-bit) as below,

Blog77_6Blog77_7Blog77_8Blog77_9

-> Select the required database and test the connection to ensure it works.

-> Once the datasource is created. Create a linked server as below,

Blog77_10Blog77_11

Thank You,
Vivek Janakiraman

Disclaimer:
The views expressed on this blog are mine alone and do not reflect the views of my company or anyone else. All postings on this blog are provided “AS IS” with no warranties, and confers no rights.

Creating DTSX files from existing SQL Services Integration packages

-> In one of my project I had to migrate SQL Server Integration Services packages from SQL Server 2008 R2 to SQL Server 2016.

-> I planned to export the existing SQL Server Integration Packages from SQL Server 2008 R2 as DTSX files and then import it into SSDT.

-> But I had close to 250 + Packages and exporting each one will take more time.

-> I used below script and executed in msdb database.


set nocount on
select foldername as FolderName,
[name] as PackageName
into #PackageNames
from msdb.dbo.sysssispackages pkg
join msdb.dbo.sysssispackagefolders fld
on pkg.folderid = fld.folderid
order by FolderName, PackageName
select 'dtutil /SQL '
+ case
when len(FolderName) = 0 then '"'
else '"'+FolderName + '\'
end
+ PackageName + '"'+
+ ' /COPY FILE;'+'"'+'C:\temp\SSIS_Packages\'
+ case
when len(FolderName) = 0 then ''
else FolderName + '\'
end
+ PackageName
+ '.dtsx' + '"'
+ ' /QUIET' --suppresses prompt to delete if an older file with same name exists
from #PackageNames
drop table #PackageNames

-> Copy the output and execute it in command prompt. You can also save it as a batch file and execute it. But be sure to check the output to make sure there are no errors.

-> I received below message for some packages,

The package SSISpackagename can not be saved to the file system since its protection level is server storage. Use the encrypt action to change the protection level.

-> I had to manually export it and select the protection level as appropriate. In my case I just had 3 packages, so manual method for those packages were best fit for me.

Thank You,
Vivek Janakiraman

Disclaimer:
The views expressed on this blog are mine alone and do not reflect the views of my company or anyone else. All postings on this blog are provided “AS IS” with no warranties, and confers no rights.