Sql-server – Connection problems with ManagePartition executable

partitioningsql server

I'm currently running SQL Server 2014 and we have some tables that have been partitioned and I'm trying to use the ManagePartition application here (http://sqlpartitionmgmt.codeplex.com/)

I've typed into the command line:

C:\>ManagePartition.exe /C:CreateStagingFull /d:<Databasename> /s:<schema> 
                        /t:<TableName> /p:5 /A:<NewTablename> /f:C:/scripts.sql 
                        /O:i /U:<My Login> /P:/<My Password>

And I'm getting the following error:

ConnectionFailureException: Failed to connect to server (local). —> System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server)

I've doubled checked all the spellings (dbname, schema, table, etc…) and the switches.

What are some things I can do to trouble shoot this (I'm kind of new to table partitioning)?

Or are there other strategies to easily manage/move data from partitioned table to a staging table?

Edit(I missed to the /S: switch)

I'm now getting this error:

System.NullReferenceException: Object reference not set to an instance of an object.
at PartitionManagement.PartitionManager.createStgIndex(Index i, TableViewBase parent)
at PartitionManagement.PartitionManager.createStgNonclusteredIndexes()
at PartitionManagement.PartitionManager.CreateStgIndexes(Boolean createNonClusteredIndexes)
at PartitionManagement.App.Run(AppArgs& parsedArgs)
Object reference not set to an instance of an object.

It did create the new table, with the indexes, constraints(including the partition constraint), but no data.

Best Answer

You are not using the

 /Server:<string>                   /S Server name, default = (local)

Failed to connect to server (local). ---> System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

From the readme page :

ManagePartition
    /Command:<string>       short form /C command, default = CreateStagingFull
    /Server:<string>                   /S Server name, default = (local)
    /User:<string>                     /U User name, default = null
    /Password:<string>                 /P Password, default = null
    /Integrated[+|-]                   /E Integrated Security, default +
    /Database:<string>                 /d Database name
    /Schema:<string>                   /s Schema name – use quotes as delimiter if needed
    /PartitionTable:<string>           /t Partition table name - use quotes as delimiter if needed
    /PartitionNumber:<int>             /p Partition Number
    /PartitionRangeValue:<string>      /v Value string to input to partition function to specify partition number
    /StagingTable:<string>             /A Staging Table Name, default = null
          /ScriptOption:<char>               /O Scripting Option -- i à Include Script, o à Script Only (no execute)
          /ScriptFile:<string>               /f path and name of file for generated TSQL -- if excluded, script any output to stdout
    /Keep[+|-]                         /K Keep Staging Table if ClearPartition, default +

<Command> = ClearPartition | CreateStagingFull | CreateStagingNoindex | CreateStagingClusteredIndex | IndexStaging