Database Mirroring and replication
Hi,
can mirroring and replication is possible on same instance of sql
of sql server 2008. if yes then please provide the information.
thanks in advance.
You may need to use traceflag 1448 to get this to work.
looking for a book on SQL Server 2008 Administration?
http://www.amazon.com/Microsoft-Server-2008-Management-Administration/dp/067233044X looking for a book on SQL Server 2008 Full-Text Search?
http://www.amazon.com/Pro-Full-Text-Search-Server-2008/dp/1430215941
Similar Messages
-
Database Mirroring and Replication in SQL Server 2008 R2
I have configured the mirroring and replication between 4 servers (A,B,C,D).i.e, Mirroring between A to B and C to D, Replication between A and C. The configuration was a success and I am able test the replication(B to C) when I have failed over the mirroring
dbs(A to B). The replication works fine after the mirroring fail over but I am not able to check its status in the Replication monitor. When I am having any insert in a table which is replicated in B, it is reflected back to C..it means the replication is
working fine.
Any thought on how I can view the status of replication from mirrored server. I tried adding the publisher in the monitor, but no luck. If I check the snapshot agent status, it says could not retrieve the info, same with the log reader agent status.
Any suggestions on this please.
Thanks, SiriFor example in your case...
Server A is principal and Server B is Mirror with either Manual or Automatic Failover.
Server A is replicated to Server B ( publisher & B is subscriber )
In Server A Database named Test_Mirror_Replication is configured for both mirroring and Replication.
Now you have failed over your Database 'Test_Mirror_Replication' from Server A to Server B.
After the Failover Server A will act as Mirror for DB 'Test_Mirror_Replication' & Server B will act as Principal for DB 'Test_Mirror_Replication'
Hope my understanding is correct ?
If yes then have you tried monitoring the replication after registering in other instance with current principal database sql instance name ? I mean current Publisher database name sql instance ? not your old sql instance name which was before the mirroring
role change or failover...
Hope you are trying with mirror database server name ?
Raju Rasagounder MSSQL DBA -
Difference between Database Mirroring and Cloning?
Hi,
Can anybody tell me the exact difference between Database Mirrorring and cloning?
Is database mirroring and multiplexing same?
Thanks
Rajeshcannot be kept current automatically with the source database It is possible using manually scripted code to automatically update a cloned database to in effect build your own mirrowing process. This is basically a description of home grown Data Guard and is how many sites maintained a ready to use backup prior to Oracle introducing Data Guard.
The best way to create a clone database today is probably to use the rman duplicate command.
The clone could be the base for use with a mirrowing process you are setting up or used for other purposes such as providing a consistent frozen snapshot of production for special reporting. It could become the unit test or system test environment or perhaps be used for diaster recovery purposes.
A clone is a one-time event. Mirrowing is an ongoing process.
HTH -- Mark D Powell -- -
Database mirroring and service accounts
Hi,
I am trying to configure database mirroring with sql server 2012.
My principal instance and my mirror instance are on different server.
Both SQL Server service run with NT SERVICE\MSSQLSERVER.
Now when I am configuring database mirroring, which service account should I use ?
database account or server account ?
Instead of using domain account, can I :
1- create local account on my two server
2- Add these 2 logins in my 2 instances.
3- use these local account for configuring database mirroring.
regardsYou should use domain account as I consider them more secured. What is database account there is nothing like that account here means valid windows login or domain account having privileges oon system.
Please read below
http://msdn.microsoft.com/en-us/library/ms189434.aspx
Setup a login account for DB Mirroring
Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
My Technet Articles -
Reverse database mirroring - and is this the right approach?
Here is my scenario. I have 2 database servers, P and M, to serve our production website. P = Principal; M = Mirror.
After some time my Principal crashes. No problem, I've got M, it's been synchronizing, and it has all latest data. So I repoint my production web server to hit the Mirror. Still, all is good.
Now comes the part where I'm fuzzy, and I need to know if my understanding is correct...
The Principal comes back online, but my website is still pointing at the Mirror. I want to repoint the site back to Principal. But P now has old data. Maybe it's been down 3 days and M has 100,000 new records that don't exist in P. When P came back online,
did transaction logs begin shipping from M to P to get P back in sync? Would it do that if a Witness were in place? How does P get caught up with all latest data? Do I have to do a full backup and restore from M to P? Is there a way this can be set up to just
gracefully (or even easy manual) get P updated and synced? Can the Principal/Mirror roles be easily swapped between the 2 servers? Does that happen automatically with a Witness in place?
Thanks in advance for any help.First, mirroring is being removed for "AlwaysOn" technology. I would not recommend using it in SQL 2012. However, if you are talking about prior versions, then...
When the failover occurs, the old mirror, now primary, attempts to send updates back to the old principal, now mirror. This is completely automatic and requires nothing manual to happen.
However, if the now mirror is down for a long period of time, the transaction log on the principal will continue to grow and grow until it is able to deliver the transactions to the mirror.
You can setup your website with a "Failover Partner=" in the connection string and the failover/failback will be completely invisible to your application.
I would suggest reading:
http://technet.microsoft.com/en-us/library/ms189852.aspx
http://technet.microsoft.com/en-us/library/cc917713.aspx -
How to use the mirrored and log shipped secondary database for update or insert operations
Hi,
I am doing a DR Test where I need to test the mirrored and log shipped secondary database but without stopping the mirroring or log shipping procedures. Is there a way to get the data out of mirrored and log shipped database to another database for update
or insert operations?
Database snapshot can be used only for mirrored database but updates cannot be done. Also the secondary database of log shipping cannot used for database snapshot. Any ideas of how this can be implemented?
Thanks,
PreethaHmm in this case I think you need Merge Replication otherwise it breaks down the purpose of DR...again in that case..
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Afaria Database on SQL Anywhere 12 and Replication
Hi,
I have Afaria Farm and I Use SQL Anywhere 12 as database server.
I want to replicate this database to another SQL Anywhere 12 Server.
Which one is good way to replication
And can I have some documentation that tells this step by step?
I am not a DB admin.Hello Tevfik,
I think we need to understand your requirements a little more: why are you interested in SQL Anywhere replication and what are your plans for it?
If you're looking for an always-available SQL Anywhere database for Afaria, there is high-availability (database mirroring). This will allow you to maintain two database server partners (with a third arbiter), where the primary has read/write capabilities and the mirror partner is read-only. There is a tutorial here in the documentation.
If you're looking for a reporting server to do read-only queries for reporting, there is read-only scale out (copy nodes). The tutorial can be found here.
Are you trying to keep a backup copy of your database via replication? If so, you may want to consider live backups (see the wiki), or just regular backups (also see the wiki). Regular backups should still be used in conjunction with any of the high-availability scenarios described above.
If you're really looking for data movement, particularly to multiple database nodes, there is synchronization to other enterprise databases (including SQL Anywhere, but this also includes HANA, ASE, IQ, etc.) with MobiLink and replication to other SQL Anywhere databases, via SQL Remote. MobiLink uses a session-based HTTP or TCP/IP connection as a transport, while SQL Remote can use offline FILE, FTP, SMTP, and online HTTP as a transport.
You may read elsewhere that historically SQL Anywhere can also be used with SQL Remote for Adaptive Server Enterprise (ASE) or Replication Server for replication, but both of these methods have been deprecated and removed in current versions and are not supported by development.
Regards,
Jeff Albion
SAP Active Global Support -
DataBase unavailable and Mirrored Db role has chnaged.
Hello All,
We got below errors in our principal and Mirror db servers.
1) The mirroring connection to "TCP://servername.domain.com:5022" has timed out for database "Db name" after 10 seconds without a response. Check the service and network connections.(Mirror Server).
2) Database mirroring is inactive for database 'DB Name'. This is an informational message only. No user action is required.(Pricipal)
2) The command failed because the database mirror is busy. Reissue the command later. .(Pricipal)
3) The mirrored database "Db" is changing roles from "PRINCIPAL" to "MIRROR" because the mirroring session or availability group failed over due to role synchronization. This is an informational message only. No user action
is required. .(Pricipal)
Before the first error we got an alert that db is unavailable. After 1 min of this alert the issue has started.
After a successful fail-over of that particular db to mirror again it was rolled back to principle automatically. After that I can see a server shut down with below errors.and mirroring failed on all the dbs.
Database mirroring connection error 4 'The connection was closed by the remote end, or an error occurred while receiving data: 55(The specified network name is no longer available.)'' for 'TCP://Server Name.Domain.com:5022'.(Mirror)
Database mirroring connection error 4 'An error occurred while receiving data: '1054(An existing connection was forcibly closed by the remote host.)'.' 'TCP://Server Name.Domain.com:5022'. .(Mirror)
SQL Server is terminating because of a system shutdown. This is an informational message only. No user action is required. (Pricipal)
The connection has been lost with Microsoft Distributed Transaction Coordinator (MS DTC). Recovery of any in-doubt distributed transactions involving Microsoft Distributed Transaction Coordinator (MS DTC) will begin once the connection is re-established.
This is an informational message only. No user action is required. (Pricipal)
SQL Server cannot accept new connections, because it is shutting down. The connection has been closed. [CLIENT: IP. (Pricipal)
I am very confused that why this db unavailable before the issue. I don’t have any information about this.
Can some body help me to find out the root cause why this unexpected fail over and
sql shutdown.Hello,
It looks like something was updated or done to the end system as:
'An error occurred while receiving data: '1054(An existing connection was forcibly closed by the remote host.)'
Is generally caused by a firewall. Please double check software and hardware firewalls (including endpoint protection software) and make sure the exceptions for port 5022 tcp exist.
-Sean
The views, opinions, and posts do not reflect those of my company and are solely my own. No warranty, service, or results are expressed or implied. -
Lack of support for FIM database mirroring
The official line is that database mirroring is not a supported architecture for the FIM deployment. I am not proposing using this, however I'd like to understand 1) What the issues really would be with a mirrored database deployment, 2) Will support
ever be added for this, and will it come in the form of SQL AlwaysOn?
Really appreciate help and input.
Rgds,
DavidDatabase mirroring comes has two modes regarding transactions: synchronous or asynchronous.
Synchronous requires that the data be committed in both places before releasing the transaction. This has a big performance impact on the FIM Service database and to a lesser extent on the FIM Sync Database.
Asynchronous means that data isn't committed in both places at the same time, the mirror can fall behind and then in failover you could be behind. In order to have automatic failover with Mirroring you have to be able to modify the connection string to include
the failover partner or the client has to support getting that data at first logon. While you can modify the FIM database connection strings, it is not understood if FIM is using database clients that support mirroring. I believe it is. Even with asynchronous
you still have performance hit for copying every transaction to the mirror.
SQL Always On combines the best of mirroring and clustering to allow you to group databases together into an availability set, and then automatic failover the whole group to another server. It should be noted that Always On makes use of a similar underlying
mechanisms as mirroring to copy the data -- this is evident when you read that Always on also has an asynchronous and synchronous mode. You will most likely run into the same performance quandary.
Will the product group add support for it? My guess is that it depends on if they find a good way to address the performance issues.
David Lundell, Get your copy of FIM Best Practices Volume 1 http://blog.ilmbestpractices.com/2010/08/book-is-here-fim-best-practices-volume.html -
Error in Starting Database Mirroring
Hai Everyone.. I have an issue in mirroring which i described below.
I am getting the above error when i click on "start mirroring" button. I turned off firewall in my antivirus.
And i also executed the below script in both my principal and mirror server. Because i created both the instances in my system only. And i am accessing those instances with windows authentication.
Go
GRANT CONNECT ON ENDPOINT:: EMP1_MIRRORING TO [DEVLAP5170\login];
Go
-- Thanks and Regards Srikar Reddy Gondesi, Trainee SQL Server Database Administrator Miracle Software systems, Inc.Hi,
How’s everything going?
Also, see prerequisites for database mirroring:
For a mirroring session to be established, the partners and the witness, if any, must be running on the same version of SQL Server.
The two partners, that is the principal server and mirror server, must be running the same edition of SQL Server. The witness, if any, can run on any edition of SQL Server that supports database mirroring.
The database must use the full recovery model.
Verify that the mirror server has sufficient disk space for the mirror database.
When you are creating the mirror database on the mirror server, make sure that you restore the backup of the principal database specifying the same database name WITH NORECOVERY. Also, all log backups that were created after
that backup was taken must also be applied, again WITH NORECOVERY.
Helpful link:
Prerequisites, Restrictions, and Recommendations for Database Mirroring
http://msdn.microsoft.com/en-us/library/ms366349.aspx
Thanks.
Tracy Cai
TechNet Community Support -
If database in suspect mode what is going to be happen in mirroring? will it failover?
Yes I would say yes because suspect mode mostly likely occurs due to Hardware failure,
improper shutdown of the database server,
corruption of the database files, and of course unavailable database files and so on...
And as we all know in mirroring
unplanned downtime can be caused by hardware failures such as storage failure, by power outages, by human error, or by natural disasters, all of which can cause the production server as suspect mode or data center to be unavailable.
However if we talkling about Suspect_pages The principal recognizes a page read error, marks the page with an 829 error (restore pending), inserts a row into the suspect_pages
table in MSDB with the error status, and requests the page from the mirror. If the mirror is victorious in reading the page, it returns the page to the principal who applies it. After the page is repaired, the principal marks the page as restored — that is,
event_type =
5 in the suspect_pages table. Then any deferred transactions are resolved.
You can use this code SELECT
* FROM
sys.dm_db_mirroring_auto_page_repair
catalog view to displays corrupted pages in the data mirroring environment.
If the mirror fails, then the principal continues functioning, so the database continues to be available to the clients. The mirroring state is DISCONNECTED, and the principal
is running exposed in this case. You can use the sys.database_mirroring
catalog view to see the mirroring state on the principal server. Make sure you have plenty of disk space for the transaction log to grow on the principal and be sure to bring the mirror server online before you run out of disk space and your other option
will be using this code to break the database mirroring session ALTER DATABASE
<database_name> SET PARTNER OFF if you have to.
If the
witness is lost, the database mirroring session will continue functioning
without interruption, and the database will be available.
However If the
principal server is lost, the failover scenario
depends on the transaction safety (FULL or OFF) and whether a witness is present. if we talk about
FULL with a witness If Server A fails, then Server B will be the Principal but witness down Server B will not be able to Serve. so if we talk about
without a witness if the Principal fails the database is not accessible to client unless you don't have to go several
steps to make it available. Finally we talk about Principal with OFF (no witness) if the
principal is lost the database will be unavailable and then your option is to FORCE FAILOVER
I hope this will help and give you idea to make more research about it and overcome your problem. Good Luck -
Best Practice Adding New Target to Namespace and Replication
Hi,
whats the best way to add a new target to Namespace and replication. Goal is to replace a old file Server at the end.
I did the following:
- copied the share with robocopy incl timestamps of files and folders
- created share
- added the new share as a new target as well as meshd member of the replication connection
- disabled the new member in the Namespace, so no one can Access it until dfsr is fully done and initialized
After the the new dfsr Connection was replicated through AD to all 4 Members (3 different site, 1 same site) the
following happend:
dfsr begin and almost every file was in a conflicted and copied over the the Conflict Folder. Almost all timestamps
of the Folders were changed to the current date, but the timestamps of the files not.
Thousands of eventlogs: 4412
The DFS Replication service detected that a file was changed on multiple servers. A conflict resolution algorithm was used to determine the winning file. The losing file was moved to the Conflict and Deleted folder.
Any idea why? Later on i disabled the Connections to the remote Fileservers, but that did not stop it.
My idea was to pre-seed the files with robocopy. So what would be the best way to prevent that for the next share ? Is it a better way to just add the target to a bi-directional Connection to the local Fileserver without adding to DFS-N and without copying
the files before ? Is it better to let DFSR do the hole Initial sync incl Files ?
At the end i have no loss of date but to check almost every file for conflict took Ages to finish.
Thanks a lot,
MarcoHi,
The steps you performed are correct - compare with waiting for DFS initial replication, a manually pre-staging is recommended.
When doing the Robocopy step, wether all attributes are copied such as NTFS permissions?
After robocopy, you can add that folder as a folder target of DFS replication group - you can add it to DFS namespace after replication finished.
And if it is a Windows 2012 R2, you can prestaging DFS database for a better result.
https://social.technet.microsoft.com/Forums/windows/en-US/a06c9d25-ed04-44e9-a1f7-e1506e645d53/forum-faq-how-to-prestaging-dfsr-database-on-windows-server-2012-r2?forum=winserverfiles
Please remember to mark the replies as answers if they help and un-mark them if they provide no help. If you have feedback for TechNet Support, contact [email protected] -
Monitor SQL Database mirroring using powershell script
I am trying use the below powershell script to monitor SQL Database mirroring. The motive here is to determine if there are databases which are in "Disconnected" or "Suspended" mode.
I am running the script on the Principal Server:
$returnStateOK = 0
$returnStateWarning = 1
$returnStateCritical = 2
$returnStateUnknown = 3
$NagiosStatus = ""
# Load SMO extension
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null;
# Servers to check
$sqlservers = @("$env:computername");
foreach($server in $sqlservers)
$srv = New-Object "Microsoft.SqlServer.Management.Smo.Server" $server;
# Get mirrored databases
$databases = $srv.Databases | Where-Object {$_.IsMirroringEnabled -eq $true -and $_.MirroringStatus -eq "Suspended" -or $_.MirroringStatus -eq "Synchronizing" -or $_.MirroringStatus -eq "Disconnected"
-or $_.MirroringStatus -eq "None" -and $_.Name -ne "Master" -and $_.Name -ne "model" -and $_.Name -ne "msdb" -and $_.Name -ne "tempdb"};
if ($databases -ne $null)
$databases | Select-Object -Property Name, MirroringStatus | Format-Table -AutoSize;
exit $returnStateCritical
} Else {
Write-Host "All Databaes are Mirrored"
exit $returnStateOK
I have Suspended few databases for testing purpose but when I run the above script the output says "All Databaes are Mirrored"
If I make changes to $database and use it below i.e. I am changing the AND operator to OR after "$_.IsMirroringEnabled -eq $true"
$databases = $srv.Databases | Where-Object {$_.IsMirroringEnabled -eq $true -or $_.MirroringStatus -eq "Suspended" -or $_.MirroringStatus -eq "Synchronizing" -or $_.MirroringStatus
-eq "Disconnected" -or $_.MirroringStatus -eq "None" -and $_.Name -ne "Master" -and $_.Name -ne "model" -and $_.Name -ne "msdb" -and $_.Name -ne "tempdb"};
I get the below output:
Name
MirroringStatus
DB1
Synchronized
DB2
Synchronized
DB3 Synchronized
DB4
Suspended
DB5 Suspended
DB6
Suspended
DB7
Synchronized
DB8
Synchronized
I only want the databases which are Suspended or Disconnected to be listed.I only want the databases which are Suspended or Disconnected to be listed.
Hi raul-133,
Based on your description, to list the databases which are Suspended or Disconnected ,I recommend you execute the following Transact-SQL statements in SQL Server firstly. If you can get the expected results from this query, then use the SQL Server query
in powershell script. For more details, please review this similar blog:
Monitor database mirroring.
Use master
go
select d.name, m.mirroring_state_desc
from sys.database_mirroring m,
sys.databases d
where m.database_id = d.database_id and (m.mirroring_state in (0,1))
For more details about mirroring state, you can review this article:
sys.database_mirroring (Transact-SQL).
Thanks,
Lydia Zhang -
Mirror Database shows Recovery state in Database mirroring in sql 2012
Hi I am working on DBmirroring and have encountered problem of mirror database showing recovery state.
I tried to resolve issue by removing database mirroring from principal ,removing endpoints from both the nodes and
finally firing alter database db1 set partner off statement also.But when reconfigure dbmirroring on principal it does not allow
start dbmirroring and mirror database db1 comes in to recovery state from restoring stage.
srm_2010ok in that case why it is not allowing me to configure db mirroring when I am trying from SSMS.It gives an error.tell me????
srm_2010
And what is the error ? If while configuring mirroring it fails for some reason you have to make sure the mirror database which has gone in recovery state needs to be brought in restoring state.
Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
My Technet Wiki Article
MVP -
Difference between oracle Data Guard and Replication
Hello Friends,
I would like to know the main difference between oracle replication and data guard. Theoretically both are same then where is the difference. Can replication or dataguard be configured in a single PC.
ThanksDataguard :
Oracle Data Guard is primarily for high availability, data protection, and disaster recovery. An Oracle Data Guard Standby instance provides transactionally consistent copies of the production database, in the event of an unplanned outage or instance maintenance the Data Guard Primary Role Standby Role can be switched so the Standby instance can provide Production services.
Replication :
Oracle Advanced Replication and Oracle Streams are Oracle's solution for replicating data and internal structures to remote databases. Advanced Replication is primarily trigger based where Streams is a rule/handler based replication process and considerably more efficient and less error prone than Advanced Replication
refer,
http://www.xtivia.com/database-management/replication/oracle-replication
Thanks
Maybe you are looking for
-
I have just set up Icloud and backed up files to it. I have not been able to log in. I get the message 'Apple ID is valid but is not an Icloud account. I have the same User ID for Icloud and Apple but different passwords. Neither combinations work
-
Can't download pdf files from websites.
Started recently I believe.
-
Problem in running Process flow
Hi, I'm bit new to OWB. I made mapping which I deployed successfully. I can run through control center and it works fine (it just fills a table). However when I made the process through process flow and after its validation , tries to start it gives
-
Itunes match having issues playing some of my songs
I recently got itunes match over winter break and it's been working pretty well. Although I do have some issues with playback. I noticed some songs just get skiped over. I have deleted them off icloud and my itunes and resynced them back on but iclou
-
ALV last 10 columns are truncating in background mode
I am using Reuse_alv_list_display function module and running the report in the background mode, the spool is generating fine but the problem is that the last 10 columns of the report are truncating.what will be the possible solution.