Off the top of my head ... and assuming the PDB and RDB are not part of some other replication setup (eg, PDB is not serving double duty as a replicate db for another replication setup) ...
---------------------------------
-- in the RS
drop connection to RDS.RDB
go
-- for all repdefs assigned to the logical connection
-- or active/primary database
drop replication definition ...
go
drop logical connection to LDS.LDB
go
-- depending on how the PDS.PDB was created and attached to
-- the logical connection you may need to run the following;
-- if you get a message saying the connection doesn't exist
-- you can ignore said message
drop connection to PDS.PDB
go
---------------------------------
-- in the PDS
use PDB
go
sp_stop_rep_agent PDB
go
sp_config_rep_agent PDB, disable
go
-- sp_config_rep_agent/disable should drop the secondary
-- trunc pt; if not, or just to be sure:
dbcc settrunc(ltm,ignore)
go
-- at this point if the database is already marked for
-- replication (eg, sp_reptostandby has already been issued)
-- then you may want to leave it as is; on the other hand,
-- if you really want to get back to 'scratch' then:
sp_reptostandby PDB, 'NONE'
go
---------------------------------
-- in the RDS
use RDB
go
-- drop the maintuser; depending on its status
-- as a user or alias to dbo ...
sp_dropuser maintuser
-- or
sp_dropalias maintuser
go
---------------------------------
-- in the ID Repserver's RSSD
-- verify physical/logical connections removed from the
-- rs_idnames table, otherwise you'll have problems adding
-- the connections back into the system later
select *
from rs_idnames
where (name1 = 'LDS' and name2 = 'LDB')
or (name1 = 'PDS' and name2 = 'PDB')
or (name1 = 'RDS' and name2 = 'RDB')
go
-- if any of these records exist in the rs_idnames table
-- then you can either manually delete them (careful that you
-- only delete the rows in question) or you can drop them by
-- executing the following in the ID Repserver ...
---------------------------------
-- ID Repserver
-- to clear entries from rs_idnames, as needed ...
sysadmin dropdb, PDS, PDB
sysadmin dropdb, RDS, RDB
sysadmin dropldb, LDS, LDB
go
---------------------------------
At this point you should be back to 'scratch' and can proceed through the normal steps for setting up a WS pair.
NOTE: There's no need to remove the various rs_* objects from the PDB/RDB databases as said objects will be rebuilt by rs_init when adding the PDB and RDB to the system.