An enhance script to check partition tables under all schemas in sqlserver
Simple step for EMC NW & NMM
(1) disable WINDOWS UAC (reboot)
(2) SET windows domain user AS sysadmin
(3) modify hosts
(4) install software (NW , NMM) (reboot)
(5) CONFIG NWDROP VIEW [partition_show]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE view [partition_show]
as
SELECT distinct OBJECT_NAME(T2.object_id) TABLE_NAME
,T1.partition_number
,T4.name as "function_name"
,T3.name as "schema_name"
,T7.name File_group_name
,T1.rows
,CASE boundary_value_on_right
WHEN 1 THEN 'less than'
ELSE 'less than or equal to ' END as 'comparision'
--,CONVERT(varchar(100), T5.value, 112) value
,T5.value
FROM sys.partitions T1
INNER JOIN sys.indexes T2
ON T1.object_id = T2.object_id
INNER JOIN sys.partition_schemes T3
ON T2.data_space_id = T3.data_space_id
INNER JOIN sys.partition_functions T4
ON T3.function_id = T4.function_id
LEFT JOIN sys.partition_range_values T5
ON T4.function_id = T5.function_id
AND T1.partition_number = T5.boundary_id
INNER JOIN sys.destination_data_spaces T6
ON T6.partition_scheme_id = T3.data_space_id
AND T6.destination_id = T1.partition_number
INNER JOIN sys.filegroups T7
ON T6.data_space_id = T7.data_space_id
where T2.object_id in (select t.object_id from sys.tables as t inner join sys.indexes as i on t.object_id=i.object_id and i.type in (0,1) inner join sys.partition_schemes ps on i.data_space_id=ps.data_space_id)
AND T1.index_id<=1
-----------------------------------------------------------------------------------------------------------------------------
Difference
------------------------------------------------------------------------------------------------------------------------------
original part:
select OBJECT_ID(t.name) from sys.tables as t inner join sys.indexes as i on t.object_id=i.object_id and i.type in (0,1) inner join sys.partition_schemes ps on i.data_space_id=ps.data_space_id
new part
select t.object_id from sys.tables as t inner join sys.indexes as i on t.object_id=i.object_id and i.type in (0,1) inner join sys.partition_schemes ps on i.data_space_id=ps.data_space_id
An enhance script to check partition tables under all schemas in sqlserver的更多相关文章
- (copy) Shell Script to Check Linux System Health
source: http://linoxide.com/linux-shell-script/shell-script-check-linux-system-health/ This article ...
- java中用activiti插件连接mysql数据库,自动建表过程中,在配置mysql架包路径“org.activiti.engine.ActivitiException: couldn't check if tables “
java中用activiti插件连接mysql数据库,出现错误: org.activiti.engine.ActivitiException: couldn't check if tables are ...
- A python script to check NE syncfail and get log from CIPS
#! /usr/bin/env python # -*- coding: UTF-8 -*- """The script is to check whether NE i ...
- partition_show , a new version to check partition table status in sqlserver
Dear all: I had put "partition_show" before . but this time it makes faster. partition_sho ...
- Write a script to check an interesting game 6174
# -*- coding: utf-8 -*-#from ftplib import FTPimport osdef sort_reverse(x,y): if x>y: return -1 i ...
- DB count check for TABLES VIEWS PROCEDURES TRIGGERS
SELECT DISTINCT(TABLESPACE_NAME) FROM ALL_TABLES; SELECT COUNT(*) FROM ALL_TABLES where TABLESPACE_N ...
- check all tables rows
select TABLE_NAME,NUM_ROWS from all_tables where OWNER='xx' order by NUM_ROWS desc;
- Partitioning & Archiving tables in SQL Server (Part 1: The basics)
Reference: http://blogs.msdn.com/b/felixmar/archive/2011/02/14/partitioning-amp-archiving-tables-in- ...
- Mysql Partition 理论知识总结
简述: 本文内容主要 Giuseppe Maxia 曾在Mysql Conference & Expo 2010发表关于 <Mysql Partition in Mysql 5.1 &a ...
随机推荐
- CF1200E Compress Words | 字符串hash
传送门 Examples input 1 5 I want to order pizza output 1 Iwantorderpizza input 2 5 sample please ease i ...
- OpenStack Identity API v3 (CURRENT)
Table Of Contents Identity API v3 (CURRENT) Authentication and token management Password authenticat ...
- Java项目之家庭收支记账软件
模拟实现基于文本界面的家庭记账软件,该软件能够记录家庭的收入支出,并能够打印收支明细表. 项目采用分级菜单方式.主菜单如下: 假设家庭起始的生活基本金为10000元. 每次登记收入(菜单2)后,收入的 ...
- EntityFramework Core表名原理解析,让我来,揭开你神秘的面纱
前言 上一节我们针对最开始抛出的异常只是进行了浅尝辄止的解析,是不是有点意犹未尽的感觉,是的,我也有这种感觉,看到这里相信您和我会有一些疑惑,要是我们接下来通过注解.Fluent APi.DbSet分 ...
- docker学习1--dockerfile
记录docker学习过程 实践启动一个redis server 命令之前 要弄懂 dockfile 镜像 容器 三者概念以及三者之间的关系 dockerfile格式 # Comment 注释 INST ...
- cogs 247. 售票系统 线段树
247. 售票系统 ★★☆ 输入文件:railway.in 输出文件:railway.out 简单对比时间限制:1 s 内存限制:128 MB [问题描述] 某次列车途经C个城市,城市 ...
- 机器学习-特征工程-Feature generation 和 Feature selection
概述:上节咱们说了特征工程是机器学习的一个核心内容.然后咱们已经学习了特征工程中的基础内容,分别是missing value handling和categorical data encoding的一些 ...
- List去重问题与方法
面试中经常被问到的list如何去重,用来考察你对list数据结构,以及相关方法的掌握,体现你的java基础学的是否牢固.我们大家都知道,set集合的特点就是没有重复的元素.如果集合中的数据类型是基本数 ...
- springcloud复习2
Hystrix断路器 Hystrix是一个用于处理分布式系统的延迟和容错的开源库,在分布式系统里,许多依赖不可避免的会调用失败,比如超时.异常等,Hystrix能够保证在一个依赖出问题的情况下,不会导 ...
- 让你的 Linux 命令骚起来
目录 管道符号 " | " grep sed awk sort comm uniq tr cat head tail wc find tsort tee 「>」重定向符号 「 ...