반응형
1. SNMP 설치
2. 서비스(services.msc) 세팅 (SNMP Service)
3. Filewall Setting
4. SNMP Port Change
반응형
1. SNMP 설치
2. 서비스(services.msc) 세팅 (SNMP Service)
3. Filewall Setting
4. SNMP Port Change
탐색기 > 도구 > 폴더 옵션 > 보기탭 > 모든 사용자에게 동일한 폴더 공유 권한을 지정(권장) 해제
대상 폴더/파일 선택 > 등록정보 > 보안탭 > 고급 > 소유탭
하위 컨테이너와 개체의 소유자 바꾸기 체크
SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE PROC [dbo].[dba_SpaceUsed]
@SourceDB varchar ( 128 ) = null -- Optional database name-- If omitted, the current database is reported., @SortBy char(1) = 'S' -- N for name, S for Size-- T for table name
/* Returns a table with the space used in all tables of the* database. It's reported with the schema information unlike* the system procedure sp_spaceuse.** sp_spaceused is used to perform the calculations to ensure* that the numbers match what SQL Server would report.** Compatible with sQL Server 2000 and 2005** Example:exec dbo.dba_SpaceUsed null, 'N'** © Copyright 2007 Andrew Novick http://www.NovickSoftware.com* This software is provided as is without warrentee of any kind.* You may use this procedure in any of your SQL Server databases* including databases that you sell, so long as they contain* other unrelated database objects. You may not publish this* procedure either in print or electronically.******************************************************************/AS
SET NOCOUNT ON
DECLARE @sql nvarchar (4000)
IF @SourceDB IS NULL BEGINSET @SourceDB = DB_NAME() -- The current DBEND
---------------------------------------------------------- Create and fill a list of the tables in the database.
CREATE TABLE #Tables ( [schema] sysname, TabName sysname )SELECT @sql = 'insert #tables ([schema], [TabName])select TABLE_SCHEMA, TABLE_NAMEfrom ['+ @SourceDB +'].INFORMATION_SCHEMA.TABLESwhere TABLE_TYPE = ''BASE TABLE'''exec (@sql)
----------------------------------------------------------------- #TabSpaceTxt Holds the results of sp_spaceused.-- It Doesn't have Schema Info!CREATE TABLE #TabSpaceTxt (TabName sysname, [Rows] varchar (11), Reserved varchar (18), Data varchar (18), Index_Size varchar ( 18 ), Unused varchar ( 18 ))----------------------------------------------------------------- The result table, with numeric results and Schema name.CREATE TABLE #TabSpace ( [Schema] sysname, TabName sysname, [Rows] bigint, ReservedMB numeric(18,3), DataMB numeric(18,3), Index_SizeMB numeric(18,3), UnusedMB numeric(18,3))
DECLARE @Tab sysname -- table name, @Sch sysname -- owner,schema
DECLARE TableCursor CURSOR FORSELECT [SCHEMA], TabNAMEFROM #tables
OPEN TableCursor;FETCH TableCursor into @Sch, @Tab;
WHILE @@FETCH_STATUS = 0 BEGIN
SELECT @sql = 'exec [' + @SourceDB+ ']..sp_executesql N''insert #TabSpaceTxt exec sp_spaceused '+ '''''[' + @Sch + '].[' + @Tab + ']' + '''''''';
Delete from #TabSpaceTxt; -- Stores 1 result at a timeEXEC (@sql);
INSERT INTO #TabSpaceSELECT @Sch, [TabName], convert(bigint, rows), convert(numeric(18,3), convert(numeric(18,3),left(reserved, len(reserved)-3)) / 1024.0)ReservedMB, convert(numeric(18,3), convert(numeric(18,3),left(data, len(data)-3)) / 1024.0) DataMB, convert(numeric(18,3), convert(numeric(18,3),left(index_size, len(index_size)-3)) / 1024.0)Index_SizeMB, convert(numeric(18,3), convert(numeric(18,3),left(unused, len([Unused])-3)) / 1024.0)[UnusedMB]FROM #TabSpaceTxt;
FETCH TableCursor into @Sch, @Tab;END;
CLOSE TableCursor;DEALLOCATE TableCursor;
------------------------------------------------------- Caller specifies sort, Default is sizeIF @SortBy = 'N' -- Use Schema then Table NameSELECT * FROM #TabSpaceORDER BY [Schema] asc, [TabName] ascELSE IF @SortBy = 'T' -- Table name, then schemaSELECT * FROM #TabSpaceORDER BY [TabName] asc, [Schema] ascELSE -- S, NULL, or whatever get's the defaultSELECT * FROM #TabSpaceORDER BY ReservedMB desc;
DROP TABLE #TablesDROP TABLE #TabSpaceTxtDROP TABLE #TabSpace