Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSacquireserverresourcefordynamicsnapshot

  No additional text.


Syntax
create procedure sys.sp_MSacquireserverresourcefordynamicsnapshot (
    @publication sysname,
    @max_concurrent_dynamic_snapshots int
    )
as
begin
    set nocount on
    declare @retcode int
    declare @pubid uniqueidentifier
    declare @process_name sysname
    declare @PALRole sysname
    select @retcode = 0


    if object_id('dbo.sysmergepublications') is null
    begin
        raiserror(21423, 16, -1, @publication)
        return (1)
    end

    select @pubid = null
    select @pubid = pubid
      from dbo.sysmergepublications
     where name = @publication
       and publisher_db = db_name()
       and upper(publisher) = upper(publishingservername())

    if @pubid is null
    begin
        raiserror(21423, 16, -1, @publication)
        return (1)
    end

    if {fn ISPALUSER(@pubid)} <> 1
    begin
        raiserror(21423, 16, -1, @publication)
        return (1)
    end

    -- Since we have gone through the PAL check already, the PAL role
    -- should have been set. The following call to sp_MSrepl_GetPALRole
    -- is nothing more than a way to retrieve the PAL role name
    select @PALRole = NULL
    select @PALRole = sys.fn_MSmerge_GetPALRole(@pubid)
    if @PALRole is NULL
        return 1

    -- The following string construction will never overflow
    -- sysname
    select @process_name = N'ReplicationSnapshotAgent' +
        convert(nvarchar(40), @pubid)

    -- Acquire head of queue lock first
    exec @retcode = sys.sp_MSacquireHeadofQueueLock
        @process_name = @process_name,
        @queue_timeout = 0,
        @no_result = 1,
        @DbPrincipal = @PALRole

    if @@error<>0
        return (1)

    if @retcode<>0
        goto Failure

    exec @retcode = sys.sp_MSacquireSlotLock
        @process_name = @process_name,
        @concurrent_max = @max_concurrent_dynamic_snapshots,
        @DbPrincipal = @PALRole
    if @@error<>0
        return (1)

    -- Also return the PAL role as a separate result set, this is
    -- used later on by the snapshot agent to release the dynamic snapshot
    -- applock under the proper security principal
    select @PALRole

Failure:

    return @retcode
end

 
Last revision 2008RTM
News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash