pavlovit.com
IT Consulting Services
September, 2011
October, 2011
November, 2011

SQL Blog

RSS
Installing and configuring Microsoft Reporting Services
11/19/2011 6:02:58 PM

Installing and configuring Microsoft Reporting Services

Every company, big or small has to use various tools to retrieve data from their Databases. IT departments receive many different requests for data to be presented in those reports.

There are many reporting tools on the market and some of them are very expensive. If your company is using a Microsoft product, you should not shop for any other tools. Microsoft Reporting Services can serve your needs.

Microsoft Reporting Services is a tool which is a part of Microsoft SQL Server package and can be installed and used as an enterprise reporting tool.

In this tutorial I will show you how to configure Microsoft Reporting Services (MRS).

Let’s start. First of all, ensure that MRS was installed as a part of your SQL Server Installation, if not; you will need to install it. To install MRS you have to go back to your SQL Server Media and run ‘install file’. Choose Add components and then choose Reporting Services. Follow screen menu to finish your installation. After the installation has completed, you should see 2 new databases created (ReportService and ReportServiceTempDB). Also, you will see Reporting Services under Start – All Programs - Microsoft SQL Server – Configuration Tools.

Can you see it? Great let’s start configuring this tool.

Let’s open Configuration tools under Start -  All Programs – Microsoft SQL Server – Configuration Tools – Reporting Services Configuration Manager as you can see in Pic #1

 



Then click Connect. Make sure that under Server Name: you put your Server Name where you installed Reporting Services, and under Instance put proper instance name if you have multi instance server.

Let’s go through each step and configure MRS. Next picture will show you your server information.

Pic #2





Click start to connect and enable configuration tools. As you can see, after we connected all options on a left side get enabled, so we can go through each one and configure our Reporting Services.

Pic #3 – Enabled Configuration Tool





Let’s go to the first tab – Service Account and configure Reporting Services Service Account

You are able to use two different types of accounts:

Build In account or another domain account the way it is showing In a picture below

Pic #4 – Service Accounts



In my example, I will use Build in option so drop down use build-in account and choose “Local Service” then click apply. Encryption Key window will pop up as showing on pic #5

Pic #5 configuring Service Account cont.





Let’s choose a file location to back up our encryption key for future use. In my example, I created new folder called Reporting Services Key where I will save my key. I created complex enough password and then save this as it showing on a next picture.

Pic #6





Next screen will allow you to select between integrated security and SQL Account. I will use Integrated Security in this tutorial.

Pic #7


Now lets move to the next tab called “WEB Service URL”. This page will allow you to configure URL for your reporting services.  Don’t forget that Reporting Services using port 80 so if your company using firewall you need to request port 80 to be opened.

Pic #8


On Web Service URL page you can set up your virtual directory, IP addresses, TCP/IP port if you want to use anything else other than port 80, and SSL Certificate.

Pic #9


Database screen will allow you to make changes to the reporting database, and reporting database credentials. In my example, I am leaving default settings and moving to Report Manager URL page.

Pic #10


Report Manager URL will let you configure your Report page URL.  In this example, we are leaving Virtual Directory and URL as default and moving to Email Setting.

Pic #11 – Email Setting



Most likely your company using Microsoft Exchange server for corporate Emails. This screen will allow you to configure email account to use it in a future for your email alerts and for emailing subscriptions.

Let’s move to Encryption Key page to backup our existing key’s.

Pic #12 – Encryption Keys


Pic #13 – Backing up Encryption Keys


After all tab’s configured we can go to the internet explorer and type reporting web page, in my example it will be

http://it:80/reports_pavlovit

 

Or you can go to your report manager URL and just click on a link. This should bring you to the Reporting page as you can see in a picture below

Pic #14


 

 

 

Create New Database and Tables
11/5/2011 10:57:59 AM
A database is nothing else but a collection of data.
A database could be as simple as a text file with a list of addresses, emails, names and data of that sort. It could also be as complex as a large, relational database management system (RDMS), with built in tools to help you maintain your data.
Before I will get into database management systems, let me start with the basics - let's look at a simple text file example.

 
We could use this information to do things such as send an email to everyone on our list. We could do this because, this file was created in the way, that we know that each row contains a different individual. Also, the items in each row are separated by commas. Therefore, we know that the email address next to "JRobinson" is her email address. Each row in this example can also can be called a record. Therefore, we currently have 3 records in our database.
A Database Management System (DBMS), is a software program that enables the creation and management of databases. Most of today's database systems are referred to as a Relational Database Management System (RDBMS), because of their ability to store related data across multiple tables.
Some of the more popular relational database management systems include:
  • Oracle
  • Microsoft SQL Server
  • MySQL
  • Microsoft Access
 
