private XmlaClient createXmlaClientAndConnect()
        {
            Context.CheckCancelled();
            XmlaClient client;

            client = new XmlaClient();
            Context.TraceEvent(100, 0, "Discover: About to Establish XML/A Connection");
            client.Connect(Context.CurrentServerID);
            Context.TraceEvent(100, 0, "Discover: XML/A Connection established");
            return(client);
        }
    public static void SendXMLA([SqlFacet(MaxSize = -1, IsNullable = false)] SqlString XMLA
                                , out SqlXml ReturnXMLA
                                , [SqlFacet(MaxSize = 255, IsNullable = true)] SqlString SSAS_Server)
    {
        XmlaClient clnt = new XmlaClient();

        clnt.Connect(SSAS_Server.IsNull ? OneIncOLAPExtensions.SSAS_Server.Value : SSAS_Server.Value);

        using (var reader = new StringReader(clnt.Send(XMLA.Value, null)))
            using (var xmlreader = new XmlTextReader(reader))
                ReturnXMLA = new SqlXml(xmlreader);

        clnt.Disconnect();
    }
Example #3
0
        private string DiscoverRestrictions(string serverName, string rowset)
        {
            Microsoft.AnalysisServices.Xmla.XmlaClient xc = new XmlaClient();
            string res = "";

            xc.Connect(serverName);
            try
            {
                xc.Discover("DISCOVER_SCHEMA_ROWSETS"
                            , string.Format("<SchemaName>{0}</SchemaName>", rowset)
                            , string.Empty
                            , out res
                            , false, false, false);
            }
            finally
            {
                xc.Disconnect();
            }

            return(res);
        }
