I have a SQL Server 2005 DB server (SRV1) and a mirror DB server (SRV2) without witness server. I saw that there is a "Failover" button on Mirror window of SRV1. When click it servers changes roles.
My question is that: If my mirrored DB server crashs and I can not open windows or if I lost all data on SRV1, how can I failover from only mirror DB (SRV2)?
I am using SQl Server 2012 Database Mirroring with around 40 gb as mdf and 1 gb as ldf. Now my ldf size increased . How to reduce ldf size while mirror enabled with mirror server and witness server. Can shrink the ldf with mirror enables.
I hope this is in the right forum, I'm new to MSDN. I'm also not an expert in SQL, so please bear with me as I was unable to find an answer by searching the archives.
We have a single SQL 2005 Standard installation with 30 user CALs on a Server2003R2 box. We have another Server 2003 box in a remote but connected location that we previously used for backup replication. What we'd like to do is use some of the replication features in SQL 2005 to replicate the data over every night to the other box, onto which we would install another copy of SQL 2005. This would not be a server accessed by clients, but simply a "live backup", that in the event of a catastrophic failure, could be manually set up to operate as a SQL server in place of the failed primary server. I don't need any kind of automatic "failover", just the ability to replicate the data over to the other system so I have two SQL Servers that synchronize from one to the other overnight.
I was told that I wouldn't need to buy the user CALs again, that the 30 user cals would translate over if the primary server fails and has to be replaced by the cloned server. But what do I buy for the SQL server itself? A boxed version is a bit pricy and comes with 5 CALs which apparently I wouldn't need. Then I noticed that on softwaremedia.com the open license version, which can be bought a la carte, lists a requirement of buying at least 5 cals or a processor license. What exactly do I need to do this, and how can I get it for the least amount of further spending?
I've tried to replicated exactly what it says in the online documentation. At the end of the post are the SQL statements issued.
1. Enable encrypted outbound connections on the primary server 2. Enable encrypted outbound connections on the mirror server 3. Enable encrypted outbound connections on the witness server 4. Enable encrypted inbound connections on the primary server 5. Enable encrypted inbound connections on the mirror server 6. Enable encrypted inbound connections on the witness server 7. Set mirror''s partner to the primary 8. Set primary''s partner the mirror 9. Set principal€™s witness. Every step run''s normally,but why can''t auto failover.
I used the following Script:
/* -------- 1. ENABLE OUTBOUND CONNECTIONS ON THE PRIMARY -------- */ use master; go DROP USER PrincipalLogin1 DROP LOGIN PrincipalLogin1 DROP USER PrincipalLogin2 DROP LOGIN PrincipalLogin2 GO
Create login PrincipalLogin1 with password='PrincipalLogin' go Create user PrincipalLogin1 from login PrincipalLogin1 go
Grant connect on endpoint::Principal_Endpoint_Mirroring to PrincipalLogin1 go ---stop
create certificate MirrorCertForPartnerPub authorization PrincipalLogin1 from file = 'd:BackupCertMirrorCertForPartner.cer'; go
Create login PrincipalLogin2 with password='PrincipalLogin' go Create user PrincipalLogin2 from login PrincipalLogin2 go
Grant connect on endpoint::Principal_Endpoint_Mirroring to PrincipalLogin2 go create certificate WintnessCertForPartnerPub authorization PrincipalLogin2 from file ='D:BackupCertCertForDBRole.cer' GO
ALTER DATABASE Mirrortest SET PARTNER = 'TCP://10.1.40.158:5022' GO
ALTER DATABASE Mirrortest SET witness = 'TCP://10.10.11.30:7000' GO
select * from sys.certificates
/* -------- 2. ENABLE OUTBOUND CONNECTIONS ON THE MIRROR -------- */ --On Mirror --Remove the database --Connect to either partner. --Issue the following Transact-SQL statement:
ALTER DATABASE Mirrortest SET PARTNER OFF
--Optionally, you can recover the former mirror database. On the server instance that was the mirror server, enter:
--RESTORE DATABASE Mirrortest WITH RECOVERY;
RESTORE DATABASE [Mirrortest] FROM DISK = N'D:BackupCertMirrortest.bak' WITH FILE = 1, NORECOVERY, NOUNLOAD, REPLACE, STATS = 10 GO select * from sys.endpoints
drop endpoint Mirror_Endpoint_Mirroring
select * from sys.certificates
Create certificate MirrorCertForPartner with subject ='this is the certificate for mirror', start_date='06/25/2006'
backup certificate MirrorCertForPartner to file='d:ackupcertMirrorCertForPartner.cer'
CREATE ENDPOINT Mirror_Endpoint_Mirroring STATE=STARTED AS TCP (LISTENER_PORT=5022) FOR DATABASE_MIRRORING ( Authentication=Certificate MirrorCertForPartner ,ROLE=ALL) GO
/* -------- 3. ENABLE OUTBOUND CONNECTIONS ON THE WINTESS -------- */
--On Witness
USE [master] GO
select * from sys.certificates
drop certificate CertForDBRole GO
create master key encryption by password='asdf'
Create certificate CertForDBRole with subject='this is a certificate for pricipal role', start_date='06/25/2006'
backup certificate CertForDBrole to file='c:CertForDBRole.cer'
select * from sys.endpoints
drop endpoint Witness_Endpoint_Mirroring
CREATE ENDPOINT Witness_Endpoint_Mirroring STATE=STARTED AS TCP (LISTENER_PORT=7000) FOR DATABASE_MIRRORING ( Authentication=Certificate CertForDBRole ,ROLE=ALL) GO
/* -------- 4. ENABLE INBOUND CONNECTIONS ON THE PRIMARY -------- */ use master; go DROP USER PrincipalLogin1 DROP LOGIN PrincipalLogin1 DROP USER PrincipalLogin2 DROP LOGIN PrincipalLogin2 GO
Create login PrincipalLogin1 with password='PrincipalLogin' go Create user PrincipalLogin1 from login PrincipalLogin1 go
Grant connect on endpoint::Principal_Endpoint_Mirroring to PrincipalLogin1 go ---stop
create certificate MirrorCertForPartnerPub authorization PrincipalLogin1 from file = 'd:BackupCertMirrorCertForPartner.cer'; go
Create login PrincipalLogin2 with password='PrincipalLogin' go Create user PrincipalLogin2 from login PrincipalLogin2 go
Grant connect on endpoint::Principal_Endpoint_Mirroring to PrincipalLogin2 go create certificate WintnessCertForPartnerPub authorization PrincipalLogin2 from file ='D:BackupCertCertForDBRole.cer' GO
ALTER DATABASE Mirrortest SET PARTNER = 'TCP://10.1.40.158:5022' GO
ALTER DATABASE Mirrortest SET witness = 'TCP://10.10.11.30:7000' GO
select * from sys.certificates
/* -------- 5. ENABLE INBOUND CONNECTIONS ON THE MIRROR -------- */ use master; go DROP USER MirrorLogin1 DROP LOGIN MirrorLogin1 DROP USER MirrorLogin2 DROP LOGIN MirrorLogin2 GO
Create login MirrorLogin1 with password='MirrorLogin' go Create user MirrorLogin1 from login MirrorLogin1 go
Grant connect on endpoint::Mirror_Endpoint_Mirroring to MirrorLogin1 go
--stop create certificate PrincipalCertForPartnerPub authorization MirrorLogin1 from file = 'd:BackupCertPrincipalCertForPartner.cer'; go
Create login MirrorLogin2 with password='MirrorLogin' go Create user MirrorLogin2 from login MirrorLogin2 go create certificate WitnessCertForPartnerPub authorization MirrorLogin2 from file ='D:BackupCertCertForDBRole.cer' GO
Grant connect on endpoint::Mirror_Endpoint_Mirroring to MirrorLogin2 go
ALTER DATABASE Mirrortest SET PARTNER = 'TCP://10.10.116.42:5022' GO
ALTER DATABASE Mirrortest SET WITNESS = 'TCP://w7mis02:5024' GO
/* -------- 6. ENABLE INBOUND CONNECTIONS ON THE WITNESS -------- */
use master; go DROP USER WitnessLogin1 drop login WitnessLogin1 DROP USER WitnessLogin2 drop login WitnessLogin2
Create login WitnessLogin1 with password='WitnessLogi*n@' go create user WitnessLogin1 from login WitnessLogin1 go
create certificate PrincipalCertForPartnerPub authorization WitnessLogin1 from file = 'c:ackupcertPrincipalCertForPartner.cer'; go --*************************************** Create login WitnessLogin2 with password='WitnessLogi*n@' go create user WitnessLogin2 from login WitnessLogin2 go
create certificate MirrorCertForPartnerPub authorization WitnessLogin2 from file = 'c:ackupcertMirrorCertForPartner.cer'; go
Grant connect on endpoint::Witness_Endpoint_Mirroring to WitnessLogin1 go Grant connect on endpoint::Witness_Endpoint_Mirroring to WitnessLogin2 go
After adding the Witness Server to the Mirror session, the Witness Connection state between the Mirror and Witness Connection is Disconnected and the state between Principal and Witness Connection is Connected.
The procedures defined in Books Online was used to setup Database Mirroring...when the Witness server was added to the Mirror session, only the alter database T-SQL statement was executed on the Principal server.
ALTER DATABASE <db_name> SET WITNESS = 'TCP://<servername>:<port>'
After executing the above statement, a few seconds later the state between Principal and Witness Connection changed to Connected and the state between Mirror and Witness Connection remains Disconnected.
The Mirror session is not using Certificates, every server is on the same domain, using the same domain login account, and all servers have SP2 installed running Enterprise Edition.
Any idea's why the state between Mirror and Witness Connection remains Disconnected?
I'm trying to setup a SQL 2005 SP2 Mirror in between two mashines with no witness server.
I have successfully established the following:
1. Backup The Database on Principal Server: OK!
2. Copy the backup over to the mirror server: OK!
3. Restore the Database on Mirror Server: OK!
4. Establish Endpoint on Principal Server: Encyrption Disabled OK! TCP - PORT 5022
4.1 Test Script: Checks fine (values match)
SELECT e.name, e.protocol_desc, e.type_desc, e.role_desc, e.state_desc, t.port, e.is_encryption_enabled, e.encryption_algorithm_desc, e.connection_auth_desc FROM sys.database_mirroring_endpoints e JOIN sys.tcp_endpoints t ON e.endpoint_id = t.endpoint_id 5. Establish Endpoint on Mirror Server: Encyrption Disabled OK! TCP - PORT 5022
5.1 Test Script: Checks fine (values match) (same script as above)
6. Specify Principal server from Mirror server: OK! Connecting with IP
7. Specify Mirror server from Principal server: OK! Connecting with IP
8. View Mirror Information:
8.1 Test Script: Shows everything in NULL
SELECT mirroring_state_desc, mirroring_partner_name, mirroring_witness_name, mirroring_witness_state_desc, mirroring_role_desc, mirroring_safety_level_desc FROM sys.database_mirroring
Mirror endpoints are still in red even though they initialized correctly. Mirror monitor shows no mirrors are up. SQL Logs shows: The Database Mirroring protocal transport is now listening for connections. Any help would be appreciated.
please see my post in the previous thread; http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=2606008&SiteID=17&mode=1 We are making our final decission of using either transaction log replicant or a database mirror replicant and which solution would provide the biggest ease of provisioning as well as the fastest turn around in recovery.
"Good Morning Team,
I have a client whom has a 2 node SQL 2005 cluster with over 100 databases, their schema design is that they create a new database for every customer that signs to their services.
The problem I am encountering is that for every new database created in the cluster we like to setup a SQL2005 mirror replicant at a remote site for disaster recovery should the cluster ever fail.
i'm looking at the SQL professionals to help me with 2 questions.
#1 Upon creation of a new database in the cluster is there an easily scripted method that could be used to automatically create the mirror replicant, what about if not being aware of the new databases having been created? since we do not know when the customer creates databases or perhaps a SQL job that could be done based on new databases created that would automatically script the procedure of a database mirror.
#2 understanding the procedures required in a mirror replicant from a cluster primary involving, database backup, database restore to mirror replicant, transaction log backup and then transaction log restore with both points of the restore leaving the mirror replicant in NO RECOVERY mode and lastly creating the connection end points.
has anyone encountered such a situation with a database cluster with a mirror replicant consisting of such a wide span of individual smaller databases and would anyone have suggestions on how to make this highly available with a mirror replicant?
I have SQL 2005 mmirroring sucessfully working in an ASP.NET 2.0 web application. I also have session state being maintained in SQL Server using the built-in functionality in ASP.NET. The problem is, even with "allowCustomSqlDatabase=True" and specifying a failover partner in the DSN, it appears that ASP.NET does not work with the failover partner. It always tries to get the session info from the "data source" server specified in the DSN.
Is there a way to get the session state to fail over to the mirrored server without writing a custom session state provider?
I was trying to test mirroring and now would like to delete the mirror database but it says I need to remove database mirroring first. I deleted the endpoint and cannot figure out how to remove the mirroring. Can someone please help.
Hi all, I feel happy to post my first thread at dbforums.com, and I think it's the community of DB professionals. my question is: I have two servers in my organization, one of them is running an SQL server database. Is there any way to make the second server a mirror of the first one and to make it runs automatically as the main server when the first server is down?
I have an access database, I am new to the SQL SERVER scene. How do I mirror the database I have in Access with out it being interrupted from its functions?
Hi folks. I'm trying to clear up some licensing confusion I"ve come across. First, if I use MIRROR on SS SE I am limited to a single REDO thread and Sycn mode. I see that on the Web. Will the singel REDO thread hurt the ability for the Secondary to keep up? Any one done any tests?
My confusion comes from a document that came across my desk a long time ago that showed that if you use MIRROR on SQL Server SE you are limited to 4 processors for the entire cluster. So if you wanted a balanced failover you would have to have two 2-ways in essence. Is this true? Is it not longer true? I can't seem to find any mention of this....did someone give me bad advice? Help! Thanks.
SQL Server replication requires the actual server name to make a connection to the server. Connections through a server alias, IP address, or any other alternate name are not supported. Specify the actual server name, 'xxxxxx'. (Replication.Utilities)
If your principal fails and your mirror assumes the main role and it is in Full recovery mode (which it has to be in Standard edition), then the log files will grow and grow until a transaction backup and shrink is executed.
I have maintenance plans running daily (and hourly for transaction log backup/shrink) on my principal, but nothing on my mirror.
Do I need to set up the same maintenance plans on my mirror server???
I have SQL 2005 database mirrror enviroment with MS jdbc driver 1.1. From code, I need to get server name that current connection connect to at run time (which server that the current connection connect to: Priciple server or mirror server). Any help for that?
Can a MIRROR server have mirrored databases on many instances or must all of the mirrored databases on a server reside on one instance?
This initial implementation worked fine:
PRINCIPAL ServerPROD1instance01 endpoint1430 MIRROR ServerDRinstance01 endpoint1440 WITNESS ServerZ endpoint1450
This second implementation (different PRINCIPAL server to same MIRROR but to a different instance)
PRINCIPAL ServerPROD2instance5 endpoint1430 MIRROR ServerDRinstance02 endpoint1440 <<same mirror server but different instance WITNESS ServerZ endpoint1450
I know that you can only install one endpoint on each server. Does that mean that the endpoint can only resolve to one instance though?
The second implementation looks fine until the final step (start mirroring). I get the following error:
An error occured while starting mirroring Alter failed for database 'test' An exception occurred while executing transaction-sql statement or batch The remote copy of database 'test' does not exist. Check the database name and resissue the command
I have created the test database in instance02 and rolled a log onto it. It is currently in recovery mode - waiting patiently for another log.....
I have read books online and 2k5 unleashed but can't see anything that relates to an implementation across mutliple instances on the DRmirrored servers.
Has anyone tried to do this? Can you confirm its possible?
the Mirror Server is not connected to the Witness Server.
Mirror Server and Wtiness Server are instances on one server.
I get this error:
" 2007-06-28 17:08:12.77 spid23s The server instance Witness rejected configure request; read its error log file for more information. The reason 1451, and state 3, can be of use for diagnostics by Microsoft. This is a transient error hence retrying the request is likely to succeed. Correct the cause if any and retry."
In the SQL Profiler for the Witness Server I get "An error occurred while receiving data" Error 64.
In the witness server logs is nothing depending on this.
The connection between the witness and principal and the mirror and principal are all right. I have created User logins with certificates on the same way on all instances.
I have created a Endpoint with "Mirroring Server" on the mirroring instance. Due to the keyword server i am not able to drop the endpoint now.
Also am not able to configure a mirror in a windows workgroup also( the two systems principal and mirror are under same network ). I have followed many ways as per msdn articles and other blogs.
I am not able to connect to the mirror server.Â
I have tried giving the ip addr and the port no, also the computer name:port no, computername.local:port no etc. Both the systems are running on sql server 2008 only
I always get the error as Connection cannot be established to the destination.
(I have also enabled the ports in firewall by creating inbound and outbound rules)
The issue probably lies in NAMING server address i guess.
Hi everybody, I have a mirroring set up for around 30 databases in a 64 bit - 2 powerfull servers scenario - wih latest sp2 + hotfix. Mirroring works perfectly most of the times but when the principal is getting busy during the busy period of the day all of a sudden the processor on the mirror jumps to 100% and stays there for a long time - there are no live databases on the mirror server - all the databases are in mirrored mode. The principal server processor is less than 5% all the time. The network load between the principal and the mirror is also in normal limits. The principal server is dedicated to SQL but the mirror has other things too but the other processes use up maximum 15-20% of the CPU and when I stop SQL Server in one of those moments when the CPU jumps to 100% everything comes back to normal so it's clear that the issue is SQL on the mirror. Any ideas would be greatly appreciated.
I have do some benchmark test between the "Principle", "Mirror" and "Witness", things seems normal, the System usage (CPU, Disk Read/Write) on the "Witness" is very small and the CPU usage on Principle and Mirror is similar, However....
For the "Disk Write Bytes/sec", the usage on Principle is 200,000 and the Mirror is 1,500,000, the mirror server is talking about x7 times Disk Write Bytes/sec on the Mirror.
I cannot think of any reason why the Disk Write Bytes /sec is so much higher than the Principle, can somebody help me?
Hi guys, right now I am having insufficient hard disc space at the secondary server (Mirror side) due to the large db that I have. Therefore, I get a new HDD on the server (Assuming located at drive G) and would like to shift the current mirroring db to that new drive. Is it possible for me to do that ? Hope able to get any suggestion from here ASAP. Thanks.
II use the mirroring wizard to config all these three servers(windows authorization is used), the error logs in primary server and mirror server are showed as below a) On primary server: Error: 1474, Severity: 16, State: 1 Database mirroring connection error 4 'An error occurred while receiving data: '10054(An existing connection was forcibly closed by the remote host.)'.' for 'TCP://mymirror.mydomain:5022' b) On mirror server: Database Mirroring login attempt by user 'NT AUTHORITYANONYMOUS LOGON.' failed with error: 'Connection handshake failed. The login 'NT AUTHORITYANONYMOUS LOGON' does not have CONNECT permission on the endpoint. State 84.'.
It states I do NOT have permission on this endpoint, but actually, I grant the permission to the endpoint on both primary and mirror server using command GRANT CONNECT ON ENDPOINT::Mirroring TO [mydomainmyuser]; Also, I followed the article http://msdn2.microsoft.com/en-us/library/ms189127.aspx ,no firewall issue, the endpoint is created and started by checking sys.database_mirroring_endpoints Hope someone can help me resolve this issue... Thank you very much..
I have an urgent requirement to setup a backup SQL server 2000. This will run as a mirror of the live SQL server 2000 which processes about 5000+ statements per minute. I will need to keep the mirror server as close to the live as possible, so if we need to take down the live server we can switch users to the backup server (it’s ok I can do this in code – client side.) and I may also be reporting from this server to take some of the strain from the live server (if that’s wise – not sure yet).
Can someone please point me in the right direction? What other software (apart from MS SQL server 2000) will I need? What sort of link do I need between both servers? (note: I don't want to do this link using triggers for each table if possible) Are there any pitfalls to look out for (i.e. I seem to remember something about auto id fields in tables but this was a long time ago so I could be wrong).
Please note I am a programmer with a lot of experience, but I don’t know that much about setting up SQL servers (well I can install one locally on my dev machine, but that’s really as far as I go) but I am willing to learn and investigate anything, so just giving me sites that I can look at will be enough.
I was contacted by the SAN team to test backup/restore of larger databases using a split-mirror backup (BCV) or clone that is taken from production db server and copied to another sql box. They want to use this process once a week. I see the mounted drives with the data/log files. All looks good. Initially I attempted to attach the databases and received (Unable to open the physical file db.mdf Operating System Error 5 Access is denied). I manually granting SQLServerMSSQLUser$<computer_name>$<instance_name> on all of the physical files 20 total. That worked.
Since this will be weekly, the SAN team performed the copy again and now none of the databases can communicate with the newly copied files. NTFS permissions need to be set again. I'm getting (Operating System error 21: the device is not ready). Is there something that I'm missing in this process how the vendor BCV clones the data and SQL communicates with the copied files as I was thinking it would be more automated process?
We use SQL server always on feather on my database and we distribute statement on main database server and mirror database server for raise performance.
My police for split statement is DML (insert, update and delete) statement go to main DB and Read Data (select) statement go to mirror DB.
I want know can I use different index on main DB and mirror Database?
Because some index are used in mirror DB not used in main database.
I have setup a database mirroring session without witness - ServerA is the principal, ServerB is the mirror,. Each SQL Server instance is hosted on its own machine on sql2005 EE SP2. The mirroring is working correctly. If I submit to server ServerA command:
ALTER DATABASE MYDBNAME SET PARTNER FAILOVER
, ServerB becomes the principal, it means that mirroring works correctly.
My issue is with the SQL Native Client and a front-end ASP application (actually IIS 6.0 site) that needs to make use of this database. I have setup my front-end application to use SQL Native Client and specified the failover server in connection string. Here is the connection string that I am using :
Everything works perfectly on my front-end application when ServerA is the principal. If I execute on server ServerA command:
ALTER DATABASE MYDBNAME SET PARTNER FAILOVER
, ServerB becomes the principal, and the failover occurs correctly on the database side. The problem is that my front-end application is not able to query the database on ServerB. The error appears:
Microsoft SQL Native Client error '80004005'
Cannot open database "MYDBNAME" requested by the login. The login failed.
This behavior my appication till I unload IIS 6.0 pool application. After that my front-end application becomes work correctly with ServerB.
When I swap server, I execute on server ServerB command:
ALTER DATABASE MYDBNAME SET PARTNER FAILOVER,
my IIS 6.0 application automaticly turn back to ServerA without any action on my side.
I am using SQL Native Client last version http://download.microsoft.com/download/2/7/c/27c60d49-6dbe-423e-9a9e-1c873f269484/sqlncli.msi (issued in February 2007). Has anyone experienced this issue? I'm thinking that it's a problem in the SQL Native client
missing witness server information and the fail-over is broken suddenly? 4:00am no maintenance job. I have one sql job on 10pm for backup on database transaction log only.
I can see the primary have problem then perform fail-over to mirror database, the auto fail-over was broken.
I re-build the sql mirror is OK , but i want to find the root cause.
Windows application event was full when there have many failed event, i have increase log size for application event. Â
We have a new server that is 64-bit and I have been approached about using the old 32-bit SQL Server (after a complete format and reinstall) for a mirrored server.
Either that, or buy a new Server with less power that would be used in times of need.
I have two sql 2005 servers. I want to do mirroring. My question is does mirroring supports store procedures, ssis packages, user log in ids also? I know mirroring supports database level. In this case, mirroring should supports sp and indexes also. Am I right?
My client wants to provide a redundant server at a remote location. They want to have db access in a worst case "building burns down" scenario. Can I use mirroring to a remote location? Do I want to use mirroring to a remote location? What happens to my mirror set when some knucklehead with a backhoe digs up my high speed cable?
Am I better off, in this case, sticking with log shipping and manually bringing up the stand by server?