This tutorial will allow you to become more familiar with some of the key concepts of database management systems such as:
  • Database creation
  • Tables and Tables Creation
  • Adding data to your database
  • Querying a database
  • Relational database design
·         Microsoft SQL Server

 
·         Microsoft SQL Server is a robust database management system. SQL Server is more suited for enterprise applications such as corporate CRMs and websites etc.
 
·         The above screen is what you see when you open SQL Server through the Enterprise Manager. Enterprise Manager is a built-in tool for managing Microsoft SQL Server and its databases. In this example, there are 2 databases. Each database is represented down the left pane, and also in the main pane (with a "database" icon).
.
·         Many database administrators (DBAs) use Structured Query Language (SQL) to perform many of their database tasks. To enter SQL, you need to open an interface that allows you to enter your code. For example, if you use SQL Server, you would normally use Query Analyzer.


·         The following example is the basic code for creating a new database. Parameters can be added to this example if your requirements are more specific.
          Example #1 Creating database using TSQL

 
Example #2 Creating database using GUI
 
·         Most database systems make it very easy to create a database via a user interface. Generally, it's just a matter of selecting an option from a menu, then providing a name for your database.

Newly created database is blank because it doesn't have any user tables. The only tables you would see in your new database are the system tables. In database terms, a table is responsible for storing data in the database. Database tables consist of rows and columns.
So let’s create a new table.
Open Management Studio and expand “DATABASES” then expand “TABLES”
 
Now let’s “Right Click on TABLES” and select “NEW TABLES”

Now let’s create same table as we created as a text file previously.

Now if you will refresh your view you will be able to see newly created table.
 
Let’s re-cap what we have done so far. We created Database called “TEST”, we created table called “Employee”
Now let’s fill this table with some information.   This can be done using GUI or TSQL.
Example #1 Filling table Employee using GUI:
Right click on a table and choose “EDIT TOP 200 ROW”, you should see screen similar to the one below:

After filling in information your table should look like as example below:

Click “SAVE” Button and close this screen.
Now you have records in your table. Another way to fill in this table is to use a TSQL Code.
Let’s try to add couple more records to this table using TSQL.
Open Query Analyzer and type following:

Now we have records in our table inserted using two different ways.
Let’s check to make sure we have 5 records in our table.

This tutorial showed you how to user TSQL and GUI in Microsoft SQL Server to create Database, Create Table and fill this table with data.
In my next tutorial, I will show you how to use Microsoft SQL Server to build Relational Database using Multiple tables and how to related those tables between each other.
 
 
 
PASS 2011
10/21/2011 6:22:11 AM
PASS 2011 in Seattle, WA.
                For the past several years, I have heard many SQL professionals of different levels attending PASS, however, this year’s summit was my first. It was an excellent experience and this year summit reached 5000 + Microsoft Professionals from all over the world.  
This conference was perfectly planned and presented by the SQL Server community, for the SQL Server community.  PASS Members and PASS Volunteers conducted an  unbelievable work. PASS volunteers helped everybody reach their scheduled classes on time regarding of how arduous the task might seem. There were many exiting classes to attend but the time was limited.  There are over 200 sessions in three days, so as a SQL professional, you will need to plan your time accordingly. Sessions are scheduled in different rooms on various floors, so navigating between classes can get a little tricky – especially if this is your first time attending.
Lunch with your Chapter Leader and MVP was very good idea. This helped people to discuss some SQL Server issues and present questions to MVP and Speakers. Another smart idea and good organization from PASS team.
The list of vendors who presented their products was very impressive. Quest, Idera, Dell and Microsoft were just a few of them. It was interesting and informing to sit through their presentations and learn a thing or two. It was very helpful to spend time in Microsoft Lab and get hands on experience in new options and immediate answers from Microsoft Professionals.
 
            I would definately recommend any DBA to make time and seriously consider attending PASS Summits. Attending classes and connecting with Microsoft MVP’s is a necessary experience and should not be taken for granted. PASS Summit remains a best place to meet SQL professionals, meet new friends and obtain new contacts.  Cannot wait for PASS 2012.
 
Always ON
10/16/2011 3:39:38 PM
Always ON High Availability option presented in SQL Server 2012.
 
