IT Nota

  • Home
  • How To
  • .NET
  • WordPress
  • Contact

How to Create a SQL Server Agent Proxy Account

When you need to execute job steps under a specific security context, proxy account can be used to allow users who are not sysadmin to run them.

Before you can create a proxy account, you first need to create a credential that needs to be linked later. This can be a window service account or a user’s active directory id.

Creating a Credential

  1. In the Object Explorer, expand Security node
  2. Right-click Credentials node and select New Credential
  3. After giving a name to the credential, enter a Windows account and the password

SQL Server Adding a New Credential

Creating a Proxy

  1. Back in the Object Explorer, expand the SQL Server Agent node
  2. Right-click Proxies and select New Proxy Account
  3. You can use the same proxy name as your credential
  4. Select any subsystems you want to enable for the particular proxy

SQL Server Agent - Adding a New Proxy Account

In this example the proxy was created to run SSIS packages, so SQL Server Integration Services Package was checked. That’s all there is to it.

Further Reading

SQL Server 2016 High Availability Unleashed cover image More detailed information can be read from “SQL Server Agent Proxy Account” section from the following book:
SQL Server 2016 High Availability Unleashed

February 6, 2014 Filed Under: Database Tagged With: Microsoft SQL Server, Proxy Account, Server Agent, SQL Server

How to Change Default Database Driver in Visio

Other than creating a flowchart, Microsoft Visio is also a very good tool for data modeling. The default database driver set on the software though is for Microsoft Access.

Visio Default Database Driver (Microsoft Access)

Here are the steps to change the target database driver to SQL Server or any other available databases:

  1. Make sure you have other database driver you want to use installed on your computer first.

  2. Go to the Database menu, then click Database Drivers.

    Visio Menu - Database Drivers

  3. On Database Drivers window under Drivers tab, select Microsoft SQL Server as the default driver for Visio and click OK.

    Visio Database Drivers Selector

That’s it. Now when you open the column property (Edit button), you see the new default driver.
Visio New Default Database Driver (Microsoft SQL Server)

December 9, 2013 Filed Under: Database Tagged With: Access, Microsoft, SQL Server

Upgrading SQL Express to Other Edition

In SQL Server 2012, upgrading edition is actually easier than ever since the data is stored under the same directory.

  1. Backup your data data. For default installation, the data can be found in the following directory:
    C:\Program Files\Microsoft SQL Server

  2. Have a local copy of SQL 2012 setup files as it will make the installation process much faster.

  3. Run setup.exe

  4. When SQL Server Installation Center launches, click on Maintenance on the left pane and select Edition Upgrade on the right.

    SQL Server Installation Center - Edition Upgrade

  5. Make sure after the Setup Support Rules shows nothing failed.

    SQL Server 2012 Setup - Setup Support Rules

    Click OK. It will run again one more time to make sure that the computer is not a domain controller. Click Next when done. You need to do this a couple times until you see the screen where you need to enter the product key.

  6. Enter the product key, and click Next.

    SQL Server 2012 - Enter product key

  7. Pick the SQL Server instance you want to upgrade.
    Click Next > until you reach the Ready to upgrade edition.

    SQL Server 2012 - Select Instance

  8. Check the summary on the Ready to upgrade edition.
    If everything looks correct, click on the Upgrade button.

    SQL Server 2012 - Ready to upgrade edition summary

  9. Once done, you should see all statuses as Succeeded in the Complete screen. Click Close.

    SQL Server 2012 - Edition Upgrade Complete

If you want to double check, connect to the database open a New Query window and run this SQL statement:

SELECT @@VERSION

 
It should display result similar to this:

Microsoft SQL Server 2012 - 11.0.2100.60 (X64)
​Feb 10 2012 19:39:15
​Copyright (c) Microsoft Corporation
​Developer Edition (64-bit) on Windows NT 6.0 <X64> ...

 

SQL Server Edition Query
 
You might also want to remove the SQL Server 2012 setup files from the local hard drive.
 
 

November 21, 2013 Filed Under: Database, How To Tagged With: SQL Server

Useful Scripts for SQL Server Performance Tuning

A couple of useful scripts of sql commands to aid performance tuning in SQL Server (T-SQL).

This handy T-SQL script was from SQL Authority shows all queries that are currently running on your server.

SELECT sqltext.TEXT,
  req.session_id,
  req.status,
  req.command,
  req.cpu_time,
  req.total_elapsed_time
