TransferClassを使用してデータを含むデータベースを転送する際に問題が発生しました。データを転送しなくても正常に動作します。私が得るデータで
エラー:エラーコード=-1071636471説明=SSISエラーコードDTS_E_OLEDBERROR。
OLEDBエラーが発生しました。エラーコード0x800040005/oledbレコードを使用できます。ソース: "Microsoft SQL Server Native Client 10.0" Hresult:0x80004005説明:2ログインに失敗しました。ログインは信頼できないドメインからのものであり、Windows認証では使用できません。」
このクラスには、transfer.DestinationLoginSecure = false;
falseに設定すると、統合セキュリティを使用しないプロパティがあります。いろいろなプロパティを無駄に設定してみました。
他のすべてのインスタンスで正常に接続する接続文字列を使用します。
using (SqlConnection conn = new SqlConnection(Connections.dbConnection_HTOUTER()))
{
conn.Open();
Server server = new Server(new ServerConnection(conn));
Database dbMaster = server.Databases[ConfigurationManager.AppSettings.Get("dbMaster")];
Database dbProduction = server.Databases[ConfigurationManager.AppSettings.Get("dbProduction")];
Transfer transfer = new Transfer(dbMaster);
string login = ConfigurationManager.AppSettings.Get("login");
string password = ConfigurationManager.AppSettings.Get("password");
transfer.CopyAllObjects = true;
transfer.CopyAllUsers = true;
transfer.Options.WithDependencies = true;
transfer.Options.ContinueScriptingOnError = true;
transfer.DestinationServer = server.Name;
transfer.DestinationDatabase = dbProduction.Name;
transfer.DestinationLoginSecure = false;
transfer.DestinationPassword = password;
transfer.DestinationLogin = login;
transfer.CopyAllRules = true;
transfer.CopyAllRoles = true;
//transfer.CopyAllObjects = true;
transfer.DropDestinationObjectsFirst = true;
transfer.CopySchema = true;
transfer.CopyData = true;
transfer.CreateTargetDatabase = false;
transfer.Options.IncludeIfNotExists = true;
transfer.Options.Indexes = true;
transfer.TransferData();
}