want to get the Logical names for secondary server on Mirroring on Prod

Answered want to get the Logical names for secondary server on Mirroring on Prod

  • Monday, February 13, 2012 1:11 PM
     
     

    Hi Friends,

    I want to get the Logical Names of the Databases on Secondary server when the Mirroring is setup?

    Thanks,

    Maddy

    • Changed Type Tom Phillips Monday, February 13, 2012 1:37 PM
    • Moved by Tom Phillips Monday, February 13, 2012 1:38 PM Database Mirror question (From:SQL Server Database Engine)
    •  

All Replies

  • Monday, February 13, 2012 1:17 PM
     
     

    Hi Maddy,

    When you say Logical Names of databases, do you mean getting the Logical Name of Database Files?


    Regards Gursethi Blog: http://gursethi.blogspot.com/ ++++ Please mark "Propose As Answer" if my answer helped ++++

  • Monday, February 13, 2012 1:53 PM
     
     
    Yes, Do you have any idea?
  • Monday, February 13, 2012 2:13 PM
     
     Answered Has Code

    Try with:

     
    SELECT db_name(dm.database_id) as database_name,
    		mf.name as file_logical_name, 
    		mf.physical_name  
    FROM sys.database_mirroring dm
    INNER JOIN sys.master_files mf
    	ON mf.database_id = dm.database_id
    WHERE dm.mirroring_role = 2
    


    Ana Mihalj

    • Marked As Answer by maddy28 Monday, February 13, 2012 2:26 PM
    •  
  • Monday, February 13, 2012 2:26 PM
     
     
    Thanks Ana Mihalj
  • Monday, February 13, 2012 5:16 PM
     
     

    Hello,

    Try this one to get the partner name

    SELECT TOP 1   mirroring_partner_instance from msdb.sys.database_mirroring (nolock)

    where mirroring_partner_instance is not null

    And this one to get the status of the database mirroring session for each database

    http://sql-javier-villegas.blogspot.com/2011/10/toda-la-informacion-necesaria-acerca-de.html


    Javier Villegas | @javier_villhttp://sql-javier-villegas.blogspot.com/

    Please click "Propose As Answer" if a post solves your problem or "Vote As Helpful" if a post has been useful to you