'MSSQL'에 해당되는 글 3건

  1. 2014.07.10 SQL Server connection strings
  2. 2014.07.07 MSSQL Log 축소 스크립트 생성 쿼리
  3. 2013.06.26 SQL Server Log 파일 축소하기

SQL Server connection strings

DATABASE/SQL Server 2014. 7. 10. 16:07

SQL Connection String 중 눈여겨 볼만한 내용은 Failover Partner 라는 부분이다.

SQL Server 를 Mirror 방식으로 운영중이라면 Failover Partner 정보를 넣어서 메인 SQL Server 에 문제가 있을 경우 Mirror SQL Server 로 연결해준다.

Database mirroring

If you connect with ADO.NET or the SQL Native Client to a database that is being mirrored, your application can take advantage of the drivers ability to automatically redirect connections when a database mirroring failover occurs. You must specify the initial principal server and database in the connection string and the failover partner server.

Data Source=myServerAddress;Failover Partner=myMirrorServerAddress;
Initial Catalog
=myDataBase;Integrated Security=True;

There is ofcourse many other ways to write the connection string using database mirroring, this is just one example pointing out the failover functionality. You can combine this with the other connection strings options available.


SQL Server 2005 / 2008 / 2012 에 해당하며 자세한 내용은 출처 URL 을 참고하면 된다.


출처 : http://www.connectionstrings.com/sql-server-2012/


:

MSSQL Log 축소 스크립트 생성 쿼리

DATABASE/SQL Server 2014. 7. 7. 22:56

데이터베이스 별로 로그축소 쿼리를 자동으로 생성하는 쿼리


select 'use '+ name +'
go
alter database '+ name +' set recovery simple
go
dbcc shrinkfile('+ name +'_log)
go
alter database '+ name +' set recovery full
go'
from master.dbo.sysdatabases



생성된 실행 쿼리 (member database인 경우)

use member
go
alter database member set recovery simple 
go   
dbcc shrinkfile(member_log) 
go   
alter database member set recovery full
go 


:

SQL Server Log 파일 축소하기

DATABASE/SQL Server 2013. 6. 26. 14:32

2005 이상 버전에서만 적용


alter database [database name] set recovery simple
go


dbcc shrinkfile([database log name], 1)
go


alter database [database name] set recovery full
go


ex)
use tsdms_New;
alter database tsdms_new set recovery simple;
dbcc shrinkfile (tsdms_new_log, 1);
alter database tsdms_new set recovery full;

use vims;
alter database vims set recovery simple;
dbcc shrinkfile (vims_log, 1);
alter database vims set recovery full;

: