블로그 이미지
LifeisSimple

calendar

1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

Notice

2010. 8. 15. 19:35 Photograph by ../일상
양재 at센터쪽에 있는 시민의 숲입니다. 
나름 가깝고 아이들 놀기에도 좋아 가끔 놀러갑니다. ^^

여름에는 옆쪽에 양재천 수영장도 괜찮습니다. 


물이 시원해 보이네요 그러나... 깨끗한지는... 


연인들이 서로 사진을 찍어주려 출사도 오고


언니가 동생 머리도 묶어주고... 


아이들은 물가에 조약돌도 모아두고... (결국 다시 물속으로)


새도 있고... 참새는 아닌거 같고


저 렌즈는.... 135인가아니면 24-70인가... 


인형같은 아이들... 아버지가 한국분이시더군요 ^^


이국적이네요... 




이쁜 나무들도 있고 ^^


나뭇잎 사이로 햇살이 비추기도 하는... 

포근한 휴식을 취할 수 있는 곳입니다. 그리고, 각종 음식도 배달이 됩니다. ^^;;

'Photograph by .. > 일상' 카테고리의 다른 글

Gitzo 1541T + 1781QR  (0) 2010.09.09
인셉션 결말은(?) - 타임스퀘어  (0) 2010.08.15
P&I 2010 모델...  (0) 2010.08.15
시간아 먼저가라 ... - 헤이리  (0) 2010.08.15
파주 헤이리  (0) 2010.08.09
posted by LifeisSimple
2010. 8. 15. 19:27 Photograph by ../일상
어떻게 기회가 생겨서 갔던... P&I 행사입니다. 
갔다가 이리저리 찍었는데 아직 실력이 미천하여 이런 사진밖에는 안나오네요 ㅎㅎ

그래도 ... 


개인적으로 아래사진이 더 마음에 드는.... 


'Photograph by .. > 일상' 카테고리의 다른 글

인셉션 결말은(?) - 타임스퀘어  (0) 2010.08.15
양재 시민의숲  (1) 2010.08.15
시간아 먼저가라 ... - 헤이리  (0) 2010.08.15
파주 헤이리  (0) 2010.08.09
파주 헤이리 (휴식)  (1) 2010.08.09
posted by LifeisSimple
2010. 8. 15. 19:23 Photograph by ../일상
시간아 먼저가라 ... 나는 좀 늦을 것 같다.
나는 여기 남아서 그 사람을 기다려 보련다... 

헤이리 소품샵에서 본 시계입니다. 음... 


'Photograph by .. > 일상' 카테고리의 다른 글

양재 시민의숲  (1) 2010.08.15
P&I 2010 모델...  (0) 2010.08.15
파주 헤이리  (0) 2010.08.09
파주 헤이리 (휴식)  (1) 2010.08.09
비오는날  (0) 2010.08.09
posted by LifeisSimple
2010. 8. 13. 14:46 Brain Trainning/DataBase

/*

       Delete Del Table

*/

 

declare @tblName varchar(300)

declare curTblName cursor fast_forward for

       select TABLE_NAME

       from srvDB.INFORMATION_SCHEMA.tables where TABLE_NAME like '%삭제%'

open curTblName

fetch next from curTblName

       into @tblName

      

while @@FETCH_STATUS = 0

begin

       exec ('drop table ' + @tblName)

 

       fetch next from curTblName

             into @tblName

end

 

close curTblName

deallocate curTblName

 

 

/*

       Delete SP

*/

declare @prcName varchar(300)

 

declare curPrcName cursor fast_forward for

       select ROUTINE_NAME

             from srvDB.INFORMATION_SCHEMA.ROUTINES

       where ROUTINE_NAME like '%삭제%'

 

open curPrcName

 

fetch next from curPrcName

       into @prcName

      

while @@FETCH_STATUS = 0

begin

       exec ('drop proc ' + @prcName)

 

       fetch next from curPrcName

             into @prcName

end

 

close curPrcName

deallocate curPrcName

posted by LifeisSimple
2010. 8. 12. 13:51 Brain Trainning/DataBase