FROM sys.dm_exec_requests req
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext

Any running query in the result can be killed by using the KILL command followed by the session id.

KILL [session_id]

Database I/O Information

This one is taken from the book:
Professional Microsoft SQL Server 2014 Administration

-- Database IO analysis.
WITH IOFORDATABASE AS 
(
  SELECT 
    DB_NAME(VFS.database_id) AS DatabaseName
    , CASE WHEN smf.type = 1 
      THEN 'LOG_FILE' ELSE 'DATA_FILE' END
	    AS DatabaseFile_Type
    , SUM(VFS.num_of_bytes_written) AS IO_Write
    , SUM(VFS.num_of_bytes_read) AS IO_Read
    , SUM(VFS.num_of_bytes_read + VFS.num_of_bytes_written) 
        AS Total_IO
    , SUM(VFS.io_stall) AS IO_STALL
  FROM sys.dm_io_virtual_file_stats(NULL, NULL) AS VFS
  JOIN sys.master_files AS smf
  ON VFS.database_id = smf.database_id
  AND VFS.file_id = smf.file_id
  GROUP BY DB_NAME(VFS.database_id), smf.type
)
SELECT
  ROW_NUMBER() OVER (ORDER BY io_stall DESC) AS RowNumber
  , DatabaseName
  , DatabaseFile_Type
  , CAST(1.0 * IO_Read / (1024 * 1024) AS DECIMAL(12,2)) 
      AS IO_Read_MB
  , CAST(1.0 * IO_Write / (1024 * 1024) AS DECIMAL(12,2)) 
      AS IO_Write_MB
  , CAST(1. * Total_IO / (1024 * 1024) AS DECIMAL(12,2)) 
      AS IO_TOTAL_MB
  , CAST(IO_STALL / 1000. AS DECIMAL(12, 2)) 
      AS IO_STALL_Seconds
  , CAST(100. * IO_STALL / SUM(IO_STALL) OVER() AS DECIMAL(10,2))
      AS IO_STALL_Pct
FROM IOFORDATABASE
ORDER BY IO_STALL_Seconds DESC

Further Reading

SQL SERVER – Find Currently Running Query – T-SQL

November 19, 2013 Filed Under: Database Tagged With: Microsoft SQL Server, SQL, SQL Server

How to Get Names of All Tables in SQL Server

Here’s a list of sql commands (T-SQL) to get the names of all tables, views, sprocs and triggers in SQL Server:

-- Get all Tables
SELECT name FROM sys.tables

-- Get all Views
SELECT name FROM sys.views

-- Get all Stored Procedures
SELECT name 
  FROM sys.procedures

-- Get all Triggers
SELECT name FROM sys.triggers

If you want to see all objects within the database, use the following SQL command:

SELECT name, type, type_desc
  FROM sys.objects

Try this one to also include all column names info:

SELECT * FROM sys.tables t
INNER JOIN sys.columns c
ON t.object_id = c.object_id

Further Reading

sys.objects (Transact-SQL)
How to Get Table Definition in SQL Server
How to Find All References to an Object in a SQL Server Database
How to Search for a String in All Tables in a Database
How to Find a String in SQL Server Stored Procedures

November 18, 2013 Filed Under: Database Tagged With: Microsoft SQL Server, SQL, SQL Server

« Previous Page
Next Page »
Buy me a coffee Support this site
Buy Me a Coffee?

Categories

  • .NET
  • Coding
  • Cybersecurity
  • Database
  • How To
  • Internet
  • Multimedia
  • Photography
  • Programming
  • Resources
  • Review
  • Tips and Tricks
  • Uncategorized
  • Use Case
  • WordPress
  • Writing

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Tags

.NET .NET Core AdSense ASP.NET Cdonts Dll Classic ASP Code Editor ETL FSharp Genesis Framework Git Google HP Asset Manager HTML5 Hugo IIS Information Security Internet Internet Information Services iOS JAMStack Linux macOS Microsoft Microsoft SQL Server MVC PHP PowerShell Python Simple Mail Transfer Protocol Smtp Server SQL SQL Server SSIS SSMS SSRS Sublime Text Visual Studio Visual Studio Code VPN Windows Windows 8 Windows 10 Windows 2012 Windows Server

Copyright © 2011-2025 IT Nota. All rights reserved. Terms of Use | Privacy Policy | Disclosure