一 概述 默认情况下,SQL Server 代理创建错误日志来记录警告和错误。日志中显示下列警告和错误: 警告消息,提供有关潜在问题的信息,例如作业 在执行时被删除。 错误消息,通常需要系统管理员干预,例如无法启动邮件会话。可以通过 net send 将错误消息发
一 概述
默认情况下,SQL Server 代理创建错误日志来记录警告和错误。日志中显示下列警告和错误:
警告消息,提供有关潜在问题的信息,例如“作业 在执行时被删除”。
错误消息,通常需要系统管理员干预,例如“无法启动邮件会话”。可以通过 net send 将错误消息发送给特定用户或计算机。
默认情况下,执行跟踪消息不写入 SQL Server代理日志错误,因为它们会将日志填满。如果错误日志已满,会降低选择和分析更严重的错误的能力。因为日志会增加服务器的处理负荷,所以请务必仔细考虑是否值得将执行跟踪消息捕获到错误日志中。通常,最好仅在调试某个特定问题时捕获所有消息。
二 错误日志的存放目录和个数
SQL Server 最多可以维护 1个当前错误日志记录 和 9个 SQL Server 代理错误日志历史记录。每个存档日志都有一个扩展名,指示该日志的相对存在时间。例如,扩展名 .1 表示最新的存档错误日志,而扩展名 .9 表示最旧的存档错误日志。
SQL Server 代理停止后,可以修改 SQL Server 代理错误日志的位置。如果错误日志为空,则无法打开日志。可以随时循环访问 SQL Server 代理日志,无需停止 SQL Server 代理。
三 基本管理任务
查看 SQL Server 代理错误日志 :企业管理器;通过openrowset读取文件;xp_cmdshell下执行dos输出的type命令等;xp_cmdshell下bcp进入数据库系统的表中;exec xp_cmdshell 'type "C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLLOGSQLAGENT.out"'
重命名 SQL Server 代理错误日志 ,重启sql代理后生效 :企业管理器;EXEC msdb.dbo.sp_set_sqlagent_properties @errorlog_file=N'C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLLOGSQLAGENT.OUT'
发送 SQL Server 代理错误消息 ,使用net send 发送消息,依赖于windows的messenges 服务 :企业管理器;EXEC msdb.dbo.sp_set_sqlagent_properties @error_recipient=N'jinsen'
将执行跟踪消息写入到 SQL Server 代理错误日志中 :配置sql代理,记录跟踪内容;
配置代理错误日志的信息内容类型(错误 1、警告 2、信息(包含错误跟踪) 4),类型可以叠加:企业管理器;EXEC msdb.dbo.sp_set_sqlagent_properties @errorlogging_level={1|2|4|3|5|7|6}
配置代理错误日志的信息内容的编码类型 :企业管理器;EXEC msdb.dbo.sp_set_sqlagent_properties @oem_errorlog={0|1}
回收错误日志的空间 :使用企业管理器;EXEC msdb.dbo.sp_cycle_agent_errorlog
配置代理错误日志文件记录数的大小(行数):企业管理器;EXEC msdb.dbo.sp_set_sqlagent_properties @jobhistory_max_rows=1000,
配置代理错误日志文件记录每个作业的最大记录的大小(行数):企业管理器;EXEC msdb.dbo.sp_set_sqlagent_properties @jobhistory_max_rows_per_job=100
四 常见问题
q:为什么sql代理错误日志文件的内容始终为空,,无法进行错误信息的日志记录?
a:重新配置sql代理错误日志文件的编码格式为非oem——即配置为unicode编码,可以解决问题
q:为什么在使用企业管理器查看sql代理错误日志时,日志查看器出现异常,“unicode file expected”?
a:重新配置sql代理错误日志文件的编码格式为非oem——即配置为unicode编码,可以解决问题
q:为什么企业管理器、sms 无法回收sql2000的sql代理错误日志文件?
a:sqlserver2000的sql 代理错误日志的文件 不支持回收!

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

The steps to build a MySQL database include: 1. Create a database and table, 2. Insert data, and 3. Conduct queries. First, use the CREATEDATABASE and CREATETABLE statements to create the database and table, then use the INSERTINTO statement to insert the data, and finally use the SELECT statement to query the data.

MySQL is suitable for beginners because it is easy to use and powerful. 1.MySQL is a relational database, and uses SQL for CRUD operations. 2. It is simple to install and requires the root user password to be configured. 3. Use INSERT, UPDATE, DELETE, and SELECT to perform data operations. 4. ORDERBY, WHERE and JOIN can be used for complex queries. 5. Debugging requires checking the syntax and use EXPLAIN to analyze the query. 6. Optimization suggestions include using indexes, choosing the right data type and good programming habits.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

Atom editor mac version download
The most popular open source editor

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 Mac version
God-level code editing software (SublimeText3)

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software