Databases Reference
In-Depth Information
//Create an XML text writer, which will be used to script the command.
System.Xml.XmlTextWriter writer =
new System.Xml.XmlTextWriter(fileName,Encoding.UTF8);
//Start a transactional batch.
Scripter.WriteStartBatch(writer, true);
foreach(Database db in srv.Databases)
{
//Script the processing of the database.
Scripter.WriteProcess(writer, db, ProcessType.ProcessFull);
}
//End the batch.
Scripter.WriteEndBatch ( writer );
//Close XML writer
writer.Close();
}
Using Traces
Analysis Services enables database administrators to monitor or trace a set of operations
executed on the server. AMO allows application designers to take advantage of this func-
tionality. Using the Trace object of AMO, you can write utilities that enable monitoring,
auditing, and profiling of Analysis Services. Another application of traces is to enable the
client application to process or display the events sent by the server during some of the
operations. For example, during processing, the server can send important information
about the status and progress of the processing operations.
The Trace object has OnEvent and Stopped methods that enable a client application to
subscribe to a trace event and get notification when the event is fired or tracing is
stopped. A client application can subscribe to the Trace event by executing the following
code:
// Start the default trace
svr.SessionTrace.OnEvent
+= new TraceEventHandler(DefaultTrace_OnEvent);
svr.SessionTrace.Stopped
+= new TraceStoppedEventHandler(DefaultTrace_Stopped);
But, the trace will not be started until the Start method is called. During the execution of
the Start method, AMO starts a new thread from which it establishes the connection to
the server that will be used to subscribe to the server traces:
svr.SessionTrace.Start();
Search WWH ::




Custom Search