SSAS下玩转PowerShell
操作SSAS数据库的方法有很多,是否有一种可以方法可以通过脚本自动去做这些事呢,比如处理分区,创建备份以及监视SSAS的运行状况。 原文地址: http://www.mssqltips.com/sqlservertip/2937/using-powershell-for-sql-server-analysis-services-tasks--part-
操作SSAS数据库的方法有很多,是否有一种可以方法可以通过脚本自动去做这些事呢,比如处理分区,创建备份以及监视SSAS的运行状况。
原文地址:
http://www.mssqltips.com/sqlservertip/2937/using-powershell-for-sql-server-analysis-services-tasks--part-1/
PowerShell作为命令行工具来自动化处理SSAS任务就是一个不错的选择。因为是围绕SSAS处理任务的话题,所以阅读此篇需要具备一些SSAS的基础知识,这里我们使用SQL Server 2012。
此篇将介绍如下内容:
启动PowerShell通过PowerShell导航并且查看SSAS对象通过PowerShell运行些基础指令处理SSAS的一个分区本文使用SQL Server 2012的Adventureworks示例数据库,有可以在这里下载到这个示例库:
http://msftdbprodsamples.codeplex.com/releases/view/55330
开始
在开始菜单下,点击Run选项。或者Windows键+r。GCI命令的含义是获取所有子对象,跟DOS时代下的dir命令很像,所以这里你也可以同样可以使用LS或者DIR获取同样的结果。从结果中可以看到,SQL Server PowerShell可以让你自动以自动化的方式去处理SQL Server数据引擎的任务,策略,数据集,SQL Server集成服务任务以及SQL Server分析服务任务。此篇我们将集中SSAS任务。
使用如下命令进入到分析服务目录中。CD sqlas
这里的CD命令跟DOS下的相同。
关于GCI的更过信息,可以输入如下命令获取帮助:get-help gci –detailed
分区操作
SSAS多维数据库下包含Cubes立方体,Cubes下又包含度量值以及度量值分区。下图展示了其层次结构。
接下来使用CD命令移动到分区目录下。
cd servername\DEFAULT\databases\AdventureWorksDW2012Multidimensional-EE\cubes\Adventure Works\MeasureGroups\Internet Orders\Partitions
Servername就是Windows Server的名称。Default是SSAS服务实例的名称。AdventureWorksDW2012Multidimensional-EE是数据库名称。AdventureWork是立方体名称。Internet Orders是度量值组名称。最后我们就可以获取到其下的分区信息。当一个分析服务数据库太大的时候我们会考虑将其拆分成不同的分区:使用分区对数据进行拆分,可以通过并行的方法提高处理的速度,并且对于相关的查询性能也会有提高。
接下来通过GCI命令列出所有的分区信息.
我们可以看到分区名称,估计行数以及处理的模式。在Adventureworks立方体中分区是按照年来进行拆分的。每个分区的行数默认是没有被计算的所以看到的是0。处理模式是分区的处理方式,Regular模式意味着数据和聚合都会被处理,另外一种Lazy聚合意味着数据首先会被处理,聚合在随后的后台进程创建。这个设置对数据以及降低索引创建是非常有帮助的,因为索引的创建会有额外的性能开销。
可以通过Get-member的方法获取分区下的所有成员。
LS | Get-Member
Get-Member命令用于列出一个对象支持的属性和方法。在这里就是列出分区下所支持的属性和方法。
比如可以看到分区名,LastProcessed时间以及分区的EstimatedSize:
LS| SELECT NAME, LASTPROCESSED, ESTIMATEDSIZE
如果要处理一个指定的分区那么就可以使用下面的命令:
Invoke-ProcessPartition -Name "Internet_Orders_2006" -MeasureGroupname "Internet Orders" -CubeName "Adventure Works" -database "AdventureWorksDW2012Multidimensional-EE" -ProcessType "ProcessFull"
这个命令会处理Adventureworks下Internet Orders度量值组名为"Internet_Order_2006"的分区,并且是以全量的方式来处理。
在SQL Server 2012 SP1的这个版本,当我们运行完这个命令然后再运行"LS|SELECT NAME, LASTPROCESSED, ESTIMATEDSIZE",默认信息是没有更新的。需要把PowerShell关闭掉然后再重新打开再运行这个命令才可以看到更新后的信息。
备份SSAS数据库
运行下面的命令可以实现Adventureworks的备份:
backup-asdatabase d:\awdb-20110930.abf "AdventureWorksDW2012Multidimensional-EE" -AllowOverwrite –ApplyCompression
这个命令会备份AdventureWorksDW2012Multidimensional-EE数据库,备份文件名为awdb-20110930.abf,并且存储在d盘根目录下。这个命令同样也会覆盖已经存在的同名备份文件。
此篇演示了如何启动PowerShell,如何显示对象下的属性,如何处理一个分区以及最后如何备份一个数据库。下一篇会介绍PowerShell在SSAS下的更多操作。
译注:
SSAS的对象的层次结构比较复杂,具体该如何进行导航或者在某些对象下能做什么,需要对SSAS数据库的基本结构有一个了解。
PowerShell操作SSAS的方式也是通过AMO的方式,方便通过基于.net的方式来进行操作。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



