Showing posts with label user. Show all posts
Showing posts with label user. Show all posts

Sunday, March 25, 2012

Backup Shared Server DB using SQL Server 2005 Management Express

Hi,

I want to backup and/or have a local copy of my DB which is on a shared host. I have an ip addreess and user/pwd, but I am at a loss to find any help for the steps to accomplish this in Management express.

Am I using the right tool?

You will have to keep in mind that backup / restore will only either reach local drives or accessible UNC shares. I do my backups using the Copy Database wizard in management Studio, but if you only have SQL Server Express you can only use the SQL Hosting Pusblishing kit to destribute the database to a hoster and not the way back unless you local database is also published to the internet and the remote server is SQL Express.

Jens K. Suessmeyer.

http://www.sqlserver2005.de
|||

Thanks.

So what is the recommended method/product to take a backup of a SQL DB from a shared host that uses a SQL 2005 Server?

|||I would recommend buying a CAL of SQL Server to have the advanced tools for importing data including the copy database wizard.

Jens K. Suessmeyer.

http://www.sqlserver2005.de

Monday, March 19, 2012

Backup Query

Hello Faculties,
Is it necessary to set a database to RESTRICTED USER before taking
backups?

*** Sent via Developersdex http://www.developersdex.com ***No.

Backups are done online and normal operations can continue against it. You
will only notice it is running when it slows your server down slightly due
to the additional Disk IO.

Regards
----------
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland

IM: mike@.epprecht.net

MVP Program: http://www.microsoft.com/mvp

Blog: http://www.msmvps.com/epprecht/

"debian mojo" <debian_mojo@.yahoo.com> wrote in message
news:v2Dre.10$GU5.4871@.news.uswest.net...
> Hello Faculties,
> Is it necessary to set a database to RESTRICTED USER before taking
> backups?
>
> *** Sent via Developersdex http://www.developersdex.com ***|||Naturally, that is when you use Enterprise Manager or use the built in T-SQL
backup command.

Never backup the LDF, NDF and MDF files directly using a backup software.

--
----------
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland

IM: mike@.epprecht.net

MVP Program: http://www.microsoft.com/mvp

Blog: http://www.msmvps.com/epprecht/

"Mike Epprecht (SQL MVP)" <mike@.epprecht.net> wrote in message
news:42af0082_3@.news.bluewin.ch...
> No.
> Backups are done online and normal operations can continue against it. You
> will only notice it is running when it slows your server down slightly due
> to the additional Disk IO.
> Regards
> ----------
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> IM: mike@.epprecht.net
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
> "debian mojo" <debian_mojo@.yahoo.com> wrote in message
> news:v2Dre.10$GU5.4871@.news.uswest.net...
>> Hello Faculties,
>> Is it necessary to set a database to RESTRICTED USER before taking
>> backups?
>>
>>
>>
>> *** Sent via Developersdex http://www.developersdex.com ***|||Assuming that you're using the TSQL BACKUP command, then no - in MSSQL,
all types of backup can be made with the database in use. See the
Remarks section under BACKUP in Books Online.

Simon

Sunday, March 11, 2012

Backup plan reccomendations for user with ZERO experience.

Hello all, I was just awarded the job of maintaing the database server
for our company. I have basically ZERO experience using MS SQL Server
2000. Can anyone point me in the direction of a good resource for
creating backups of our database? I would love something that comes
with a gui that really simplifies the process; seeing as how i have
never even opened the MS SQL program.

Our database is fairly small we have 7 users with access to the
database. That is it.

any advice or good resources would be greatly appreciated.Look into Enterprise Manager, Maintenance Plan Wizard. It will help
you with various tasks including backups.
In my backup jobs, I first perform a log backup then a full backup.
This will keep the size of the transaction log in check as it gets
truncated during this process. (Assuming the database is in FULL and
not SIMPLE. Check the properties of the database via EM).

I found that when I only did a full backup, my transaction log kept
growing.
MC2
Rob

On Aug 14, 10:49 pm, scott s <scott.str...@.gmail.comwrote:

Quote:

Originally Posted by

Hello all, I was just awarded the job of maintaing the database server
for our company. I have basically ZERO experience using MS SQL Server
2000. Can anyone point me in the direction of a good resource for
creating backups of our database? I would love something that comes
with a gui that really simplifies the process; seeing as how i have
never even opened the MS SQL program.
>
Our database is fairly small we have 7 users with access to the
database. That is it.
>
any advice or good resources would be greatly appreciated.

|||scott s (scott.streit@.gmail.com) writes:

Quote:

Originally Posted by

Hello all, I was just awarded the job of maintaing the database server
for our company. I have basically ZERO experience using MS SQL Server
2000. Can anyone point me in the direction of a good resource for
creating backups of our database? I would love something that comes
with a gui that really simplifies the process; seeing as how i have
never even opened the MS SQL program.
>
Our database is fairly small we have 7 users with access to the
database. That is it.
>
any advice or good resources would be greatly appreciated.


First you need to determine which recovery model you want to use. There
are three to choose from FULL, BULK_LOGGED and SIMPLE. BULK_LOGGED is really
a variation of FULL, and we can leave it out for now.

In FULL recovery mode you are able to recover from a failure to any point
in time. In SIMPLE recovery, you can only recover by restoring the last
backup. So the question you need to answer: if you take a full backup
at midight, and at 15:00 something bad happens (disk crash, an UPDATE
without a WHERE clause or similar), what is your business requirement:
being able to recover the state at 14:59? Or are you fully content with
restoring the backup from midnight?

If you are content with restoring from the most recent backup, make
sure the database is simple recovery:

ALTER DATABASE db SET RECOVERY SIMPLE

now all you have to bother about is setting up full backup that is
scheduled each night, and that the backup file is copied somewhere. You
should make sure that you have backups a couple of days back in time
available, in case some accident is not discovered in time, or if a
backup is unreadable for some reason.

If you need up-to-the-point recovery, you also need to take log backups,
and you need full recovery. It's important to understand that taking log
backups is independet from database backups. If you never back up the log,
it will grow and grow. Since you are unexperienced, the best may be to
set up database backups through a maintenance plan in Enterprise
Manager.

Once you have your backups, you should also test restoring them, so
that you know the procedure if disaster strikes.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Thursday, March 8, 2012

Backup Plan

