2009. 9. 28. 14:47

미러링::Error: 1479, Severity: 16, State: 1.

SQL SERVER 2005 이상


미러서버의 네티워크 사용량 증라고 미러링이 재개되지 못하는 경우. 

 

Database mirroring sessions may stop intermittently in SQL Server 2005

http://support.microsoft.com/default.aspx?scid=kb;en-us;959006&sd=rss&spid=2855

 

select is_send_flow_controlled column , * from sys.dm_db_mirroring_connections dynamic management

is_send_flow_controlled column  컬럼이 1 이면 네트워크 사용량이 많은거다.

 

(미러서버)

 

<Date><Time> spid16s Error: 1479, Severity: 16, State: 1.
<Date><Time> spid16s The mirroring connection to "<EndPoint>" has timed out for database "MSS" after 120 seconds without a response. Check the service and network connections.
<Date><Time> spid16s Database mirroring is inactive for database 'MSS'. This is an informational message only. No user action is required.
<Date><Time> spid16s Restart packet created for dbid 5.
<Date><Time> spid22s Restart packet processing for dbid 5.
<Date><Time> spid22s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'Object Plans' cachestore (part of plan cache) due to some database maintenance or reconfigure operations.
<Date><Time> spid22s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'SQL Plans' cachestore (part of plan cache) due to some database maintenance or reconfigure operations.
<Date><Time> spid22s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'Bound Trees' cachestore (part of plan cache) due to some database maintenance or reconfigure operations.
<Date><Time> spid22s Starting up database '<Database name>'.
<Date><Time> spid22s Bypassing recovery for database '<Database name>' because it is marked as a mirror database, which cannot be recovered. This is an informational message only. No user action is required.

 

2009. 8. 13. 18:41

T-SQL::Total Disk Size 얻기 (OLE 사용)

디스크의 남은 용량은 xp_fixeddrives 를 이용해서 구할 수 있지만 디스크 전체 사이즈를 쉽게 얻기는 쉽지 않다.

여러 방법이 있었는데 그중 OLE 사용하는 방법이다.

 

이 방법을 사용하기 위해서는 기능 영역에 OLE 자동화 사용이 활성화 되어 있어야 한다.

서비스 되고 있는 DB 장비는 이 기능을 ON 해 놓지 않기에 평범하게 사용할 수는 없다.

 

(클릭해서 크게 보세요)

 

CREATE PROCEDURE sp_diskspace
AS
/*
   Displays the free space,free space percentage
   plus total drive size for a server
*/
SET NOCOUNT ON

DECLARE @hr int
DECLARE @fso int
DECLARE @drive char(1)
DECLARE @odrive int
DECLARE @TotalSize varchar(20)
DECLARE @MB bigint ; SET @MB = 1048576

CREATE TABLE #drives (drive char(1) PRIMARY KEY,
                      FreeSpace int NULL,
                      TotalSize int NULL)

INSERT #drives(drive,FreeSpace)
EXEC master.dbo.xp_fixeddrives

EXEC @hr=sp_OACreate 'Scripting.FileSystemObject',@fso OUT
IF @hr <> 0 EXEC sp_OAGetErrorInfo @fso

DECLARE dcur CURSOR LOCAL FAST_FORWARD
FOR SELECT drive from #drives
ORDER by drive

OPEN dcur

FETCH NEXT FROM dcur INTO @drive

WHILE @@FETCH_STATUS=0
BEGIN

        EXEC @hr = sp_OAMethod @fso,'GetDrive', @odrive OUT, @drive
        IF @hr <> 0 EXEC sp_OAGetErrorInfo @fso
       
        EXEC @hr = sp_OAGetProperty @odrive,'TotalSize', @TotalSize OUT
        IF @hr <> 0 EXEC sp_OAGetErrorInfo @odrive
                       
        UPDATE #drives
        SET TotalSize=@TotalSize/@MB
        WHERE drive=@drive
       
        FETCH NEXT FROM dcur INTO @drive

END

CLOSE dcur
DEALLOCATE dcur

EXEC @hr=sp_OADestroy @fso
IF @hr <> 0 EXEC sp_OAGetErrorInfo @fso