SQL Server 데이터베이스 엔진을 SQL Server 2008로 업그레이드할 수 있습니다. 지원되는 업그레이드 경로에 대한 자세한 내용은 버전 및 에디션 업그레이드를 참조하십시오.

SQL Server 설치 프로그램은 최소한의 사용자의 개입만으로 이전 버전의 SQL Server를 업그레이드할 수 있습니다. 업그레이드 프로세스를 사전에 제대로 준비하고 잘 이해하면 문제 발생을 방지할 수 있고 문제가 발생하더라도 보다 쉽게 해결할 수 있습니다.

이 항목에서는 업그레이드 프로세스를 준비하고 이해하는 데 필요한 다음과 같은 정보를 제공합니다.

  • 알려진 업그레이드 문제

  • 업그레이드 전 태스크 및 고려 사항

  • 데이터베이스 엔진 업그레이드 절차 항목에 대한 링크

  • 데이터베이스를 SQL Server로 마이그레이션하는 절차 항목에 대한 링크

  • 장애 조치 클러스터에 대한 고려 사항

  • 업그레이드 후 태스크 및 고려 사항

알려진 업그레이드 문제

데이터베이스 엔진을 업그레이드하기 전에 SQL Server 데이터베이스 엔진의 이전 버전과의 호환성을 검토하십시오. 지원되는 업그레이드 시나리오와 알려진 업그레이드 문제에 대한 자세한 내용은 버전 및 에디션 업그레이드를 참조하십시오. 다른 SQL Server 구성 요소에 대한 이전 버전과의 호환성 정보를 보려면 이전 버전과의 호환성을 참조하십시오.

중요:
한 버전의 SQL Server에서 다른 버전으로 업그레이드하기 전에 현재 사용 중인 기능이 업그레이드할 버전에서 지원되는지 확인하십시오.

업그레이드 전 검사 목록

이전 SQL Server 버전에서의 업그레이드는 SQL Server 설치 프로그램에서 지원됩니다. 이전 SQL Server 버전에서 데이터베이스를 마이그레이션할 수도 있습니다. 한 SQL Server 인스턴스에서 같은 컴퓨터에 있는 다른 인스턴스로, 또는 다른 컴퓨터에 있는 SQL Server 인스턴스에서 마이그레이션할 수 있습니다. 마이그레이션 옵션에는 데이터베이스 복사 마법사, 백업 및 복원 기능, SQL Server 2005 Integration Services 가져오기 및 내보내기 마법사, 대량 내보내기/대량 가져오기 방법의 사용이 포함됩니다.

데이터베이스 엔진을 업그레이드하기 전에 다음을 수행해야 합니다.

  • SQL Server 2008 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 검토합니다.

  • 시스템 구성 검사기의 검사 매개 변수를 검토합니다.

  • SQL Server 설치에 대한 보안 고려 사항을 검토합니다.

  • 버전 및 에디션 업그레이드를 검토합니다.

  • 업그레이드 관리자를 사용하여 업그레이드 준비를 검토합니다.

  • SQL Server 데이터베이스 엔진의 이전 버전과의 호환성을 검토합니다.

  • 쿼리 계획 마이그레이션을 검토합니다.