DDREASE is a tool for recovering data from file or block devices such as hard drives, SSDs, RAM disks, CDs, DVDs and USB storage devices. It copies data from one block device to another, leaving corrupted data blocks behind and moving only good data blocks. ddreasue is a powerful recovery tool that is fully automated as it does not require any interference during recovery operations. Additionally, thanks to the ddasue map file, it can be stopped and resumed at any time. Other key features of DDREASE are as follows: It does not overwrite recovered data but fills the gaps in case of iterative recovery. However, it can be truncated if the tool is instructed to do so explicitly. Recover data from multiple files or blocks to a single

0.What does this article do? We propose DepthFM: a versatile and fast state-of-the-art generative monocular depth estimation model. In addition to traditional depth estimation tasks, DepthFM also demonstrates state-of-the-art capabilities in downstream tasks such as depth inpainting. DepthFM is efficient and can synthesize depth maps within a few inference steps. Let’s read about this work together ~ 1. Paper information title: DepthFM: FastMonocularDepthEstimationwithFlowMatching Author: MingGui, JohannesS.Fischer, UlrichPrestel, PingchuanMa, Dmytr

The performance of JAX, promoted by Google, has surpassed that of Pytorch and TensorFlow in recent benchmark tests, ranking first in 7 indicators. And the test was not done on the TPU with the best JAX performance. Although among developers, Pytorch is still more popular than Tensorflow. But in the future, perhaps more large models will be trained and run based on the JAX platform. Models Recently, the Keras team benchmarked three backends (TensorFlow, JAX, PyTorch) with the native PyTorch implementation and Keras2 with TensorFlow. First, they select a set of mainstream

Facing lag, slow mobile data connection on iPhone? Typically, the strength of cellular internet on your phone depends on several factors such as region, cellular network type, roaming type, etc. There are some things you can do to get a faster, more reliable cellular Internet connection. Fix 1 – Force Restart iPhone Sometimes, force restarting your device just resets a lot of things, including the cellular connection. Step 1 – Just press the volume up key once and release. Next, press the Volume Down key and release it again. Step 2 – The next part of the process is to hold the button on the right side. Let the iPhone finish restarting. Enable cellular data and check network speed. Check again Fix 2 – Change data mode While 5G offers better network speeds, it works better when the signal is weaker

I cry to death. The world is madly building big models. The data on the Internet is not enough. It is not enough at all. The training model looks like "The Hunger Games", and AI researchers around the world are worrying about how to feed these data voracious eaters. This problem is particularly prominent in multi-modal tasks. At a time when nothing could be done, a start-up team from the Department of Renmin University of China used its own new model to become the first in China to make "model-generated data feed itself" a reality. Moreover, it is a two-pronged approach on the understanding side and the generation side. Both sides can generate high-quality, multi-modal new data and provide data feedback to the model itself. What is a model? Awaker 1.0, a large multi-modal model that just appeared on the Zhongguancun Forum. Who is the team? Sophon engine. Founded by Gao Yizhao, a doctoral student at Renmin University’s Hillhouse School of Artificial Intelligence.

Recently, the military circle has been overwhelmed by the news: US military fighter jets can now complete fully automatic air combat using AI. Yes, just recently, the US military’s AI fighter jet was made public for the first time and the mystery was unveiled. The full name of this fighter is the Variable Stability Simulator Test Aircraft (VISTA). It was personally flown by the Secretary of the US Air Force to simulate a one-on-one air battle. On May 2, U.S. Air Force Secretary Frank Kendall took off in an X-62AVISTA at Edwards Air Force Base. Note that during the one-hour flight, all flight actions were completed autonomously by AI! Kendall said - "For the past few decades, we have been thinking about the unlimited potential of autonomous air-to-air combat, but it has always seemed out of reach." However now,

This week, FigureAI, a robotics company invested by OpenAI, Microsoft, Bezos, and Nvidia, announced that it has received nearly $700 million in financing and plans to develop a humanoid robot that can walk independently within the next year. And Tesla’s Optimus Prime has repeatedly received good news. No one doubts that this year will be the year when humanoid robots explode. SanctuaryAI, a Canadian-based robotics company, recently released a new humanoid robot, Phoenix. Officials claim that it can complete many tasks autonomously at the same speed as humans. Pheonix, the world's first robot that can autonomously complete tasks at human speeds, can gently grab, move and elegantly place each object to its left and right sides. It can autonomously identify objects

The latest video of Tesla's robot Optimus is released, and it can already work in the factory. At normal speed, it sorts batteries (Tesla's 4680 batteries) like this: The official also released what it looks like at 20x speed - on a small "workstation", picking and picking and picking: This time it is released One of the highlights of the video is that Optimus completes this work in the factory, completely autonomously, without human intervention throughout the process. And from the perspective of Optimus, it can also pick up and place the crooked battery, focusing on automatic error correction: Regarding Optimus's hand, NVIDIA scientist Jim Fan gave a high evaluation: Optimus's hand is the world's five-fingered robot. One of the most dexterous. Its hands are not only tactile
