473,583 Members | 3,072 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DB Maintenance Plan - single user mode

I have a db maintenance plan which is set to backup (then truncate hopefully)
the transaction log. In order to backup a transaction log the db must be in
single user mode so the maint. plan fails. How do you automatically set the db,
in single user mode, for the transaction log to be backed up then truncated?

Also, I manually set the db in single user mode and it shows itself to be in
single user mode yet the number of users in the db properties says there are 8
users connected. What's this about?

Thanks

Mark

Jul 20 '05 #1
5 19469
I realize that the recovery option must be full or bulk-logged for db backup to
occur, so I guess I can use t-sql to truncate but it is not preferred.

Mark S wrote:
I have a db maintenance plan which is set to backup (then truncate
hopefully) the transaction log. In order to backup a transaction log the
db must be in single user mode so the maint. plan fails. How do you
automatically set the db, in single user mode, for the transaction log
to be backed up then truncated?

Also, I manually set the db in single user mode and it shows itself to
be in single user mode yet the number of users in the db properties says
there are 8 users connected. What's this about?

Thanks

Mark


Jul 20 '05 #2
Simple recovery mode marks the inactive portion of the log to truncate after
the data is checkpointed. No additional steps are required. Note that
truncating the log has no effect on the log file(s) size(s). The truncation
is internal. Shrinking the transaction log files requires using the DBCC
SHRINKFILE command.

Read BOL for more information on choosing a recovery model and implementing
t-log and full backups.

--
Geoff N. Hiten
SQL Server MVP
Senior Database Administrator
Careerbuilder.c om

"Mark S" <ma**********@a v.com> wrote in message
news:bh******** **@nntp2-cm.news.eni.net ...
I realize that the recovery option must be full or bulk-logged for db backup to occur, so I guess I can use t-sql to truncate but it is not preferred.

Mark S wrote:
I have a db maintenance plan which is set to backup (then truncate
hopefully) the transaction log. In order to backup a transaction log the
db must be in single user mode so the maint. plan fails. How do you
automatically set the db, in single user mode, for the transaction log
to be backed up then truncated?

Also, I manually set the db in single user mode and it shows itself to
be in single user mode yet the number of users in the db properties says
there are 8 users connected. What's this about?

Thanks

Mark

Jul 20 '05 #3
jj
I had the same problem. Every time I tried to backup the
transaction log (included in my Maintenance Plan), I got an
error that the log could not be backed up, unless the DB was
in single-user mode.

I read through several books, BOS, even posted several
messages on this newsgroup, just like you. But, could not
get my answer. I finally got the answer.

First, ignore the "single user mode" error. I don't know
why SQL Server provides this error message.

The reason why you can't backup the log (and several of the
system databases), is because you have your database in
SIMPLE RECOVERY MODE. You need to change this to FULL
recovery mode.

Can you believe this? After taking a course in SQL Server
2000 Administration, reading 2 full training books, and
working with SQL Server 2K for over 2 years, that NOWHERE
did I find out that the reason the transaction log wouldn't
backup, is because the DB recovery method was set to SIMPLE?
I can't believe something this important isn't covered or
mentioned in documentation. Nor, was anyone on this
newsgroup able to help. That's why I'm taking the time to
help you, because I wish someone would have given me this
information several years ago.