I have been using enterprise manager to run backups. I backup up all the
db's system and user under one maitenance plan. I have it set to remove the
bakups after 7 days. The backups are removed but not the tranaction log
backups. Why is this and how can I resolve this so I don't have to manaully
delete delete the tranaction log backups.Hi Geroge,
Thanks for posting.
I noticed that you posted another post abouit MSDE backup in newsgroup.
From that post, I noticed that you are using simple recovery mode. If so,
there will be no transaction log be backed up.
Regarding backup plan, please refer to:
<http://msdn2.microsoft.com/en-us/library/ms191239.aspx>
Hope this helps.
Best regards,
Vincent Xu
Microsoft Online Partner Support
======================================================Get Secure! - www.microsoft.com/security
======================================================When responding to posts, please "Reply to Group" via your newsreader so
that others
may learn and benefit from this issue.
======================================================This posting is provided "AS IS" with no warranties,and confers no rights.
======================================================>>Thread-Topic: Backup Plan
>>thread-index: AcbR8vM/1aiy35xvSLanR5zrbdipVg==>>X-WBNR-Posting-Host: 209.244.152.162
>>From: =?Utf-8?B?R2VvcmdlIFNjaG5laWRlcg==?=<georgedschneider@.news.postalias>
>>Subject: Backup Plan
>>Date: Wed, 6 Sep 2006 13:28:02 -0700
>>Lines: 5
>>Message-ID: <B4DE2B3C-D601-4D03-80A0-645853CF42DA@.microsoft.com>
>>MIME-Version: 1.0
>>Content-Type: text/plain;
>> charset="Utf-8"
>>Content-Transfer-Encoding: 7bit
>>X-Newsreader: Microsoft CDO for Windows 2000
>>Content-Class: urn:content-classes:message
>>Importance: normal
>>Priority: normal
>>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
>>Newsgroups: microsoft.public.sqlserver.server
>>Path: TK2MSFTNGXA01.phx.gbl
>>Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.sqlserver.server:444422
>>NNTP-Posting-Host: TK2MSFTNGXA01.phx.gbl 10.40.2.250
>>X-Tomcat-NG: microsoft.public.sqlserver.server
>>I have been using enterprise manager to run backups. I backup up all the
>>db's system and user under one maitenance plan. I have it set to remove
the
>>bakups after 7 days. The backups are removed but not the tranaction log
>>backups. Why is this and how can I resolve this so I don't have to
manaully
>>delete delete the tranaction log backups.|||The other post was for an MSDE database on as erver. This post isfor one of
my SQL 2000 Servers using Enterprise manager.
"Vincent Xu [MSFT]" wrote:
> Hi Geroge,
> Thanks for posting.
> I noticed that you posted another post abouit MSDE backup in newsgroup.
> From that post, I noticed that you are using simple recovery mode. If so,
> there will be no transaction log be backed up.
> Regarding backup plan, please refer to:
> <http://msdn2.microsoft.com/en-us/library/ms191239.aspx>
> Hope this helps.
>
> Best regards,
> Vincent Xu
> Microsoft Online Partner Support
> ======================================================> Get Secure! - www.microsoft.com/security
> ======================================================> When responding to posts, please "Reply to Group" via your newsreader so
> that others
> may learn and benefit from this issue.
> ======================================================> This posting is provided "AS IS" with no warranties,and confers no rights.
> ======================================================>
> --
> >>Thread-Topic: Backup Plan
> >>thread-index: AcbR8vM/1aiy35xvSLanR5zrbdipVg==> >>X-WBNR-Posting-Host: 209.244.152.162
> >>From: =?Utf-8?B?R2VvcmdlIFNjaG5laWRlcg==?=> <georgedschneider@.news.postalias>
> >>Subject: Backup Plan
> >>Date: Wed, 6 Sep 2006 13:28:02 -0700
> >>Lines: 5
> >>Message-ID: <B4DE2B3C-D601-4D03-80A0-645853CF42DA@.microsoft.com>
> >>MIME-Version: 1.0
> >>Content-Type: text/plain;
> >> charset="Utf-8"
> >>Content-Transfer-Encoding: 7bit
> >>X-Newsreader: Microsoft CDO for Windows 2000
> >>Content-Class: urn:content-classes:message
> >>Importance: normal
> >>Priority: normal
> >>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
> >>Newsgroups: microsoft.public.sqlserver.server
> >>Path: TK2MSFTNGXA01.phx.gbl
> >>Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.sqlserver.server:444422
> >>NNTP-Posting-Host: TK2MSFTNGXA01.phx.gbl 10.40.2.250
> >>X-Tomcat-NG: microsoft.public.sqlserver.server
> >>
> >>I have been using enterprise manager to run backups. I backup up all the
> >>db's system and user under one maitenance plan. I have it set to remove
> the
> >>bakups after 7 days. The backups are removed but not the tranaction log
> >>backups. Why is this and how can I resolve this so I don't have to
> manaully
> >>delete delete the tranaction log backups.
> >>
>|||George Schneider wrote:
> I have been using enterprise manager to run backups. I backup up all the
> db's system and user under one maitenance plan. I have it set to remove the
> bakups after 7 days. The backups are removed but not the tranaction log
> backups. Why is this and how can I resolve this so I don't have to manaully
> delete delete the tranaction log backups.
You say you're backing up ALL databases within a single maintenance
plan? Are any of these databases in Simple recovery mode? If so, then
transaction log backups are not possible for those DB's, and that is
likely causing the transaction log part of your maintenance plan to
fail, preventing it from running the deletion step.
Check the job history and the maintenance plan history for error messages.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||how would I change the recovery mode and what should I change the recovery
mode to if I wanted to back up the transaction logs. Wouldn't one need the
transaction logs in a disaster recovery scenario.
"Tracy McKibben" wrote:
> George Schneider wrote:
> > I have been using enterprise manager to run backups. I backup up all the
> > db's system and user under one maitenance plan. I have it set to remove the
> > bakups after 7 days. The backups are removed but not the tranaction log
> > backups. Why is this and how can I resolve this so I don't have to manaully
> > delete delete the tranaction log backups.
> You say you're backing up ALL databases within a single maintenance
> plan? Are any of these databases in Simple recovery mode? If so, then
> transaction log backups are not possible for those DB's, and that is
> likely causing the transaction log part of your maintenance plan to
> fail, preventing it from running the deletion step.
> Check the job history and the maintenance plan history for error messages.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
>|||George Schneider wrote:
> how would I change the recovery mode and what should I change the recovery
> mode to if I wanted to back up the transaction logs. Wouldn't one need the
> transaction logs in a disaster recovery scenario.
>
Refer to Books Online for more info on recovery models. There's not a
blanket answer to your question, you'll have to decide what is
appropriate for your needs.
--
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Hi Geroge,
Thanks for your reply.
To switch recovery mode, please refer to following article:
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/a
d_bkprst_8ik3.asp>
Actually, MSDE & SQL 2000 is the same by the nature. Therefore, you can
refer to my reply in the "MSDE Backup " Thread. For your convenience, I
paste it here
==================If you perform full backup regularly, you can just restore the latest
backup when disaster occurs.
The transaction log is a serial record of all the transactions that have
been performed against the database since the transaction log was last
backed up. With transaction log backups, you can recover the database to a
specific point in time (for example, prior to entering unwanted data), or
to the point of failure. Check following article:
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/a
d_bkprst_565v.asp>
How to: Create a Transaction Log Backup (Transact-SQL)
<http://msdn2.microsoft.com/en-us/library/ms191284.aspx>
How to: Restore to the Point of Failure (Transact-SQL)
<http://msdn2.microsoft.com/en-us/library/ms175093.aspx>
How to: Restore to a Point in Time (Transact-SQL)
<http://msdn2.microsoft.com/en-us/library/ms179451.aspx>
==================
Best regards,
Vincent Xu
Microsoft Online Partner Support
======================================================Get Secure! - www.microsoft.com/security
======================================================When responding to posts, please "Reply to Group" via your newsreader so
that others
may learn and benefit from this issue.
======================================================This posting is provided "AS IS" with no warranties,and confers no rights.
======================================================>>Thread-Topic: Backup Plan
>>thread-index: AcbSsnohDScBOuYQRe6ilXpgrPC+Dg==>>X-WBNR-Posting-Host: 209.244.152.162
>>From: =?Utf-8?B?R2VvcmdlIFNjaG5laWRlcg==?=<georgedschneider@.news.postalias>
>>References: <B4DE2B3C-D601-4D03-80A0-645853CF42DA@.microsoft.com>
<45002CE9.5010006@.realsqlguy.com>
>>Subject: Re: Backup Plan
>>Date: Thu, 7 Sep 2006 12:19:02 -0700
>>Lines: 27
>>Message-ID: <784A7375-55CC-442D-8E6B-F86A5DE784DD@.microsoft.com>
>>MIME-Version: 1.0
>>Content-Type: text/plain;
>> charset="Utf-8"
>>Content-Transfer-Encoding: 7bit
>>X-Newsreader: Microsoft CDO for Windows 2000
>>Content-Class: urn:content-classes:message
>>Importance: normal
>>Priority: normal
>>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
>>Newsgroups: microsoft.public.sqlserver.server
>>Path: TK2MSFTNGXA01.phx.gbl
>>Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.sqlserver.server:444545
>>NNTP-Posting-Host: TK2MSFTNGXA01.phx.gbl 10.40.2.250
>>X-Tomcat-NG: microsoft.public.sqlserver.server
>>how would I change the recovery mode and what should I change the
recovery
>>mode to if I wanted to back up the transaction logs. Wouldn't one need
the
>>transaction logs in a disaster recovery scenario.
>>"Tracy McKibben" wrote:
>> George Schneider wrote:
>> > I have been using enterprise manager to run backups. I backup up all
the
>> > db's system and user under one maitenance plan. I have it set to
remove the
>> > bakups after 7 days. The backups are removed but not the tranaction
log
>> > backups. Why is this and how can I resolve this so I don't have to
manaully
>> > delete delete the tranaction log backups.
>> You say you're backing up ALL databases within a single maintenance
>> plan? Are any of these databases in Simple recovery mode? If so, then
>> transaction log backups are not possible for those DB's, and that is
>> likely causing the transaction log part of your maintenance plan to
>> fail, preventing it from running the deletion step.
>> Check the job history and the maintenance plan history for error
messages.
>>
>> --
>> Tracy McKibben
>> MCDBA
>> http://www.realsqlguy.com
>>|||I guess I'm a little confussed here. I thought transaction logs were
required to restore to make the db full operational again. What purpose do
transaction logs perform then if you do not have to restore then in a
disaster sceanrio?
"Vincent Xu [MSFT]" wrote:
> Hi Geroge,
> Thanks for your reply.
> To switch recovery mode, please refer to following article:
> <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/a
> d_bkprst_8ik3.asp>
> Actually, MSDE & SQL 2000 is the same by the nature. Therefore, you can
> refer to my reply in the "MSDE Backup " Thread. For your convenience, I
> paste it here
> ==================> If you perform full backup regularly, you can just restore the latest
> backup when disaster occurs.
> The transaction log is a serial record of all the transactions that have
> been performed against the database since the transaction log was last
> backed up. With transaction log backups, you can recover the database to a
> specific point in time (for example, prior to entering unwanted data), or
> to the point of failure. Check following article:
> <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/a
> d_bkprst_565v.asp>
> How to: Create a Transaction Log Backup (Transact-SQL)
> <http://msdn2.microsoft.com/en-us/library/ms191284.aspx>
> How to: Restore to the Point of Failure (Transact-SQL)
> <http://msdn2.microsoft.com/en-us/library/ms175093.aspx>
> How to: Restore to a Point in Time (Transact-SQL)
> <http://msdn2.microsoft.com/en-us/library/ms179451.aspx>
> ==================> Best regards,
> Vincent Xu
> Microsoft Online Partner Support
> ======================================================> Get Secure! - www.microsoft.com/security
> ======================================================> When responding to posts, please "Reply to Group" via your newsreader so
> that others
> may learn and benefit from this issue.
> ======================================================> This posting is provided "AS IS" with no warranties,and confers no rights.
> ======================================================>
> --
> >>Thread-Topic: Backup Plan
> >>thread-index: AcbSsnohDScBOuYQRe6ilXpgrPC+Dg==> >>X-WBNR-Posting-Host: 209.244.152.162
> >>From: =?Utf-8?B?R2VvcmdlIFNjaG5laWRlcg==?=> <georgedschneider@.news.postalias>
> >>References: <B4DE2B3C-D601-4D03-80A0-645853CF42DA@.microsoft.com>
> <45002CE9.5010006@.realsqlguy.com>
> >>Subject: Re: Backup Plan
> >>Date: Thu, 7 Sep 2006 12:19:02 -0700
> >>Lines: 27
> >>Message-ID: <784A7375-55CC-442D-8E6B-F86A5DE784DD@.microsoft.com>
> >>MIME-Version: 1.0
> >>Content-Type: text/plain;
> >> charset="Utf-8"
> >>Content-Transfer-Encoding: 7bit
> >>X-Newsreader: Microsoft CDO for Windows 2000
> >>Content-Class: urn:content-classes:message
> >>Importance: normal
> >>Priority: normal
> >>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
> >>Newsgroups: microsoft.public.sqlserver.server
> >>Path: TK2MSFTNGXA01.phx.gbl
> >>Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.sqlserver.server:444545
> >>NNTP-Posting-Host: TK2MSFTNGXA01.phx.gbl 10.40.2.250
> >>X-Tomcat-NG: microsoft.public.sqlserver.server
> >>
> >>how would I change the recovery mode and what should I change the
> recovery
> >>mode to if I wanted to back up the transaction logs. Wouldn't one need
> the
> >>transaction logs in a disaster recovery scenario.
> >>
> >>"Tracy McKibben" wrote:
> >>
> >> George Schneider wrote:
> >> > I have been using enterprise manager to run backups. I backup up all
> the
> >> > db's system and user under one maitenance plan. I have it set to
> remove the
> >> > bakups after 7 days. The backups are removed but not the tranaction
> log
> >> > backups. Why is this and how can I resolve this so I don't have to
> manaully
> >> > delete delete the tranaction log backups.
> >>
> >> You say you're backing up ALL databases within a single maintenance
> >> plan? Are any of these databases in Simple recovery mode? If so, then
> >> transaction log backups are not possible for those DB's, and that is
> >> likely causing the transaction log part of your maintenance plan to
> >> fail, preventing it from running the deletion step.
> >>
> >> Check the job history and the maintenance plan history for error
> messages.
> >>
> >>
> >> --
> >> Tracy McKibben
> >> MCDBA
> >> http://www.realsqlguy.com
> >>
> >>
>|||George Schneider wrote:
> I guess I'm a little confussed here. I thought transaction logs were
> required to restore to make the db full operational again. What purpose do
> transaction logs perform then if you do not have to restore then in a
> disaster sceanrio?
>
That all depends on the recovery model that you're using. The
transaction log records everything that happens in the database. Let's
say you delete a million rows from a table, and partway through that
delete operation, it fails. The delete will be rolled back, none of the
records will be deleted. In order to perform that rollback, SQL has to
record somewhere what records it's deleting - that's what the
transaction log is used for. The transaction log will need to be large
enough to hold this entire transaction. If the delete is successful,
the transaction is committed, and the events recorded in the transaction
log are flagged as committed.
In SIMPLE mode, SQL will issue periodic "checkpoint" instructions that
will flush out those committed events, and the space that was previously
used for them will be available for future transactions to use. The
transaction log will not shrink at this point, it will remain the same
physical size. Once the committed events have been flushed, they are
permanently written to the database, and the only way to "undo" them is
to restore from a full backup taken prior to the delete, probably the
backup from the night before.
In FULL or BULK-LOGGED modes, these committed events are not
automatically flushed out of the transaction log. They are flushed when
you issue a BACKUP LOG command. This gives you the ability to recover
the database to virtually any point in time. For sake of example, let's
assume you're taking transaction log backups every 5 minutes. You
delete the million rows, and an hour later, decide that you need those
rows back. You simply restore the previous full backup, and then
restore each transaction log backup up to the point where you issued the
delete. You lose an hour's worth of work instead of a full day.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Hi All,
Tracy provided great information. Well done!.
George, if youi still have anything unclear, please feel free to reply.
I'll try my best to be of assistance.
Best regards,
Vincent Xu
Microsoft Online Partner Support
======================================================Get Secure! - www.microsoft.com/security
======================================================When responding to posts, please "Reply to Group" via your newsreader so
that others
may learn and benefit from this issue.
======================================================This posting is provided "AS IS" with no warranties,and confers no rights.
======================================================>>Message-ID: <4501C028.9030606@.realsqlguy.com>
>>Date: Fri, 08 Sep 2006 14:10:32 -0500
>>From: Tracy McKibben <tracy@.realsqlguy.com>
>>User-Agent: Thunderbird 1.5.0.5 (Windows/20060719)
>>MIME-Version: 1.0
>>Subject: Re: Backup Plan
>>References: <B4DE2B3C-D601-4D03-80A0-645853CF42DA@.microsoft.com>
<45002CE9.5010006@.realsqlguy.com>
<784A7375-55CC-442D-8E6B-F86A5DE784DD@.microsoft.com>
<$tCEyDv0GHA.5212@.TK2MSFTNGXA01.phx.gbl>
<BFF0BF45-3B81-4813-98CD-EBCF3828C52D@.microsoft.com>
>>In-Reply-To: <BFF0BF45-3B81-4813-98CD-EBCF3828C52D@.microsoft.com>
>>Content-Type: text/plain; charset=UTF-8; format=flowed
>>Content-Transfer-Encoding: 7bit
>>Newsgroups: microsoft.public.sqlserver.server
>>NNTP-Posting-Host: ncsgate.ncspearson.com 12.106.111.10
>>Lines: 1
>>Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP03.phx.gbl
>>Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.sqlserver.server:444677
>>X-Tomcat-NG: microsoft.public.sqlserver.server
>>George Schneider wrote:
>> I guess I'm a little confussed here. I thought transaction logs were
>> required to restore to make the db full operational again. What
purpose do
>> transaction logs perform then if you do not have to restore then in a
>> disaster sceanrio?
>>
>>That all depends on the recovery model that you're using. The
>>transaction log records everything that happens in the database. Let's
>>say you delete a million rows from a table, and partway through that
>>delete operation, it fails. The delete will be rolled back, none of the
>>records will be deleted. In order to perform that rollback, SQL has to
>>record somewhere what records it's deleting - that's what the
>>transaction log is used for. The transaction log will need to be large
>>enough to hold this entire transaction. If the delete is successful,
>>the transaction is committed, and the events recorded in the transaction
>>log are flagged as committed.
>>In SIMPLE mode, SQL will issue periodic "checkpoint" instructions that
>>will flush out those committed events, and the space that was previously
>>used for them will be available for future transactions to use. The
>>transaction log will not shrink at this point, it will remain the same
>>physical size. Once the committed events have been flushed, they are
>>permanently written to the database, and the only way to "undo" them is
>>to restore from a full backup taken prior to the delete, probably the
>>backup from the night before.
>>In FULL or BULK-LOGGED modes, these committed events are not
>>automatically flushed out of the transaction log. They are flushed when
>>you issue a BACKUP LOG command. This gives you the ability to recover
>>the database to virtually any point in time. For sake of example, let's
>>assume you're taking transaction log backups every 5 minutes. You
>>delete the million rows, and an hour later, decide that you need those
>>rows back. You simply restore the previous full backup, and then
>>restore each transaction log backup up to the point where you issued the
>>delete. You lose an hour's worth of work instead of a full day.
>>
>>--
>>Tracy McKibben
>>MCDBA
>>http://www.realsqlguy.com|||If I understand you correctly then if I'm in Simple recovery mode for my
databases then the maitenance plan that I'm using to include tranaction logs
is not needed. Can you explain what is happening in simple recovery mode to
why tranaction log backups are not needed.
"Tracy McKibben" wrote:
> George Schneider wrote:
> > I guess I'm a little confussed here. I thought transaction logs were
> > required to restore to make the db full operational again. What purpose do
> > transaction logs perform then if you do not have to restore then in a
> > disaster sceanrio?
> >
> That all depends on the recovery model that you're using. The
> transaction log records everything that happens in the database. Let's
> say you delete a million rows from a table, and partway through that
> delete operation, it fails. The delete will be rolled back, none of the
> records will be deleted. In order to perform that rollback, SQL has to
> record somewhere what records it's deleting - that's what the
> transaction log is used for. The transaction log will need to be large
> enough to hold this entire transaction. If the delete is successful,
> the transaction is committed, and the events recorded in the transaction
> log are flagged as committed.
> In SIMPLE mode, SQL will issue periodic "checkpoint" instructions that
> will flush out those committed events, and the space that was previously
> used for them will be available for future transactions to use. The
> transaction log will not shrink at this point, it will remain the same
> physical size. Once the committed events have been flushed, they are
> permanently written to the database, and the only way to "undo" them is
> to restore from a full backup taken prior to the delete, probably the
> backup from the night before.
> In FULL or BULK-LOGGED modes, these committed events are not
> automatically flushed out of the transaction log. They are flushed when
> you issue a BACKUP LOG command. This gives you the ability to recover
> the database to virtually any point in time. For sake of example, let's
> assume you're taking transaction log backups every 5 minutes. You
> delete the million rows, and an hour later, decide that you need those
> rows back. You simply restore the previous full backup, and then
> restore each transaction log backup up to the point where you issued the
> delete. You lose an hour's worth of work instead of a full day.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
>|||George Schneider wrote:
> If I understand you correctly then if I'm in Simple recovery mode for my
> databases then the maitenance plan that I'm using to include tranaction logs
> is not needed. Can you explain what is happening in simple recovery mode to
> why tranaction log backups are not needed.
>
In Simple mode, committed transactions are automatically purged from the
log file by SQL's checkpointing process, so there's nothing in the log
for you to back up.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Correct me if I'm wrong on this one concerning recover modes. In sim[ple
recovery mode the tranactions are recorded in the log but as soon as they are
applied to the databse sql purges them from the log so in essece the log is
empty in this recovery mode.
If I'm running simple recovery then I should change the maitenace plan
backup configuration not to backup the tranaction logs correct?
Is it alright to have one maintenace plan to backup all the db's both system
and user?
"Tracy McKibben" wrote:
> George Schneider wrote:
> > If I understand you correctly then if I'm in Simple recovery mode for my
> > databases then the maitenance plan that I'm using to include tranaction logs
> > is not needed. Can you explain what is happening in simple recovery mode to
> > why tranaction log backups are not needed.
> >
> In Simple mode, committed transactions are automatically purged from the
> log file by SQL's checkpointing process, so there's nothing in the log
> for you to back up.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
>|||George Schneider wrote:
> Correct me if I'm wrong on this one concerning recover modes. In sim[ple
> recovery mode the tranactions are recorded in the log but as soon as they are
> applied to the databse sql purges them from the log so in essece the log is
> empty in this recovery mode.
Correct
> If I'm running simple recovery then I should change the maitenace plan
> backup configuration not to backup the tranaction logs correct?
Correct. You cannot run a transaction log backup against a Simple mode
database. However, you should consider if the risk of data loss, and
decide if Simple mode is right for your needs.
> Is it alright to have one maintenace plan to backup all the db's both system
> and user?
Yes
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Now I'm back to square one. I thought the problem with not removing the
tranaction backups was becuase I was running backups on db's that were in
simple recovery mode. This is not the case. I have some db's in simple and
some in full recovery mode. The one's in simple recovery mode are fine and
do not have a tranaction log backup created. Its the four pr have db's that
are in full recovery mode. The tranaction logs backups are not being deleted
like the bak files from the backup directory. What can be causing this and
how cna I resolve this?
"Tracy McKibben" wrote:
> George Schneider wrote:
> > Correct me if I'm wrong on this one concerning recover modes. In sim[ple
> > recovery mode the tranactions are recorded in the log but as soon as they are
> > applied to the databse sql purges them from the log so in essece the log is
> > empty in this recovery mode.
> Correct
> > If I'm running simple recovery then I should change the maitenace plan
> > backup configuration not to backup the tranaction logs correct?
> Correct. You cannot run a transaction log backup against a Simple mode
> database. However, you should consider if the risk of data loss, and
> decide if Simple mode is right for your needs.
> > Is it alright to have one maintenace plan to backup all the db's both system
> > and user?
> Yes
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
>|||Don't use the same maint plans for the databases in full vs. simple mode. If you do, maint plan is a
little bit daft and doesn't remove old tlog backups for the ones in full mode.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"George Schneider" <georgedschneider@.news.postalias> wrote in message
news:F2886839-6488-47B7-8AE6-4C0E2E7294D6@.microsoft.com...
> Now I'm back to square one. I thought the problem with not removing the
> tranaction backups was becuase I was running backups on db's that were in
> simple recovery mode. This is not the case. I have some db's in simple and
> some in full recovery mode. The one's in simple recovery mode are fine and
> do not have a tranaction log backup created. Its the four pr have db's that
> are in full recovery mode. The tranaction logs backups are not being deleted
> like the bak files from the backup directory. What can be causing this and
> how cna I resolve this?
> "Tracy McKibben" wrote:
>> George Schneider wrote:
>> > Correct me if I'm wrong on this one concerning recover modes. In sim[ple
>> > recovery mode the tranactions are recorded in the log but as soon as they are
>> > applied to the databse sql purges them from the log so in essece the log is
>> > empty in this recovery mode.
>> Correct
>> > If I'm running simple recovery then I should change the maitenace plan
>> > backup configuration not to backup the tranaction logs correct?
>> Correct. You cannot run a transaction log backup against a Simple mode
>> database. However, you should consider if the risk of data loss, and
>> decide if Simple mode is right for your needs.
>> > Is it alright to have one maintenace plan to backup all the db's both system
>> > and user?
>> Yes
>>
>> --
>> Tracy McKibben
>> MCDBA
>> http://www.realsqlguy.com|||George Schneider wrote:
> Now I'm back to square one. I thought the problem with not removing the
> tranaction backups was becuase I was running backups on db's that were in
> simple recovery mode. This is not the case. I have some db's in simple and
> some in full recovery mode. The one's in simple recovery mode are fine and
> do not have a tranaction log backup created. Its the four pr have db's that
> are in full recovery mode. The tranaction logs backups are not being deleted
> like the bak files from the backup directory. What can be causing this and
> how cna I resolve this?
>
The problem is that you're doing all of this from ONE maintenance plan,
and have told the maintenance plan to do transaction log backups of ALL
your databases. When it attempts to do that, it fails on the ones that
are in Simple mode, and never gets to the cleanup step where it deletes
the old files.
Create two seperate maintenance plans, one for the Simple mode
databases, one for the others. OR, better yet, dump the maintenance
plan altogether and use scripts to perform these tasks. Here is one:
http://realsqlguy.com/serendipity/archives/11-Send-In-Backup!.html
Tracy McKibben
MCDBA
http://www.realsqlguy.com