SQL Server를 업그레이드하기 전에 다음 사항을 검토하고 변경합니다.

  • SQL Server 64비트 버전에서 SQL Server 2008 64비트 버전으로 업그레이드하는 경우 데이터베이스 엔진을 업그레이드하기 전에 Analysis Services를 업그레이드해야 합니다.

  • 필요할 때 복원할 수 있도록 업그레이드할 인스턴스의 모든 SQL Server 데이터베이스 파일을 백업합니다.

  • 업그레이드할 데이터베이스에서 적절한 DBCC(데이터베이스 콘솔 명령)를 실행하여 데이터베이스가 일관된 상태를 유지하도록 합니다.

  • SQL Server 구성 요소 및 사용자 데이터베이스 업그레이드에 필요한 디스크 공간을 예측합니다. SQL Server 구성 요소에 필요한 디스크 공간은 SQL Server 2008 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

  • 기존 SQL Server 시스템 데이터베이스 master, model, msdbtempdb가 자동 증가되도록 구성되어 있는지, 각각의 하드 디스크 공간이 충분한지 확인합니다.

  • master 데이터베이스에 모든 데이터베이스 서버에 대한 로그온 정보가 있는지 확인합니다. 시스템 로그온 정보는 master 데이터베이스에 있으므로 이는 데이터베이스 복원을 위해 중요합니다.

  • 업그레이드 프로세스를 수행할 경우 업그레이드 중인 SQL Server 인스턴스의 서비스가 중지되었다가 시작되므로 모든 시작 저장 프로시저를 해제합니다. 시작 시 처리되는 저장 프로시저로 인해 업그레이드 프로세스가 중단될 수 있습니다.

  • 복제를 중지하고 복제 로그가 비어 있는지 확인합니다.

  • SQL Server 2000 데이터베이스 엔진 인스턴스를 업그레이드해도 max worker threads에 대한 구성 값은 그대로 유지됩니다. 그러나 데이터베이스 엔진에서 최적 스레드 수를 계산할 수 있도록 업그레이드 전에 max worker threads 값을 0으로 변경하는 것이 좋습니다. 자세한 내용은 SQL Server 온라인 설명서의 max worker threads 옵션을 참조하십시오.

  • SQL Server 종속성을 갖는 모든 서비스를 포함한 모든 응용 프로그램을 끝냅니다. 로컬 응용 프로그램이 업그레이드 중인 인스턴스에 연결되어 있으면 업그레이드가 실패할 수 있습니다.

  • 데이터베이스 미러링을 사용하는 경우 SQL Server 온라인 설명서의 방법: 서버 인스턴스 업그레이드 시 미러된 데이터베이스의 작동 중단 최소화를 참조하십시오.

데이터베이스 엔진 업그레이드

버전 업그레이드로 SQL Server 2000 또는 SQL Server 2005 설치를 덮어쓸 수 있습니다. SQL Server 설치 프로그램을 실행할 때 이전 버전의 SQL Server가 검색되면 이전의 모든 SQL Server 프로그램 파일이 업그레이드되고 이전 SQL Server 인스턴스에 저장된 모든 데이터는 그대로 보존됩니다. 또한 이전 버전의 SQL Server 온라인 설명서도 변경되지 않고 컴퓨터에 남아 있습니다.

주의:
SQL Server를 업그레이드하면 이전 SQL Server 인스턴스를 덮어쓰게 되므로 이러한 인스턴스는 시스템에 더 이상 존재하지 않게 됩니다. 따라서 업그레이드 전에 이전 SQL Server 인스턴스와 연결된 SQL Server 데이터베이스 및 기타 개체를 백업하십시오.

SQL Server 설치 마법사를 사용하여 데이터베이스 엔진을 업그레이드할 수 있습니다.

주의:
컴퓨터에 SQL Server 2000 관리 도구와 SQL Server 2008 기본 인스턴스가 설치되어 있으면 SQL Server 설치 프로그램을 통해 SQL Server 2000 기본 인스턴스를 설치할 수 있습니다. 그러나 이렇게 하면 설치된 SQL Server 2008 인스턴스를 사용할 수 없게 됩니다. 따라서 SQL Server 2000 관리 도구와 SQL Server 2008 기본 인스턴스가 컴퓨터에 이미 있는 경우에는 SQL Server 기본 인스턴스를 설치하지 마십시오.

업그레이드 후 데이터베이스 호환성 수준

업그레이드 후에는 tempdb, model, msdbResource 데이터베이스의 호환성 수준이 100으로 설정됩니다. master 시스템 데이터베이스는 업그레이드 이전의 호환성 수준이 80 미만이 아니었다면 이전 호환성 수준으로 유지됩니다. master의 호환성 수준이 업그레이드 이전에 80 미만이었다면 업그레이드 후에는 80으로 설정됩니다.

사용자 데이터베이스의 호환성 수준이 업그레이드 이전에 80 또는 90이었다면 업그레이드 후에도 동일하게 유지됩니다. 업그레이드 이전에 호환성 수준이 70 이하였다면 업그레이드된 데이터베이스에서는 SQL Server 2008에서 지원되는 가장 낮은 호환성 수준인 80으로 설정됩니다.

참고:
새 사용자 데이터베이스는 model 데이터베이스의 호환성 수준을 상속합니다.

