Skip to main content
SnapCenter 4.8 cmdlets

Invoke-SmConfigureResources

Contributors

Moves an existing Microsoft SQL Server database from a local disk to a NetApp LUN.

Syntax

Invoke-SmConfigureResources [-Resources]  <Hashtable[]>  [-DataPath]  <String>  [-LogPath]  <String>  [-Files]  <Hashtable[]>  [-DeleteOriginal]  <>  [-PluginCode]  <PluginCode>  [-DBCC_NOINDEX]  <>  [-DBCC_ALL_ERRORMSGS]  <>  [-DBCC_NO_INFOMSGS]  <>  [-DBCC_TABLOCK]  <>  [-DBCC_PHYSICALONLY]  <>  [-UpdateTableStatsBeforeDetach]  <>  [-RUnDBCCBeforeMigration]  <>  [-RunDBCCAfterMigration]  <>

Detailed Description

Moves an existing Microsoft SQL Server database from a local disk to a NetApp LUN. This cmdlet moves and configures either system or user databases for the following configurations:- Configuration of databases on standalone SQL server instances- Configuration of Availability Group SQL databases.- Configuration of SQL Failover Cluster Instance databases.In an Availability Group, you must run this cmdlet separately on both the primary and secondary nodes to ensure databases are moved for all nodes.

Parameters

Name Description Required? Pipeline Input Default Value

Resources

Specifies the resources, in a hashtable, including host, type, name, files, and destination.Host indicates the name of the host from which the database is being moved.Type is the type of database being moved. The type is SQLDatabase.

true

true (ByValue)

DataPath

Specifies the destination disk path for database data files to be moved.

false

true (ByValue)

LogPath

Specifies the destination path to which all the database log files will be moved.

false

true (ByValue)

Files

Specifies the logical name of the database file and the destination path to which the file will be moved.

false

true (ByValue)

DeleteOriginal

Specifies that all the database files are deleted from the source location.

false

true (ByValue)

PluginCode

Specifies the plug-in code of the destination host. The valid code is SMSQL.

true

true (ByValue)

DBCC_NOINDEX

false

false

DBCC_ALL_ERRORMSGS

false

true (ByPropertyName)

DBCC_NO_INFOMSGS

false

true (ByPropertyName)

DBCC_TABLOCK

false

true (ByPropertyName)

DBCC_PHYSICALONLY

false

true (ByPropertyName)

UpdateTableStatsBeforeDetach

false

true (ByPropertyName)

RUnDBCCBeforeMigration

false

true (ByPropertyName)

RunDBCCAfterMigration

false

true (ByPropertyName)

Examples

Example 1: Moving a single database at the database level

 Invoke-SmConfigureResources -Resources @{"Host"="scspr0088723007";"Type"="SQL Database";"Name"="scspr0088723007\INST1\d1"} –DataPath G:\ -Logpath G:\ –PluginCode SMSQL

Example 2: Moving multiple databases at the database level

 Invoke-SmConfigureResources -Resources @{"Host"="nfs1";"Type"="SQL Database";"Name"="nfs1\SQL12INST1\newnfs"},@{"Host"="nfs1";"Type"="SQL Database";"Name"="nfs1\SQL12INST1\chk1";} -DataPath E:\ -LogPath E:\ -PluginCode SMSQL

Example 3: Moving a single database at the file level

 Invoke-SmConfigureResources -Resources @{"Host"="nfs1";"Type"="SQLDatabase";"Name"="nfs1\SQL12INST1\new1";"Files"=@{"LogicalName"="new1";"Destination"="E:\"},@{"LogicalName"="new1_log";"Destination"="E:\"},@{"LogicalName"="f";"Destination"="E:\"}} –DeleteOriginal –PluginCode SMSQL

This example syntax moves a single database from on disk to another.

Example 4: Moving multiple databases at the file level

 Invoke-SmConfigureResources -Resources @{"Host"="nfs1";"Type"="SQLDatabase";"Name"="nfs1\SQL12INST1\newnfs";"Files"=@{"LogicalName"="newnfs";"Destination"="F:\"},@{"LogicalName"="newnfs_log";"Destination"="E:\"}},@{"Host"="nfs1";"Type"="SQLDatabase";"Name"="nfs1\SQL12INST1\chk1";"Files"=@{"LogicalName"="chk1";"Destination"="F:\"},@{"LogicalName"="chk1_log";"Destination"="F:\"}} –DeleteOriginal –PluginCode SMSQL

This example syntax moves multiple database files from one disk to another.

Example 5: Moving a database in a failover cluster instance

 Invoke-SmConfigureResources -Resources @{"Host"="Host1";"Type"="SQLDatabase";"Name"="Host1\DB1";"Files"=@{"LogicalName"="DB1";"Destination"="F:\"},@{"LogicalName"="DB1_log";"Destination"="F:\"}},@{"Host"="Host2";"Type"="SQLDatabase";"Name"="Host2\RahulDB";"Files"=@{"LogicalName"="RahulDB";"Destination"="F:\"},@{"LogicalName"="RahulDB_log";"Destination"="F:\"}} –DeleteOriginal –PluginCode SMSQL

This example syntax moves a database from one shared volume to another shared volume in a failover cluster instance.