Home All Groups Group Topic Archive Search About

Backing Up Mirrored database

Author
27 Sep 2007 1:20 PM
BigSam
I'm looking for some suggestions & strategies I should take when backing up a
mirrored database.
Ideally I just want to backup the principal, but how do I create a
maintenance plan that is aware of the failover partner?

Author
27 Sep 2007 2:27 PM
Andrew J. Kelly
It is not clear to me what you mean by this. Why would the backup plan need
to be aware of the mirrored server?

--
Andrew J. Kelly    SQL MVP
Solid Quality Mentors


Show quote
"BigSam" <Big***@discussions.microsoft.com> wrote in message
news:09BDBDB1-2199-4F00-8DB0-523D79497F65@microsoft.com...
> I'm looking for some suggestions & strategies I should take when backing
> up a
> mirrored database.
> Ideally I just want to backup the principal, but how do I create a
> maintenance plan that is aware of the failover partner?
Author
27 Sep 2007 3:51 PM
BigSam
When I create a backup plan I don't know if the database is the principal or
the mirror on the server. I assume I need to create a backup plan on each
server for the mirrored database. I could live with that, but I don't want to
copy 2 versions of the database backups to my offsite storage.

Show quote
"Andrew J. Kelly" wrote:

> It is not clear to me what you mean by this. Why would the backup plan need
> to be aware of the mirrored server?
>
> --
> Andrew J. Kelly    SQL MVP
> Solid Quality Mentors
>
>
> "BigSam" <Big***@discussions.microsoft.com> wrote in message
> news:09BDBDB1-2199-4F00-8DB0-523D79497F65@microsoft.com...
> > I'm looking for some suggestions & strategies I should take when backing
> > up a
> > mirrored database.
> > Ideally I just want to backup the principal, but how do I create a
> > maintenance plan that is aware of the failover partner?
>
>
Author
27 Sep 2007 4:18 PM
Tibor Karaszi
You can't backup a mirrored database. If you try, you will get an error message. If you want your
agent job to take this into account, you can in your job query the sys.database_mirroring catalog
view to see whether "you" are principal or mirror. If you are mirror, you can just exit without
attempting to do backup.

Show quote
"BigSam" <Big***@discussions.microsoft.com> wrote in message
news:D4F05338-82D7-4C13-8DAB-9D31EE5A234E@microsoft.com...
> When I create a backup plan I don't know if the database is the principal or
> the mirror on the server. I assume I need to create a backup plan on each
> server for the mirrored database. I could live with that, but I don't want to
> copy 2 versions of the database backups to my offsite storage.
>
> "Andrew J. Kelly" wrote:
>
>> It is not clear to me what you mean by this. Why would the backup plan need
>> to be aware of the mirrored server?
>>
>> --
>> Andrew J. Kelly    SQL MVP
>> Solid Quality Mentors
>>
>>
>> "BigSam" <Big***@discussions.microsoft.com> wrote in message
>> news:09BDBDB1-2199-4F00-8DB0-523D79497F65@microsoft.com...
>> > I'm looking for some suggestions & strategies I should take when backing
>> > up a
>> > mirrored database.
>> > Ideally I just want to backup the principal, but how do I create a
>> > maintenance plan that is aware of the failover partner?
>>
>>
Author
28 Sep 2007 10:01 PM
Mohit K. Gupta
What Tibor said, just adding two cents.

I have backup job on both SQL Servers (principle and mirror) set to backup
all databases; and both run successfully without any issues.  SQL Server is
smart enough to ignored mirrored databases if the job is on mirrored partner
because databases are in Restoring mode.  So I don't have to do any extra
work when partner fails over.  But it does backup the system databases,
without any issues. 

--
Mohit K. Gupta
B.Sc. CS, Minor Japanese
MCTS: SQL Server 2005


Show quote
"BigSam" wrote:

> When I create a backup plan I don't know if the database is the principal or
> the mirror on the server. I assume I need to create a backup plan on each
> server for the mirrored database. I could live with that, but I don't want to
> copy 2 versions of the database backups to my offsite storage.
>
> "Andrew J. Kelly" wrote:
>
> > It is not clear to me what you mean by this. Why would the backup plan need
> > to be aware of the mirrored server?
> >
> > --
> > Andrew J. Kelly    SQL MVP
> > Solid Quality Mentors
> >
> >
> > "BigSam" <Big***@discussions.microsoft.com> wrote in message
> > news:09BDBDB1-2199-4F00-8DB0-523D79497F65@microsoft.com...
> > > I'm looking for some suggestions & strategies I should take when backing
> > > up a
> > > mirrored database.
> > > Ideally I just want to backup the principal, but how do I create a
> > > maintenance plan that is aware of the failover partner?
> >
> >
Author
29 Sep 2007 7:49 AM
Tibor Karaszi
> I have backup job on both SQL Servers (principle and mirror) set to backup
> all databases; and both run successfully without any issues.  SQL Server is
> smart enough to ignored mirrored databases if the job is on mirrored partner
> because databases are in Restoring mode.

Interesting... When you say "ignoring", do you mean
"Attempt to backup but receives an error message from the engine so the job fails"?
or
"Doesn't attempt to backup and hence nor error message"?

