Home > Articles > Data > SQL Server

Performing General Administration Tasks in SQL Server 2000

Database administrators must ensure that servers run smoothly and that databases are fast and efficient. The good news is that most of these tasks can be done automatically with SQL Server 2000. After these are defined, jobs can be scheduled to run when specified. In this excerpt from SQL Server 2000 Database Development From Scratch, author Rob Hawthorne discusses the administrative tasks of a DBA that can be automated by setting up a hypothetical scheduled job that performs a nightly database backup.
This article is excerpted from the author's book SQL Server 2000 Database Development From Scratch.
This chapter is from the book

Besides checking server settings and backing up databases you'll be doing a lot of other tasks as a DBA. If being a DBA were too easy, you wouldn't want the job! How boring would that be?

As already mentioned, you must ensure that the server is running smoothly and that your databases are fast and efficient. The good news is that most of these tasks can be done for us automatically. After we have defined which tasks need to be completed and when, we can build scheduled jobs that will run when we specify them.

Let's take a look at setting up a scheduled job that performs a database backup for us during the night, so that we don't have to get up at 3 a.m. to do the backup. Like I would have made you do that? Maybe your new boss will, but I won't.

Scheduling Jobs

What is a scheduled job? Well this is like a reminder in Microsoft Outlook. We can schedule a task or job to fire at a designated time, for example we can set a database backup for 3 a.m. These jobs are simple to set up, and the configuration options for each job are very versatile.


