AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 30.12.2013, 19:00   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006


Welcher Eigentümer von Immobilien wünscht sich das nicht? Viele verschiedene Mieter(innen), die sich gegenseitig nicht in die Quere kommen, keinen Streit haben und sich nicht in die Wohnungen schauen oder möglicherweise neidisch auf anderer Leute Wohnungen sind? Und dann auch noch alle im ersten Stock. Hoch genug, so dass niemand von der Straße hinein sehen kann, aber nicht zu hoch, so dass der Weg in die Wohnung nicht beschwerlich ist.</p>


Genau das liefert Ihnen Dynamics NAV Multi-Tenancy!</p>


multi-tenancy (comp.): Mandantenfähigkeit. Als mandantenfähig (auch mandantentauglich) wird Informationstechnik bezeichnet, die auf demselben Server oder demselben Software-System mehrere Mandanten, also Kunden oder Auftraggeber, bedienen kann, ohne dass diese gegenseitigen Einblick in ihre Daten, Benutzerverwaltung und Ähnliches haben.</p>


Wann und warum benötigt man aber dieses Feature? Nun, es gibt viele Szenarien, in denen Multi-Tenancy nützlich ist. Speziell beim Hosting war es in der Vergangenheit schwierig, eine Trennung, speziell der übergreifenden Daten, sicherzustellen. Auch die Skalierbarkeit spielt eine große Rolle, denn ein kleineres Unternehmen benötigt unter Umständen nicht eine große Benutzerzahl von 100 oder mehr Benutzern, die ein Dynamics NAV Dienst nun bedienen kann. Hier wäre es sinnvoll, die Nutzer mehrerer, ggf. auch rechtlich getrennter Firmen, ebenfalls auf diesem Dienst arbeiten zu lassen und mit diesem einen Dienst viele Firmen und auch Datenbanken zu bedienen. Das spart Ressourcen!</p>


Sicherlich gibt es noch andere Anwendungsfälle. Ich werde aber generell im Folgenden die Überführung einer klassischen Datenbank mit mehreren Mandanten in den Multi-Tenant-Betrieb, mit mehreren Daten-Datenbanken und einer Applikationsdatenbank.</p>


</p>


Dabei wird von folgender bestehender Einrichtung und Lage ausgegangen:</p>
<ul>[*]Sie sind mit einem Windows-Benutzer angemeldet, der mit administrativen Rechten ausgerüstet ist, also mindestens der lokalen Gruppe der Administratoren angehört.[*]Auf dem SQL Server ist Ihnen die Rolle sysadmin zugewiesen.[*]Sie haben den Ordner Multitenancy aus dem Dynamics NAV 2013 R2 Installations-Order auf Laufwerk C: kopiert.[*]Zum “spielen” sind mindestens zwei Mandanten in der Quelldatenbank vorhanden. Haben Sie derzeit nur eine, können Sie in der Mandantenübersicht bestehende Mandanten kopieren.[/list]

</p>


Öffnen Sie nun die Microsoft Dynamics NAV 2013 R2 Administration Shell oder die PowerShell ISE (Integrated Scripting Environment, siehe http://technet.microsoft.com/de-de/l.../dd759217.aspx) als Administrator und importieren Sie dort die Dynamics NAV Admin Tools und das Multi-Tenancy Beispiel-Modul mit folgenden Befehlen. Hinweis: Selbstverständlich können Sie alle Befehle (die sogenannten CmdLets) auch in der ISE als PS1-Datei speichern und dann komplett an einem Stück ausführen.</p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="color: blue; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US">Set-ExecutionPolicy</span><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"> <span style="color: blueviolet;">unrestricted</span> <span style="color: navy;">-Force</span></span></p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="color: blue; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US">Import-Module</span><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"> <span style="color: darkred;">'C:Program FilesMicrosoft Dynamics NAV71ServiceNavAdminTool.ps1'</span> </span></p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="color: blue; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US">Import-Module</span><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"> <span style="color: darkred;">'C:MultitenancyNAVMultitenancySamples.psm1'</span> </span></p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"> </p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;">Um nicht alle Werte immer wieder angeben zu müssen, setzen wir einige Variablen. Für weiterführende Informationen zu Variablen innerhalb von PowerShell, schauen Sie sich bitte den folgenden Artikel an: Windows Powershell - The Power of Variables. Vergessen Sie aber nicht, auch diese Zeilen auszuführen, damit die Werte entsprechend vorbelegt werden.</p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"> </p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="color: orangered; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US">$databaseServerName</span><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"> <span style="color: darkgray;">=</span> <span style="color: darkred;">"sqlservername" <span style="color: darkgreen; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa;" lang="EN-US"># Name des Datenbankservers</span></span></span></p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="color: orangered; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US">$sourceDatabaseName</span><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"> <span style="color: darkgray;">=</span> <span style="color: darkred;">"Demo Database NAV (7-1)" <span style="color: darkgreen; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa;" lang="EN-US"># Name der bestehenden Quelldatenbank mit einem oder mehreren Mandanten</span></span></span></p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="color: orangered; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US">$appDatabaseName</span><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"> <span style="color: darkgray;">=</span> <span style="color: darkred;">"Demo Database NAV (7-1) App" <span style="color: darkgreen; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa;" lang="EN-US"># Name der (neuen) Applikationsdatebank.</span></span></span></p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="color: orangered; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US">$serverInstanceName</span><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"> <span style="color: darkgray;">=</span> <span style="color: darkred;">"DynamicsNAV71" <span style="color: darkgreen; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa;" lang="EN-US"># Instanzname des Dynamics NAV Servers</span></span></span></p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="color: orangered; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US">$serviceAccount</span><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"> <span style="color: darkgray;">=</span> <span style="color: darkred;">"DOMAINServiceUser" <span style="color: darkgreen; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa;" lang="EN-US"># Benutzer unter dem der Dynamics NAV Dienst ausgeführt wird</span></span></span></p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="color: orangered; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US">$tenantsConfigFile</span><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"> <span style="color: darkgray;">=</span> <span style="color: darkred;">"C:Program FilesMicrosoft Dynamics NAV71Servicetenants.config"</span> </span></p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"> </p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;">Mit den folgenden Befehlen wird sichergestellt, dass eine eventuell bestehende tenants.config-Datei, in der Informationen zu den Daten-Datenbanken hinterlegt sind, vorab gelöscht wird. Die letzte Zeile beendet den Dynamics NAV Serverdienst.</p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"> </p>
<div class="MsoNormal" style="background: white; mso-layout-grid-align: none;">
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="color: darkblue; font-family: 'Lucida Console'; font-size: 10pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US">If</span><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"> (<span style="color: blue;">Test-Path</span> <span style="color: orangered;">$tenantsConfigFile</span>) { </span></p>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: blue;">Remove-Item</span> <span style="color: orangered;">$tenantsConfigFile</span> </span></p>
</blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console';">} </span></p>
</div>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="color: blue; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US">Set-NAVServerInstance</span><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"> <span style="color: orangered;">$serverInstanceName</span> <span style="color: navy;">-Stop</span> </span></p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"> </p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;">Jetzt soll es aber endlich losgehen: Überführen wir also die Applikation in eine (neue) Datenbank, die Applikationsdatenbank. Ist dieser Schritt abgeschlossen (und ggf. geprüft), kann die bestehende Applikation aus der ursprünglichen Datenbank entfernt werden.</p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;">Nebenbei: Das Zeichen “`” wird unter PowerShell verwendet, um einen Befehl in mehrere Zeilen aufzuteilen.</p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"> </p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="color: blue; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US">Export-NAVApplication</span><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"> ` </span></p>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">-DestinationDatabaseName</span> <span style="color: orangered;">$appDatabaseName</span> ` </span></p>
</blockquote>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">-DatabaseName</span> <span style="color: orangered;">$sourceDatabaseName</span> ` </span></p>
</blockquote>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">-DatabaseServer</span> <span style="color: orangered;">$databaseServerName</span> ` </span></p>
</blockquote>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">-ServiceAccount</span> <span style="color: orangered;">$serviceAccount</span> </span></p>
</blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"> </p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="color: blue; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US">Remove-NAVApplication</span><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"> ` </span></p>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">-DatabaseName</span> <span style="color: orangered;">$sourceDatabaseName</span> ` </span></p>
</blockquote>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">-DatabaseServer</span> <span style="color: orangered;">$databaseServerName</span> ` </span></p>
</blockquote>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">-Force</span> </span></p>
</blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"> </p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;">Mit obigen Befehlen wird die bestehende Datenbank, wie unten zu sehen ist, aufgeteilt, so dass die gemeinsame Applikation und die Tenant-Datenbanken getrennt werden. Mit den ehemals mandantenübergreifenden System-Tabellen (DataPerCompany=No), wird verfahren, wie in der folgenden Grafik zu sehen.</p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"> </p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"></p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"> </p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;">Um dem Dynamics NAV Server letztendlich beizubringen, dass dieser sich nun im Multi-Tenant-Betrib befindet, wird in der Konfigurationsdatei CustomSettings.config im Serververzeichnis der Name der Datenbank gelöscht und das Flag MultiTenant gesetzt. Der Name der Datenbank wird entfernt, da die Namen der Tenant-Datenbanken fortan in der Datei tenants.config im Serververzeichnis verwaltet werden. Anschließend wird der Serverdienst neu gestartet. Das passiert mit den folgenden drei Befehlen.</p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"> </p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="color: blue; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US">Set-NAVServerConfiguration</span><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"> <span style="color: navy;">-ServerInstance</span> <span style="color: orangered;">$serverInstanceName</span> <span style="color: navy;">-KeyName</span> <span style="color: blueviolet;">DatabaseName</span> <span style="color: navy;">-KeyValue</span> <span style="color: darkred;">""</span> </span></p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="color: blue; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US">Set-NAVServerConfiguration</span><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"> <span style="color: navy;">-ServerInstance</span> <span style="color: orangered;">$serverInstanceName</span> <span style="color: navy;">-KeyName</span> <span style="color: blueviolet;">MultiTenant</span> <span style="color: navy;">-KeyValue</span> <span style="color: darkred;">"true"</span> </span></p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="color: blue; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US">Set-NAVServerInstance</span><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"> <span style="color: orangered;">$serverInstanceName</span> <span style="color: navy;">-Start</span> </span></p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"> </p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;">Um nun die tenants.config tatsächlich zu schreiben – sprich die Applikations- und die Tenant-Datenbank anzumelden, sind folgende zwei Befehle notwendig. Sie sehen hier, dass die Quelldatenbank zunächst als Tenant-Datenbank (ID: default) herhält, in der nach wie vor zwei Mandanten liegen. Um eine eventuell bestehende alte Tenant-ID zu überschreiben, nutze ich hier OverwriteTenantIdInDatabase.</p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"> </p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="color: blue; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US">Mount-NAVApplication</span><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"> ` </span></p>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">-DatabaseServer</span> <span style="color: orangered;">$databaseServerName</span> ` </span></p>
</blockquote>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">-DatabaseName</span> <span style="color: orangered;">$appDatabaseName</span> `      </span></p>
</blockquote>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">-ServerInstance</span> <span style="color: orangered;">$serverInstanceName</span>      </span></p>
</blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"> </p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="color: blue; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US">Mount-NAVTenant</span><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"> `    </span></p>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">-Id</span> <span style="color: blueviolet;">default</span> ` </span></p>
</blockquote>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">-DatabaseServer</span> <span style="color: orangered;">$databaseServerName</span> `      </span></p>
</blockquote>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">-ServerInstance</span> <span style="color: orangered;">$serverInstanceName</span> `      </span></p>
</blockquote>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">-DatabaseName</span> <span style="color: orangered;">$sourceDatabaseName</span> `      </span></p>
</blockquote>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">-OverwriteTenantIdInDatabase</span>      </span></p>
</blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"> </p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;">Das große Finale naht! Die folgende Kombination von PowerShell-Befehlen ermittelt zunächst die in der Quelldatenbank (nun Default-Tenant) vorhandenen Mandanten (Get-NAVCompany) und führt für jeden gefundenen Mandanten (ForEach) das Beispielscript HowTo-MoveCompanyToTenant aus. Dieses wiederum erstellt neue Datenbanken sofern notwendig, legt entsprechend Benutzer automatisch an und verschiebt die bestehenden Daten durch Nutzung eines SQL Server T-SQL Scripts (Transact-SQL) in eine neue Tenant-Datenbank.</p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;">Der neue Tenant-Name wird aus dem bestehenden Mandantennamen gebildet, indem Leerzeichen entfernt werden. Am Ende wird noch der nun nicht mehr benötigte default-Tenant abgemeldet und die Quelldatenbank ist nun nicht mehr in Benutzung.</p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"> </p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="color: blue; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US">Get-NAVCompany</span><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"> <span style="color: navy;">-ServerInstance</span> <span style="color: orangered;">$serverInstanceName</span> <span style="color: navy;">-Tenant</span> <span style="color: blueviolet;">default</span> <span style="color: darkgray;">|</span> </span></p>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: blue;">ForEach</span> { </span></p>
</blockquote>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: blue;"><span style="color: #072b60;">      </span>HowTo-MoveCompanyToTenant</span> ` </span></p>
</blockquote>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">            -ServerInstance</span> <span style="color: orangered;">$serverInstanceName</span> ` </span></p>
</blockquote>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">            -FromDatabase</span> <span style="color: orangered;">$sourceDatabaseName</span>` </span></p>
</blockquote>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">            -CompanyName</span> <span style="color: orangered;">$_</span><span style="color: darkgray;">.</span>CompanyName ` </span></p>
</blockquote>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">            -OldTenantName</span> <span style="color: blueviolet;">default </span>` </span></p>
</blockquote>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">            -NewTenantName</span> <span style="color: orangered;">$_</span><span style="color: darkgray;">.</span>CompanyName<span style="color: darkgray;">.</span>Replace(<span style="color: darkred;">" "</span><span style="color: darkgray;">,</span> <span style="color: darkred;">""</span>) ` </span></p>
</blockquote>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">            -DatabaseServer</span> <span style="color: orangered;">$databaseServerName</span>` </span></p>
</blockquote>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">            -ServiceAccount</span> <span style="color: orangered;">$serviceAccount</span> ` </span></p>
</blockquote>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">            -RemoveCompanyWhenMoved</span> ` </span></p>
</blockquote>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"><span style="color: navy;">            -Force</span></span></p>
</blockquote>
<blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US">}      </span></p>
</blockquote>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"> </p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"><span style="color: blue; font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US">Dismount-NAVTenant</span><span style="font-family: 'Lucida Console'; font-size: 10pt; mso-bidi-font-size: 9.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Lucida Console'; mso-ansi-language: en-us;" lang="EN-US"> <span style="color: navy;">-Tenant</span> <span style="color: blueviolet;">default</span> <span style="color: navy;">-ServerInstance</span> <span style="color: orangered;">$serverInstanceName</span> <span style="color: navy;">-Force</span> </span></p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;"> </p>
<p class="MsoNormal" style="background: white; mso-layout-grid-align: none;">Info ==> $_: Was hat es hiermit auf sich? Unter Automatic Variables kann man sich über alle automatischen Variablen informieren. Kurz: PowerShell ist objektorientiert und $_ enthält das aktuell in der ForEach-Schleife durchlaufene Objekt. Somit kann man per $_.XXX auf die Eigenschaft XXX eines Objekts zugreifen. Im Fall unten z.B. auf den Mandantennamen ($_.CompanyName) für jeden Mandanten der durch Get-NAVCompany ermittelt wurde.</p>


Nun existieren auf dem SQL Server folgende Datenbanken:</p>


</p>


Ein Ausschnitt aus der neuen tenants.config:</p>


</p>


Das Ergebnis ist nun ein Dynamics NAV Server der drei aktive Datenbanken bedient. Die Applikationsdatenbank "Demo Database NAV (7-1) App” und zwei Tenant-Datenbanken mit nach Mandanten getrennten Daten “CONTOSOAG” und “CRONUSAG”. Nur die Applikationsdatenbank lässt sich aus der Entwicklungsumgebung auswählen, da nur diese die eigentliche Applikation enthält:</p>


</p>


Der Start des Windows Clients wird zunächst mit einer Fehlermeldung quittiert, welche aussagt, dass kein Tenant angegeben wurde.</p>


</p>


Das ist auch völlig korrekt, da ein bestimmter Tenant nun folgendermaßen angesprochen und adressiert wird: navservernameort/navinstanz/tenantid</p>


</p>


Um diese Struktur nun wieder zurückzubauen, habe ich ein PowerShell-Script angehängt, welches die nun bestehenden Struktur wieder in den Ausgangszustand mit nur einer Datenbank mit zwei Mandanten und der Applikation überführt.</p>


Wichtig: Selbstverständlich können verschiedenen Tenant-Datenbanken auch auf verschiedenen SQL Server Instanzen, auch auf verschiedenen Servern liegen, so lange der Dynamics NAV Dienst-Account Zugriff auf diese hat. Die Überführung muss allerdings manuell oder mit selbst erstellten PowerShell-Scripts geschehen, da wir hierfür (noch) nichts vorgefertigtes mitliefern. Beachten Sie dabei aber, dass derzeit die Sortierung (Collation) der Datenbanken durchgängig die gleiche sein muss. Aber, wie immer: Wir arbeiten daran!</p>


Carsten Scholling </p>


Microsoft Dynamics Germany Microsoft Global Business Support (GBS) EMEA</p>


Email: cschol@microsoft.com Microsoft Connect: http://connect.microsoft.com Online Support: http://www.microsoft.com/support Sicherheitsupdates: http://www.microsoft.de/sicherheit</p>


Microsoft Deutschland GmbH Konrad-Zuse-Straße 1 D-85716 Unterschleißheim http://www.microsoft.de</p><div style="clear:both;"></div>Далее
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 14:48.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.