May 25, 2012

sp_MSrepl_startup_internal (Transact-SQL MetaData) Definition

Please note: that the following source code is provided and copyrighted by Microsoft and is for educational purpose only.
The meta data is from an SQL 2012 Server.

I have posted alot more, find the whole list here.

Goto Definition or MetaData

Definition:

sys.sp_MSrepl_startup_internal()

MetaData:

 create procedure sys.sp_MSrepl_startup_internal  
as
--
-- Security Check: require sysadmin
--
IF (ISNULL(IS_SRVROLEMEMBER('sysadmin'),0) = 0)
BEGIN
RAISERROR(21089,16,-1)
RETURN (1)
END

-- Drop and create publisher side cache table
--
if exists (select * from tempdb.sys.objects where name = 'MSpublisher_access' and
type = 'U')
drop table tempdb.dbo.MSpublisher_access

create table tempdb.dbo.MSpublisher_access
(
spid int NOT NULL,
db_id int not null,
publication sysname not null,
login_time datetime not null,
pubid uniqueidentifier null -- Used for merge only.
)

CREATE CLUSTERED INDEX ucMSpublisher_access ON tempdb.dbo.MSpublisher_access
(spid, publication, db_id)
exec tempdb.dbo.sp_MS_marksystemobject 'dbo.MSpublisher_access'
--

-- Drop and create distributor side cache table
-- We need to avoid publisher and distributor using the same table to prevent
-- contention in local distributor case.
if exists (select * from master.dbo.sysservers
WHERE srvstatus & 8 <> 0 and UPPER(datasource collate database_default) = UPPER(@@servername) collate database_default)
begin
if exists (select * from tempdb.sys.objects where name = 'MSdistributor_access' and
type = 'U')
drop table tempdb.dbo.MSdistributor_access

create table tempdb.dbo.MSdistributor_access
(
spid int NOT NULL,
db_id int not null,
agent_id int not null,
agent_type int not null,
publication_id int not null,
login_time datetime not null
)

create clustered index ucMSdistributor_access on tempdb.dbo.MSdistributor_access
(spid, login_time)

exec tempdb.dbo.sp_MS_marksystemobject 'dbo.MSdistributor_access'

-- init perfmon counters
exec sys.sp_MSinit_replication_perfmon
end

No comments:

Post a Comment

Total Pageviews