데이터베이스 마이그레이션

SQL Server의 백업 및 복원 기능이나 분리 및 연결 기능을 사용하여 사용자 데이터베이스를 SQL Server 인스턴스로 이동할 수 있습니다.

중요:
원본 서버와 대상 서버에서 이름이 같은 데이터베이스는 이동하거나 복사할 수 없습니다. 이 경우 "이미 존재하는 것"으로 인식됩니다.

자세한 내용은 데이터베이스 복사 마법사 사용 또는 방법: 데이터베이스 복사 마법사를 사용한 SQL Server 업그레이드를 참조하십시오.

데이터베이스 엔진 업그레이드 후 수행할 작업

데이터베이스 엔진을 업그레이드한 후에 다음 태스크를 완료하십시오.

  • 서버를 다시 등록합니다. 서버 등록에 대한 자세한 내용은 SQL Server 온라인 설명서의 서버 등록 항목을 참조하십시오.

  • 전체 텍스트 카탈로그를 다시 채웁니다. 이 작업을 사용하면 SQL Server 설치의 성능이 향상됩니다. 자세한 내용은 SQL Server 온라인 설명서의 sp_fulltext_catalog(Transact-SQL) 항목을 참조하십시오.

  • 업그레이드한 후 모든 데이터베이스에서 통계를 업데이트합니다. sp_updatestats 저장 프로시저를 사용하여 SQL Server 데이터베이스에 있는 사용자 정의 테이블의 통계를 업데이트할 수 있습니다.

  • 모든 데이터베이스에서 DBCC UPDATEUSAGE를 실행하여 잘못된 행이나 페이지 수를 수정합니다.

  • SQL Server 설치를 구성합니다. SQL Server는 공격받을 수 있는 시스템의 노출 영역을 줄이기 위해 핵심 서비스와 기능을 선별하여 설치 및 활성화합니다.

  • SQL Server 2005에서 생성되어 분할된 테이블 및 인덱스에 대한 쿼리에 적용되는 USE PLAN 힌트의 유효성을 검사하거나 이러한 힌트를 제거합니다.

    SQL Server 2008에서는 분할된 테이블 및 인덱스에 대한 쿼리의 처리 방법이 달라졌습니다. SQL Server 2005에서 생성된 계획에 USE PLAN 힌트를 사용하는 분할된 개체에 대한 쿼리에는 SQL Server 2008에서 사용할 수 없는 계획이 포함될 수 있습니다. SQL Server 2008로 업그레이드한 후 다음 절차를 수행하는 것이 좋습니다.

    USE PLAN 힌트가 쿼리에 직접 지정된 경우

    1. 쿼리에서 USE PLAN 힌트를 제거합니다.

    2. 쿼리를 테스트합니다.

    3. 최적화 프로그램에서 적절한 계획을 선택하지 못하는 경우 쿼리를 조정하고 원하는 쿼리 계획에서 USE PLAN 힌트를 지정하는 방법을 고려합니다.

    USE PLAN 힌트가 계획 지침에 지정된 경우

    1. sys.fn_validate_plan_guide 함수를 사용하여 계획 지침의 유효성을 검사합니다. 또는 SQL Server 프로파일러에서 Plan Guide Unsuccessful 이벤트를 사용하여 잘못된 계획이 있는지 확인할 수 있습니다.

    2. 계획 지침이 올바르지 않으면 해당 계획 지침을 삭제합니다. 최적화 프로그램에서 적절한 계획을 선택하지 못하는 경우 쿼리를 조정하고 원하는 쿼리 계획에서 USE PLAN 힌트를 지정하는 방법을 고려합니다.

    계획 지침에 USE PLAN 힌트가 지정된 경우 잘못된 계획 지침은 쿼리 실패를 유발하지 않습니다. 대신 USE PLAN 힌트를 사용하지 않은 채 쿼리가 컴파일됩니다. 분할된 개체에서의 쿼리 처리에 대한 자세한 내용은 분할된 테이블 및 인덱스에서의 향상된 쿼리 처리를 참조하십시오.

