
SQL Server DBA
1000 FOLLOWERS
Learn about SQL Server DBA, SQL Server database performance,SQL Server optimisation,database tuning,t-sql,ssis,powershell.
SQL Server DBA
1M ago
Question : What is the difference between Always On Clustered and Always On Clusterless ?
Answer: It is important to distinguish between these two flavours - Clustered vs Clusterless .
Version 1 - Clustered Availability Groups aka "Standard" Availability Groups which include Windows Server failover cluster . Introduced on SQL Server 2012
Primary Purpose is to offer High Availability
Version 2 - Clusterless aka Read Scale A ..read more
SQL Server DBA
1M ago
Cross-database ownership chaining is a SQL Server security feature allowing database users access to other database objects hosted on the same SQL server instance, in the case where database users don't have access granted explicitly
Two examples of situations where cross-database ownership occurs.
1) A database view joining data from tables residing on multiple databases
2) A stored procedure accessing multiple database objects but at the same time restricting access to the underpinning tables
How do I check my cross DB ownership chaining ?
SELECT i ..read more
SQL Server DBA
2M ago
Question: I have a SQL Server Agent job in a disabled status. The disabled status is applied to the SQL Agent Job and the associated schedule. The problem is I'm logged on as a full administrator onto the Windows Server - and as BUILTIN\Administrator is defined on the SQL Server , but am able to manually override the SQL Agent Job.
Is there a way to Disable the SQL Agent Job where I'm not able to manually override the job?
Answer: There is no way to disable a SQL Agent Job where it cannot be run manually. The disabled option on a SQL Agent Job&n ..read more
SQL Server DBA
4M ago
Question: How can I check the current SQL Server Agent Job Status?
Answer: You have a few different options to check the SQL Server Agent Jobs Status.
Option 1 : SQL Server Job Activity Monitor .Check the "Status"
Option 2 : Use the syshobhistory run_status column - Check SQL Agent Job Exceution Status and Messages Generated with a sql script
Option 3 : SQL-DMO , reading the output from the CurrentRunStatus PropertyThe CurrentRunStatus property returns the executing state of a SQL Server Agent job.
If you're using the SQL-DMO method - the see the latest sta ..read more
SQL Server DBA
4M ago
Question: How do I enable SQL Server trace flags at startup ?
Answer: To add a trace flag as a SQL Server startup parameter, use SQL Server Configuration Manager. By adding the trace flag as a start up parameter -
Start SQL Server Configuration Manager. An alternative is to start SQL Server Configuration Manager from Command Line
Choose SQL Server Services is selected
On the right panel, right-click the SQL Server service instance -> Properties.
Choose Startup Parameters tab.
In the textbox, titled "Specify a startup parameter"&nb ..read more
SQL Server DBA
4M ago
Question: Do you have a query that returns the user permissions for the database objects ?
Answer: This query utilises the sys.database_principals view joined with the sys.database_permissions.
The sys.database_principals returns a row for every security principal for a SQL Server database
The sys.database_permissions returns a recordset of rows for every permission
SELECT db_pri.name As USERNAME
, db_pri.type_desc AS USER_TYPE
, pmt.permission_name AS PERMISSION
, pmt.state_desc AS PERMISSION_STATE
, pmt.class_desc CLASS
, object_name(p ..read more
SQL Server DBA
4M ago
Question: How can I list all Foreign Keys referencing tables and columns within SQL Server tables?
Answer: This query will return 6 columns
FOREIGN_KEY = Name of Foreign Key
SCHEMA_NAME = Name of Schema
TABLE = name of table
COLUMN = Column name
REFERENCED_TBL = the table that has the key column that your FOREIGN_KEY is pointing to
REFERENCED_COL = The column that is the key that your FOREIGN_KEY is pointing to
kkk
use [mydb]
SELECT obj.name AS FOREIGN_KEY,
sch.name AS [SCHEMA_NAME],
tab1.name AS [TABLE],
col1.name AS [COLUMN],
tab2.na ..read more
SQL Server DBA
5M ago
SQL Server Horizontal Partitioning separates a table into multiple tables , all with the same number of columns, but with fewer rows. A typical example is where you might have data - used for monthly charts - separated monthly and each partitioned table represents a month.
Decide on a column to use for separating the data. An example column may be a date column.
This example code represents horizontal partitioning by creating a new new partitioned table.
--create test DB
create database HorzPartitioining
--create additional filegroups ..read more
SQL Server DBA
6M ago
Question: We have a number of MS Access front ends using DSN connections through ODBC to a PostgreSQL database. All works fine. There is a now a new requirement to no store the PostgreSQL ids in the applications but to store them in Hashiccorp vault.
Based on some research , there are quite a few methods to connect to Hashicorp , extract the password and use the information for connecting. One area I'm struggling to establish an approach is with Hashicorp Vault connections from legacy code based on VBA. What's a good approach?
Answer: A good starting point is the ..read more
SQL Server DBA
7M ago
Using a symetric key , how can I encrypt a column in a SQL Server database table? And what are some of the common pitfalls related to setting up column level encryption
In summary these are the steps
=>Step 1 : Create a database master key
=>Step 2 :Create a SQL Server self-signed certificate
=>Step 3 : Create and Configure a symmetric key for encryption
=>Step 4: Encrypt the column data
=>Step 5: Query and verify the encryption
There is a previous post with an outline of the sql code How to set up SQL Server Column Level Encryption . The following post is adding so ..read more