Re: Continue SP after Database Access Failure

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: PaulaPompey (PaulaPompey_at_discussions.microsoft.com)
Date: 02/02/05


Date: Wed, 2 Feb 2005 04:07:04 -0800

Abolutely great! I was over complicating things for my self instead of
breaking the problem down. I will now be pinging the server using your
helpful code, then testing for the database using another great persons
suggestions from this wonderful resource!

Thanks again

Paula

"Uri Dimant" wrote:

> Paula
> You can check PING Server to make sure that remote server is UP or DOWN
> set nocount on
> CREATE TABLE #t_ip (ip varchar(255))
> DECLARE @PingSql varchar(1000)
> SELECT @PingSql = 'ping ' + '00.00.0.0'
> INSERT INTO #t_ip EXEC master.dbo.xp_cmdshell @PingSql
> SELECT * FROM #t_ip
> IF EXISTS (SELECT TOP 2 * FROM #t_ip WHERE IP = 'Request timed out' )
> BEGIN
> 'Do something'
> END
> DROP TABLE #t_ip
>
>
>
> "PaulaPompey" <PaulaPompey@discussions.microsoft.com> wrote in message
> news:2D613817-450D-45B4-8EE2-D0B0B849D4E5@microsoft.com...
> > Works for tables on the local SQL server, but not on Linked Servers, which
> is
> > where I'm having the problem.
> >
> > Thanks for the tip anyway.
> >
> > Paula
> >
> > "JohnnyAppleseed" wrote:
> >
> > > Perhaps the object_id(<object>) function can help. For example, if
> > > object_id('mydb..mytable') will return an object id if the database and
> > > table exists, otherwise it will return NULL.
> > >
> > >
> > > "PaulaPompey" <PaulaPompey@discussions.microsoft.com> wrote in message
> > > news:752B8EAA-BC40-4B0D-B413-EFC8F94189A7@microsoft.com...
> > > > Over night we take a copy of various live SQL databases onto another
> SQL
> > > > server for reporting purposes.
> > > > I have a stored procedure that compares the latest live data against
> the 1
> > > > day old copies to ensure that they are up to date.
> > > > I connect to the live databases using linked servers.
> > > > Here's where the problem is - when one of the external links is down
> or
> > > one
> > > > of the live databases is offline the stored procedure has an error and
> > > stops.
> > > > How can I test within the stored procedure that the database on the
> linked
> > > > server is available? Then, based on the result, carry out an action?
> > > > Even a simple select statement against an unavailable database halts
> the
> > > > whole SP even though I've tried breaking the code down into seperate
> > > > transactions, checking for @@ERROR > 0, SET XACT_ABORT OFF, the code
> still
> > > > fails with "SQL Server does not exist or access denied."
> > > >
> > > > Any advice greatly appreciated.
> > > >
> > >
> > >
> > >
>
>
>



Relevant Pages

  • Re: Insights into DBI->connect differences
    ... it really looks like an issue with your "mp3i" not being a known service. ... Capacio, Paula J wrote: ... server with the same perl and oracle libraries/versions only the first ...
    (perl.dbi.users)
  • Re: DHCP Server service just STOPS on its own - PLEASE HELP!
    ... "Paula" wrote in message ... I ran the forestprep and domainprep successfully 4 days ago in preperation for a Windows 2003 Domain Controller to be added. ... Would this cause the DHCP Server serviceto just stop running? ...
    (microsoft.public.win2000.active_directory)
  • RE: Trying to test 5.5 migration to 2003 in a LAB Environment - HELP!
    ... you can't restore Exchange 5.5 to an alternate server. ... "Paula" wrote: ... > directory service in a different domain and different server name to attempt ... I want to use actual data and do the real migration ...
    (microsoft.public.exchange.misc)
  • RE: How to connect test to production system
    ... main computer or the local SQL Server computer? ... should I be able to link the database on my local SQL server to the ... For example, your test SQL Server instance name is "Server1\SQL2K", while ...
    (microsoft.public.sqlserver.connect)
  • Re: Job Failure
    ... Tibor Karaszi, SQL Server MVP ... > set up to use a valid account on the linked servers. ... >>You will get problems is the job owner isn't sysadmin, ...
    (microsoft.public.sqlserver.server)