업그레이드 전에 전체 텍스트 카탈로그가 설정 또는 해제된 것으로 표시된 데이터베이스는 업그레이드 후에도 해당 상태가 유지됩니다. 전체 텍스트 카탈로그가 설정된 데이터베이스의 경우 업그레이드 후에 전체 텍스트 카탈로그가 자동으로 다시 작성되고 채워집니다. 이 작업에는 시간과 리소스가 많이 소요됩니다. 전체 텍스트 인덱싱 작업을 일시적으로 중지하려면 다음 문을 실행합니다.

코드 복사
EXEC sp_fulltext_service 'pause_indexing', 1

전체 텍스트 인덱스 채우기를 재개하려면 다음 문을 실행합니다.

코드 복사
EXEC sp_fulltext_service 'pause_indexing', 0

참고 항목

관련 자료

여러 버전 및 인스턴스의 SQL Server 작업
이전 버전과의 호환성
복제된 데이터베이스 업그레이드 시 고려 사항

도움말 및 정보

SQL Server 2008 지원 받기

출처 : MSDN

'Brain Trainning > DataBase' 카테고리의 다른 글

sp_readerrorlog (xp_readerrorlog)  (0) 2010.08.17
특정이름의 테이블/SP 등등 삭제  (0) 2010.08.13
SP_Helpindex2  (0) 2010.08.11
DB 파일 사용상태 쿼리  (0) 2010.08.06
MSSQL 2008 설치 Video (Microsoft)  (0) 2010.07.23
posted by LifeisSimple
2010. 8. 11. 11:39 Brain Trainning/DataBase


/*============================================================================

  File:     sp_helpindex2.sql

 

 Summary:  So, what are the included columns?!

                                This is a MODIFIED sp_helpindex script that includes INCLUDEd

                                columns AND filtered index columns.

 

  Date:     April 2008

 

  SQL Server *2008* Version: 10.00.1300.13 (SQL Server 2008 CTP6)

------------------------------------------------------------------------------

  Written by Kimberly L. Tripp, SYSolutions, Inc.

 

  For more scripts and sample code, check out

    http://www.SQLskills.com

 

  This script is intended only as a supplement to demos and lectures

  given by SQLskills instructors. 

 

  THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF

  ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED

  TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A

  PARTICULAR PURPOSE.

============================================================================*/

 

USE master

go

 

create procedure sp_helpindex2

           @objname nvarchar(776)            -- the table to check for indexes

as

 

-- Updated in April 2008 by Kimberly L. Tripp, SQLskills.com

-- to add included columns AND filter_definition to the output.

-- See Kimberly's blog for updates and/or additional information

