WID から SQL への WSUS データベースの移行Migrating the WSUS Database from WID to SQL
適用対象: Windows Server 2012、Windows Server 2012 R2、Windows Server 2016Applies to: Windows Server 2012, Windows Server 2012 R2, Windows Server 2016
WSUS データベース (SUSDB) を Windows Internal Database インスタンスから SQL Server のローカルまたはリモートインスタンスに移行するには、次の手順を実行します。Use the following steps to migrate the WSUS database (SUSDB) from a Windows Internal Database instance to a Local or Remote instance of SQL Server.
前提条件Prerequisites
- SQL インスタンス。SQL Instance. 既定の MSSQLServer またはカスタムインスタンスを指定できます。This can be the default MSSQLServer or a custom Instance.
- SQL Server Management StudioSQL Server Management Studio
- WID 役割がインストールされた WSUSWSUS with WID role installed
- IIS (これは通常、サーバーマネージャーによって WSUS をインストールする場合に含まれます)。IIS (This is normally included when you install WSUS through Server Manager). まだインストールされていないため、である必要があります。It is not already installed, it will need to be.
WSUS データベースの移行Migrating the WSUS database
WSUS サーバー上の IIS および WSUS サービスを停止します。Stop the IIS and WSUS services on the WSUS server
PowerShell (管理者特権) から、次のように実行します。From PowerShell (elevated), run:
Stop-Service IISADMIN
Stop-Service WsusService
Windows Internal Database から SUSDB をデタッチするDetach SUSDB from the Windows Internal Database
SQL Management Studio の使用Using SQL Management Studio
- [ SUSDB tasks] を右クリックし、[デタッチ] をクリックします。 - > - > ![ SUSDB > Tasks > detach] オプションが選択されていることを示す SQL Server Management Studio スクリーンショットです。Right-click SUSDB -> Tasks -> click Detach:
- [ 既存の接続を削除 する] をオンにし、[ OK] をクリックします (アクティブな接続が存在する場合は省略可能)。Check Drop Existing Connections and click OK (optional, if active connections exist).
コマンド プロンプトを使用Using Command Prompt
重要
次の手順は、 sqlcmd ユーティリティを使用して、Windows Internal database インスタンスから WSUS データベース (SUSDB) をデタッチする方法を示しています。These steps show how to detach the WSUS database (SUSDB) from the Windows Internal Database instance by using the sqlcmd utility. Sqlcmd ユーティリティの詳細については、「 sqlcmd ユーティリティ」を参照してください。For more information about the sqlcmd utility, see sqlcmd Utility.
- 管理者特権でコマンド プロンプトを開きますOpen an elevated command prompt
- 次の SQL コマンドを実行して、 sqlcmd ユーティリティを使用して Windows Internal database インスタンスから WSUS データベース (SUSDB) をデタッチします。Run the following SQL command to detach the WSUS database (SUSDB) from the Windows Internal Database instance by using the sqlcmd utility:
sqlcmd -S \\.\pipe\Microsoft##WID\tsql\query
use master
GO
alter database SUSDB set single_user with rollback immediate
GO
sp_detach_db SUSDB
GO
SUSDB ファイルを SQL Server にコピーします。Copy the SUSDB files to the SQL Server
- WID データフォルダー (% SystemDrive% Windows WID データ) から SUSDB と SUSDB を _ \ SQL インスタンスのデータフォルダーに \ \ コピーします。Copy SUSDB.mdf and SUSDB_log.ldf from the WID Data Folder (%SystemDrive%\Windows\WID\Data) to the SQL Instance Data Folder.
ヒント
たとえば、SQL インスタンスフォルダーが C:\Program SERVER\MSSQL12. sql の場合、MSSQLSERVER\MSSQL、WID Data フォルダーは C:\Windows\WID\Data で 、SUSDB ファイルを C:\WINDOWS\WID\DATA から C:\Program Server\MSSQL12. SQL にコピーします。MSSQLSERVER\MSSQL\DataFor example, if your SQL Instance Folder is C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL, and the WID Data folder is C:\Windows\WID\Data, copy the SUSDB files from C:\Windows\WID\Data to C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Data
SUSDB を SQL インスタンスにアタッチするAttach SUSDB to the SQL Instance
- SQL Server Management Studio の [インスタンス] ノードで、[データベース] を右クリックし、[アタッチ] をクリックします。In SQL Server Management Studio, under the Instance node, right-click Databases, and then click Attach.
- [ データベースの接続 ] ボックスの [ アタッチするデータベース] で、[ 追加 ] ボタンをクリックし、(WID フォルダーからコピーした) SUSDB ファイルを見つけて、[ OK] をクリックします。In the Attach Databases box, under Databases to attach, click the Add button and locate the SUSDB.mdf file (copied from the WID Folder), and then click OK.
ヒント
これは、Transact-sql を使用して行うこともできます。This is also able to be done using Transact-Sql. データベースをアタッチする手順については、SQL のドキュメントを参照してください。Please see the SQL documentation for attaching a database for its instructions.
例 (前の例のパスを使用):Example (using paths from previous example):
USE master;
GO
CREATE DATABASE SUSDB
ON
(FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Data\SUSDB.mdf'),
(FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Log\SUSDB_Log.ldf')
FOR ATTACH;
GO
SQL Server とデータベースのログインとアクセス許可を確認するVerify SQL Server and Database Logins and Permissions
SQL Server のログイン権限SQL Server Login Permissions
SUSDB をアタッチした後、次の手順を実行して、 NT AUTHORITY\NETWORK SERVICE に SQL Server のインスタンスへのログイン権限があることを確認します。After attaching the SUSDB, verify that NT AUTHORITY\NETWORK SERVICE has login permissions to the instance of SQL Server by doing the following:
- SQL Server Management Studio にアクセスGo into SQL Server Management Studio
- インスタンスを開くOpening the Instance
- [セキュリティ] をクリックします。Click Security
- [ログイン] をクリックします。Click Logins
NT AUTHORITY\NETWORK SERVICE アカウントが一覧表示されます。The NT AUTHORITY\NETWORK SERVICE account should be listed. そうでない場合は、新しいログイン名を追加して追加する必要があります。If it is not, you need to add it by adding New Login Name.
重要
SQL インスタンスが WSUS とは別のコンピューターにある場合は、WSUS サーバーのコンピューターアカウントが [FQDN] \ [WSUSComputerName] $ という形式で表示されている必要があります。If the SQL Instance is on a different machine from WSUS, the WSUS Server's computer account should be listed in the format [FQDN]\[WSUSComputerName]$. そうでない場合は、次の手順を使用して追加し、 nt AUTHORITY\NETWORK service を WSUS サーバーのコンピューターアカウント ([FQDN] \ [WSUSComputerName] $) に置き換えます。これは _ nt AUTHORITY\NETWORK SERVICE に対する _ 権限の許可に追加 されます。If not, the steps below can be used to add it, replacing NT AUTHORITY\NETWORK SERVICE with the WSUS Server's computer account ([FQDN]\[WSUSComputerName]$) This would be **in addition to_ granting rights to _* NT AUTHORITY\NETWORK SERVICE*
NT AUTHORITY\NETWORK サービスを追加してアクセス権を付与するAdding NT AUTHORITY\NETWORK SERVICE and granting it rights
- [ログイン] を右クリックし、[新しいログイン... ] をクリックします。Right Click Logins and click New Login…
![ログイン > 新しいログインオプションが選択されている SQL Server Management Studio を示すスクリーンショット。
- [ 全般 ] ページで、 ログイン名 (NT AUTHORITY\NETWORK SERVICE) に入力し、既定の データベース を SUSDB に設定します。On the General page, fill out the Login name (NT AUTHORITY\NETWORK SERVICE), and set the Default database to SUSDB.
- [ サーバーの役割 ] ページで、[ パブリック ] と [ sysadmin ] が選択されていることを確認します。On the Server Roles page, ensure public and sysadmin are selected.
- [ ユーザーマッピング ] ページで、次のようにします。On the User Mapping page:
- [このログインにマップ されたユーザー] で、[ SUSDB ] を選択します。Under Users mapped to this login: select SUSDB
- [ データベースロールのメンバーシップ: SUSDB] で、次のチェックボックスがオンになっていることを確認します。Under Database role membership for: SUSDB, ensure the following are checked:
- publicpublic
- webService
webService
- [OK]Click OK
[ログイン] の下に NT AUTHORITY\NETWORK SERVICE が表示されます。You should now see NT AUTHORITY\NETWORK SERVICE under Logins.
データベース権限Database Permissions
- SUSDB を右クリックします。Right-click the SUSDB
- プロパティ の選択Select Properties
- [アクセス許可]Click Permissions
NT AUTHORITY\NETWORK SERVICE アカウントが一覧表示されます。The NT AUTHORITY\NETWORK SERVICE account should be listed.
そうでない場合は、アカウントを追加します。If it is not, add the account.
[ログイン名] ボックスに、次の形式で WSUS コンピューターを入力します。On the Login name textbox, enter the WSUS machine in the following format:
[FQDN] \[WSUSComputerName] $[FQDN]\[WSUSComputerName]$
既定のデータベース が SUSDB に設定されていることを確認します。Verify that the Default database is set to SUSDB.
ヒント
次の例では、FQDN は Contosto.com 、WSUS コンピューター名は WsusMachine です。In the following example, the FQDN is Contosto.com and the WSUS machine name is WsusMachine:
[ユーザーマッピング] ページで、[このログインにマップ されたユーザー] の下にある SUSDB データベースを選択します。On the User Mapping page, select the SUSDB Database under Users mapped to this login
[ログイン] ダイアログボックスの [ユーザーマッピング] ページで、選択した SUSDB および webService オプションが表示されている web サービス を確認します。 SUSDB:
Check webservice under the Database role membership for: SUSDB:
[ OK ] をクリックして設定を保存します。Click OK to save settings.
注意
変更を有効にするには、SQL サービスの再起動が必要になる場合があります。You may need to restart the SQL Service for the changes to take effect.
レジストリを編集して、WSUS が SQL Server インスタンスを指すようにします。Edit the registry to point WSUS to the SQL Server Instance
重要
慎重にこのセクションの手順に従います。Follow the steps in this section carefully. レジストリを正しく変更しないと、重大な問題が発生する可能性があります。Serious problems might occur if you modify the registry incorrectly. 変更する前に、問題が発生した場合に復元するためにレジストリをバックアップします。Before you modify it, back up the registry for restoration in case problems occur.
[スタート] ボタン、 [ファイル名を指定して実行] の順にクリックし、「regedit」と入力して [OK] をクリックします。Click Start, click Run, type regedit, and then click OK.
次のキーを見つけます。 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\UpdateServices\Server\Setup\SqlServerNameLocate the following key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\UpdateServices\Server\Setup\SqlServerName
[ 値 ] テキストボックスに「 [ServerName] \ [InstanceName]」と入力し、[ OK] をクリックします。In the Value text box, type [ServerName]\[InstanceName], and then click OK. インスタンス名が既定のインスタンスの場合は、「 [ServerName]」と入力します。If the instance name is the default instance, type [ServerName].
次のキーを探し
Locate the following key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Update Services\Server\Setup\Installed Role Services\UpdateServices-WidDatabase
キー名を UpdateServices-Database に更新していることを示すレジストリエディターのダイアログボックスで、キーの名前を Updateservices-database
Rename the Key to UpdateServices-Database
注意
このキーを更新しない場合、 WsusUtil は、移行した SQL インスタンスではなく、WID のサービスを試行します。If you do not update this key, then WsusUtil will attempt to service the WID rather than the SQL Instance to which you have migrated.
WSUS サーバーで IIS および WSUS サービスを開始するStart the IIS and WSUS services on the WSUS server
PowerShell (管理者特権) から、次のように実行します。From PowerShell (elevated), run:
Start-Service IISADMIN
Start-Service WsusService
注意
WSUS コンソールを使用している場合は、を閉じて再起動します。If you are using the WSUS Console, close and restart it.
WID ロールのアンインストール (推奨されません)Uninstalling the WID role (not recommended)
警告
WID ロールを削除すると、インストール後のタスク用に WSUSUtil.exe に必要なスクリプトを含むデータベースフォルダー (%SystemDrive%\Program Files\Update Services\Database) も削除されます。Removing the WID role also removes a database folder (%SystemDrive%\Program Files\Update Services\Database) that contains scripts required by WSUSUtil.exe for post-installation tasks. WID ロールをアンインストールする場合は、事前に %SystemDrive%\Program Files\Update Services\Database フォルダーをバックアップしていることを確認してください。If you choose to uninstall the WID role, make sure you back up the %SystemDrive%\Program Files\Update Services\Database folder beforehand.
PowerShell の使用:Using PowerShell:
Uninstall-WindowsFeature -Name 'Windows-Internal-Database'
WID ロールが削除されたら、次のレジストリキーが存在することを確認します。 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Update Services\Server\Setup\Installed Role Services\UpdateServices-DatabaseAfter the WID role is removed, verify that the following registry key is present: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Update Services\Server\Setup\Installed Role Services\UpdateServices-Database