Database Research & Development

  • Home
  • NoSQL
    • NoSQL
    • Cassandra
  • Databases
    • Database Theory
    • Database Designing
    • SQL Server Coding Standards
    • SQL Server
    • PostgreSQL
    • MySQL
    • Greenplum
    • Linux
  • Interviews
    • SQL Server Interviews
    • MySQL Interviews
    • SQL Puzzles
  • DBA Scripts
    • SQL Server DBA Scripts
    • PostgreSQL DBA Scripts
    • MySQL DBA Scripts
    • Greenplum DBA Scripts
  • Home
  • Blog Archives !
  • (: Laugh@dbrnd :)
  • Contact Me !
sqlserverinterviews
Home 2016 June SQL Server: Database Mirroring Interview Questions and Answers (Day-4)

SQL Server: Database Mirroring Interview Questions and Answers (Day-4)

This article is half-done without your Comment! *** Please share your thoughts via Comment ***

How can we create an end point using SQL script?

1
2
3
4
5
CREATE ENDPOINT Endpoint1
STATE = STARTED
AS TCP ( LISTENER_PORT = 5022 )
FOR DATABASE_MIRRORING (ROLE=PARTNER);
GO

What is the default of end points (port numbers) of principal, mirror and witness servers?

The default port numbers of principal, mirror and Witness servers are 5022, 5023 and 5024.

Can we use a mirror database as read-only database for reporting purposes?

You can take advantage of a mirror database that you are maintaining for availability purposes to offload reporting. To use a mirror database for reporting, you can create a database snapshot on the mirror database and direct client connection requests to the most recent snapshot.

Can we configure a single database to be mirrored to more than one server. i.e) One source & many destination like logshipping?

No, It is not possible.

Is it possible to take backup of mirrored database in mirror server?

No:

Can I create multiple endpoints for configuring different databases for mirroring and point each database to unique endpoint?

No:

How to know the database mirroring connection time out in Mirroring?

1
2
3
SELECT Mirroring_Connection_Timeout
FROM sys.database_mirroring
WHERE database_id = db_id('Database Names');

What is Automatic Page Repairing?

Automatic page repair is supported by database mirroring. After certain types of errors corrupt a page, making it unreadable, a database mirroring partner (principal or mirror) attempts to automatically recover the page. The partner/replica that cannot read the page requests a fresh copy of the page from its partner. If this request succeeds, the unreadable page is replaced by the readable copy, and this usually resolves the error, this whole process is called Automatic Page Repair.

What are the page types which are not repairable using Automatic Page repair option?

File header page (page ID 0).

Page 9 (the database boot page).

Allocation pages: Global Allocation Map (GAM) pages, Shared Global Allocation Map (SGAM) pages, and Page Free Space (PFS) pages.

Why I’m getting the below error message while configuring database mirroring?

Msg 1416, Level 16, State 31, Line 3. Database is not configured for database mirroring

You need to restore the Full backup from principal server using With NoRecovery option and also one transactional log backup from principal server using With NoRecovery option and then start configuring mirroring.

How you fix the below error?

Mirroring Error 1418: The server network address “%.*ls” can not be reached or does not exist. Check the network address name and that the ports for the local and remote endpoints are operational.

  • Suggestion 1: Make sure that on Mirror Server the database is restored with NO RECOVERY option (This is the most common problem).
  • Suggestion 2: Make sure that from Principal the latest LOG backup is restored to mirror server. (Attempt this one more time even though the full backup has been restored recently).
  • Suggestion 3: Check if you can telnet to your ports using command TELNET ServerName Ports like “telnet SQLServerName 5023”.
  • Suggestion 4: Make sure your firewall is turned off.
  • Suggestion 5: Verify that the endpoints are started on the partners by using the state or state_desc column the of the sys.database_mirroring_endpoints catalog view. You can start end point by executing an ALTER ENDPOINT statement.
  • Suggestion 6: Try the following command as one of the last options. GRANT CONNECT ON ENDPOINT::Mirroring TO ALL
  • Suggestion 7: Delete the end points and recreate them.