Backup Plan

I have been using enterprise manager to run backups. I backup up all the
db's system and user under one maitenance plan. I have it set to remove the
bakups after 7 days. The backups are removed but not the tranaction log
backups. Why is this and how can I resolve this so I don't have to manaully
delete delete the tranaction log backups.Hi Geroge,
Thanks for posting.
I noticed that you posted another post abouit MSDE backup in newsgroup.
From that post, I noticed that you are using simple recovery mode. If so,
there will be no transaction log be backed up.
Regarding backup plan, please refer to:
<http://msdn2.microsoft.com/en-us/library/ms191239.aspx>
Hope this helps.
Best regards,
Vincent Xu
Microsoft Online Partner Support
========================================
==============
Get Secure! - www.microsoft.com/security
========================================
==============
When responding to posts, please "Reply to Group" via your newsreader so
that others
may learn and benefit from this issue.
========================================
==============
This posting is provided "AS IS" with no warranties,and confers no rights.
========================================
==============
--[vbcol=seagreen]
<georgedschneider@.news.postalias>[vbcol=seagreen]
the[vbcol=seagreen]
manaully[vbcol=seagreen]|||The other post was for an MSDE database on as erver. This post isfor one o
f
my SQL 2000 Servers using Enterprise manager.
"Vincent Xu [MSFT]" wrote:

