在论坛看到收缩主数据库在 Mirror 上没有效果的问题。以前我也认为在主数据库上执行的 DBCC Shirnkfile 命令会在 Mirror 数据库上重做,所以收缩主数据库可以导致Mirror数据库跟着收缩。事实不是。从MS网站找到的资料: When you use databasemirroring in M
在论坛看到收缩主数据库在Mirror上没有效果的问题。以前我也认为在主数据库上执行的DBCC Shirnkfile命令会在Mirror数据库上重做,所以收缩主数据库可以导致Mirror数据库跟着收缩。事实不是。从MS网站找到的资料:
When you use databasemirroring in Microsoft SQL Server 2005, SQL Server automatically propagates anychanges on the principal database to the mirror database. However, if you runthe DBCC SHRINKDATABASE statement or the DBCC SHRINKFILE statements to shrinkthe principal database,theshrink operation is not duplicated on the mirror database.
CAUSE:Database mirroring will change the physical file sizes only after a checkpoint.
在主数据库上执行DBCC SHRINKDATABASE或者DBCC SHRINKFILE的命令,收缩的操作不会在Mirror数据库上重做。原因是:Mirror数据库只在checkpoint动作后才会修改物理文件的大小。
有几个办法可以解决这个问题:
1. 在Master数据库执行下面的命令创建存储过程,在主数据库上运行创建的存储过程。
use master
go
if object_id('sp_shrink_mirrored_database','P') is not null
drop proc sp_shrink_mirrored_database
go
create procedure sp_shrink_mirrored_database@dbnamesysname, @target_percent int = null
as
begin
declare@filenamesysname
declare@filesizeint
declare@sqlnvarchar(4000)
if @target_percent is null
dbccshrinkdatabase(@dbname)
else
dbccshrinkdatabase(@dbname,@target_percent)
declareccursor for
select[name],[size] from sys.master_fileswhere type=0and database_id = db_id(@dbname)
open c
fetch next from cinto @filename,@filesize
while @@fetch_status=0
begin
set @filesize=(@filesize+1)*8
set @sql='alter database ['+ @dbname + '] modify file ( name='
+ @filename + ', size='+ cast(@filesizeas nvarchar)+ 'kb )'
executesp_executesql@sql
fetchnextfrom c into @filename,@filesize
end
close c
deallocatec
end
go
2. 在主数据库上执行收缩命令之后手动允许checkpoint命令。
3. 可以考虑做Failover将辅助的直接变成主的,执行收缩命令。
另外建议经常对数据库进行日志备份,如果发现日志文件增长的快可以考虑增加备份的频率,这样可以导致日志空间重用,从而减少日志文件的增长。
另外在2008版本上测试不会有这个问题,收缩的命令可以成功在Mirror上面起作用,所以这个现象可能只限于2005的版本。

todropaViewInmysql, "dropviewifexistsview_name;"및 TomodifyAview를 사용하고 "createOrreplaceViewView_NameAsselect ...". "

mysqlViewScaneFeficTicallyINGILIDESIGNPATTORNSLIKEADAPTER, DECIARATOR, FACTORY 및 OBSERVER.1) AdapterPatternAdAptSDataFromDifferentTablesinToAunifiedView.2) Decor

viewsinmysqlarebeneficialforsimplifyingcomplexqueries, envancingsecurity, dataconsistency, andoptimizing promperformance

toeteimpleviewinmysql, usethecreateviewstatement.1) definetheviewwithReateViewview_nameas.2) specifyTesLectStatementToreTrievesiredData.3) usetheViewLikeAtableForqueries.ViewsSimplifyDataAccessAndenHances, ButconSiderFormance

toCreateUserSinmysql, usethecreateuserstatement.1) foralocaluser : createUser'LocalUser '@'localHost'IndifiedBy'SecurePassword '; 2) foremoteUser : createUser'RemoteUser'@'%'reidentifiedBy'StrongPassword ';

mysqlviewshavelimitations : 1) 그들은 upportallsqloperations, datamanipulation throughviewswithjoinsorbqueries를 제한하지 않습니다

적절한 usermanagementInmysqliscrucialforenhancingsecurityandensuringfefficientDatabaseOperation.1) USECREATEUSERTOWDDUSERS,@'localHost'or@'%'.

mysqldoes notimposeahardlimitontriggers, butpracticalfactorsdeteirefectiveuse : 1) ServerConfigurationimpactStriggerManagement; 2) 복잡한 트리거 스케일 스케일 사이드로드; 3) argertableSlowtriggerTriggerPerformance; 4) High ConconcercencyCancaUspriggerContention; 5) m


핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

Video Face Swap
완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

인기 기사

뜨거운 도구

ZendStudio 13.5.1 맥
강력한 PHP 통합 개발 환경

SecList
SecLists는 최고의 보안 테스터의 동반자입니다. 보안 평가 시 자주 사용되는 다양한 유형의 목록을 한 곳에 모아 놓은 것입니다. SecLists는 보안 테스터에게 필요할 수 있는 모든 목록을 편리하게 제공하여 보안 테스트를 더욱 효율적이고 생산적으로 만드는 데 도움이 됩니다. 목록 유형에는 사용자 이름, 비밀번호, URL, 퍼징 페이로드, 민감한 데이터 패턴, 웹 셸 등이 포함됩니다. 테스터는 이 저장소를 새로운 테스트 시스템으로 간단히 가져올 수 있으며 필요한 모든 유형의 목록에 액세스할 수 있습니다.

Atom Editor Mac 버전 다운로드
가장 인기 있는 오픈 소스 편집기

MinGW - Windows용 미니멀리스트 GNU
이 프로젝트는 osdn.net/projects/mingw로 마이그레이션되는 중입니다. 계속해서 그곳에서 우리를 팔로우할 수 있습니다. MinGW: GCC(GNU Compiler Collection)의 기본 Windows 포트로, 기본 Windows 애플리케이션을 구축하기 위한 무료 배포 가능 가져오기 라이브러리 및 헤더 파일로 C99 기능을 지원하는 MSVC 런타임에 대한 확장이 포함되어 있습니다. 모든 MinGW 소프트웨어는 64비트 Windows 플랫폼에서 실행될 수 있습니다.

맨티스BT
Mantis는 제품 결함 추적을 돕기 위해 설계된 배포하기 쉬운 웹 기반 결함 추적 도구입니다. PHP, MySQL 및 웹 서버가 필요합니다. 데모 및 호스팅 서비스를 확인해 보세요.