Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
5Activity
0 of .
Results for:
No results containing your search query
P. 1
SQL Server 2008 Tips_3

SQL Server 2008 Tips_3

Ratings:

5.0

(2)
|Views: 869|Likes:
Published by Indrajit Banerjee

More info:

Published by: Indrajit Banerjee on Feb 23, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF or read online from Scribd
See more
See less

05/10/2014

 
SQL Server 2008 TipsByThe Technocrats
Configure a Fail-Safe Operator for Notifications
 When things go wrong with notification, operators do not get notified and problems might not be corrected in a timely manner. Toprevent this, you might want to designate a fail-safe operator. The fail-safe operator is notified in the following situations:
 
SQL Server Agent cannot access system tables in the msdb database, which is where operator definitions and notificationlists are stored.All pager notifications to designated operators have failed, or the designated operators are off duty (as defined in thepager schedule).To configure a fail-safe operator:
1.
Right-click the SQL Server Agent entry in SQL Server Management Studio, and then select Properties.
2.
In the SQL Server Agent Properties dialog box, select the Alert System page.
3.
Select Enable Fail-Safe Operator to define a fail-safe operator.
4.
Use the Operator drop-down list to choose an operator to designate as the fail-safe operator. You can reassign the fail-safe dutyby selecting a different operator, or you can disable the feature by clearing Enable Fail-Safe Operator.
5.
Use the Notify Using check boxes to determine how the fail-safe operator is notified.
6.
Click OK.Using the fail-safe operator on pager notification failure might seem strange, but it is a good way to ensure that alerts are handledefficiently. E-mail and net send messages almost always reach their destination
but the people involved are not always watchingtheir mail or sitting at their computer to receive net send messages, so the fail-safe operator is a way to guarantee notification.
Configure Parallel Processing in SQL Server 2008
 A lot of calculations are required to determine whether parallel processing should be used. Generally, SQL Server processes queriesin parallel in the following cases:
 
When the number of CPUs is greater than the number of active connections.When the estimated cost for the serial execution of a query is higher than the query plan threshold (The estimated costrefers to the elapsed time in seconds required to execute the query serially.)Certain types of statements cannot be processed in parallel unless they contain clauses, however. For example, UPDATE, INSERT,and DELETE are not normally processed in parallel even if the related query meets the criteria. But if the UPDATE or DELETEstatements contain a WHERE clause, or an INSERT statement contains a SELECT clause, WHERE and SELECT can be executed inparallel. Changes are applied serially to the database in these cases.To configure parallel processing, simply do the following:
1.
In the Server Properties dialog box, go to the Advanced page.
2.
By default, the Max Degree Of Parallelism setting has a value of 0, which means that the maximum number of processors usedfor parallel processing is controlled automatically. Essentially, SQL Server uses the actual number of available processors,depending on the workload. To limit the number of processors used for parallel processing to a set amount (up to the maximumsupported by SQL Server), change the Max Degree Of Parallelism setting to a value greater than 1. A value of 1 tells SQL Servernot to use parallel processing.
3.
Large, complex queries usually can benefit from parallel execution. However, SQL Server performs parallel processing only whenthe estimated number of seconds required to run a serial plan for the same query is higher than the value set in the cost thresholdfor parallelism. Set the cost estimate threshold using the Cost Threshold For Parallelism box on the Advanced page of the ServerProperties dialog box. You can use any value from 0 through 32,767. On a single CPU, the cost threshold is ignored.
4.
Click OK. These changes are applied immediately. You do not need to restart the server.You can use the stored procedure sp_configure to configure parallel processing. The Transact-SQL commands are:
exec sp_configure "max degree of parallelism", <integer value>
 
exec sp_configure "cost threshold for parallelism", <integer value>
 
 
Configure SQL Server 2008 to Automatically Manage FileSize
 With SQL Server 2008, you can manage database and log size either automatically or manually. You can use SQL ServerManagement Studio or Transact-SQL to configure database or log size.
 
Using SQL Server Management Studio, you can configure automatic management of database and log size by performing thefollowing steps:
1.
Start SQL Server Management Studio. In the Object Explorer view, connect to the appropriate server, and then work your waydown to the Databases folder.
2.
Right-click the database you want to configure, and then select Properties from the shortcut menu.
3.
Select Files from the Select A Page list in the Database Properties dialog box. Each data and log file associated with the databaseis listed under Database Files. For each data and log file, do the following:
Click the button to the right of the file’s Autogrowth box to adjust
the related settings. This will display the ChangeAutogrowth For dialog box.Set the file to grow using a percentage or an amount in megabytes, and then either restrict the maximum file growth to aspecific size or allow unrestricted file growth.Click OK.
4.
Optionally, access the Options page and set Auto Shrink to True. Auto Shrink compacts and shrinks the database periodically.
5.
Click OK when you have finished. Your changes take effect immediately without restarting the server.
Recover Missing Data in SQL Server 2008 Using a PartialRestore
 If you suspect part of a database is missing or corrupted, you can perform a partial restore to a new location so that you canrecover the missing or corrupted data. To do this, use the PARTIAL option with the RESTORE DATABASE statement in Transact-SQL.You can restore partial databases only at the filegroup level. The primary file and filegroup are always restored along with the filesthat you specify and their corresponding filegroups. Files and filegroups that are not restored are marked as offline, and you cannotaccess them.
 
To carry out the restore and recovery process:
1.
Perform a partial database restore. Give the database a new name and location in the RESTORE DATABASE statement and useMOVE/TO to move the original database source files to new locations. For example:
RESTORE DATABASE new_custdb_partialFILEGROUP = 'Customers2'FROM DISK='g:\cust.dmp'WITH FILE=1,NORECOVERY,PARTIAL,MOVE 'cust' TO 'g:\cu2.pri',MOVE 'cust_log' TO 'g:\cu2.log',MOVE 'cust_data_2' TO 'g:\cu2.dat2'GO
2.
Extract any needed data from the partial restore, and insert it into the database from which it was deleted.
Customize Memory Allocation for Queries in SQL Server2008
 By default, SQL Server 2008 allocates a minimum of 1024 KB of memory for query execution. This memory allocation is guaranteedper user, and you can set it anywhere from 512 KB to 2 GB. If you increase the minimum query size, you can improve theperformance of queries that perform processor-intensive operations, such as sorting or hashing. If you set the value too high,

Activity (5)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Flush Infotech liked this
A Alagu Ganesh liked this
A Alagu Ganesh liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->