Re: Backup/Restore question

From: Tibor Karaszi (tibor_please.no.email_karaszi_at_hotmail.nomail.com)
Date: 03/23/04


Date: Wed, 24 Mar 2004 00:22:07 +0100

You can use the ExecuteNonQuery method, for instance. If it fails, you
should get an exception in your client code which you can capture with
standard .NET error handling (TRY and CATCH).

-- 
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"SStory" <TheStorys@TAKEOUTTHISSPAMBUSTERsofthome.net> wrote in message
news:%23nhDTYSEEHA.3672@TK2MSFTNGP09.phx.gbl...
> One more question then.
> In ADO.NET
>
> I pass the backup statement.
> How can I tell if it failed or not.
>
> In a Stored proc I would check @ERROR or @@ERRor (can't remember which)
>
> So howto?
>
> Thanks,
>
> Shane
> "Tibor Karaszi" <tibor_please.no.email_karaszi@hotmail.nomail.com> wrote
in
> message news:O7Ai9$REEHA.3372@TK2MSFTNGP10.phx.gbl...
> > > I would need to either somehow connect and install a blank copy of the
> > > database and then restore from the backup file???
> >
> > No need to create a "blank database" first. The database is created for
> you
> > when you execute the RESTORE command.
> >
> >
> > > Now how do I connect to the server to do this if the database isn't
> > > there--via ADO.NET conn string?
> >
> > As for your connection from ADO, just connect to the master database and
> > execute your restore command from there.
> >
> >
> > > also am I correct that a restore will wipe-out/replace the existing
> > database
> > > with the backed up one?
> >
> > Yes, assuming the existing one has the same layout for the database
files.
> > If not, then you'll get an error message. You can either delete the
> database
> > first and then do the restore or use the REPLACE parameter to the
restore
> > command (same thing).
> > -- 
> > Tibor Karaszi, SQL Server MVP
> > http://www.karaszi.com/sqlserver/default.asp
> >
> >
> > "SStory" <TheStorys@TAKEOUTTHISSPAMBUSTERsofthome.net> wrote in message
> > news:%23dB$q7REEHA.712@tk2msftngp13.phx.gbl...
> > > I want to offer a simple backup/restore option in my vb.net app.
> > >
> > > So I did BACKUP DATABASE MYDB TO DISK="D:\SOMEFILENAME.BKP
> > >
> > > I execute this via a SQLCommand object.
> > >
> > > backup is simple.  But say the database gets wiped out, then they
> > reinstall
> > > MSDE.
> > >
> > > I would need to either somehow connect and install a blank copy of the
> > > database and then restore from the backup file???
> > >
> > > Now how do I connect to the server to do this if the database isn't
> > > there--via ADO.NET conn string?
> > >
> > > Am I missing something?
> > >
> > > also am I correct that a restore will wipe-out/replace the existing
> > database
> > > with the backed up one?
> > >
> > > Thanks
> > >
> > > Shane
> > >
> > >
> >
> >
>
>


Relevant Pages

  • RE: How do I restore from mdf and ldf files?
    ... Tasks -> Backup Database ... Tasks -> Restore Database ... Windows 2003 Server with Latest Service Pack ... Pre-requisites for Sharepoint Backup and Restore: ...
    (microsoft.public.sharepoint.portalserver)
  • Re: Restoring SQL Server Backups
    ... ORIGINAL BACKUP & RESTORE (MSDE Database) ... occurrenceof cachestore flush for the 'Object Plans' cachestore (part ...
    (microsoft.public.sqlserver.server)
  • Re: Restoring SQL Server Backups
    ... ORIGINAL BACKUP & RESTORE (MSDE Database) ... occurrenceof cachestore flush for the 'Object Plans' cachestore (part ...
    (microsoft.public.sqlserver.server)
  • Re: POINT IN TIME RESTORE
    ... This is what you should have done in order to do the restore as you wish: ... > 3- erase data ... > 5- restore database with norecovery ... The BACKUP DATABAE can of course be at an earlier point in time, ...
    (microsoft.public.sqlserver.server)
  • Re: Backend Exchange migrate to New Hardware (Server)
    ... Exchange mailbox stores and Exchange public folder stores. ... When you use Backup to restore Exchange databases, ... Storage Engine to restore Exchange database files and their ...
    (microsoft.public.exchange.setup)

Quantcast