- Moderator
- #1
I *thought* I had this working, and for some reason it's just... not.
When I run the SP, it says that the MIRRORMAS doesn't exist in sys.servers
This *did* work the first day I wrote it, then it just stopped working. It's like it's just totally ignoring the linked server routine.
If I run the commands just as a query, and not as a SP, it links the server fine.
I have tested my loops, and they are working fine.
I'm going bald over this one... I don't understand why my SP is just choosing to ignore the linking of the server, and hopping straight on to the table replication, where it fails.
Note: If I link the server, then run the routine, the routine runs fine.
Any thoughts or insight?
TIA!
Just my 2¢
"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."
--Greg
Code:
IF NOT EXISTS (SELECT 1 FROM sys.servers WHERE name = N'MIRRORMAS')
BEGIN
EXEC master.dbo.sp_addlinkedserver @server = N'MIRRORMAS', @srvproduct=N'SILENTMAS', @provider=N'MSDASQL', @datasrc=N'SILENTMAS'
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'MIRRORMAS',@useself=N'False',@locallogin=NULL,@rmtuser=NULL,@rmtpassword=NULL
EXEC master.dbo.sp_serveroption @server=N'MIRRORMAS', @optname=N'collation compatible', @optvalue=N'false'
EXEC master.dbo.sp_serveroption @server=N'MIRRORMAS', @optname=N'data access', @optvalue=N'true'
EXEC master.dbo.sp_serveroption @server=N'MIRRORMAS', @optname=N'dist', @optvalue=N'false'
EXEC master.dbo.sp_serveroption @server=N'MIRRORMAS', @optname=N'pub', @optvalue=N'false'
EXEC master.dbo.sp_serveroption @server=N'MIRRORMAS', @optname=N'rpc', @optvalue=N'false'
EXEC master.dbo.sp_serveroption @server=N'MIRRORMAS', @optname=N'rpc out', @optvalue=N'false'
EXEC master.dbo.sp_serveroption @server=N'MIRRORMAS', @optname=N'sub', @optvalue=N'false'
EXEC master.dbo.sp_serveroption @server=N'MIRRORMAS', @optname=N'connect timeout', @optvalue=N'0'
EXEC master.dbo.sp_serveroption @server=N'MIRRORMAS', @optname=N'collation name', @optvalue=null
EXEC master.dbo.sp_serveroption @server=N'MIRRORMAS', @optname=N'lazy schema validation', @optvalue=N'false'
EXEC master.dbo.sp_serveroption @server=N'MIRRORMAS', @optname=N'query timeout', @optvalue=N'0'
EXEC master.dbo.sp_serveroption @server=N'MIRRORMAS', @optname=N'use remote collation', @optvalue=N'true'
EXEC master.dbo.sp_serveroption @server=N'MIRRORMAS', @optname=N'remote proc transaction promotion', @optvalue=N'true'
END
-- Delay until linked server appears in sys.servers
WHILE (1=1)
BEGIN
-- Loop here
IF EXISTS (SELECT '1' FROM sys.servers WHERE name='MIRRORMAS')
BREAK;
END
-- DO a bunch of table replication...
-- Unlink MAS90 Server
EXEC master.dbo.sp_dropserver 'MIRRORMAS', 'droplogins'
When I run the SP, it says that the MIRRORMAS doesn't exist in sys.servers
This *did* work the first day I wrote it, then it just stopped working. It's like it's just totally ignoring the linked server routine.
If I run the commands just as a query, and not as a SP, it links the server fine.
I have tested my loops, and they are working fine.
I'm going bald over this one... I don't understand why my SP is just choosing to ignore the linking of the server, and hopping straight on to the table replication, where it fails.
Note: If I link the server, then run the routine, the routine runs fine.
Any thoughts or insight?
TIA!
Just my 2¢
"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."
--Greg