SELECT drive,
       FreeSpace as 'Free(MB)',
       TotalSize as 'Total(MB)',
       CAST((FreeSpace/(TotalSize*1.0))*100.0 as int) as 'Free(%)'
FROM #drives
ORDER BY drive

DROP TABLE #drives

RETURN
go

'T-SQL' 카테고리의 다른 글

T-SQL::Attach  (1) 2009.12.01
T-SQL::테이블 ROWCOUNT, 사이즈  (0) 2009.11.27
T-SQL::Index Script  (1) 2009.11.19
T-SQL::List all indexes in database  (0) 2009.11.19
2009. 7. 17. 19:35

복제::Snaphort DB 이용한 데이터 초기화.

트랜잭션 복제, 병합복제, 스냅숏 복제에 게시를 초기화 하는 방법 중에 스냅숏 DB를 사용한 게시 초기화 방법.

  •  SQL Server 2005 Enterprise Edition 서비스 팩 2 이상 버전일 경우만 가능

 

현재 구독 초기화 방법중 알고 있는 방법은

  • 스냅숏 복제를 이용하는 방법
  • Db 백업 후 복원을 이용하는 방법
  • 게시할 테이블을 BCP 나 SSIS를 통해 데이터를 이관해 둔 상태로 처리하는 방법
  • 스냅숏 DB를 사용하는 방법

 

방법

게시의 속성 중에  sync_method 옵션중에  database snapshot 가 추가 되었음 (database snaphort character : 문자모드, 사용하지 않은 것이 좋을 것 같음)
해당 옵션은 복제 마법사를 통해서 세팅이 불가능하며, 게시를 설정한 후 아래 스크립트로 변경해야 한다.

    1. 게시 DB에서 실행

    2. exec sp_helppublication;  

    3. exec sp_changepublication

          @publication = '게시 이름',

          @force_invalidate_snapshot = 1,

          @property  = 'sync_method',

          @value = 'database snapshot'  -- 5

 

결과

  •  이 방법으로 변경해서 게시를 초기화 하게 되면 게시이름_DB 이름으로 스탭숏 DB가 생성되며, 게시가 초기화 완료되면 삭제된다. 기존에 동일한 스탭숏 DB가 있다고 해도 항상 새로 생성한다. 
  • 대용량 DB일 경우 스탭숏 DB를 생성할 공간만 있다면, 이 방법을 사용했을 때 스냅숏 초기화 하는 과정 동안 서비스 DB에  테이블 lock가 걸리지 않으므로 서비스에 지장이 덜 가게 된다. 
  • 스냅숏 복제 작동 방법 : http://msdn.microsoft.com/ko-kr/library/ms151734(SQL.90).aspx

참고

2009. 7. 12. 23:27

64bit Standard 에디션 에서 "Lock Page in memory" 가능

SQL SERVER 2005 이상

좋은 소식!!

 

이제 2005, 2008의 스탠다드 에디션에서도 Locak Page Memory 사용이 가능해 졌다.

 

CU2 for SQL Server 2008 SP1 => http://support.microsoft.com/kb/970315/en-us

http://support.microsoft.com/kb/970279/ko
CU4 for SQL Server 2005 SP3 => http://support.microsoft.com/kb/970279/en-us

http://support.microsoft.com/kb/970279/ko

 

 

How to enable "Lock pages in Memory" at the Windows level:

  1. On the Start menu, click Run. In the Open box, type gpedit.msc. The Group Policy dialog box opens.
  2. On the Group Policy console, expand Computer Configuration, and then expand Windows Settings.
  3. Expand Security Settings, and then expand Local Policies.
  4. Select the User Rights Assignment folder. The policies will be displayed in the details pane.
  5. In the pane, double-click Lock pages in memory.
  6. In the Local Security Policy Setting dialog box, click Add.
  7. In the Select Users or Groups dialog box, add the account that runs the SQL Server Service.
  8. Restart the machine for these changes to take effect.

If you are running an Enterprise or Developer Edition of SQL Server 2005 or 2008, please stop here. The rest of the steps are for the Standard Edition Only.

  1. Ensure that the build of SQL Server 2008 is Cumulative Update 2 on Service Pack 1. Preferably, run the "select @@version" command against the SQL Server Instance and verify that the build is 10.00.2714.00. In case of SQL Server 2005, please verify that the build is 9.00.4226.
  2. Now  set  the  Trace  Flag  845 as a  startup trace flag. This can be done by adding
    -T845 to the startup parameters from the SQL Server Configuration Manager. Please refer to the screenshot below:

    SQLConfigManager
  3. Restart the SQL Server Service.
  4. Verify that the following message is written in the SQL Server ErrorLog file at startup:
            Using locked pages for buffer pool

Note: Enabling Locked Pages may have a negative performance impact on your system performance. Please consider all potential effects before you use this option.
Enabling this trace flag on the Enterprise Edition or the Developer Edition has no effect.

 

 

2009. 7. 10. 16:35

복제::article 상세 속성 정보

복제를 구성한 후 article 속성을 셋팅해서 게시 한 경우 추후 Aritical 속성을 확인할때 UI를 통한 확인도 가능하지만 부하가 있는 서버의 복제를 확인할때 UI가 응답 없음으로 될 경우가 있다.

 

sysarticles 테이블의 schema_option 값에 바이너리 값으로 속성값이 저장되며, 도움말 확인하여 연산해서 속성 확인 가능하다.

 

http://msdn.microsoft.com/ko-kr/library/ms173857.aspx

 

(트랜잭션 복제 기준)

select pub.name,art.pubid,art.artid --, art.objid
    ,art.dest_table
    ,case art.pre_creation_cmd when 0 then '없음' when 1 then 'DROP' when 2 then 'DELETE' when 3 then 'TRUNCATE' end as pre_creation_cmd
    ,case when (art.schema_option & 4) > 0 then 'TRUE' ELSE 'FALE' end as 'identity_ID열'
    ,case when (art.schema_option & 16) > 0 then 'TRUE' ELSE 'FALE' end as 'clustered'
    ,case when (art.schema_option & 32) > 0 then 'TRUE' ELSE 'FALE' end as 'UDT'
    ,case when (art.schema_option & 64) > 0 then 'TRUE' ELSE 'FALE' end as 'nonclustered'
    ,case when (art.schema_option & 128) > 0 then 'TRUE' ELSE 'FALE' end as 'PK'
    ,case when (art.schema_option & 256) > 0 then 'TRUE' ELSE 'FALE' end as 'triggers'
    ,case when (art.schema_option & 512) > 0 then 'TRUE' ELSE 'FALE' end as 'FK'
    ,case when (art.schema_option & 1024) > 0 then 'TRUE' ELSE 'FALE' end as 'check'
    ,case when (art.schema_option & 2048) > 0 then 'TRUE' ELSE 'FALE' end as 'default'
    ,case when (art.schema_option & 16384) > 0 then 'TRUE' ELSE 'FALE' end as 'unique_const'
    ,case when (art.schema_option & 134217728) > 0 then 'TRUE' ELSE 'FALE' end as 'ddl'
    ,case when (art.schema_option & 262144) > 0 then 'TRUE' ELSE 'FALE' end as 'filegroup'
    ,case when (art.schema_option & 524288) > 0 then 'TRUE' ELSE 'FALE' end as 'partition'
    ,case when (art.schema_option & 1048576) > 0 then 'TRUE' ELSE 'FALE' end as 'partition_index'
    ,case when (art.schema_option & 1073741824) > 0 then 'TRUE' ELSE 'FALE' end as 'permissions'
from sysarticles as  art
    inner join syspublications as pub  on art.pubid = pub.pubid
order by pub.pubid


 

 

2009. 7. 9. 18:27

Trouble Shooting Query Performance Issues Related to Plan Cache in SQL 2005 RTM and SP1

http://blogs.msdn.com/sqlprogrammability/archive/2007/01/20/trouble-shooting-query-performance-issues-related-to-plan-cache-in-sql-2005-rtm-and-sp1.aspx

 

 

SQL  SP3  CU4 부터 2005 X64 스탠다드 에디션에서 Lock Page in Memory 기능을 사용할 수 있게 되었음.

'ETC' 카테고리의 다른 글

최상위 코어 i7 프로세서를 낳은 인텔 네할렘 아키텍처  (0) 2010.06.10
유틸::엑셀이용 데이터 입력  (1) 2010.06.03
Active Directory Management  (0) 2009.09.16
Windows용 Dr. Watson  (0) 2009.09.14