SQL SERVER Job (or call execution plan)

Source: Internet
Author: User
Tags system log

If you need to execute a stored procedure or 3200-character SQL statement at regular intervals in SQL Server, you can use the Management->sql Server Agent-Job to implement. 1, Management->sql Server Agent----Jobs (right mouse button), new job, 2, New Job Properties (General), name [Customize the name of this job]-> enabled box is tick-- [Uncategorized (local)]-> owner defaults to login to SQL Server user [optional other login]-> description [fill in the details of this job]; [Steps to create a job classification: Right-click All tasks, such as SQL Server Agent--Add, modify, delete] 3, New job properties (steps), new step name [custom First step name]-> type [ Transact-SQL (TSQL) script]-> database [Database]-> command to manipulate [if it is simple SQL write it directly, you can also use the Open button to enter a written *.sql file if you want to execute the stored procedure, the EXEC P_ Procedure_name v_parameter1,[v_parameter2...v_parametern]]->Ok (if you have more than one step, you can call the new button below again, or you can insert, edit, delete a number of existing steps); 4, Build Job properties (schedule), new schedule--name [custom schedule name]-> enabled box is tick-and schedule-and recurring-change [schedule Schedule]->Ok (if you just save this job, do not do it on a regular basis, you can remove the check mark in the Enabled box); 5, build the job properties (notification), with the default notification method is good [when the job fails, write to the Windows Application System log] OK.  Some SQL Server knowledge related to job execution: The SQLServerAgent service must function correctly, and the NT login user who starts it is consistent with the NT login user who started the SQL Server database.  Point jobs Right-click to view the history of job execution, or start jobs and stop jobs immediately.  When I recently looked at the job history, we found that there were more history records of the job records, and there were fewer records of the record of the job.  How can some jobs be kept for a period of time according to their needs. For example, keep a history of one months. Read the online Help documentation for SQL Server, which describes the restrictions on the size of the job history log-> The job system, the right-click Property,->sql Server Agent, and the  maximum size of the job history log (rows) Default is 1000 if a machine has a large number of jobs, be sure to increase it, for example, 100000 the maximum number of rows per job history log defaults to 100 if the job executes two times a day, you need to keep the log for one months, which can be set to 60 there is a mutual restriction between them.  We can change according to our own needs. If the SQL Server server changes the machine name and the job that is established when the old name is managed, you may encounter error 14274: Unable to add, update, or delete a job (or its steps or schedules) that originated on the MSX server, looked at Microsoft's Documentation:/HTTP support.microsoft.com/default.aspx?scid=kb;en-us;281642  is said to be in the SQL Server 2000 system in msdb.  The name of the original server is stored in the Originating_server field in the Sysjobs.  24x7 systems are definitely not going to change the name back to what Microsoft's documentation says. So I thought, msdb.  Sysjobs can update originating_server interleaved the new server name now in use? Use  msdb select * from  sysjobs find the Originating_server field or the job_id of the old server, and then execute the UPDATE statement: Update sysjobs set Origi Nati     

SQL SERVER Job (or call execution plan)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.