> Hi Geroge,
> Thanks for posting.
> I noticed that you posted another post abouit MSDE backup in newsgroup.
> From that post, I noticed that you are using simple recovery mode. If so,
> there will be no transaction log be backed up.
> Regarding backup plan, please refer to:
> <http://msdn2.microsoft.com/en-us/library/ms191239.aspx>
> Hope this helps.
>
> Best regards,
> Vincent Xu
> Microsoft Online Partner Support
> ========================================
==============
> Get Secure! - www.microsoft.com/security
> ========================================
==============
> When responding to posts, please "Reply to Group" via your newsreader so
> that others
> may learn and benefit from this issue.
> ========================================
==============
> This posting is provided "AS IS" with no warranties,and confers no rights.
> ========================================
==============
>
> --
> <georgedschneider@.news.postalias>
> the
> manaully
>|||George Schneider wrote:
> I have been using enterprise manager to run backups. I backup up all the
> db's system and user under one maitenance plan. I have it set to remove t
he
> bakups after 7 days. The backups are removed but not the tranaction log
> backups. Why is this and how can I resolve this so I don't have to manaul
ly
> delete delete the tranaction log backups.
You say you're backing up ALL databases within a single maintenance
plan? Are any of these databases in Simple recovery mode? If so, then
transaction log backups are not possible for those DB's, and that is
likely causing the transaction log part of your maintenance plan to
fail, preventing it from running the deletion step.
Check the job history and the maintenance plan history for error messages.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||how would I change the recovery mode and what should I change the recovery
mode to if I wanted to back up the transaction logs. Wouldn't one need the
transaction logs in a disaster recovery scenario.
"Tracy McKibben" wrote:

> George Schneider wrote:
> You say you're backing up ALL databases within a single maintenance
> plan? Are any of these databases in Simple recovery mode? If so, then
> transaction log backups are not possible for those DB's, and that is
> likely causing the transaction log part of your maintenance plan to
> fail, preventing it from running the deletion step.
> Check the job history and the maintenance plan history for error messages.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
>|||George Schneider wrote:
> how would I change the recovery mode and what should I change the recovery
> mode to if I wanted to back up the transaction logs. Wouldn't one need th
e
> transaction logs in a disaster recovery scenario.
>
Refer to Books Online for more info on recovery models. There's not a
blanket answer to your question, you'll have to decide what is
appropriate for your needs.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Hi Geroge,
Thanks for your reply.
To switch recovery mode, please refer to following article:
<http://msdn.microsoft.com/library/d...n-us/adminsql/a
d_bkprst_8ik3.asp>
Actually, MSDE & SQL 2000 is the same by the nature. Therefore, you can
refer to my reply in the "MSDE Backup " Thread. For your convenience, I
paste it here
==================
If you perform full backup regularly, you can just restore the latest
backup when disaster occurs.
The transaction log is a serial record of all the transactions that have
been performed against the database since the transaction log was last
backed up. With transaction log backups, you can recover the database to a
specific point in time (for example, prior to entering unwanted data), or
to the point of failure. Check following article:
<http://msdn.microsoft.com/library/d...n-us/adminsql/a
d_bkprst_565v.asp>
How to: Create a Transaction Log Backup (Transact-SQL)
<http://msdn2.microsoft.com/en-us/library/ms191284.aspx>
How to: Restore to the Point of Failure (Transact-SQL)
<http://msdn2.microsoft.com/en-us/library/ms175093.aspx>
How to: Restore to a Point in Time (Transact-SQL)
<http://msdn2.microsoft.com/en-us/library/ms179451.aspx>
==================
Best regards,
Vincent Xu
Microsoft Online Partner Support
========================================
==============
Get Secure! - www.microsoft.com/security
========================================
==============
When responding to posts, please "Reply to Group" via your newsreader so
that others
may learn and benefit from this issue.
========================================
==============
This posting is provided "AS IS" with no warranties,and confers no rights.
========================================
==============
--[vbcol=seagreen]
<georgedschneider@.news.postalias>[vbcol=seagreen]
<45002CE9.5010006@.realsqlguy.com>[vbcol=seagreen]
recovery[vbcol=seagreen]
the[vbcol=seagreen]
the[vbcol=seagreen]
remove the[vbcol=seagreen]
log[vbcol=seagreen]
manaully[vbcol=seagreen]
messages.[vbcol=seagreen]|||I guess I'm a little confussed here. I thought transaction logs were
required to restore to make the db full operational again. What purpose do
transaction logs perform then if you do not have to restore then in a
disaster sceanrio?
"Vincent Xu [MSFT]" wrote:

