您好,登錄后才能下訂單哦!
小編給大家分享一下如何部署自動(dòng)Microsoft Dynamics NAV,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
背景:
客戶(hù)在以下情況下會(huì)增加一個(gè)新的Microsoft Dynamics NAV系統(tǒng)
--新建一個(gè)分支機(jī)構(gòu)
--新建一系列測(cè)試
--開(kāi)始一個(gè)新的財(cái)務(wù)年度
--等等
在實(shí)踐階段一個(gè)“新的Microsoft Dynamics NAV系統(tǒng)”可以使一個(gè)新的Microsoft Dynamics NAV 實(shí)例,一個(gè)database,一個(gè)company或者是一個(gè)tenant。為了簡(jiǎn)化介紹我們重用現(xiàn)有的Microsoft Dynamics NAV Service創(chuàng)建我們的新的database。
準(zhǔn)備工作:
我們使用import-module sqlps.來(lái)導(dǎo)入SQLServer的PowerShell。安裝SQLServer的時(shí)候提供了SQLPS,但是不安裝SQL也可以獲得該module。
如果在運(yùn)行PS的機(jī)器上沒(méi)有安裝SQLSever,可以按照下面的地址安裝Microsoft SQL Server 2012Feature Pack:
http://www.microsoft.com/en-us/download/details.aspx?id=29065
以下是代碼
#準(zhǔn)備工作 $MyNAVServerName = "DynamicsNAV80" $MySQLServerName = "." $MyNewCustomerName = "NewCustomer" $MyNewDatabaseName = "NewCustomerDatabase" Set-ExecutionPolicy unrestricted import-module "C:\Program Files\Microsoft Dynamics NAV\80\Service\NavAdminTool.ps1" Push-Location #jump back to standard prompt with pop-location import-module sqlps #ignore any warnings you may get #Restore SQL db (NAV demo db) #Relocate database files http://stackoverflow.com/questions/26400752/cannot-bind-relocatefile-when-using-restore-sqldatabase-cmdlet $mdf = New-Object Microsoft.SqlServer.Management.Smo.RelocateFile("Demo Database NAV (8-0)_Data", "C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\DB_Data_$MyNewCustomerName.mdf") $ldf = New-Object Microsoft.SqlServer.Management.Smo.RelocateFile("Demo Database NAV (8-0)_Log", "C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\DB_Log_$MyNewCustomerName.ldf") restore-SqlDatabase -ServerInstance $MySQLServerName ` -Database $MyNewDatabaseName ` -BackupFile "C:\NAVDVD\SQLDemoDatabase\CommonAppData\Microsoft\Microsoft Dynamics NAV\80\Database\Demo Database NAV (8-0).bak" ` -ReplaceDatabase ` -RelocateFile @($mdf,$ldf) #Set network service as dbo $CreateServiceAccountUser = "CREATE USER [NT AUTHORITY\NETWORK SERVICE] FOR LOGIN [NT AUTHORITY\NETWORK SERVICE]" Invoke-Sqlcmd -ServerInstance $MySQLServerName -Database $MyNewDatabaseName -Query $CreateServiceAccountUser$AddServiceAccountAsDbo = "exec sp_addrolemember 'db_owner', 'NT AUTHORITY\NETWORK SERVICE'" Invoke-Sqlcmd -ServerInstance $MySQLServerName -Database $MyNewDatabaseName -Query $AddServiceAccountAsDbo pop-location # Finished with SQL commands so popping back to normal PS prompt #For NAV 2013(R2), to convert the database to latest executable version. #For NAV 2015 we don't need this (in fact we don't have the Invoke-DatabaseConversion cmdlet). import-module "C:\PSscripts\Upgrade\Cmdlets\NAVUpgradeCmdlets.psm1" Invoke-NAVDatabaseConversion -DatabaseServer localhost -DatabaseName "Demo Database NAV (7-1)" -FinSqlExeFile "C:\Program Files\Microsoft Dynamics NAV\71\Service\finsql.exe" #At this point the next steps depend on whether we want a new NAV Service, connect to an existing one, etc. Here we just reuse existing NAV Service #Configure then restart the service and get status Set-NAVServerConfiguration $MyNAVServerName -KeyName DatabaseName -KeyValue $MyNewDatabaseName Set-NAVServerInstance $MyNAVServerName -restart Get-NAVServerInstance $MyNAVServerName
以上是“如何部署自動(dòng)Microsoft Dynamics NAV”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。