I guess the later, since you say "run successfully". I do know that if you try BACKUP DATABASE on a
mirrored database, you do get an error message. This is why I'm curious. Are you using Maintenance
Plans? If so, perhaps the MPs are smart enough to not attempt backing up a mirrored database?

Show quote
"Mohit K. Gupta" <mohitkgu***@msn.com> wrote in message
news:28254A7C-F73B-4D65-A633-EA19EA01A2DF@microsoft.com...
> What Tibor said, just adding two cents.
>
> I have backup job on both SQL Servers (principle and mirror) set to backup
> all databases; and both run successfully without any issues.  SQL Server is
> smart enough to ignored mirrored databases if the job is on mirrored partner
> because databases are in Restoring mode.  So I don't have to do any extra
> work when partner fails over.  But it does backup the system databases,
> without any issues.
>
> --
> Mohit K. Gupta
> B.Sc. CS, Minor Japanese
> MCTS: SQL Server 2005
>
>
> "BigSam" wrote:
>
>> When I create a backup plan I don't know if the database is the principal or
>> the mirror on the server. I assume I need to create a backup plan on each
>> server for the mirrored database. I could live with that, but I don't want to
>> copy 2 versions of the database backups to my offsite storage.
>>
>> "Andrew J. Kelly" wrote:
>>
>> > It is not clear to me what you mean by this. Why would the backup plan need
>> > to be aware of the mirrored server?
>> >
>> > --
>> > Andrew J. Kelly    SQL MVP
>> > Solid Quality Mentors
>> >
>> >
>> > "BigSam" <Big***@discussions.microsoft.com> wrote in message
>> > news:09BDBDB1-2199-4F00-8DB0-523D79497F65@microsoft.com...
>> > > I'm looking for some suggestions & strategies I should take when backing
>> > > up a
>> > > mirrored database.
>> > > Ideally I just want to backup the principal, but how do I create a
>> > > maintenance plan that is aware of the failover partner?
>> >
>> >
Author
29 Sep 2007 9:16 PM
Mohit K. Gupta
Hi Tibor,

   Correct I meant the later, it doesn't attempt to backup and hence no
error message, I am using MPs, and looks like they are smart enough to ignore
the partner databases.   Thanks!

--
Mohit K. Gupta
B.Sc. CS, Minor Japanese
MCTS: SQL Server 2005


Show quote
"Tibor Karaszi" wrote:

> > I have backup job on both SQL Servers (principle and mirror) set to backup
> > all databases; and both run successfully without any issues.  SQL Server is
> > smart enough to ignored mirrored databases if the job is on mirrored partner
> > because databases are in Restoring mode.
>
> Interesting... When you say "ignoring", do you mean
> "Attempt to backup but receives an error message from the engine so the job fails"?
> or
> "Doesn't attempt to backup and hence nor error message"?
>
> I guess the later, since you say "run successfully". I do know that if you try BACKUP DATABASE on a
> mirrored database, you do get an error message. This is why I'm curious. Are you using Maintenance
> Plans? If so, perhaps the MPs are smart enough to not attempt backing up a mirrored database?
>
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
>
Author
30 Sep 2007 7:29 AM
Tibor Karaszi
Interesting...
Thanks Mohit! :-)

Show quote
"Mohit K. Gupta" <mohitkgu***@msn.com> wrote in message
news:7621F481-9F20-4B88-88D6-63793B08F097@microsoft.com...
> Hi Tibor,
>
>   Correct I meant the later, it doesn't attempt to backup and hence no
> error message, I am using MPs, and looks like they are smart enough to ignore
> the partner databases.   Thanks!
>
> --
> Mohit K. Gupta
> B.Sc. CS, Minor Japanese
> MCTS: SQL Server 2005
>
>
> "Tibor Karaszi" wrote:
>
>> > I have backup job on both SQL Servers (principle and mirror) set to backup
>> > all databases; and both run successfully without any issues.  SQL Server is
>> > smart enough to ignored mirrored databases if the job is on mirrored partner
>> > because databases are in Restoring mode.
>>
>> Interesting... When you say "ignoring", do you mean
>> "Attempt to backup but receives an error message from the engine so the job fails"?
>> or
>> "Doesn't attempt to backup and hence nor error message"?
>>
>> I guess the later, since you say "run successfully". I do know that if you try BACKUP DATABASE on
>> a
>> mirrored database, you do get an error message. This is why I'm curious. Are you using
>> Maintenance
>> Plans? If so, perhaps the MPs are smart enough to not attempt backing up a mirrored database?
>>
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://sqlblog.com/blogs/tibor_karaszi
>>
>>
Author
4 Oct 2007 9:53 PM
Saleem Hakani
Take a look at this script:
http://www.sqlcommunity.com/Default.aspx?grm2id=47&tabid=56

It will ignore any mirrored databases. (DBMaintplan in SQL Server 2005 SP1
would ignore mirror databases but SP2 will throw an error)

--
Thank you,
Saleem Hakani
HTTP://WWW.SQLCOMMUNITY.COM (World Wide SQL Server Community)
SQLTips, Scripts, Discussions, Blogs, Articles, Radio and a lot of SQL
Server Fun.


Show quote
"BigSam" wrote:

> I'm looking for some suggestions & strategies I should take when backing up a
> mirrored database.
> Ideally I just want to backup the principal, but how do I create a
> maintenance plan that is aware of the failover partner?

AddThis Social Bookmark Button