> Hi Geroge,
> Thanks for your reply.
> To switch recovery mode, please refer to following article:
> <[url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/a[/ur
l]
> d_bkprst_8ik3.asp>
> Actually, MSDE & SQL 2000 is the same by the nature. Therefore, you can
> refer to my reply in the "MSDE Backup " Thread. For your convenience, I
> paste it here
> ==================
> If you perform full backup regularly, you can just restore the latest
> backup when disaster occurs.
> The transaction log is a serial record of all the transactions that have
> been performed against the database since the transaction log was last
> backed up. With transaction log backups, you can recover the database to a
> specific point in time (for example, prior to entering unwanted data), or
> to the point of failure. Check following article:
> <http://msdn.microsoft.com/library/d...y/ms191284.aspx>
> How to: Restore to the Point of Failure (Transact-SQL)
> <http://msdn2.microsoft.com/en-us/library/ms175093.aspx>
> How to: Restore to a Point in Time (Transact-SQL)
> <http://msdn2.microsoft.com/en-us/library/ms179451.aspx>
> ==================
> Best regards,
> Vincent Xu
> Microsoft Online Partner Support
> ========================================
==============
> Get Secure! - www.microsoft.com/security
> ========================================
==============
> When responding to posts, please "Reply to Group" via your newsreader so
> that others
> may learn and benefit from this issue.
> ========================================
==============
> This posting is provided "AS IS" with no warranties,and confers no rights.
> ========================================
==============
>
> --
> <georgedschneider@.news.postalias>
> <45002CE9.5010006@.realsqlguy.com>
> recovery
> the
> the
> remove the
> log
> manaully
> messages.
>|||George Schneider wrote:
> I guess I'm a little confussed here. I thought transaction logs were
> required to restore to make the db full operational again. What purpose d
o
> transaction logs perform then if you do not have to restore then in a
> disaster sceanrio?
>
That all depends on the recovery model that you're using. The
transaction log records everything that happens in the database. Let's
say you delete a million rows from a table, and partway through that
delete operation, it fails. The delete will be rolled back, none of the
records will be deleted. In order to perform that rollback, SQL has to
record somewhere what records it's deleting - that's what the
transaction log is used for. The transaction log will need to be large
enough to hold this entire transaction. If the delete is successful,
the transaction is committed, and the events recorded in the transaction
log are flagged as committed.
In SIMPLE mode, SQL will issue periodic "checkpoint" instructions that
will flush out those committed events, and the space that was previously
used for them will be available for future transactions to use. The
transaction log will not shrink at this point, it will remain the same
physical size. Once the committed events have been flushed, they are
permanently written to the database, and the only way to "undo" them is
to restore from a full backup taken prior to the delete, probably the
backup from the night before.
In FULL or BULK-LOGGED modes, these committed events are not
automatically flushed out of the transaction log. They are flushed when
you issue a BACKUP LOG command. This gives you the ability to recover
the database to virtually any point in time. For sake of example, let's
assume you're taking transaction log backups every 5 minutes. You
delete the million rows, and an hour later, decide that you need those
rows back. You simply restore the previous full backup, and then
restore each transaction log backup up to the point where you issued the
delete. You lose an hour's worth of work instead of a full day.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Hi All,
Tracy provided great information. Well done!.
George, if youi still have anything unclear, please feel free to reply.
I'll try my best to be of assistance.
Best regards,
Vincent Xu
Microsoft Online Partner Support
========================================
==============
Get Secure! - www.microsoft.com/security
========================================
==============
When responding to posts, please "Reply to Group" via your newsreader so
that others
may learn and benefit from this issue.
========================================
==============
This posting is provided "AS IS" with no warranties,and confers no rights.
========================================
==============
--[vbcol=seagreen]
<45002CE9.5010006@.realsqlguy.com>
<784A7375-55CC-442D-8E6B-F86A5DE784DD@.microsoft.com>
<$tCEyDv0GHA.5212@.TK2MSFTNGXA01.phx.gbl>
<BFF0BF45-3B81-4813-98CD-EBCF3828C52D@.microsoft.com>[vbcol=seagreen]
purpose do[vbcol=seagreen]

Backup Permissions

Hi,
The user that i use to make backups is in the
db_backupoperator, but when i select the backup
destination the following error appear:
ERROR 229: EXECUTE permission denied on
object 'xp_availablemedia', database 'master', owner 'dbo'
cant understand
Beat regardsHi
An what are the permissions on this stored procedure?
John
"CC&JM" <anonymous@.discussions.microsoft.com> wrote in message
news:18f4301c44c93$2caec050$a301280a@.phx
.gbl...
> Hi,
> The user that i use to make backups is in the
> db_backupoperator, but when i select the backup
> destination the following error appear:
> ERROR 229: EXECUTE permission denied on
> object 'xp_availablemedia', database 'master', owner 'dbo'
> cant understand
> Beat regards|||Hi,
Open query analyzer and execute the below command:-
master..xp_availablemedia
Check the drives, the command is displaying. Based on this create the backup
files. I think you are trying to backup to a remote server or a media not
available. If the execution gives you an error try giving execute prev to
this extended procedure to your backup user.
use master
go
sp_adduser <user_name>
go
grant exec on xp_availablemedia to <user>
(Try executing backup database now)
Still if you have errors then try below:- Can you please assign "SYSADMIN"
server fixed role to this user and try backup the database.
Thanks
Hari
MCDBA
"CC&JM" <anonymous@.discussions.microsoft.com> wrote in message
news:18f4301c44c93$2caec050$a301280a@.phx
.gbl...
> Hi,
> The user that i use to make backups is in the
> db_backupoperator, but when i select the backup
> destination the following error appear:
> ERROR 229: EXECUTE permission denied on
> object 'xp_availablemedia', database 'master', owner 'dbo'
> cant understand
> Beat regards

Backup Permissions

Hi,
The user that i use to make backups is in the
db_backupoperator, but when i select the backup
destination the following error appear:
ERROR 229: EXECUTE permission denied on
object 'xp_availablemedia', database 'master', owner 'dbo'
cant understand
Beat regardsHi
An what are the permissions on this stored procedure?
John
"CC&JM" <anonymous@.discussions.microsoft.com> wrote in message
news:18f4301c44c93$2caec050$a301280a@.phx.gbl...
> Hi,
> The user that i use to make backups is in the
> db_backupoperator, but when i select the backup
> destination the following error appear:
> ERROR 229: EXECUTE permission denied on
> object 'xp_availablemedia', database 'master', owner 'dbo'
> cant understand
> Beat regards|||Hi,
Open query analyzer and execute the below command:-
master..xp_availablemedia
Check the drives, the command is displaying. Based on this create the backup
files. I think you are trying to backup to a remote server or a media not
available. If the execution gives you an error try giving execute prev to
this extended procedure to your backup user.
use master
go
sp_adduser <user_name>
go
grant exec on xp_availablemedia to <user>
(Try executing backup database now)
Still if you have errors then try below:- Can you please assign "SYSADMIN"
server fixed role to this user and try backup the database.
Thanks
Hari
MCDBA
"CC&JM" <anonymous@.discussions.microsoft.com> wrote in message
news:18f4301c44c93$2caec050$a301280a@.phx.gbl...
> Hi,
> The user that i use to make backups is in the
> db_backupoperator, but when i select the backup
> destination the following error appear:
> ERROR 229: EXECUTE permission denied on
> object 'xp_availablemedia', database 'master', owner 'dbo'
> cant understand
> Beat regards

Backup Permissions

Hi,
The user that i use to make backups is in the
db_backupoperator, but when i select the backup
destination the following error appear:
ERROR 229: EXECUTE permission denied on
object 'xp_availablemedia', database 'master', owner 'dbo'
cant understand
Beat regards
Hi
An what are the permissions on this stored procedure?
John
"CC&JM" <anonymous@.discussions.microsoft.com> wrote in message
news:18f4301c44c93$2caec050$a301280a@.phx.gbl...
> Hi,
> The user that i use to make backups is in the
> db_backupoperator, but when i select the backup
> destination the following error appear:
> ERROR 229: EXECUTE permission denied on
> object 'xp_availablemedia', database 'master', owner 'dbo'
> cant understand
> Beat regards
|||Hi,
Open query analyzer and execute the below command:-
master..xp_availablemedia
Check the drives, the command is displaying. Based on this create the backup
files. I think you are trying to backup to a remote server or a media not
available. If the execution gives you an error try giving execute prev to
this extended procedure to your backup user.
use master
go
sp_adduser <user_name>
go
grant exec on xp_availablemedia to <user>
(Try executing backup database now)
Still if you have errors then try below:- Can you please assign "SYSADMIN"
server fixed role to this user and try backup the database.
Thanks
Hari
MCDBA
"CC&JM" <anonymous@.discussions.microsoft.com> wrote in message
news:18f4301c44c93$2caec050$a301280a@.phx.gbl...
> Hi,
> The user that i use to make backups is in the
> db_backupoperator, but when i select the backup
> destination the following error appear:
> ERROR 229: EXECUTE permission denied on
> object 'xp_availablemedia', database 'master', owner 'dbo'
> cant understand
> Beat regards

Wednesday, March 7, 2012

backup only Users and Permissions

Hi,
I have a DataBase with several User's and specific permissions to every
User.
For test-reasons I have to restore the DataBase from time to time with
another DataBase that doesn't have these User's and permissions. After such
a restore my users's and permissions are gone offcourse.
So what I need is a way to have a backup of only my users and their
permissions, some kind of sql-script. In that way I should be able to put
them back after I restored the DataBase.
Does anybody knows how to do this?
Thansk a lot in advance,
PieterDragu
--Identify Orphan Users
select u.name from master..syslogins l right join
sysusers u on l.sid = u.sid
where l.sid is null and issqlrole <> 1 and isapprole <> 1
and (u.name <> 'INFORMATION_SCHEMA' and u.name <> 'guest'
and u.name <> 'system_function_schema')
----
--
These two stored procedures are provided by Microsoft. Run them on source
server. It will produce the SPID/Scripts of users/logins and then run the
script on destination server.
USE master
GO
IF OBJECT_ID ('sp_hexadecimal') IS NOT NULL
DROP PROCEDURE sp_hexadecimal
GO
CREATE PROCEDURE sp_hexadecimal
@.binvalue varbinary(256),
@.hexvalue varchar(256) OUTPUT
AS
DECLARE @.charvalue varchar(256)
DECLARE @.i int
DECLARE @.length int
DECLARE @.hexstring char(16)
SELECT @.charvalue = '0x'
SELECT @.i = 1
SELECT @.length = DATALENGTH (@.binvalue)
SELECT @.hexstring = '0123456789ABCDEF'
WHILE (@.i <= @.length)
BEGIN
DECLARE @.tempint int
DECLARE @.firstint int
DECLARE @.secondint int
SELECT @.tempint = CONVERT(int, SUBSTRING(@.binvalue,@.i,1))
SELECT @.firstint = FLOOR(@.tempint/16)
SELECT @.secondint = @.tempint - (@.firstint*16)
SELECT @.charvalue = @.charvalue +
SUBSTRING(@.hexstring, @.firstint+1, 1) +
SUBSTRING(@.hexstring, @.secondint+1, 1)
SELECT @.i = @.i + 1
END
SELECT @.hexvalue = @.charvalue
GO
IF OBJECT_ID ('sp_help_revlogin') IS NOT NULL
DROP PROCEDURE sp_help_revlogin
GO
CREATE PROCEDURE sp_help_revlogin @.login_name sysname = NULL AS
DECLARE @.name sysname
DECLARE @.xstatus int
DECLARE @.binpwd varbinary (256)
DECLARE @.txtpwd sysname
DECLARE @.tmpstr varchar (256)
DECLARE @.SID_varbinary varbinary(85)
DECLARE @.SID_string varchar(256)
IF (@.login_name IS NULL)
DECLARE login_curs CURSOR FOR
SELECT sid, name, xstatus, password FROM master..sysxlogins
WHERE srvid IS NULL AND name <> 'sa'
ELSE
DECLARE login_curs CURSOR FOR
SELECT sid, name, xstatus, password FROM master..sysxlogins
WHERE srvid IS NULL AND name = @.login_name
OPEN login_curs
FETCH NEXT FROM login_curs INTO @.SID_varbinary, @.name, @.xstatus, @.binpwd
IF (@.@.fetch_status = -1)
BEGIN
PRINT 'No login(s) found.'
CLOSE login_curs
DEALLOCATE login_curs
RETURN -1
END
SET @.tmpstr = '/* sp_help_revlogin script '
PRINT @.tmpstr
SET @.tmpstr = '** Generated '
+ CONVERT (varchar, GETDATE()) + ' on ' + @.@.SERVERNAME + ' */'
PRINT @.tmpstr
PRINT ''
PRINT 'DECLARE @.pwd sysname'
WHILE (@.@.fetch_status <> -1)
BEGIN
IF (@.@.fetch_status <> -2)
BEGIN
PRINT ''
SET @.tmpstr = '-- Login: ' + @.name
PRINT @.tmpstr
IF (@.xstatus & 4) = 4
BEGIN -- NT authenticated account/group
IF (@.xstatus & 1) = 1
BEGIN -- NT login is denied access
SET @.tmpstr = 'EXEC master..sp_denylogin ''' + @.name + ''''
PRINT @.tmpstr
END
ELSE BEGIN -- NT login has access
SET @.tmpstr = 'EXEC master..sp_grantlogin ''' + @.name + ''''
PRINT @.tmpstr
END
END
ELSE BEGIN -- SQL Server authentication
IF (@.binpwd IS NOT NULL)
BEGIN -- Non-null password
EXEC sp_hexadecimal @.binpwd, @.txtpwd OUT
IF (@.xstatus & 2048) = 2048
SET @.tmpstr = 'SET @.pwd = CONVERT (varchar(256), ' + @.txtpwd + ')'
ELSE
SET @.tmpstr = 'SET @.pwd = CONVERT (varbinary(256), ' + @.txtpwd + ')'
PRINT @.tmpstr
EXEC sp_hexadecimal @.SID_varbinary,@.SID_string OUT
SET @.tmpstr = 'EXEC master..sp_addlogin ''' + @.name
+ ''', @.pwd, @.sid = ' + @.SID_string + ', @.encryptopt = '
END
ELSE BEGIN
-- Null password
EXEC sp_hexadecimal @.SID_varbinary,@.SID_string OUT
SET @.tmpstr = 'EXEC master..sp_addlogin ''' + @.name
+ ''', NULL, @.sid = ' + @.SID_string + ', @.encryptopt = '
END
IF (@.xstatus & 2048) = 2048
-- login upgraded from 6.5
SET @.tmpstr = @.tmpstr + '''skip_encryption_old'''
ELSE
SET @.tmpstr = @.tmpstr + '''skip_encryption'''
PRINT @.tmpstr
END
END
FETCH NEXT FROM login_curs INTO @.SID_varbinary, @.name, @.xstatus, @.binpwd
END
CLOSE login_curs
DEALLOCATE login_curs
RETURN 0
GO
sp_help_revlogin
"DraguVaso" <pietercoucke@.hotmail.com> wrote in message
news:eDod5oIzEHA.3512@.TK2MSFTNGP10.phx.gbl...
> Hi,
> I have a DataBase with several User's and specific permissions to every
> User.
> For test-reasons I have to restore the DataBase from time to time with
> another DataBase that doesn't have these User's and permissions. After
such
> a restore my users's and permissions are gone offcourse.
> So what I need is a way to have a backup of only my users and their
> permissions, some kind of sql-script. In that way I should be able to put
> them back after I restored the DataBase.
> Does anybody knows how to do this?
> Thansk a lot in advance,
> Pieter
>|||Thanks,
These are two really nice and helpfull scripts.
Although: they aren't what I need: these are jsut the Login's, but I have
them alreaddy on my Server, and they aren't changed during the restore.
What I actually need is a script for the individual Permissions of each user
on every table...
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:eqsgKLJzEHA.1932@.TK2MSFTNGP09.phx.gbl...
> Dragu
> --Identify Orphan Users
> select u.name from master..syslogins l right join
> sysusers u on l.sid = u.sid
> where l.sid is null and issqlrole <> 1 and isapprole <> 1
> and (u.name <> 'INFORMATION_SCHEMA' and u.name <> 'guest'
> and u.name <> 'system_function_schema')
> ----
--
> --
> These two stored procedures are provided by Microsoft. Run them on source
> server. It will produce the SPID/Scripts of users/logins and then run the
> script on destination server.
> USE master
> GO
> IF OBJECT_ID ('sp_hexadecimal') IS NOT NULL
> DROP PROCEDURE sp_hexadecimal
> GO
> CREATE PROCEDURE sp_hexadecimal
> @.binvalue varbinary(256),
> @.hexvalue varchar(256) OUTPUT
> AS
> DECLARE @.charvalue varchar(256)
> DECLARE @.i int
> DECLARE @.length int
> DECLARE @.hexstring char(16)
> SELECT @.charvalue = '0x'
> SELECT @.i = 1
> SELECT @.length = DATALENGTH (@.binvalue)
> SELECT @.hexstring = '0123456789ABCDEF'
> WHILE (@.i <= @.length)
> BEGIN
> DECLARE @.tempint int
> DECLARE @.firstint int
> DECLARE @.secondint int
> SELECT @.tempint = CONVERT(int, SUBSTRING(@.binvalue,@.i,1))
> SELECT @.firstint = FLOOR(@.tempint/16)
> SELECT @.secondint = @.tempint - (@.firstint*16)
> SELECT @.charvalue = @.charvalue +
> SUBSTRING(@.hexstring, @.firstint+1, 1) +
> SUBSTRING(@.hexstring, @.secondint+1, 1)
> SELECT @.i = @.i + 1
> END
> SELECT @.hexvalue = @.charvalue
> GO
> IF OBJECT_ID ('sp_help_revlogin') IS NOT NULL
> DROP PROCEDURE sp_help_revlogin
> GO
> CREATE PROCEDURE sp_help_revlogin @.login_name sysname = NULL AS
> DECLARE @.name sysname
> DECLARE @.xstatus int
> DECLARE @.binpwd varbinary (256)
> DECLARE @.txtpwd sysname
> DECLARE @.tmpstr varchar (256)
> DECLARE @.SID_varbinary varbinary(85)
> DECLARE @.SID_string varchar(256)
> IF (@.login_name IS NULL)
> DECLARE login_curs CURSOR FOR
> SELECT sid, name, xstatus, password FROM master..sysxlogins
> WHERE srvid IS NULL AND name <> 'sa'
> ELSE
> DECLARE login_curs CURSOR FOR
> SELECT sid, name, xstatus, password FROM master..sysxlogins
> WHERE srvid IS NULL AND name = @.login_name
> OPEN login_curs
> FETCH NEXT FROM login_curs INTO @.SID_varbinary, @.name, @.xstatus, @.binpwd
> IF (@.@.fetch_status = -1)
> BEGIN
> PRINT 'No login(s) found.'
> CLOSE login_curs
> DEALLOCATE login_curs
> RETURN -1
> END
> SET @.tmpstr = '/* sp_help_revlogin script '
> PRINT @.tmpstr
> SET @.tmpstr = '** Generated '
> + CONVERT (varchar, GETDATE()) + ' on ' + @.@.SERVERNAME + ' */'
> PRINT @.tmpstr
> PRINT ''
> PRINT 'DECLARE @.pwd sysname'
> WHILE (@.@.fetch_status <> -1)
> BEGIN
> IF (@.@.fetch_status <> -2)
> BEGIN
> PRINT ''
> SET @.tmpstr = '-- Login: ' + @.name
> PRINT @.tmpstr
> IF (@.xstatus & 4) = 4
> BEGIN -- NT authenticated account/group
> IF (@.xstatus & 1) = 1
> BEGIN -- NT login is denied access
> SET @.tmpstr = 'EXEC master..sp_denylogin ''' + @.name + ''''
> PRINT @.tmpstr
> END
> ELSE BEGIN -- NT login has access
> SET @.tmpstr = 'EXEC master..sp_grantlogin ''' + @.name + ''''
> PRINT @.tmpstr
> END
> END
> ELSE BEGIN -- SQL Server authentication
> IF (@.binpwd IS NOT NULL)
> BEGIN -- Non-null password
> EXEC sp_hexadecimal @.binpwd, @.txtpwd OUT
> IF (@.xstatus & 2048) = 2048
> SET @.tmpstr = 'SET @.pwd = CONVERT (varchar(256), ' + @.txtpwd + ')'
> ELSE
> SET @.tmpstr = 'SET @.pwd = CONVERT (varbinary(256), ' + @.txtpwd + ')'
> PRINT @.tmpstr
> EXEC sp_hexadecimal @.SID_varbinary,@.SID_string OUT
> SET @.tmpstr = 'EXEC master..sp_addlogin ''' + @.name
> + ''', @.pwd, @.sid = ' + @.SID_string + ', @.encryptopt = '
> END
> ELSE BEGIN
> -- Null password
> EXEC sp_hexadecimal @.SID_varbinary,@.SID_string OUT
> SET @.tmpstr = 'EXEC master..sp_addlogin ''' + @.name
> + ''', NULL, @.sid = ' + @.SID_string + ', @.encryptopt = '
> END
> IF (@.xstatus & 2048) = 2048
> -- login upgraded from 6.5
> SET @.tmpstr = @.tmpstr + '''skip_encryption_old'''
> ELSE
> SET @.tmpstr = @.tmpstr + '''skip_encryption'''
> PRINT @.tmpstr
> END
> END
> FETCH NEXT FROM login_curs INTO @.SID_varbinary, @.name, @.xstatus, @.binpwd
> END
> CLOSE login_curs
> DEALLOCATE login_curs
> RETURN 0
> GO
> sp_help_revlogin
> "DraguVaso" <pietercoucke@.hotmail.com> wrote in message
> news:eDod5oIzEHA.3512@.TK2MSFTNGP10.phx.gbl...
> > Hi,
> >
> > I have a DataBase with several User's and specific permissions to every
> > User.
> > For test-reasons I have to restore the DataBase from time to time with
> > another DataBase that doesn't have these User's and permissions. After
> such
> > a restore my users's and permissions are gone offcourse.
> >
> > So what I need is a way to have a backup of only my users and their
> > permissions, some kind of sql-script. In that way I should be able to
put
> > them back after I restored the DataBase.
> >
> > Does anybody knows how to do this?
> >
> > Thansk a lot in advance,
> >
> > Pieter
> >
> >
>|||Hi
Look at this stored procedure
sp_helprotect
"DraguVaso" <pietercoucke@.hotmail.com> wrote in message
news:uKU5kQJzEHA.3368@.TK2MSFTNGP15.phx.gbl...
> Thanks,
> These are two really nice and helpfull scripts.
> Although: they aren't what I need: these are jsut the Login's, but I have
> them alreaddy on my Server, and they aren't changed during the restore.
> What I actually need is a script for the individual Permissions of each
user
> on every table...
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:eqsgKLJzEHA.1932@.TK2MSFTNGP09.phx.gbl...
> > Dragu
> > --Identify Orphan Users
> > select u.name from master..syslogins l right join
> > sysusers u on l.sid = u.sid
> > where l.sid is null and issqlrole <> 1 and isapprole <> 1
> > and (u.name <> 'INFORMATION_SCHEMA' and u.name <> 'guest'
> > and u.name <> 'system_function_schema')
> ----
> --
> > --
> > These two stored procedures are provided by Microsoft. Run them on
source
> > server. It will produce the SPID/Scripts of users/logins and then run
the
> > script on destination server.
> >
> > USE master
> > GO
> > IF OBJECT_ID ('sp_hexadecimal') IS NOT NULL
> > DROP PROCEDURE sp_hexadecimal
> > GO
> > CREATE PROCEDURE sp_hexadecimal
> > @.binvalue varbinary(256),
> > @.hexvalue varchar(256) OUTPUT
> > AS
> > DECLARE @.charvalue varchar(256)
> > DECLARE @.i int
> > DECLARE @.length int
> > DECLARE @.hexstring char(16)
> > SELECT @.charvalue = '0x'
> > SELECT @.i = 1
> > SELECT @.length = DATALENGTH (@.binvalue)
> > SELECT @.hexstring = '0123456789ABCDEF'
> > WHILE (@.i <= @.length)
> > BEGIN
> > DECLARE @.tempint int
> > DECLARE @.firstint int
> > DECLARE @.secondint int
> > SELECT @.tempint = CONVERT(int, SUBSTRING(@.binvalue,@.i,1))
> > SELECT @.firstint = FLOOR(@.tempint/16)
> > SELECT @.secondint = @.tempint - (@.firstint*16)
> > SELECT @.charvalue = @.charvalue +
> > SUBSTRING(@.hexstring, @.firstint+1, 1) +
> > SUBSTRING(@.hexstring, @.secondint+1, 1)
> > SELECT @.i = @.i + 1
> > END
> > SELECT @.hexvalue = @.charvalue
> > GO
> >
> > IF OBJECT_ID ('sp_help_revlogin') IS NOT NULL
> > DROP PROCEDURE sp_help_revlogin
> > GO
> > CREATE PROCEDURE sp_help_revlogin @.login_name sysname = NULL AS
> > DECLARE @.name sysname
> > DECLARE @.xstatus int
> > DECLARE @.binpwd varbinary (256)
> > DECLARE @.txtpwd sysname
> > DECLARE @.tmpstr varchar (256)
> > DECLARE @.SID_varbinary varbinary(85)
> > DECLARE @.SID_string varchar(256)
> >
> > IF (@.login_name IS NULL)
> > DECLARE login_curs CURSOR FOR
> > SELECT sid, name, xstatus, password FROM master..sysxlogins
> > WHERE srvid IS NULL AND name <> 'sa'
> > ELSE
> > DECLARE login_curs CURSOR FOR
> > SELECT sid, name, xstatus, password FROM master..sysxlogins
> > WHERE srvid IS NULL AND name = @.login_name
> > OPEN login_curs
> > FETCH NEXT FROM login_curs INTO @.SID_varbinary, @.name, @.xstatus, @.binpwd
> > IF (@.@.fetch_status = -1)
> > BEGIN
> > PRINT 'No login(s) found.'
> > CLOSE login_curs
> > DEALLOCATE login_curs
> > RETURN -1
> > END
> > SET @.tmpstr = '/* sp_help_revlogin script '
> > PRINT @.tmpstr
> > SET @.tmpstr = '** Generated '
> > + CONVERT (varchar, GETDATE()) + ' on ' + @.@.SERVERNAME + ' */'
> > PRINT @.tmpstr
> > PRINT ''
> > PRINT 'DECLARE @.pwd sysname'
> > WHILE (@.@.fetch_status <> -1)
> > BEGIN
> > IF (@.@.fetch_status <> -2)
> > BEGIN
> > PRINT ''
> > SET @.tmpstr = '-- Login: ' + @.name
> > PRINT @.tmpstr
> > IF (@.xstatus & 4) = 4
> > BEGIN -- NT authenticated account/group
> > IF (@.xstatus & 1) = 1
> > BEGIN -- NT login is denied access
> > SET @.tmpstr = 'EXEC master..sp_denylogin ''' + @.name + ''''
> > PRINT @.tmpstr
> > END
> > ELSE BEGIN -- NT login has access
> > SET @.tmpstr = 'EXEC master..sp_grantlogin ''' + @.name + ''''
> > PRINT @.tmpstr
> > END
> > END
> > ELSE BEGIN -- SQL Server authentication
> > IF (@.binpwd IS NOT NULL)
> > BEGIN -- Non-null password
> > EXEC sp_hexadecimal @.binpwd, @.txtpwd OUT
> > IF (@.xstatus & 2048) = 2048
> > SET @.tmpstr = 'SET @.pwd = CONVERT (varchar(256), ' + @.txtpwd + ')'
> > ELSE
> > SET @.tmpstr = 'SET @.pwd = CONVERT (varbinary(256), ' + @.txtpwd + ')'
> > PRINT @.tmpstr
> > EXEC sp_hexadecimal @.SID_varbinary,@.SID_string OUT
> > SET @.tmpstr = 'EXEC master..sp_addlogin ''' + @.name
> > + ''', @.pwd, @.sid = ' + @.SID_string + ', @.encryptopt = '
> > END
> > ELSE BEGIN
> > -- Null password
> > EXEC sp_hexadecimal @.SID_varbinary,@.SID_string OUT
> > SET @.tmpstr = 'EXEC master..sp_addlogin ''' + @.name
> > + ''', NULL, @.sid = ' + @.SID_string + ', @.encryptopt = '
> > END
> > IF (@.xstatus & 2048) = 2048
> > -- login upgraded from 6.5
> > SET @.tmpstr = @.tmpstr + '''skip_encryption_old'''
> > ELSE
> > SET @.tmpstr = @.tmpstr + '''skip_encryption'''
> > PRINT @.tmpstr
> > END
> > END
> > FETCH NEXT FROM login_curs INTO @.SID_varbinary, @.name, @.xstatus, @.binpwd
> > END
> > CLOSE login_curs
> > DEALLOCATE login_curs
> > RETURN 0
> > GO
> >
> > sp_help_revlogin
> >
> > "DraguVaso" <pietercoucke@.hotmail.com> wrote in message
> > news:eDod5oIzEHA.3512@.TK2MSFTNGP10.phx.gbl...
> > > Hi,
> > >
> > > I have a DataBase with several User's and specific permissions to
every
> > > User.
> > > For test-reasons I have to restore the DataBase from time to time with
> > > another DataBase that doesn't have these User's and permissions. After
> > such
> > > a restore my users's and permissions are gone offcourse.
> > >
> > > So what I need is a way to have a backup of only my users and their
> > > permissions, some kind of sql-script. In that way I should be able to
> put
> > > them back after I restored the DataBase.
> > >
> > > Does anybody knows how to do this?
> > >
> > > Thansk a lot in advance,
> > >
> > > Pieter
> > >
> > >
> >
> >
>

backup only Users and Permissions

Hi,
I have a DataBase with several User's and specific permissions to every
User.
For test-reasons I have to restore the DataBase from time to time with
another DataBase that doesn't have these User's and permissions. After such
a restore my users's and permissions are gone offcourse.
So what I need is a way to have a backup of only my users and their
permissions, some kind of sql-script. In that way I should be able to put
them back after I restored the DataBase.
Does anybody knows how to do this?
Thansk a lot in advance,
PieterDragu
--Identify Orphan Users
select u.name from master..syslogins l right join
sysusers u on l.sid = u.sid
where l.sid is null and issqlrole <> 1 and isapprole <> 1
and (u.name <> 'INFORMATION_SCHEMA' and u.name <> 'guest'
and u.name <> 'system_function_schema')
----
--
These two stored procedures are provided by Microsoft. Run them on source
server. It will produce the SPID/Scripts of users/logins and then run the
script on destination server.
USE master
GO
IF OBJECT_ID ('sp_hexadecimal') IS NOT NULL
DROP PROCEDURE sp_hexadecimal
GO
CREATE PROCEDURE sp_hexadecimal
@.binvalue varbinary(256),
@.hexvalue varchar(256) OUTPUT
AS
DECLARE @.charvalue varchar(256)
DECLARE @.i int
DECLARE @.length int
DECLARE @.hexstring char(16)
SELECT @.charvalue = '0x'
SELECT @.i = 1
SELECT @.length = DATALENGTH (@.binvalue)
SELECT @.hexstring = '0123456789ABCDEF'
WHILE (@.i <= @.length)
BEGIN
DECLARE @.tempint int
DECLARE @.firstint int
DECLARE @.secondint int
SELECT @.tempint = CONVERT(int, SUBSTRING(@.binvalue,@.i,1))
SELECT @.firstint = FLOOR(@.tempint/16)
SELECT @.secondint = @.tempint - (@.firstint*16)
SELECT @.charvalue = @.charvalue +
SUBSTRING(@.hexstring, @.firstint+1, 1) +
SUBSTRING(@.hexstring, @.secondint+1, 1)
SELECT @.i = @.i + 1
END
SELECT @.hexvalue = @.charvalue
GO
IF OBJECT_ID ('sp_help_revlogin') IS NOT NULL
DROP PROCEDURE sp_help_revlogin
GO
CREATE PROCEDURE sp_help_revlogin @.login_name sysname = NULL AS
DECLARE @.name sysname
DECLARE @.xstatus int
DECLARE @.binpwd varbinary (256)
DECLARE @.txtpwd sysname
DECLARE @.tmpstr varchar (256)
DECLARE @.SID_varbinary varbinary(85)
DECLARE @.SID_string varchar(256)
IF (@.login_name IS NULL)
DECLARE login_curs CURSOR FOR
SELECT sid, name, xstatus, password FROM master..sysxlogins
WHERE srvid IS NULL AND name <> 'sa'
ELSE
DECLARE login_curs CURSOR FOR
SELECT sid, name, xstatus, password FROM master..sysxlogins
WHERE srvid IS NULL AND name = @.login_name
OPEN login_curs
FETCH NEXT FROM login_curs INTO @.SID_varbinary, @.name, @.xstatus, @.binpwd
IF (@.@.fetch_status = -1)
BEGIN
PRINT 'No login(s) found.'
CLOSE login_curs
DEALLOCATE login_curs
RETURN -1
END
SET @.tmpstr = '/* sp_help_revlogin script '
PRINT @.tmpstr
SET @.tmpstr = '** Generated '
+ CONVERT (varchar, GETDATE()) + ' on ' + @.@.SERVERNAME + ' */'
PRINT @.tmpstr
PRINT ''
PRINT 'DECLARE @.pwd sysname'
WHILE (@.@.fetch_status <> -1)
BEGIN
IF (@.@.fetch_status <> -2)
BEGIN
PRINT ''
SET @.tmpstr = '-- Login: ' + @.name
PRINT @.tmpstr
IF (@.xstatus & 4) = 4
BEGIN -- NT authenticated account/group
IF (@.xstatus & 1) = 1
BEGIN -- NT login is denied access
SET @.tmpstr = 'EXEC master..sp_denylogin ''' + @.name + ''''
PRINT @.tmpstr
END
ELSE BEGIN -- NT login has access
SET @.tmpstr = 'EXEC master..sp_grantlogin ''' + @.name + ''''
PRINT @.tmpstr
END
END
ELSE BEGIN -- SQL Server authentication
IF (@.binpwd IS NOT NULL)
BEGIN -- Non-null password
EXEC sp_hexadecimal @.binpwd, @.txtpwd OUT
IF (@.xstatus & 2048) = 2048
SET @.tmpstr = 'SET @.pwd = CONVERT (varchar(256), ' + @.txtpwd + ')'
ELSE
SET @.tmpstr = 'SET @.pwd = CONVERT (varbinary(256), ' + @.txtpwd + ')'
PRINT @.tmpstr
EXEC sp_hexadecimal @.SID_varbinary,@.SID_string OUT
SET @.tmpstr = 'EXEC master..sp_addlogin ''' + @.name
+ ''', @.pwd, @.sid = ' + @.SID_string + ', @.encryptopt = '
END
ELSE BEGIN
-- Null password
EXEC sp_hexadecimal @.SID_varbinary,@.SID_string OUT
SET @.tmpstr = 'EXEC master..sp_addlogin ''' + @.name
+ ''', NULL, @.sid = ' + @.SID_string + ', @.encryptopt = '
END
IF (@.xstatus & 2048) = 2048
-- login upgraded from 6.5
SET @.tmpstr = @.tmpstr + '''skip_encryption_old'''
ELSE
SET @.tmpstr = @.tmpstr + '''skip_encryption'''
PRINT @.tmpstr
END
END
FETCH NEXT FROM login_curs INTO @.SID_varbinary, @.name, @.xstatus, @.binpwd
END
CLOSE login_curs
DEALLOCATE login_curs
RETURN 0
GO
sp_help_revlogin
"DraguVaso" <pietercoucke@.hotmail.com> wrote in message
news:eDod5oIzEHA.3512@.TK2MSFTNGP10.phx.gbl...
> Hi,
> I have a DataBase with several User's and specific permissions to every
> User.
> For test-reasons I have to restore the DataBase from time to time with
> another DataBase that doesn't have these User's and permissions. After
such
> a restore my users's and permissions are gone offcourse.
> So what I need is a way to have a backup of only my users and their
> permissions, some kind of sql-script. In that way I should be able to put
> them back after I restored the DataBase.
> Does anybody knows how to do this?
> Thansk a lot in advance,
> Pieter
>|||Thanks,
These are two really nice and helpfull scripts.
Although: they aren't what I need: these are jsut the Login's, but I have
them alreaddy on my Server, and they aren't changed during the restore.
What I actually need is a script for the individual Permissions of each user
on every table...
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:eqsgKLJzEHA.1932@.TK2MSFTNGP09.phx.gbl...
> Dragu
> --Identify Orphan Users
> select u.name from master..syslogins l right join
> sysusers u on l.sid = u.sid
> where l.sid is null and issqlrole <> 1 and isapprole <> 1
> and (u.name <> 'INFORMATION_SCHEMA' and u.name <> 'guest'
> and u.name <> 'system_function_schema')
> ----
--
> --
> These two stored procedures are provided by Microsoft. Run them on source
> server. It will produce the SPID/Scripts of users/logins and then run the
> script on destination server.
> USE master
> GO
> IF OBJECT_ID ('sp_hexadecimal') IS NOT NULL
> DROP PROCEDURE sp_hexadecimal
> GO
> CREATE PROCEDURE sp_hexadecimal
> @.binvalue varbinary(256),
> @.hexvalue varchar(256) OUTPUT
> AS
> DECLARE @.charvalue varchar(256)
> DECLARE @.i int
> DECLARE @.length int
> DECLARE @.hexstring char(16)
> SELECT @.charvalue = '0x'
> SELECT @.i = 1
> SELECT @.length = DATALENGTH (@.binvalue)
> SELECT @.hexstring = '0123456789ABCDEF'
> WHILE (@.i <= @.length)
> BEGIN
> DECLARE @.tempint int
> DECLARE @.firstint int
> DECLARE @.secondint int
> SELECT @.tempint = CONVERT(int, SUBSTRING(@.binvalue,@.i,1))
> SELECT @.firstint = FLOOR(@.tempint/16)
> SELECT @.secondint = @.tempint - (@.firstint*16)
> SELECT @.charvalue = @.charvalue +
> SUBSTRING(@.hexstring, @.firstint+1, 1) +
> SUBSTRING(@.hexstring, @.secondint+1, 1)
> SELECT @.i = @.i + 1
> END
> SELECT @.hexvalue = @.charvalue
> GO
> IF OBJECT_ID ('sp_help_revlogin') IS NOT NULL
> DROP PROCEDURE sp_help_revlogin
> GO
> CREATE PROCEDURE sp_help_revlogin @.login_name sysname = NULL AS
> DECLARE @.name sysname
> DECLARE @.xstatus int
> DECLARE @.binpwd varbinary (256)
> DECLARE @.txtpwd sysname
> DECLARE @.tmpstr varchar (256)
> DECLARE @.SID_varbinary varbinary(85)
> DECLARE @.SID_string varchar(256)
> IF (@.login_name IS NULL)
> DECLARE login_curs CURSOR FOR
> SELECT sid, name, xstatus, password FROM master..sysxlogins
> WHERE srvid IS NULL AND name <> 'sa'
> ELSE
> DECLARE login_curs CURSOR FOR
> SELECT sid, name, xstatus, password FROM master..sysxlogins
> WHERE srvid IS NULL AND name = @.login_name
> OPEN login_curs
> FETCH NEXT FROM login_curs INTO @.SID_varbinary, @.name, @.xstatus, @.binpwd
> IF (@.@.fetch_status = -1)
> BEGIN
> PRINT 'No login(s) found.'
> CLOSE login_curs
> DEALLOCATE login_curs
> RETURN -1
> END
> SET @.tmpstr = '/* sp_help_revlogin script '
> PRINT @.tmpstr
> SET @.tmpstr = '** Generated '
> + CONVERT (varchar, GETDATE()) + ' on ' + @.@.SERVERNAME + ' */'
> PRINT @.tmpstr
> PRINT ''
> PRINT 'DECLARE @.pwd sysname'
> WHILE (@.@.fetch_status <> -1)
> BEGIN
> IF (@.@.fetch_status <> -2)
> BEGIN
> PRINT ''
> SET @.tmpstr = '-- Login: ' + @.name
> PRINT @.tmpstr
> IF (@.xstatus & 4) = 4
> BEGIN -- NT authenticated account/group
> IF (@.xstatus & 1) = 1
> BEGIN -- NT login is denied access
> SET @.tmpstr = 'EXEC master..sp_denylogin ''' + @.name + ''''
> PRINT @.tmpstr
> END
> ELSE BEGIN -- NT login has access
> SET @.tmpstr = 'EXEC master..sp_grantlogin ''' + @.name + ''''
> PRINT @.tmpstr
> END
> END
> ELSE BEGIN -- SQL Server authentication
> IF (@.binpwd IS NOT NULL)
> BEGIN -- Non-null password
> EXEC sp_hexadecimal @.binpwd, @.txtpwd OUT
> IF (@.xstatus & 2048) = 2048
> SET @.tmpstr = 'SET @.pwd = CONVERT (varchar(256), ' + @.txtpwd + ')'
> ELSE
> SET @.tmpstr = 'SET @.pwd = CONVERT (varbinary(256), ' + @.txtpwd + ')'
> PRINT @.tmpstr
> EXEC sp_hexadecimal @.SID_varbinary,@.SID_string OUT
> SET @.tmpstr = 'EXEC master..sp_addlogin ''' + @.name
> + ''', @.pwd, @.sid = ' + @.SID_string + ', @.encryptopt = '
> END
> ELSE BEGIN
> -- Null password
> EXEC sp_hexadecimal @.SID_varbinary,@.SID_string OUT
> SET @.tmpstr = 'EXEC master..sp_addlogin ''' + @.name
> + ''', NULL, @.sid = ' + @.SID_string + ', @.encryptopt = '
> END
> IF (@.xstatus & 2048) = 2048
> -- login upgraded from 6.5
> SET @.tmpstr = @.tmpstr + '''skip_encryption_old'''
> ELSE
> SET @.tmpstr = @.tmpstr + '''skip_encryption'''
> PRINT @.tmpstr
> END
> END
> FETCH NEXT FROM login_curs INTO @.SID_varbinary, @.name, @.xstatus, @.binpwd
> END
> CLOSE login_curs
> DEALLOCATE login_curs
> RETURN 0
> GO
> sp_help_revlogin
> "DraguVaso" <pietercoucke@.hotmail.com> wrote in message
> news:eDod5oIzEHA.3512@.TK2MSFTNGP10.phx.gbl...
> such
put[vbcol=seagreen]
>|||Hi
Look at this stored procedure
sp_helprotect
"DraguVaso" <pietercoucke@.hotmail.com> wrote in message
news:uKU5kQJzEHA.3368@.TK2MSFTNGP15.phx.gbl...
> Thanks,
> These are two really nice and helpfull scripts.
> Although: they aren't what I need: these are jsut the Login's, but I have
> them alreaddy on my Server, and they aren't changed during the restore.
> What I actually need is a script for the individual Permissions of each
user
> on every table...
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:eqsgKLJzEHA.1932@.TK2MSFTNGP09.phx.gbl...
> ----
> --
source[vbcol=seagreen]
the[vbcol=seagreen]
every[vbcol=seagreen]
> put
>

Backup on Local Disk Failing! urgent help plz!

Folks, this is the error i get when backing up user db to local disk:

[Microsoft][ODBC SQL Server Driver][Shared Memory]ConnectionRead (WrapperRead()).
Server: Msg 11, Level 16, State 1, Line 0
General network error. Check your network documentation.
10 percent backed up.

Connection Broken

If i copy a file (2gb) to local disk from network it works. The disk have much space. Any ideas;;; :confused:

I get the same error when backuping up even MSDB to a network path using UNC [\\].How large is the db you're trying to back up. How much disk space do you have? Can you backup a very small database?|||As i mentioned; i get the error even backing up MSDB(system) db either on network or local disk. Strangely; when i try backing up any db to local disk using EM; i get the message; backup successfully completed. and the file disappears(0 kb during backup) disappears on the disk!
Killing me!|||How is your SQL Server registered? Are you using the server name or are you using (local) or . ?
Whenever you use the 2 last options to register your server in EM it uses the shared memory driver, If you use the name of your server/instance, It should make it use the network librbary instead. I say that only to get to the point that if it is not a diskspace issue, it may be a memory issue, perhaps RAM going out.

I know that's not really a solution, but perhaps it can help you troubleshoot.|||How is the SQLServerAgent service and the MSSQLServer Service configured on the Log On tab in services? Are they configured to log on as "Local System"? Also, are there any messages in the SQL Server errorlog, or the NT Application event log?|||I don't quite understand "disappears from the disk" part. But in your first post you mentioned something about copying the file (2GB) from a share to a local drive and the backup would work. This leads me to believe that you're appending to the same backup file. I've seen cases when an interupted backup/restore would corrupt the device and no further appends are possible. The only solution would be to re-create the backup file by deleting the old one and creating a new one by backing up your database. Appending is a bad idea because it leads to what I've just described, in which case you DR is down the drain.|||Hi folks, thanx so much for ur input.
RESTARTING the instance just squared it away; so i suspect as mentioned by the fellow, memory problem (but what's the permanent fix?)
I didn't change any SQL-AGENT of SQL changes so far nor did this production machine had been restarted for last 2 months. I just saw my scheduled backup job failed last night and since then i tried restarting the job; backing the databases manually using QA or EM. So i didn't change any settings so far. I couldn't restart the instance during working times so i posted for the suggestion. After the restart it's working.
And, guru? believe me the file on the disk was of zero kb while backing up the db, then after the success message on EM i coldn't find the file; while in QA i get the GENERAL NETWORK error. Wasn't using the append db option!

Howdy!|||See this:

http://support.microsoft.com/default.aspx?scid=kb;en-us;827452|||Hmmm, and I had this in my Favorites for while it was still in the Premier section...Good catch, pshisbey!|||Many thanx to ya all!