2012-03-01 1 views
1

SQLServer 프로파일 러를 사용하여 재생할 추적 파일 (trc 파일)을 기록했습니다. article의 지침에 따라 내 서버에 스트레스를 가하고 있습니다.매개 변수화 후 trc 파일 재생 SQL Server 2008

이 파일을 조작하여 매개 변수화하고 임의화할 필요가 있습니다.

가장 좋은 방법은 무엇입니까? 추적 파일을 구문 분석하고 수정하는 API를 찾을 수 없습니다 .... 제가 고려중인 솔루션은 T-SQL 파일로 추적을 내보내고 스크립트를 수정하는 것입니다.

감사

답변

1

나는 당신의 제안에 또한 갈 것이다 (그리고 실제로 문서도 그것을 제안). 추적을 매개 변수화 할 수있는 저장 프로 시저를 만들 것입니다. 그리고, 당신은 매개 변수의이 유형/종류를 랜덤 화하기 위해 만들어진 것입니다 방법 인 당신의 기사 RandomParam1와

public class LoadConnection 
{ 
       public void startConnection() 
       { 
          Try 
          { 
             SqlConnection conn=new SqlConnection(); 
             conn.ConnectionString = “Integrated Security=true;Initial Catalog =<yourDatabase>;Data Source=<yourServer>;Connect Timeout=600;Pooling=false;Application Name=’<yourApplicationName>’”; 
             conn.Open(); 
             SqlCommand comm=new SqlCommand(); 
             comm.Connection=conn; 
             comm.CommandTimeout = 600; 
             comm.CommandType = CommandType.StoredProcedure; 
             comm.CommandText = “<yourStoredProcedure>”; 

             SqlParameter param1 = new SqlParameter("<your parameter>", RandomParam1()); 
             comm.Parameters.Add(param1); 


             comm.ExecuteNonQuery(); 

             conn.Close(); 
          } 
          catch(Exception ex) 
          { 
             MessageBox.Show(“Error”,ex.Message); 
          } 
       } 
}; 

` ()에서 LoadConnection 같은 코드입니다.

희망을 얻었습니다.