-- http://www.SQLskills.com/blogs/Kimberly

 

           -- PRELIM

           set nocount on

 

           declare @objid int,                              -- the object id of the table

                                @indid smallint,  -- the index id of an index

                                @groupid int,              -- the filegroup id of an index

                                @indname sysname,

                                @groupname sysname,

                                @status int,

                                @keys nvarchar(2126),     --Length (16*max_identifierLength)+(15*2)+(16*3)

                                @inc_columns    nvarchar(max),

                                @inc_Count                 smallint,

                                @loop_inc_Count                     smallint,

                                @dbname         sysname,

                                @ignore_dup_key          bit,

                                @is_unique                  bit,

                                @is_hypothetical bit,

                                @is_primary_key bit,

                                @is_unique_key bit,

                                @auto_created   bit,

                                @no_recompute bit,

                                @filter_definition nvarchar(max)

 

           -- Check to see that the object names are local to the current database.

           select @dbname = parsename(@objname,3)

           if @dbname is null

                     select @dbname = db_name()

           else if @dbname <> db_name()

                     begin

                                raiserror(15250,-1,-1)

                                return (1)

                     end

 

           -- Check to see the the table exists and initialize @objid.

           select @objid = object_id(@objname)

           if @objid is NULL

           begin

                     raiserror(15009,-1,-1,@objname,@dbname)

                     return (1)

           end

 

           -- OPEN CURSOR OVER INDEXES (skip stats: bug shiloh_51196)

           declare ms_crs_ind cursor local static for

                     select i.index_id, i.data_space_id, i.name,

                                i.ignore_dup_key, i.is_unique, i.is_hypothetical, i.is_primary_key, i.is_unique_constraint,

                                s.auto_created, s.no_recompute, i.filter_definition

                     from sys.indexes i join sys.stats s

                                on i.object_id = s.object_id and i.index_id = s.stats_id

                     where i.object_id = @objid

           open ms_crs_ind

           fetch ms_crs_ind into @indid, @groupid, @indname, @ignore_dup_key, @is_unique, @is_hypothetical,

                                @is_primary_key, @is_unique_key, @auto_created, @no_recompute, @filter_definition

 

           -- IF NO INDEX, QUIT

           if @@fetch_status < 0

           begin

                     deallocate ms_crs_ind

                     raiserror(15472,-1,-1,@objname) -- Object does not have any indexes.

                     return (0)

           end

 

           -- create temp tables

           CREATE TABLE #spindtab

           (

                     index_name                            sysname collate database_default NOT NULL,

                     index_id                      int,

                     ignore_dup_key             bit,

                     is_unique                               bit,

                     is_hypothetical              bit,

                     is_primary_key               bit,

                     is_unique_key               bit,

                     auto_created                bit,

                     no_recompute              bit,

                     groupname                             sysname collate database_default NULL,

                     index_keys                              nvarchar(2126)    collate database_default NOT NULL, -- see @keys above for length descr

                     filter_definition   nvarchar(max),

                     inc_Count                              smallint,

                     inc_columns                            nvarchar(max)

           )

 

           CREATE TABLE #IncludedColumns

           (          RowNumber      smallint,

                     [Name]  nvarchar(128)

           )

 

           -- Now check out each index, figure out its type and keys and

           --         save the info in a temporary table that we'll print out at the end.

           while @@fetch_status >= 0

           begin

                     -- First we'll figure out what the keys are.

                     declare @i int, @thiskey nvarchar(131) -- 128+3

 

                     select @keys = index_col(@objname, @indid, 1), @i = 2

                     if (indexkey_property(@objid, @indid, 1, 'isdescending') = 1)

                                select @keys = @keys  + '(-)'

 

                     select @thiskey = index_col(@objname, @indid, @i)

                     if ((@thiskey is not null) and (indexkey_property(@objid, @indid, @i, 'isdescending') = 1))

                                select @thiskey = @thiskey + '(-)'

 

                     while (@thiskey is not null )

                     begin

                                select @keys = @keys + ', ' + @thiskey, @i = @i + 1

                                select @thiskey = index_col(@objname, @indid, @i)

                                if ((@thiskey is not null) and (indexkey_property(@objid, @indid, @i, 'isdescending') = 1))

                                          select @thiskey = @thiskey + '(-)'

                     end

 

                     -- Second, we'll figure out what the included columns are.

                     SELECT @inc_Count = count(*)

                     FROM

                     sys.tables AS tbl

                     INNER JOIN sys.indexes AS si

                                ON (si.index_id > 0

                                          and si.is_hypothetical = 0)

                                          AND (si.object_id=tbl.object_id)

                     INNER JOIN sys.index_columns AS ic

                                ON (ic.column_id > 0

                                          and (ic.key_ordinal > 0 or ic.partition_ordinal = 0 or ic.is_included_column != 0))

                                          AND (ic.index_id=CAST(si.index_id AS int) AND ic.object_id=si.object_id)

                     INNER JOIN sys.columns AS clmns

                                ON clmns.object_id = ic.object_id

                                and clmns.column_id = ic.column_id

                     WHERE ic.is_included_column = 1 and

                                (si.index_id = @indid) and

                                (tbl.object_id= @objid)

 

                     IF @inc_Count > 0

                                INSERT #IncludedColumns

                                          SELECT ROW_NUMBER() OVER (ORDER BY clmns.column_id)

                                          , clmns.name

                                FROM

                                sys.tables AS tbl

                                INNER JOIN sys.indexes AS si

                                          ON (si.index_id > 0

                                                     and si.is_hypothetical = 0)

                                                     AND (si.object_id=tbl.object_id)

                                INNER JOIN sys.index_columns AS ic

                                          ON (ic.column_id > 0

                                                     and (ic.key_ordinal > 0 or ic.partition_ordinal = 0 or ic.is_included_column != 0))

                                                     AND (ic.index_id=CAST(si.index_id AS int) AND ic.object_id=si.object_id)

                                INNER JOIN sys.columns AS clmns

                                          ON clmns.object_id = ic.object_id

                                          and clmns.column_id = ic.column_id

                                WHERE ic.is_included_column = 1 and

                                          (si.index_id = @indid) and

                                          (tbl.object_id= @objid)

                               

                                SELECT @inc_columns = [Name] FROM #IncludedColumns WHERE RowNumber = 1

 

                                SET @loop_inc_Count = 1

 

                                WHILE @loop_inc_Count < @inc_Count

                                BEGIN

                                          SELECT @inc_columns = @inc_columns + ', ' + [Name]

                                                     FROM #IncludedColumns WHERE RowNumber = @loop_inc_Count + 1

                                          SET @loop_inc_Count = @loop_inc_Count + 1

                                END

          

                     select @groupname = null

                     select @groupname = name from sys.data_spaces where data_space_id = @groupid

 

                     -- INSERT ROW FOR INDEX

                     insert into #spindtab values (@indname, @indid, @ignore_dup_key, @is_unique, @is_hypothetical,

                                @is_primary_key, @is_unique_key, @auto_created, @no_recompute, @groupname, @keys, @filter_definition, @inc_Count, @inc_columns)

 

                     -- Next index

                     fetch ms_crs_ind into @indid, @groupid, @indname, @ignore_dup_key, @is_unique, @is_hypothetical,

                                @is_primary_key, @is_unique_key, @auto_created, @no_recompute, @filter_definition

           end

           deallocate ms_crs_ind

 

           -- DISPLAY THE RESULTS

           select

                     'index_name' = index_name,

                     'index_description' = convert(varchar(210), --bits 16 off, 1, 2, 16777216 on, located on group

                                          case when index_id = 1 then 'clustered' else 'nonclustered' end

                                          + case when ignore_dup_key <>0 then ', ignore duplicate keys' else '' end

                                          + case when is_unique <>0 then ', unique' else '' end

                                          + case when is_hypothetical <>0 then ', hypothetical' else '' end

                                          + case when is_primary_key <>0 then ', primary key' else '' end

                                          + case when is_unique_key <>0 then ', unique key' else '' end

                                          + case when auto_created <>0 then ', auto create' else '' end

                                          + case when no_recompute <>0 then ', stats no recompute' else '' end

                                          + ' located on ' + groupname),

                     'index_keys' = index_keys,

                     --'num_included_columns' = inc_Count,

                     'included_columns' = inc_columns,

                     'filter_definition' = filter_definition

           from #spindtab

           order by index_name

 

           return (0) -- sp_helpindexwinc2