Like most things in SQL Server 2000, scheduled jobs can be created either through Enterprise Manager or through Transact-SQL. This time we are going to go for the GUI in Enterprise Manager, but if you would like to know how to set them up with Transact-SQL look up sp_add_jobschedule in Books Online.

  1. Fire up Enterprise Manager and navigate your way through the folders until you find Management, and then open the SQL Server Agent folder. Inside this folder you will find three options.

    • Alerts—These allow us to configure what actions happen if a specific error occurs.

    • Operators—These are user accounts that allow us to email, Net send (on Windows NT/2000), or even send a page to someone's pager when something goes wrong.

    • Jobs—These are tasks that can have one or more steps performed. These steps are Transact-SQL statements that SQL Server can execute. Our jobs can occur one time or can be recurring events.

  2. Select the Jobs folder, right-click, and click New Job from the menu shown in Figure 1.

  3. Figure 1 Selecting the New Job option to create a new job in SQL Server 2000.

  4. This will bring up a screen similar to that shown in Figure 2.

  5. Figure 2 Setting the General properties of the new job.

  6. Because we're creating a job to perform our SQLSpyNet database backup, give the job a name that describes the task and the database it is for, such as Database Backup for SQLSpyNet. This allows us to specify a descriptive name so that anyone else will be able to recognize what the job is for. The name can't be any longer than 128 characters, which is more than enough for us!

  7. Next we need to enable the job. Make sure the Enable option is checked. The Target Local Server option allows us to have this job performed on our current instance of SQL Server 2000. If we had linked servers (if we were connected to a network) attached to our server, then we would be able to create our job to run on the other servers, even though it is only enabled on our server.

  8. Linked Servers are data sources that SQL Server 2000 can communicate with (for example, other SQL Servers, Excel, or Access). We can then perform queries on those servers to retrieve and manipulate data.

  9. Next we can assign our job to a particular category so we can better organize our jobs. Let's assign our job to the Database Maintenance category.

  10. If we have a multitude of jobs, we can sort the jobs by category, so it is a good idea to assign our jobs to categories.


    If you click the ellipsis button..., you will see all the current jobs in this category.

  11. Next we can assign an owner to the job. If the job is owned by another login, we need to ensure that the login has sufficient privilege to run the job. For example, we could assign this job to our SQLSpyNetUser, but they wouldn't be able to run the task because they do not have permission to perform database backups. Make sure the sa account is the owner.

  12. Let's add a description to our job. This will allow us to understand the job, why it was created, and by whom. In the future we can review the job and assess whether we still need it. We have a limitation of 512 characters for the description field.

  13. The description I have entered appears in the Description box.

    "To perform the database backup for the SQLSpyNet database. 
    [ic:ccc] This was created so we didn't have to get up at 3am to 
    [ic:ccc] perform a backup. Created by Rob Hawthorne 16 Aug 2000."
  14. Next we need to tell SQL Server 2000 what task to actually perform. Click the Steps tab. This will give you a screen similar to Figure 3.

  15. Figure 3 Setting up the steps in our new job to perform our database backups.

  16. Click the New button. This will allow us to create our first (and only) step that we want SQL Server 2000 to perform for us when doing a database backup. This will give you a screen similar to that shown in Figure 4.

  17. Figure 4 Telling SQL Server 2000 the actual commands we want our new job to perform.

  18. First we need to assign a name for our step, something like Step 1 Database Backup. This name cannot exceed 128 characters and must be unique.

  19. Next we can choose the type of command that we want SQL Server 2000 to execute for us. Most of the time you will want to use the Transact-SQL option, but you do have the ability to get SQL Server 2000 to run operating system commands, such as batch files (these are files that have operating system commands within them) and so forth, as well as a multitude of other scripts. For our task, though, leave the option set to Transact-SQL.

  20. Next we can specify the database against which we want to perform the task. Because we are performing a database backup it doesn't matter whether we have the Transact-SQL execute against the master database. Why? Well we specify the name of the database in the backup statement, so SQL Server 2000 knows which database we are backing up.

  21. Finally, let's enter the command that we want SQL Server 2000 to perform.

    1a: TO DISK = 'C:\Program Files\Microsoft SQL Server\
      [ic:ccc] MSSQL$MYSQLSERVER\BACKUP\SQLSpyNetJob.bak'


    The suffixes on the filenames are not compulsory. It is just something that I believe allows us to easily identify where the backup file came from. It is best to practice and all that, right?

    The Open button shown in Figure 4 will allow us to select a saved Transact-SQL script to load. So maybe we should have saved our script from earlier, bugger! Another little Kiwi saying for you.

    The Parse button will check that your syntax is correct. Click this now because it's better to be safe than sorry.

  23. In the Advanced tab we can specify what actions SQL Server 2000 takes when the job either succeeds or fails. The defaults for this screen suit our needs fine, so we will leave them as they are.

    • On success action—Go to the next step.

    • Retry attempts—0.

    • On failure action—Quit the job reporting failure.

    Click OK. You will see our job appear in the Steps list box. If we had several steps in our process, we could reorder them so that some fired before others.

  24. Next we need to specify when our task will run. Click the Schedules tab. Then click the New Schedule button. This will give you a screen similar to that shown in Figure 5.

  25. Figure 5 Scheduling how often SQL Server 2000 will run the new job.

  26. Like our step names, our schedule names must be descriptive, no greater than 128 characters, and unique. Enter something similar to "3 a.m. Schedule for SQLSpyNet database backup." Make sure the Enabled option is checked.

  27. Next we need to setup a schedule. Let's take a quick look first at the options that we do have.

    • Start automatically when SQL Server Agent starts—This will get the job to start when the SQL Server Agent starts. You can set the SQL Server Agent to start when the operating system starts by using the SQL Service Manager.

    • Start whenever the CPU becomes idle—We can specify the CPU idle time for our instance of SQL Server 2000. When the CPU is idle we can get our job to start.

    • One time—We can set our job to run once only, at a specified time.

    • Recurring—This is the option that we are going to select. It allows us to have our job repeated for a specified set of time or until some indefinite period.

    Select the Recurring option, and click the Change button. You will see a screen similar to that shown in Figure 6.

    Figure 6 Defining when we want our job to run in SQL Server 2000.

  28. The screen is self-explanatory, especially if you have set up recurring items in Outlook before. We need to set the following options:

    • Occurs—Daily.

    • Daily—Every 1 day.

    • Daily Frequency—3:00:00 a.m.

    • Duration—Start date, set that to today's date. Do not specify an end date.

  29. Click OK. This will take us back to the New Job Schedule screen. Once again click OK. You will now see our new schedule in the job screen.

Gee, that was easy, but what do we do if it fails? I'm glad to see you thinking ahead! We can never, ever guarantee that something will work, so it pays to know what to do when it goes wrong. Hence the reason for the Notifications tab. Click this tab. You will see a screen similar to that shown in Figure 7.

Figure 7 Defining what happens if our job fails or succeeds.

The most common option for this screen is to write to the Windows NT Event log. Unfortunately, because we are using Windows 98 as our operating system, we do not have the ability to write to the NT Event log (because it doesn't exist). So what do we do?

This is where we introduce operators. With an operator, we can specify a specific recipient to SQL Server 2000 to which an email or page (using a third party's paging software) can be sent. But we will take a look at this shortly.

If you now click OK, our new job will be written away, ready to run in the morning at 3 a.m. There are two things you should note about this though:

  • Your computer must be on for this task to perform. Although it seems obvious, I have heard of people setting up jobs and having them never run because they shut off the system!

  • Check regularly that the task has run. In the Jobs folder you can see a list of jobs and the last time they ran, and whether they succeeded or failed. Next you should check where you specified that the file be saved to for the backup. This will allow you to check that the file has been successfully created.

  • Create a secondary database into which you restore the file occasionally just to check that it is actually backing up correctly.

And that, ladies and gentlemen, brings us to the end of yet another section of administration.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020