During this year’s PASS 2011, which was held in Seattle, WA, Microsoft introduced a new version of Microsoft SQL Server called Denali. New version will be named SQL Server 2012 and will be available in the first quarter of 2012.
In this tutorial, I will briefly introduce one of the new options that comes with new SQL Server 2012 called, this option is called “Always ON’
As many of you know, in previous versions, Microsoft already introduced four High Availability and Disaster Recovery options:  Database Mirroring, SQL Clustering, Replication and Log Shipping.  Those features cane be combined in any way. For example, you could combine Database Mirroring and Log Shipping to create additional copies of your primary server and improve availability.
SQL Server 2012 will have a new High Availability option called AlwaysON. This is a very cool option that will allow you to protect your data even more and use multiple (up to 4) secondary servers called ‘replica’.
AlwaysON is much better then Clustering and Database Mirroring and will give you 100% up time and 100% availability. Also, this option will allow you to use one of your replica as a ‘read only’ copy and point any ‘ read only’ application to use this replica instead of your Primary production server.
If you  are experiencing problems backing up your production databases on your environment,  you should consider  AlwaysON option as a solution for this.
AlwaysON option requires all your servers to be part of the same Windows cluster group and requires them be on the same Domain. Servers located on different Domains cannot be part of AlwaysON group.
 
This this only a brief introduction of the new High Availability option presented by Microsoft in SQL Server 2012.
You will be able to gather more details in my book, which will become available towards the beginning of next year.
If you have any questions regarding my book, feel free to contact me  at victor@pavlovit.com or you can follow me @PavlovDBAPro
Creating Maintenance Plan
9/26/2011 11:41:51 AM
As you all know a database is a collection of data. Database size varies greatly from company to company; it all depends on the business requirements. Every company has a different way of importing data into the database.  As long as your data is not static, and you perform a lot of insert, delete and update operations, your database will require a Maintenance Plan.
In this tutorial, we will create a basic maintenance plan and will discuss options that were selected and their purpose.
Let’s start with opening Microsoft Management Studio and expanding a Management folder:

Under a Management folder, you will see a Maintenance Plans folder, Right click on it and select Maintenance Plan Wizard.

Let’s click Next to move to move on to  the next screen. Next screen will allow us to put more details, include daily schedule, some notes and under what account your Maintenance job will be running.
 
Let’s click on ‘Change’ to Schedule to set up our schedule. As I mentioned, we will be setting up this maintenance plan to be scheduled between Monday and Friday, so let’s change Frequency to Weekly and select Monday through Friday.
In daily frequency you can specify time when your job will be executed. Make sure your job is enabled (see example below), and then click ‘OK’.
 


After you will click ‘OK’, it will bring you back to the screen “Select Plan Properties” but this time you will see schedule which we just set up under Schedule:
 
Let’s click a ‘ Next’ button to switch to the next screen where we will be able to select  what options our maintenance plan will have.

In our tutorial, we will be setting up a Database Integrity check, Rebuild Indexes, Update Statistics, and  last but not least a Full Backup. 

After you selected necessary options, go ahead and click ‘next’.

Screen above shows you an order in which your maintenance plan will be executed. If for any reason, you want to change the priority of those steps, you can highlight that step and click a  ‘move down’ button. If you are good with this configuration setting, just click ‘next’ to jump to the next screen – setting up Database Integrity Check

Click on the drop down box to select on which database you want to perform the Integrity check. (In my example, I picked all users databases.) If you are setting up a maintenance plan for system databases, you can select those.

Next screen will allow us to configure databases for Rebuild indexes

Once again, on this screen we are setting up options and choosing databases on which indexes need to be rebuild on.  

In my tutorial I am setting up maintenance plan against users databases, so I will choose Users Databases under Databases. Also, I chose to keep indexes online while re-indexing .

Next screen will bring you to the Update Statistics setting.

 
Once again I am choosing All Users Databases. You also can choose what type of update you want to proceed. Choose between All existing statistics, column statistics only, or index statistics only.
Next screen will bring you to the final set up page – Setting up Full Backup.





Click ‘ Finish’ to finish up the creation of your Maintenance Plan.

 
Now you can see your newly created Maintenance plan under Maintenance Plan folder.
 
Also you can find your scheduled Maintenance plan under SQL Server Agent

 
Installing SQL Server
9/15/2011 10:52:50 AM
As many of you can guess, one of the primary DBA roles is to install and configure a correct SQL Server Instance upon your server. Microsoft  offers multiple versions of SQL. DBA should choose a proper version that suits company’s needs  to with the lowest cost and maximum performance.
Microsoft offers following  the editions:
·         SQL Server Express
·         SQL Server Compact
·         SQL SERVER Developer
·         SQL Server Workgroup
·         SQL Server Web
·         SQL Server Standard
·         SQL Server Enterprise
·         SQL Server Datacenter


Link to the Video
Creating Database
9/9/2011 1:30:49 PM
Today I will show you how to create a Database using SQL Server Management Studio.
As you know, creating a database is one of the major factors and responsibilities that are usually assigned to SQL Server Database Administrator. Creating a database is not a simple task as you need to know what options and settings need to be chosen.
Let’s go through this process together.  I will show you how to create a database using GUI (Graphical User Interface) called Management Studio.
Let’s open Management Studio. To do so, go to Start - All Programs-Microsoft SQL Server—SQL Server Management Studio. 