go

 

exec sys.sp_MS_marksystemobject 'sp_helpindex2'

posted by LifeisSimple
2010. 8. 9. 00:56 Photograph by ../일상

헤이리 이쁜 카페 건물~

'Photograph by .. > 일상' 카테고리의 다른 글

P&I 2010 모델...  (0) 2010.08.15
시간아 먼저가라 ... - 헤이리  (0) 2010.08.15
파주 헤이리 (휴식)  (1) 2010.08.09
비오는날  (0) 2010.08.09
HP mini 5101 Driver Energystar  (0) 2010.06.27
posted by LifeisSimple
2010. 8. 9. 00:49 Photograph by ../일상
파주 헤이리를 살짝 다녀왔습니다. 

이전에 이미 다녀와서 이런 저런 글을 많이 적은 관계로 그냥 마음에 드는 사진 하나... 


작은 휴식같은 하루가 되었으면 합니다. 

'Photograph by .. > 일상' 카테고리의 다른 글

시간아 먼저가라 ... - 헤이리  (0) 2010.08.15
파주 헤이리  (0) 2010.08.09
비오는날  (0) 2010.08.09
HP mini 5101 Driver Energystar  (0) 2010.06.27
HP mini 5101 Driver  (0) 2010.06.27
posted by LifeisSimple
2010. 8. 9. 00:47 Photograph by ../일상
비가 오는 날






