Checking For Duplicate Replicas On Two Servers

Checking For Duplicate Replicas On Two Servers

Checking for duplicate replicas on two servers
If you don't use the catalogue and want to see if a database has replicas on
two servers, you can use this script to see if there are any duplicates.

Just copy this code into an agent or button and run it. It will produce a
report that is mailed to you with all the replicas that reside on both servers.


Caution
Be warned, if you run this on a mail server, you may look like a hacker.
See our logs after I ran it:
08/04/99 01:45:10 PM Performing consistency check on Mail\jdelmona.nsf...
08/04/99 01:45:10 PM ATTEMPT TO ACCESS DATABASE Mail\mclouti2.nsf by Ian
Connor/CSI/CSC was denied
08/04/99 01:45:11 PM ATTEMPT TO ACCESS DATABASE Mail\mcolema5.nsf by Ian
Connor/CSI/CSC was denied
08/04/99 01:45:11 PM ATTEMPT TO ACCESS DATABASE Mail\mconnel4.nsf by Ian
Connor/CSI/CSC was denied
08/04/99 01:45:11 PM ATTEMPT TO ACCESS DATABASE Mail\MCRAIG.NSF by Ian
Connor/CSI/CSC was denied
08/04/99 01:45:12 PM ATTEMPT TO ACCESS DATABASE Mail\mczupryn.nsf by Ian
Connor/CSI/CSC was denied
08/04/99 01:45:13 PM Performing consistency check on Mail\dgreer4.nsf...
08/04/99 01:45:13 PM ATTEMPT TO ACCESS DATABASE Mail\MFIOLA.NSF by Ian
Connor/CSI/CSC was denied
08/04/99 01:45:14 PM ATTEMPT TO ACCESS DATABASE Mail\mfoxx.nsf by Ian
Connor/CSI/CSC was denied
08/04/99 01:45:14

    Requires Free Membership to View

    Register today to access targeted resources from our editorial writers and independent industry experts focused on Lotus Domino, Notes, Workplace and other related technologies.

    By submitting your registration information to SearchDomino.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchDomino.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

PM ATTEMPT TO ACCESS DATABASE Mail\mfreibe2.nsf by Ian
Connor/CSI/CSC was denied
08/04/99 01:45:14 PM ATTEMPT TO ACCESS DATABASE Mail\MFreiber.nsf by Ian
Connor/CSI/CSC was denied
08/04/99 01:45:15 PM Opened session for VA_FCH35/CORP/CSC (Build 147)

The code
'Name: Ian Connor
'Company: CSC
'Date: Aug 4, 1999

'PRE: None
'POST: Report of common replica is produced

'PURPOSE: Sys Admin tool to see if a db is on two servers

Dim s As notessession
Dim cdb As notesdatabase
Dim report As notesdocument

Set s = New notessession
Set cdb = s.currentdatabase
Set report = cdb.createdocument


'Ask user for the server names
Dim server1 As New notesname(Inputbox("Type the first server's name",
"First Server","Put your default here"))

Dim server2 As New notesname(Inputbox("Type the second server's name",
"Second Server","Put your default here"))

'Start the report
report.sendto = s.USERNAME
report.subject = "Report of common replicas between " &
server1.ABBREVIATED & " and " & server2.ABBREVIATED
Dim body As New notesrichtextitem(report,"Body")


'Get all DBs on server1
Dim s1directory As New NotesDbDirectory( server1.ABBREVIATED )
If s1directory Is Nothing Then
Msgbox "Error connecting to " & server1.ABBREVIATED
Exit Sub
End If

'Loop through these DBs
Dim db1 As notesdatabase
Set db1 = s1directory.GetFirstDatabase(DATABASE)

On Error Goto errorhandle

Do While Not(db1 Is Nothing)
Call db1.Open( "", "" )
Dim db2 As New notesdatabase("","")

Print "Working on: " & db1.title
'See if the DB is on server2

If db2.OPENBYREPLICAID(server2.ABBREVIATED, db1.REPLICAID) Then
'If it is then add it to the report
Call body.appenddoclink(db1, "Database on " &
server1.ABBREVIATED)
Call body.appenddoclink(db2, "Database on " &
server2.ABBREVIATED)
Call body.appendtext(": " & db1.title & " Size: " & db1.size
&Chr(13))
End If
nextdb:
Set db1 = s1directory.getnextdatabase()
Loop

'Send the report to the user running it
Call report.send(False)

Exit Sub

errorhandle:
Call body.appendtext("Error: " & Error & Chr(13))
Resume nextdb

This was first published in November 2000

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.