Example #4
0
        static void Main(string[] args)
        {
            Console.Write("Server:");
            string server = Console.ReadLine();

            Console.Write("Database:");
            string database = Console.ReadLine();

            Console.Write("WaitIntervalInMiliSeconds:");
            string interval = Console.ReadLine();
            int    waitIntervalInMiliSeconds;

            Int32.TryParse(interval, out waitIntervalInMiliSeconds);

            XmlaClient clnt = new XmlaClient();

            int counter = 0;

            while (true)
            {
                clnt.Connect(server);

                string xmla = String.Format(@"<ClearCache xmlns=""http://schemas.microsoft.com/analysisservices/2003/engine"">  
                                    <Object>
                                        <DatabaseID>{0}</DatabaseID>
                                    </Object >
                                </ClearCache>", database);

                Console.WriteLine("Clearing cache (counter=" + counter + ")");

                clnt.Send(xmla, null);

                clnt.Disconnect();

                Thread.Sleep(waitIntervalInMiliSeconds);

                counter++;
            }
        }
Example #5
0
        public void ClearCache()
        {
            XmlaClient clnt = new XmlaClient();
            string     xmla;

            clnt.Connect(SSASConnection.ConnectionString);
            xmla = @"<ClearCache xmlns=""http://schemas.microsoft.com/analysisservices/2003/engine"">
                    <Object>
                    <DatabaseID>" + this.DatabaseName + @"</DatabaseID>
                    </Object>
                    </ClearCache>";
            try
            {
                clnt.Send(xmla, null);
            }
            catch (XmlaException e)
            {
                clnt.Disconnect();
                throw new Exception(e.Message, e);
            }

            clnt.Disconnect();
        }
 private XmlaClient createXmlaClientAndConnect()
 {
     Context.CheckCancelled();
     XmlaClient client;
     client = new XmlaClient();
     Context.TraceEvent(100,0,"Discover: About to Establish XML/A Connection");
     client.Connect(Context.CurrentServerID);
     Context.TraceEvent(100, 0, "Discover: XML/A Connection established");
     return client;
 }
 /// <summary>
 /// Execute XMLA script for creating multidimensional project.
 /// </summary>
 public static void ExecuteXMLAScript()
 {
     string connectionString =
     ConfigurationManager.ConnectionStrings["ConnectionStringAnalysisServices"].ToString();
       var client = new XmlaClient();
       var builder = new SqlConnectionStringBuilder(connectionString);
       client.Connect(builder.DataSource);
       string xmla = File.ReadAllText(Environment.CurrentDirectory + @"\Resources\XMLAQuery2.xmla");
       client.Send(xmla, null);
       client.Disconnect();
 }
        private string DiscoverRestrictions(string serverName, string rowset)
        {
            Microsoft.AnalysisServices.Xmla.XmlaClient xc = new XmlaClient();
            string res = "";
            xc.Connect(serverName);
            try
            {
                xc.Discover("DISCOVER_SCHEMA_ROWSETS"
                    , string.Format("<SchemaName>{0}</SchemaName>", rowset)
                    , string.Empty
                    , out res
                    , false, false, false);
            }
            finally
            {
                xc.Disconnect();
            }

            return res;
        }
Example #9
0
        static public void Process(string parConnectionString, string parDB, string parCube, int parStep = 0, int parMetod = 0)
        {
            Server s = new Server();

            try
            {
                Log.log("Try Connect=>" + parDB);
                s.Connect(parConnectionString);
                Database varDB = s.Databases.FindByName(parDB);

                XMLACl = new XmlaClient();
                XMLACl.Connect(parConnectionString);

                //                AddSlicePartition(varDB); //TMP
                Log.log("Connect=>" + parDB);

                if (parStep < -9990)
                {
                    foreach (Cube varCube in varDB.Cubes)
                    {
                        Log.log("Куб=>" + varCube.Name + "\t Size=>" + CountCubeSize(varCube).ToString() + " :" + varCube.State.ToString() + " :" + varCube.Description);
                        if (varCube.State != AnalysisState.Processed || parStep == -9998)
                        {
                            foreach (MeasureGroup varMG in varCube.MeasureGroups)
                            {
                                if (varMG.State != AnalysisState.Processed || parStep == -9998)
                                {
                                    Log.log(" Група мір =>" + varMG.Name + "\t Size=>" + CountMeasureSize(varMG).ToString() + " :" + varMG.State.ToString() + " :" + (GetTemplatePartition(varMG) == null ? "" : GetTemplatePartition(varMG).Name) + " :" + varMG.Description);
                                }
                            }
                        }
                        ;
                    }
                    return;
                }
                // dimensions processing   || Процесимо діменшини.
                if (parCube == null && GlobalVar.varIsProcessDimension)
                {
                    Log.log("Dimensions processing" + parDB);
                    foreach (Dimension dim in varDB.Dimensions)
                    {
                        GlobalListOnLine.Add(new ProcessingOnLine(SafeProcTypeGet(dim, GlobalVar.varProcessDimension), dim));
                    }
                    ProcessPartXMLA();
                    GlobalListOnLine.Clear();
                }

                //Створення нових партіций.
                Log.log("Try CreatePartition");
                if (parCube == null)
                {
                    foreach (Cube varC in varDB.Cubes)
                    {
                        CreatePartition(varC);
                    }
                }
                else
                {
                    CreatePartition(varDB.Cubes.FindByName(parCube));
                }

                // Швидке підняття куба

                if (parCube == null)
                {
                    foreach (Cube varC in varDB.Cubes)
                    {
                        QuickUp(varC);
                    }
                }
                else
                {
                    QuickUp(varDB.Cubes.FindByName(parCube));
                }


                //Процес куба.

                Log.log("Try ListProcess");
                if (parCube == null)
                {
                    foreach (Cube varCube in varDB.Cubes)
                    {
                        AddListProcessPartition(varCube, parStep);
                    }
                }
                else
                {
                    Cube varCube = varDB.Cubes.FindByName(parCube);
                    AddListProcessPartition(varCube, parStep);
                }
                WaitOracle(parStep);
                Log.log("Try Process");
                ProcessPartXMLA();

                // Всі куби процесимо INDEX (Якщо процесили діменшини)
                //ProcessList(parMetod,parStep,parXMLA);
                if (parCube == null && GlobalVar.varIsProcessDimension)
                {
                    foreach (Cube varCube in varDB.Cubes)
                    {
                        ProcessIndex(varCube);
                    }
                    ProcessPartXMLA();
                    //                  ProcessList(parMetod,parStep,1);
                    GlobalListOnLine.Clear();
                }
            }
            finally
            {
                /*                s.Disconnect();
                 *              clnt.Disconnect(); */
            }
        }