sqlserver2008 用维护计划备份数据库,怎么异地备份到别的服务器上,磁盘映射也不管用啊。。。
------解决方案--------------------------------------------------------
试试通过一台服务器向另一台服务器授权实现
------解决方案--------------------------------------------------------
做数据镜像!
- SQL code
一、建立证书:主:建立证书drop master keydrop certificate host_a_cert --证书名host_a_certcreate master key encryption by password='mbooKsKmK_00e3syc'create certificate host_a_cert with subject='host_a',start_date='10/10/2010'备机:建立证书drop master keydrop certificate host_b_certcreate master key encryption by password='mbooKsKmK_00e3syc'create certificate host_b_cert with subject='host_b',start_date='10/10/2010'二、建立端点:主:create endpoint endpoint_carpoolstate=startedastcp(listener_port=5022,listener_ip=all)for database_mirroring(authentication=certificate host_a_cert,encryption=REQUIRED ALGORITHM AES,role=all)备:create endpoint endpoint_carpoolstate=startedastcp(listener_port=5022,listener_ip=all)fordatabase_mirroring(AUTHENTICATION = CERTIFICATE HOST_B_cert , ENCRYPTION = REQUIRED ALGORITHM AES , ROLE = ALL)三、备份证书主:backup certificate host_a_cert to file='d:\host_a_cert.cer'备:backup certificate host_b_cert to file='d:\host_b_cert.cer'四、互换证书HOST_A_cert.cer复制到备机的D:\HOST_B_cert.cer复制到主机的D:\五、添加登录主体:create login host_b_login with password='mbooKsKmK_00e3syc'create user host_b_user for login host_b_login;create certificate host_b_cert authorization host_b_user from file='d:\host_b_cert.cer';grant connect on endpoint::endpoint_carpool to [host_b_login]备:CREATE LOGIN host_a_login WITH PASSWORD = 'mbooKsKmK_00e3syc';CREATE USER host_a_user FOR LOGIN host_a_login;CREATE CERTIFICATE host_a_cert AUTHORIZATION host_a_user FROM FILE ='D:\HOST_A_cert.cer';GRANT CONNECT ON ENDPOINT:: endpoint_carpool TO [host_a_login];六:建立镜像主:alter database carpool set partner='tcp://备机ip:5022'备:alter database carpool set partner='tcp://主机ip:5022'其他事项:1、alter database test set partner off 删除test数据库的数据库镜像;重建的时候需要先删除;2、如果出现错误,可以通过查看系统日志来分析;通常情况是权限问题(需要重新分配证书和权限);七:镜像高可用性实现主备互换:主(一定要在主上执行,备上执行与否无所谓):alter database 操作的数据库名 set partner failover;备:alter database 操作的数据库名 set partner force_service_allow_data_loss;主机出现问题需要启用备机则过程如下:1\alter database 操作的数据库名 set partner force_service_allow_data_loss;2\alter database test set partner off过程不可颠倒如果原来的主服务器恢复,则重新设定镜像备:alter database 操作的数据库名 set partner resume;alter database 操作的数据库名 set partner failover;