Generally, when you are getting errors during the Database Mirroring session?

  • When there is a network then mirroring endp piont needs to be restarted.
  • Installing Service Packs while installing SQL Server or windows patching.
  • Adding a ndf file to the primary Server.
  • Moving databases between the Drives.
  • Shrinking the log(ldf) files.

Can multiple databases on the same instance be in mirroring sessions?

Yes, but there are limitations, based on the hardware of your servers.

If I set up mirroring, do I still have to take full, differential, or transaction log backups?

Yes! Mirroring increases the availability of your databases. It is not a substitute for regular backups, however.

How does index maintenance (rebuilds) affect the mirror?

Transactions that fill up the log can affect the performance of mirroring. When the amount of information in the log increases, the amount of information that needs to be sent to and committed to the mirror increases also. If performance is crucial, you may want to do index maintenance more frequently, so it takes less time. If large transactions such as batch inserts are affecting performance, break those into smaller transactions.

T-SQL Script to manual failover for Mirror database.

1
ALTER DATABASE Database_Name SET PARTNER FAILOVER

T-SQL Script to bring mirror DB online if Principle is down.

1
ALTER DATABASE Database_Name SET PARTNER FORCE_SERVICE_ALLOW_DATA_LOSS

Jun 2, 2016Anvesh Patel
SQL Server: Database Mirroring Interview Questions and Answers (Day-3)SQL Server: Database Mirroring Interview Questions and Answers (Day-5)
Comments: 1
  1. Babu Venugopalan
    May 27, 2019 at 5:40 am

    Hi Anvesh,

    Could you please add AlwaysOn & Cluster interview questions for MSSQL server. It would be of great help to fellow DBA’s

Anvesh Patel
Anvesh Patel

Database Engineer

June 2, 2016 SQL Server InterviewAnvesh Patel, database, database research and development, dbrnd, manual faliover, mirroring, read only database, SQL Query, SQL Server, SQL Server Administrator, SQL Server Monitoring, SQL Server Performance Tunning, SQL Server Tips and Tricks, TSQL
About Me!

I'm Anvesh Patel, a Database Engineer certified by Oracle and IBM. I'm working as a Database Architect, Database Optimizer, Database Administrator, Database Developer. Providing the best articles and solutions for different problems in the best manner through my blogs is my passion. I have more than six years of experience with various RDBMS products like MSSQL Server, PostgreSQL, MySQL, Greenplum and currently learning and doing research on BIGData and NoSQL technology. -- Hyderabad, India.

About DBRND !

dbrnd

This is a personal blog (www.dbrnd.com).

Any views or opinions represented in this blog are personal and belong solely to the blog owner and do not represent those of people, institutions or organizations that the owner may or may not be associated with in professional or personal capacity, unless explicitly stated.

Feel free to challenge me, disagree with me, or tell me I’m completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever (abusive, profane, rude, or anonymous comments) - so keep it polite.

The content of this website is protected by copyright. No portion of this website may be copied or replicated in any form without the written consent of the website owner.

Recent Comments !
  • Anvesh Patel { Sure will do... } – May 27, 12:43 PM
  • Anvesh Patel { Great... } – May 27, 12:41 PM
  • Anvesh Patel { Great... } – May 27, 12:39 PM
  • Anvesh Patel { Great... } – May 27, 12:36 PM
  • Anvesh Patel { Great... } – May 27, 12:28 PM
  • Anvesh Patel { Great... } – May 27, 12:27 PM
  • Anvesh Patel { Great... } – May 27, 12:16 PM
  • Older »
Follow Me !
  • facebook
  • linkedin
  • twitter
  • youtube
  • google
  • flickr
© 2015 – 2019 All rights reserved. Database Research & Development (dbrnd.com)
Posting....