'Photograph by .. > 일상' 카테고리의 다른 글

파주 헤이리  (0) 2010.08.09
파주 헤이리 (휴식)  (1) 2010.08.09
HP mini 5101 Driver Energystar  (0) 2010.06.27
HP mini 5101 Driver  (0) 2010.06.27
아이팟에서도 블로깅이  (1) 2010.06.23
posted by LifeisSimple
2010. 8. 6. 16:22 Brain Trainning/DataBase

이건 DataFile 들


create table #tmpspc (Fileid int, FileGroup int, TotalExtents int, UsedExtents int, Name sysname, FileName nchar(520))
insert #tmpspc EXEC ('dbcc showfilestats')
SELECT
db_name() as DBName,
CAST(cast(g.name as varbinary(256)) AS sysname) AS [FileGroup_Name],
s.name AS [Name],
left(s.physical_name, 1) as DriveName,
s.physical_name AS [FileName],
(tspc.TotalExtents - tspc.UsedExtents)*convert(float,64) AS [AvailableSpace],
CAST(CASE s.is_percent_growth WHEN 1 THEN s.growth ELSE s.growth*8 END AS float) AS [Growth],
CAST(CASE when s.growth=0 THEN 99 ELSE s.is_percent_growth END AS int) AS [GrowthType],
s.file_id AS [ID],
CAST(CASE s.file_id WHEN 1 THEN 1 ELSE 0 END AS bit) AS [IsPrimaryFile],
CASE when s.max_size=-1 then -1 else s.max_size * CONVERT(float,8) END AS [MaxSize],
s.size * CONVERT(float,8) AS [Size],
CAST(tspc.UsedExtents*convert(float,64) AS float) AS [UsedSpace],
CAST(case s.state when 6 then 1 else 0 end AS bit) AS [IsOffline],
s.is_read_only AS [IsReadOnly],
s.is_media_read_only AS [IsReadOnlyMedia],
s.is_sparse AS [IsSparse]
FROM
sys.filegroups AS g
INNER JOIN sys.master_files AS s ON (s.type = 0 and s.database_id = db_id() and (s.drop_lsn IS NULL)) AND (s.data_space_id=g.data_space_id)
LEFT OUTER JOIN #tmpspc tspc ON tspc.Fileid = s.file_id
ORDER BY
[FileGroup_Name] ASC,[Name] ASC

drop table #tmpspc

이건 Log 파일들

SELECT db_name() as DBName, null as [FileGroup_Name], s.name AS [Name], left(s.physical_name, 1) as DriveName, s.physical_name AS [FileName], s.size * CONVERT(float,8) - CAST(FILEPROPERTY(s.name, 'SpaceUsed') AS float)* CONVERT(float,8) as [AvailableSpace], CAST(CASE s.is_percent_growth WHEN 1 THEN s.growth ELSE s.growth*8 END AS float) AS [Growth], CAST(CASE when s.growth=0 THEN 99 ELSE s.is_percent_growth END AS int) AS [GrowthType], s.file_id AS [ID], null as IsPrimaryFile, CASE when s.max_size=-1 then -1 else s.max_size * CONVERT(float,8) END AS [MaxSize], s.size * CONVERT(float,8) AS [Size], CAST(FILEPROPERTY(s.name, 'SpaceUsed') AS float)* CONVERT(float,8) AS [UsedSpace], CAST(case s.state when 6 then 1 else 0 end AS bit) AS [IsOffline], s.is_read_only AS [IsReadOnly], s.is_media_read_only AS [IsReadOnlyMedia], s.is_sparse AS [IsSparse] FROM sys.master_files AS s WHERE (s.type = 1 and s.database_id = db_id()) ORDER BY [Name] ASC
이렇게 구경하면 됩니다. 음... 

'Brain Trainning > DataBase' 카테고리의 다른 글

버전 호환성 Upgrade 작업 후 해야할 작업  (0) 2010.08.12
SP_Helpindex2  (0) 2010.08.11
MSSQL 2008 설치 Video (Microsoft)  (0) 2010.07.23
[SSRS] Microsoft Video  (0) 2010.07.23
[SSAS] Microsoft Video  (0) 2010.07.23
posted by LifeisSimple