Manage Learn to apply best practices and optimize your operations.

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 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

Dig Deeper on Domino Resources - Part 3

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close