473,660 Members | 2,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Maintenance job fails

Hi there,

Used the wizard to create a maintenance plan for a db. But it fails most of
the time. I checked the log-files.

At 1.00 AM, it runs the "Optimizati ons" job for 6-9 seconds. It succeeds
always.

At 1.05 AM, for 1 second, it runs "integrity check", but most of the time it
fails, and says that it couldn't switch to single-user because other users
are using the database.

And when "integrity check" fails the "backup" job won't run at 1.10 AM. When
it DOES run it takes 2 seconds.

How do I find out who is using the database ? How do I put a sp_who (or
similar) in the "integrity check" job ?
I got this tip:
----------
Assuming you have SQL2000, then you can use something like this to
kick out all the users:

ALTER DATABASE foo SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE

If you want to know who is using the database, then this is one way:

select suser_sname(sid )
from master..sysproc esses
where dbid = db_id('foo')
---------

But how do I actually do it ? How do I edit a maintenance plan ?

thx
/jim
Jul 23 '05 #1
5 1756
Stu
You don't have to edit the maintenance plan; you can either add a step
to the job before the maintenance plan runs, or create a new job that
runs prior to you maintenance plan.

Stu

Jul 23 '05 #2
in EM, Managment> SQL Server Agent>Jobs > Properties > Steps . You will
see the steps, which you can edit or insert. I would imagine you could
insert a step before the integrity to do the commands you posted.
HTH

Jul 23 '05 #3
I'm not sure I completely follow your series of events, but I would try
using multiple steps in a single job. In the first step, set the
database to RESTRICTED_USER ; in the second, run your integrity checks;
in the third, run the backup; in the fourth, set the database back to
MULTI_USER.

If you do set this up, one common error is to set the Database in the
job steps to the user database, instead of master. If you don't choose
master, then the job can block itself.

Simon

Jul 23 '05 #4
Guys

We seem to be missing the main point here. The maint plan is trying to
put the database into single user mode because you have ticked the
attempt to repair minor problems option for the database integrity
checks.

As the vast majority of times this check runs, it will find no errors,
a lot of sites consider this unecessary to do every night. An option to
consider is to remove this option, which solves your imediate problem.
Check the output from the maint plan regularly and if you do get any
errors, schedule a run of DBCC CHECKDB with applicable options at a
time when you can arrange to not have users on the system.

As for editing your maintenance plan. In EM open the management folder
and highlight Database maintenance plans. Double click the plan in the
right paine and you can now change it.

Hope this helps

John

Jul 23 '05 #5
My trick is to schedule the maintenance right after my system is
recycled during the night.
That way, I dont have to deal with this nagging issue.

Mario

Jul 23 '05 #6

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

Similar topics

5
19480
by: Mark S | last post by:
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...
2
1904
by: GTM | last post by:
I'm trying to backup several databases to UNC folders. I'm able to do it manually for each database, but when I set up the maintenance plan it fails because SQL tries to use the SQL administrator account to push the data. The million dollar question is how does one change which account is running the maintenance?
1
1973
by: Alexey Aksyonenko | last post by:
I know that SQL Servers can be set up to forward alerts to a single SQL Server. I am wondering if same would be true for the Maintenance Plan Reports. Basically, I want to have only one SQL Server on the network that has the SQL Agent Mail profile set up, and to use that server for all e-mail and/or pager notifications for all alerts and events raised by any of the SQL Servers on the network, including Maintenance Plan reports. Is this...
2
3550
by: Michael Nostrom | last post by:
Hello, I'm trying to configure my MSDE 2000 installation to dump all databases and transaction logs to disk every night to be backed up by our backup software. All goes great in configuring the maintenance plan until I get to the retention part. I want to configure the backup plan so that it'll delete OLD backup older than 2 days. When I click the 'Remove files older than" box and choose 2, but there's nothing in the drop-down box where...
9
13933
by: dm4714 | last post by:
Hello - we have an ecommerce application that needs to come down for maintenance. The application is normally only accessed via http://www.mydomain.com/virtualdir/aspfile.asp. I'm using W2K Advanced Server/SP4. I would like to create a generic HTML page that can easily be put on the IIS server to redirect all users that access any files on this domain to my maintenance page.
0
1760
by: robberjohn | last post by:
Hello all, I have a SQL 2000 Standard SP3 install. I was running low on free space so added a secondary data file on a separate hard drive. I did this for each of two databases. Since then, and I guess it could be only a coincidence, my weekly reindex maintenance plan has been failing, but only for one of the two databases I added the secondary file to. The 1st weeks emailed report shows that it rebuilds indices for 12 tables and then...
3
11547
by: vikramp | last post by:
Hi, I want to know how to setup the "Under Maintenance" page for the website? Here is the thing: I have application setting in web.config called "MMode". I set it to "Y" when I need to do site maintenance such as changes in the backend database, etc.
47
1698
by: editormt | last post by:
Software maintenance is an important part of the software development activity, but it is also the less discussed. A recent poll seems to show that the part of maintenance in software development budget is going down. Why? Question: what percentage of your software development budget is devoted to maintenance. Maintenance is defined as process of correcting, enhancing and optimising deployed software. 25% or less of the budget...
4
3362
by: Mike Gleason jr Couturier | last post by:
Hi, What's a clean way to redirect users on an information page while doing site maintenance... Can we do it with urlMappings !? (wildcard "*"?) Thanks
0
8851
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8754
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8542
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7362
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4177
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4343
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2760
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.