Alibabacloud.com offers a wide variety of articles about how to automate sql script execution, easily find your how to automate sql script execution information here online.
or simulate the experiment below on SQL Server.
Start
To explain "Table scan", "index scan", "index seek", "clustered index scan", and "clustered index seek" in "display Execution Plan", create a new table first, and add some sample data. The script for creating a new table is as follows:
Create Table performanceissue(PRID uniqueidentifier not null,Pr
First, describe the memory used by SQL Server. The memory occupied by SQL Server is mainly composed of three parts: Data Buffer, Procedure Cache, and SQL Server engine program. The cache occupied by SQL Server engine programs is generally relatively small, so the main focus of memory optimization is data cache and
Tags: style blog http ar color OS using SP filesOriginal: sql2005 restore extra-long SQL scripts, restore oversized script filesFrom the outside of the database with export scripts exported to the way, 280M look, the guide is exported, but in the native execution of SQL script
First, describe the memory used by SQL Server. The memory occupied by SQL Server is mainly composed of three parts: Data Buffer, Procedure Cache, and SQL Server engine program. The cache occupied by SQL Server engine programs is generally relatively small, so the main focus of memory optimization is data cache and
Scene:
The DBA gave me the creation scripts for all the storage, functions, and so on, with thousands of files.
Now you need to import these object creation scripts into another library, how do you solve them?
Manual execution is obviously not realistic.
So manually wrote a batch, all the files into one. SQL scripts, which are generated at the end of @. SQL s
Start by explaining which parts of SQL Server memory footprint are made up of. The memory consumed by SQL Server consists primarily of three parts: data caching (database buffer), execution caching (Procedure cache), and SQL Server engine programs. The caching of SQL Server
execution plan
View code
--Delete all plansDBCCFreeproccache
2.3 Test script (create an employee table and insert 1000 pieces of data to it)
View code
If Exists ( Select * From SYS. Objects Where Object_id = Object_id (N ' [DBO]. [employee] ' )) Drop Table [ DBO ] . Employee Go -- Personnel table Create Table DBO. employee (ID Int , Name Nvarchar ( 50 )); -
by setting Statistics we can view the system situation when executing SQL. The options are Profile,io, time. Introduced as follows:SET STATISTICS profile on: Displays the time, in milliseconds, that is required to parse, compile, and execute the query.SET STATISTICS IO on: reports information about the number of scans per table referenced in the statement, the number of logical reads (pages accessed in the cache), and the number of physical reads (the
Label:SET STATISTICS profile on: Displays the time, in milliseconds, that is required to parse, compile, and execute the query.SET STATISTICS IO on: Reports information about the number of scans per table referenced in the statement, the number of logical reads (pages accessed in the cache), and the number of physical reads (the number of times the disk was accessed).Set STATISTICS time on: Displays the result set after each query execution, represent
I don't know whether stored procedures can be implemented, but SQL Server 2000 Job Scheduling does have this function. How can I make some SQL statements run regularly and perform the following operations in sequence:
Enterprise Manager-- Manage
-- SQL Server proxy
-- Right-click a job
-- Create a job
-- Enter the job name in "general"
-- "Step"
-- New
:-- Delete all plansDBCC FREEPROCCACHE 2.3 Test script (create an employee table and insert 1000 pieces of data to it)Copy codeThe Code is as follows:If exists (SELECT * FROM sys. objects WHERE object_id = OBJECT_ID (n' [dbo]. [Employee] ')Drop table [dbo]. EmployeeGO-- Personnel tableCreate table dbo. Employee(Id int,Name nvarchar (50));-- Insert Test DataDECLARE @ I INT = 0, @ ENDI INT = 1000;WHILE (@ I BEGINSET @ I + = 1;INSERT dbo. Employee (id, n
tasks-> Generate SQL scripts-> Save to an SQL file in the OS
Then, run the SQL script for creating the job saved just now on the target server.
(If the user who created the job or the user who reminded him does not exist, an error will occur;
We need to create a WINDOWS user or SQ
If the data table you maintain depends on the data tables of other modules and supports data of other modules, and these tables are updated in real time, therefore, you cannot update a data table by calling SQL statements on the page. You can only update the data table regularly and automatically. I don't know whether stored procedures can be implemented, but SQL Server 2000 Job Scheduling does have this fu
'
, Objtype AS 'type'
, St. [text] AS 'SQL text'
, Plan_handle AS 'scheduler handler'
FROM sys. dm_exec_cached_plans cp
Cross apply sys. dm_exec_ SQL _text (plan_handle) AS st
WHERE st. text not like '% sys %'
2.2 Delete an execution plan
The Code is as follows:
-- Delete all plans
DBCC FREEPROCCACHE
2.3 Test script
Server 2005, which allows the ownership of objects to be detached and easier to manage than SQL Server 2000, which creates the database schema that we will use:
CREATE SCHEMA [TableOwnerSchema] AUTHORIZATION [TableOwner]GONow I enable logins so they can be used:ALTER LOGIN [TableOwner] ENABLEALTER LOGIN [BaseUser] ENABLEGOGRANT CREATE TABLE TO TableOwnerGO
First, I used the EXECUTE AS command, and I set the current
data, with the increasing scale of data, is the original analysis techniques outdated? The answer is clearly no, the original analytical skills remain valid in the existing analytical dimension, of course, for the new data we want to dig out more interesting and valuable content, this goal can be given to data mining or machine learning to complete.So how can the original data analysts quickly switch to Big Data's platform, to re-learn a script, dire
onSET STATISTICS time onGO– Your SQL script startsSELECT [TestCase] from [Testcaseselect]– Your SQL script is overGOSET STATISTICS Profile OFFSET STATISTICS IO OFFSET STATISTICS Time OFF Alternatively, you can determine how efficient the SQL statement is by adding statement
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.