How to: Create, Drop, or Reinitialize a Model Store
Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
The model store is a database where all application elements for Microsoft Dynamics AX are stored. This topic describes how to create, remove, and reinitialize a model store.
Ważne
In Microsoft Dynamics AX 2012 R2, the model store was moved into a database that is separate from the business database.
The following table describes the scenarios in which you may want to create, remove, or reinitialize a model store.
Task |
Scenario |
---|---|
Create an empty model store. |
You want to archive a version of a model store. |
Remove a temporary model store. A temporary model store is not associated with the dbo schema. |
You created a temporary model store during import. |
Initialize a model store. Initializing a model store recreates stored procedures, and creates tables if they do not exist. |
The schema of the model store does not match the default model store. |
You can use either Windows PowerShell cmdlets or the AXUtil command-line utility to perform these tasks.
Validate permissions
If you are initializing a model store, you must drain the client connections that are connected to the Application Object Server (AOS) instance that you are working with. For more information, see Drain users from an AOS.
Validate that you have appropriate permissions to work with the model store:
Administrative permissions on the local computer
System Administrator rights in Microsoft Dynamics AX
In Microsoft SQL Server:
Membership in the Securityadmin server role on the SQL Server instance
Membership in the db_owner role in the Microsoft Dynamics AX database
Create an empty model store (Windows PowerShell)
On the Start menu, point to All Programs, point to Administrative Tools, and then click Microsoft Dynamics AX Management Shell.
At the Windows PowerShell command prompt, PS C:\>, type the following command, and then press ENTER.
Initialize-AXModelStore -AOSAccount "Domain\AccountName" -SchemaName <NewSchema> -Server <ServerName -Database <DatabaseName>
This command creates an empty model store on the specified server, in the specified database, and in the specified schema. The command also grants access rights to the specified domain account.
For more information, see Initialize-AXModelStore.
Create an empty model store (AXUtil)
On the Start menu, click Command prompt.
Navigate to the directory for the management utilities. Typically, the location of this directory is %ProgramFiles%\Microsoft Dynamics AX\60\ManagementUtilities.
At the command prompt, type the following command, and then press ENTER.
axutil schema /db:databasename /s:servername /config[[:aosinstance]:name] /schemaname:name
This command creates an empty model store on the specified server, in the specified database, and in the specified schema. The command also grants access rights to the specified domain account. If no parameters are provided, /config is the default.
The /db parameter specifies the database name for the model store on the server. The database must exist before the connection. It cannot be used with the /config parameter. The default value is tempdb.
The /s parameter specifies the server name for the model store database. This parameter cannot be used with /config parameter. Default: "(local)".
The /config parameter specifies an Application Object Server (AOS) configuration to use to determine the model store database and server name. The default for AOS instance is the name of the "01" AOS instance on the local computer. The default for name is the name of the current configuration on the specified instance. This parameter cannot be used with the /db or /s parameters.
Remove a temporary, or non-dbo-schema, model store (Windows PowerShell)
On the Start menu, point to All Programs, point to Administrative Tools, and then click Microsoft Dynamics AX Management Shell.
At the Windows PowerShell command prompt, PS C:\>, type the following command, and then press ENTER.
Initialize-AXModelStore –Drop <SchemaName>
This command removes the model store from the specified schema.
Uwaga
Only model stores that are associated with non-default schemas can be removed. The model store that is associated with dbo cannot be removed.
For more information, see Initialize-AXModelStore.
Remove a temporary, or non-dbo-schema, model store (AXUtil)
On the Start menu, click Command prompt.
Navigate to the directory for the management utilities. Typically, the location of this directory is %ProgramFiles%\Microsoft Dynamics AX\60\ManagementUtilities.
At the command prompt, type the following command, and then press ENTER.
axutil schema /drop:name
This command removes the model store from the specified schema.
Uwaga
Only model stores that are associated with non-default schemas can be removed. The model store that is associated with dbo cannot be removed.
Reinitialize a model store (Windows PowerShell)
On the Start menu, point to All Programs, point to Administrative Tools, and then click Microsoft Dynamics AX Management Shell.
At the Windows PowerShell command prompt, PS C:\>, type the following command, and then press ENTER.
Initialize_AXModelStore
This command reinitializes the default model store.
For more information, see Initialize-AXModelStore.
Reinitialize a model store (AXUtil)
On the Start menu, click Command prompt.
Navigate to the directory for the management utilities. Typically, the location of this directory is %ProgramFiles%\Microsoft Dynamics AX\60\ManagementUtilities.
At the command prompt, type the following command, and then press ENTER.
axutil schema
This command reinitializes the default model store.
See also
Troubleshooting working with model files
Models, Layers, and the Model Store
AxUtil and Windows PowerShell Commands for Deploying Models
Administering Microsoft Dynamics AX by using Windows PowerShell