The editions of SQL Server 2008 are as follows: Enterprise: this is the high-end edition with the full feature set. It supports systems up to 8 CPU and 2 TB RAM. The maximum size of the database is 524 PB. Standard it has a bit less features than Enterprise, but it is a good choice when advanced functions (such as data compression, compressed backups, indexed views, etc.) are not required for the business. It supports systems up to 4 CPU and 64 GB RAM. Workgroup: it is suitable for remote offices of a larger company. It supports systems up to 2 CPU and… Read more
SSAS STORAGE MODES
In SQL Server Analysis Services 2008, we have three storage mode options available to us: Relational Online Analytical Processing (ROLAP), Multidimensional Online Analytical Processing (MOLAP) and Hybrid Online Analytical Processing (HOLAP). There are advantages and disadvantages to each, so I figured I’d take a few minutes to give a quick overview describing the storage modes and laying out some of the pros and cons of each. Relational Online Analytical Processing (ROLAP) The ROLAP storage mode allows the detail data and aggregations to be stored in the relational database. If you plan on using ROLAP, you need to make sure that… Read more
Best Practices while creating Stored Procedures
1. SET NOCOUNT ON: Always use ‘SET NOCOUNT ON’ statement at the begening of your code inside the SP to reduce unnecessary network round trips. 2. PARAMETER SNIFFING: Do not use SP parameters directly within the WHERE clause of SQL statements. This may cause the case of Prameter Sniffing. To avod this assign the parameter values to local variables and then use them with SQL queries. 3. Use table variables: Try to use table variables instead of temporary tables inside the SP to cache small record sets whenever possible. 4. Use of Temp Tables: If you think that the temporary… Read more
SQL SERVER – Get Database Backup History
Setting Up Alerts for All SQL Server Agent Jobs
Some times clients ask to enable alerts for the sql agent jobs, it will be difficult when we have more jobs, because we need to goto each and every job and enable the notifications. Here is the script for enabling for the jobs, Steps : 1. Create Mail Profile 2. Enable the mail profile for agent (SQL Server Agent Properties –> Alert System –>select Enable Mail profile & Select profile) 3. Create Operator with Mail ID. (Ex : DBA) 4. Run below script for enabling the alerts for all the jobs. We need to decide when we want email to… Read more
Windows Disk Space Alert From SQL SERVER JOB
In SQL server when the auto growth option is set to true and when we have defined the autogorwth in MB, some times we may face the issue like windows disk space is full, during that time SQL Server cannot increase the auto growth size of the mdf or ldf files. As Best practice to have the alert for the drives free space. We can create a job for the below script. schedule it for every 15 or 30 minutes based on your application usage / load.
Types of SQL Server Backup -1 : FULL Backup
The most common types of SQL Server backups are complete or full backups, also known as database backups. These backups create a complete backup of your database as well as part of the transaction log, so the database can be recovered. This allows for the simplest form of database restoration, since all of the contents are contained in one backup. A full backup can be completed either using T-SQL or by using SSMS Create a full backup of the AdventureWorks database to one disk file T-SQL BACKUP DATABASE AdventureWorks TO DISK = ‘C:\AdventureWorks.BAK’ GO SQL Server Management Studio Right click… Read more
SQL Server Backup Types
The different types of backups that you can create are as follows: Full backups Differential backups File backups File group backups Partial backups Copy-Only backups Mirror backups Transaction log backups we will discuss one by one in detail in next posts.
SQL Server – Hide system objects in Object Explorer – SQL Server Management Studio
By default, SQL Server system objects are listed in Object Explorer in Management Studio. These system objects include system database, system tables/views/procedures and so on. SQL Server Management Studio provides an option to hide these objects from Object Explorer to prevent *accidental* use. To enable this option follow below steps. Step1: Go to Tools > Options Step2: Navigate to Environment > Startup Step3: Check Hide system objects in Object Explorer and click OK: Step4: An confirmation message will be displayed saying that changes will take effect after Management Studio is restarted, click on OK to continue: Once you restart SQL Server Management Studio, you will notice that system objects are no longer listed in… Read more
How to Find SQL Server Database Size
if convert(varchar(20),SERVERPROPERTY(‘productversion’)) like ‘8%’ SELECT [name], fileid, filename, [size]/128 AS ‘Total Size in MB’, [size]/128.0 – CAST(FILEPROPERTY(name, ‘SpaceUsed’) AS int)/128.0 AS ‘Available Space In MB’, CAST(FILEPROPERTY(name, ‘SpaceUsed’) AS int)/128.0 AS ‘Used Space In MB’, (100-((([size]/128.0 – CAST(FILEPROPERTY(name, ‘SpaceUsed’) AS int)/128)/([size]/128))*100)) AS ‘percentage Used’ FROM sysfiles else SELECT [name], file_id, physical_name, [size]/128 AS ‘Total Size in MB’, [size]/128.0 – CAST(FILEPROPERTY(name, ‘SpaceUsed’) AS int)/128.0 AS ‘Available Space In MB’, CAST(FILEPROPERTY(name, ‘SpaceUsed’) AS int)/128.0 AS ‘Used Space In MB’, (100-((([size]/128.0 – CAST(FILEPROPERTY(name, ‘SpaceUsed’) AS int)/128)/([size]/128))*100)) AS ‘percentage Used’ FROM sys.database_files