As a result, only recently was I able to backup my
transaction log, for the first time in almost 2 years. It
was 13 Gigs in size. (Now, it's about 20 megs).

To do this, open Enterprise Mgr, and right-click on your
database, and choose PROPERTIES. Under the OPTIONS tab,
change recovery mode to FULL. After doing this, you might
want to take your database OFFLINE, then ONLINE. To do
this, just right-click your database, and choose TAKE
OFFLINE. Then, wait 10-15 seconds, then choose BRING ONLINE.

You can now backup your log, and any of the system databases
that wouldn't backup.

Keep in mind that when you have your database in SIMPLE
recovery mode, you can only RESTORE the database from the
last FULL BACKUP performed on your database.

If recovery mode is set to FULL, you can RESTORE your
database at any point, from the last full backup to current
day/time. However, in FULL mode, the transaction log will
grow. This is because the log is used to help restore your
database, so it keeps track of all the transactions since
the last backup.

Also, in FULL mode, you'll need to regularly backup your
database AND transaction log. And remember to SHRINK the DB
and LOG after the backup, in order to keep the transaction
log to a reasonable size. Otherwise, if you don't shrink
it, it will grow and grow (if your settings allow unlimited
growth), until all your disk space is used up.

Many people backup the log every n hours, or once/day, and
run the backups daily or weekly.

Sometimes when you use the SHRINK database command (using
FILES, to select the LOG file), it doesn't actually shrink
the LOG. So, you may have to use the DBCC SHRINKDATABASE or
SHRINKFILE transact SQL. I still haven't figured this one
out, as far as the syntax.

So, I use a technique, taught to me by a nice person on this
newsgroup, that WILL shrink the log file (in actual size),
using EM's SHRINK DATABASE (FILES) option. If you would
like this info, let me know, and I'll post it. Good luck.

jj
=============== ============
Mark S wrote:
I have a db maintenance plan which is set to backup (then truncate
hopefully) the transaction log. In order to backup a transaction log the
db must be in single user mode so the maint. plan fails. How do you
automatically set the db, in single user mode, for the transaction log
to be backed up then truncated?

Also, I manually set the db in single user mode and it shows itself to
be in single user mode yet the number of users in the db properties says
there are 8 users connected. What's this about?

Thanks

Mark


Jul 20 '05 #4

<quote> "So, I use a technique, taught to me by a nice person on this

newsgroup, that WILL shrink the log file (in actual size),

using EM's SHRINK DATABASE (FILES) option. If you would

like this info, let me know, and I'll post it. Good luck.

</quote>

Jj,

I would like to know more about your "shrinking technique". I had the
same problem (simple/full recovery mode), but thanks to you I did have
to search for long. Today, I'm going to try your solution concerning
the single user mode-error. After that, I will check out the size of
that log to decide if srinking is needed.

Grooverider
--
Posted via http://dbforums.com
Jul 20 '05 #5
Hi

You may want to check out

http://msdn.microsoft.com/library/de...r_da2_1uzr.asp

John

"grooveride r" <me*********@db forums.com> wrote in message
news:33******** ********@dbforu ms.com...

<quote> "So, I use a technique, taught to me by a nice person on this

newsgroup, that WILL shrink the log file (in actual size),

using EM's SHRINK DATABASE (FILES) option. If you would

like this info, let me know, and I'll post it. Good luck.

</quote>

Jj,

I would like to know more about your "shrinking technique". I had the
same problem (simple/full recovery mode), but thanks to you I did have
to search for long. Today, I'm going to try your solution concerning
the single user mode-error. After that, I will check out the size of
that log to decide if srinking is needed.

Grooverider
--
Posted via http://dbforums.com

Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2994
by: Vincent Jones | last post by:
If I start the server in single user mode does it reset the sort order?
1
2015
by: debashish | last post by:
Hello Faculties When doing recovery after loss of data files, one would like to start SQL Server in single user mode. Is this possible? Thanks in advance Debashish
5
5698
by: mghale | last post by:
Hi, I wanted to know if there is a way in DB2 UDB/AIX v. 8.2.2 to activate/start a database in a single user mode similar to how you can start the entire instance in Admin Mode. I want to take a database offline. I use the force command but there are apps that constantly try to reconnect. I want to set the database to only allow an...
0
1814
by: johan degraeve | last post by:
Hello, Put sqlsvr 2000 into single user mode (startup parameter -m added, server restarted, says it's in single mode) used query analyser to run the following: dbcc checkdb 'atimowork2',REPAIR_ALLOW_DATA_LOSS query analyser reports the error that database must be in single user mode while it is? Can anyone help, please, because I have...
0
986
by: sherifbk | last post by:
Hi How can I run the SQL server 6.5 in a single user mode? Thanks
5
9540
by: velu5 | last post by:
Hello , Is it possible/recommended to do SQL server instance backups in Single user mode ? Thanks in advance, atv
6
6315
by: Mike | last post by:
I'm having trouble running TSQL commands when SQL2005 is in single- user mode. I've restarted SQL with -m, -c, -T3608 set in the startup options. I can get into Config manager OK, but as soon as I try to start a New Query it complains that the DB is in single-user mode and there's already someone connected to the DB. Is there something...
2
19399
by: aj | last post by:
SQL Server 2005 SP2 2005.090.3054.00 I'm trying to move master/model/msdb to a new spot. I restart SQL Server in single user mode with the "-c;-m;-T3608" startup params. When I try to connect to do the detach, I get: Login failed for user 'sa'. Reason: Server is in single user mode. Only one administrator can connect at this time....
4
3649
sashi
by: sashi | last post by:
Hi everyone, I've been facing a problem with one of my RHEL 4 box. Due to a recently power failure i am not able to get the system to work as usual. I've configured RAID1 as well as LVM2, the problems is that soon after the power failure the system is not able to detect any valid Linux partition. It sends a TERM signal that says 'Kernel...
0
7826
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8182
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8327
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8193
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6579
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5701
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5374
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3843
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2333
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.