Then Expand database






Right click on Database and choose New Databases




 
Let’s quickly go through this screen. On your left you see 3 tabs:
General – on this page, you are allowed to chose your database name and Database Owner. Under Database files you can specify where your data and log files will be located (i.e. drive, folder, file size, auto growth)



Alter General page completely and will move to the Option tab



This page will allow you to select proper database collation, database recovery model, compatibility level. Also, you can set up the following options on a database level:
Database auto shrink, auto update statistics and much more. If you are interested in receiving more details ,please contact me with your questions.
File Group is your last tab:
This page will allow you to select or create multiple file groups




After you selected your last options – File Groups and clicked OK, your database will be created and you will be able to view it in your Management Studio



Control Your SQL Server Environment
9/1/2011 6:43:58 PM
Today we will have a discussion regarding how to control your SQL Server environment.
As a Database Administrator, you are responsible for Databases, Scheduled Jobs, Security, Backup and Recovery process and much more.
 
All Server Database Administrators in most companies work closely with SQL Server Development and Application Teams, who usually create their own databases for various purposes of their own.
 
In most cases, an unknown database on one of your Servers will cause problems such as:
“New database was not backed up because your full backup is scheduled to execute once a week on Saturday, and database was added to your system on Tuesday”
“Database was placed on wrong drive and you get alerts regarding your drive being out of space”
“New database does not have indexes and application owner, users or developers asking you why their application running slow”
 
All those questions and topics can come to you at any time. Well, if you are not aware of a new database that was created by one of those groups on your Database Server you will be surprised and in some cases shocked, but if you will keep track of what is going on in your environment you will be a head of this game. As soon as somebody will ask you a question regarding an application running slowly or you will receive alerts from your server regarding a low disk space, you will know where to look and why this is occurring.
 
You can ask me “HOW will You know if new database was created and when it was created?” You can argue that you are the only DBA who supports over 20 Servers and it’s impossible to get this information manually.
 
I completely agree with you. Manual process such as this, will take a lot of time to go over.  You would face an annoying but mandatory task of going through your servers in order to get the necessary info.
Don’t worry, you can automate this process and get an email on daily or weekly basis regarding this information.
Below I will show you a short example of this process. If you are interested in getting a full version, feel free to contact me or sent me an email regarding your request.
 
Step #1 - “Creating table”
USE [Your Database Name where you will create this table]
GO
 
CREATE TABLE [dbo].[Last_DB_Track](
      [last_checked] [datetime] NULL,
      [new_db_name] [varchar](128) NULL,
      [server_name] [varchar](1280) NULL
 
Step #2 – “ Creating Store Procedure to capture this information”
CREATE Procedure [dbo].[usp_track_new_databases]
as
 
begin
 
declare @last_run datetime
declare @newDbCnt int
 
set nocount on
set @newDbCnt = 0
 
select @last_run = max(last_checked) from Last_DB_Track
 
if @last_run is not null
 begin
   select @newDbCnt = count(name)
     from master..sysdatabases
     where crdate > @last_run
 end
 
Step # 3 – “creating Scheduled Job”
 
Retrieving Account Information
9/1/2011 8:16:18 AM
One of my students asked me “One of my projects was to present all SQL Server accounts for one of the Security Auditing Company’s. They want to know which user has more read/write access.
Good question!!!! It is easy to find if your situation is as follows: you have one server, couple databases, and only a handful of users. What if you have more than thirty users and most of them have different type of access?? Then this request becomes more complicated, if not scary. Sounds like a big chunk of DBA’s time and manual work needs to be done to present this information.
Well, let’s use tools that were provided by  Microsoft , such as system tables and functions to retrieve this information using TSQL.
All logins and users information saved in master database. SQL Server providing us with very powerful tool named system tables. Using system tables you can gather pretty much everything about your databases, security and much more.
Well, let’s use what we have and pull requested information.
Below is a part of the code which I came up with to retrieve this information.
USE [master]
 
SELECT ServerName.srvname, syslogins.loginname,
        CASE WHEN syslogins.isntname = 1 THEN CASE WHEN syslogins.isntgroup = 1 THEN 'AD Group'
                                         ELSE 'AD Acct'
                                    END
             ELSE 'SQL Acct'
        END AS AcctType, CONVERT(VARCHAR(10), syslogins.createdate, 101) AS createdate
 
 
Scripts can be modified to retrieve all types of security information.
9 items total
All rights reserved © pavlovit.com