Problems displaying this newsletter? View online.
SQL Server Central
Featured Contents
Question of the Day
The Voice of the DBA
 

The New DBA is a Developer

This editorial was originally published on Jan 30, 2017. It is being re-run as Steve is on vacation.

I was reading a short piece from Mike Fal recently and it struck a chord with me. I started working with computers as a developer, really a hack programmer as a kid. Friends and I would build small games or hack existing ones to change things. Eventually I was paid to write code, and moved into data work because the pay was better. That was 25 years ago, and I haven't regretted the change since. In fact, I've enjoyed working with data.

Even as I managed data, I always ended up writing some code. Not code, code, like an application that others could use to accomplish a task (though I have often done a touch of that), but rather code to help me as a DBA. I had code to check servers and record values. I had code to move backup files around and generate restore scripts. I had code that would build reports for other DBAs. Some of this code are queries, some are more complex scripts in PoSH (or older VBScript), some could be C# or some other language, but it's all code. Fundamentally, the code isn't much different from the code that application developers write and deploy to clients, web servers, or mobile devices.

There always seemed to be a separation between a DBA that could script something and a DBA limited to simple DML queries. The latter was much less efficient, less productive, less capable of managing a larger environment. As I look to the future, I'd say that that DBA or sysadmin that can't write some code, that is mystified by the concepts of Puppet, Chef, or even unattended SQL installs, is less likely to find good paying, enjoyable, desirable employment. There will be exceptions and less capable people will find work, but given a choice, I think businesses will prefer to get the coding DBA.

Mike brings up great points in his piece, and despite my history as a developer, I've build bad habits over the years. I used to carry around a CD, then a flash drive with helpful DBA scripts on it. I didn't always have a good test process. Part of this was the lack of good modern tools, part was laziness, but just like Mike, I've started to think of anything I do as an effective developer would. I make sure things get done, and I don't try for 100% solutions. I try to get something working, find the problems and fix them, adjusting as I learn and the system changes. I try to build unit tests and ensure that as I change code, I'm not introducing silly bugs because I'm focusing on today's issue while neglecting the requirements I had to meet last week.

Above all, I use version control. That should be a no-brainer for a DBA. We preach backups and restores all the time. Why should our code be any different? These days I've adopted git and I use it extensively. Whether on Github or VisualStudio.com, I'm ensure I've got my code backed up, and practice restoring regularly on other machines. I create repos as soon as I create a folder to work in, and commit regularly. I don't revert often, but when I do, it's nice to have that backup in my VCS.

Steve Jones - SSC Editor

Join the debate, and respond to today's editorial on the forums

 
 Featured Contents
SQLServerCentral Article

Using SQLite with Flutter

mamta_d from SQLServerCentral

Learn how you can build a basic Flutter application that interacts with a SQLite database.

SQLServerCentral Article

Different Ways to Populate the List of Tables

Nisarg Upadhyay from SQLServerCentral

This article shows how you can query different types of tables, based on certain criteria that may be important to you. A good list of basics for any database administrator that will help you find tables in your database.

External Article

Power BI Workspace Permissions and Roles

Additional Articles from MSSQLTips.com

What are the Power BI workspace permissions and roles and how are they used?

Blog Post

From the SQL Server Central Blogs - Quick Filtering in SSMS–#SQLNewBlogger

Steve Jones - SSC Editor from The Voice of the DBA

I saw someone limit the databases they see in SSMS, which isn’t something I often do, but I thought this was great. A Long List This is the list...

Blog Post

From the SQL Server Central Blogs - Extended Events and I (T-SQL Tuesday #166)

Zikato from StraightforwardSQL

Foreword
This month’s invitation is from Grant Fritchey (t|b), aka the Scary DBA, about Extended Events (XEs).
If you look at the Tags section of my blog, you can see that...

Pro T-SQL 2022: Toward Speed, Scalability, and Standardization for SQL Server Developers

Steve Jones - SSC Editor from SQLServerCentral

Learn how to write and design simple and efficient T-SQL code. This is a hands-on book that teaches you how to write better T-SQL with examples and straightforward explanations.

 

 Question of the Day

Today's question (by Steve Jones - SSC Editor):

 

Double Standby

I have a SQL Server 2019 instance and I run this:
USE [master]
RESTORE DATABASE [sandbox4] FROM  DISK = N'D:\SQLBackup\New folder\sandbox_20210308.bak' WITH  FILE = 1,
  MOVE N'Sandbox' TO N'D:\SQLServerData\SQL2017\Sandbox4.mdf',
  MOVE N'Sandbox_log' TO N'D:\SQLServerData\SQL2017\Sandbox4_log.ldf',
  STANDBY = N'D:\SQLBackup\New folder\sandbox_RollbackUndo_2023-08-07_11-51-39.bak',  NOUNLOAD,  STATS = 5
GO
This works and I see the database in standby/read-only. Now I run this:
RESTORE LOG [sandbox4] FROM  DISK = N'D:\SQLBackup\New folder\sandbox_20210308_1301.trn' WITH  
  STANDBY = N'D:\SQLBackup\New folder\sandbox_RollbackUndo2.bak',  NOUNLOAD,  STATS = 5
GO
What happens?

Think you know the answer? Click here, and find out if you are right.

 

 

 Yesterday's Question of the Day (by Steve Jones - SSC Editor)

Closing a Symmetric Key

If I open a symmetric key with this code:

OPEN SYMMETRIC KEY PIIKey DECRYPTION BY PASSWORD =  'MyS3cr#tP@ssword'

When is it closed?

 

Answer: When the session ends or the key is explicitly closed

Explanation: They key is for the connection and remains open through context changes. It is closed when the CLOSE SYMMETRIC KEY command is used or the session terminated. Ref: OPEN SYMMETRIC KEY - https://learn.microsoft.com/en-us/sql/t-sql/statements/open-symmetric-key-transact-sql?view=sql-server-ver16

Discuss this question and answer on the forums

 

 

 

Database Pros Who Need Your Help

Here's a few of the new posts today on the forums. To see more, visit the forums.


SQL Server 2017 - Administration
Central Management Server (CMS) on AlwaysOn for Failover Process - Good afternoon! Is there any type of documentation or process for failing over a CMS server? Do I have to remove them from Primary and add them to secondary (new primary)? This is cumbersome work. Let's assume it's HA and failed over every 2 weeks. Or assume a DR failed over for over a month. […]
cost threshold for parallelism value to be set - Hi Everyone, Why and when should be set 'cost threshold for parallelism'? We are on SQL 2017 Enterprise Edition. What should be the value set for cost threshold for parallelism instead of default value 5 and why ? what benefit do we get if we set a high value and what should be the starting […]
SQL Server 2016 - Administration
Alwyason availability group can set primary role permanently? - Hi. Two node windows clusters Node1 and Node2 and configured alwayson availability group. Will it possible to Alwyason availability group can set primary role permanently any one of the node? Thanks  
Does multi-subnet with standardeditionofsqlserver supports DB Mirror Or AG group - Does multi subnet failover with standard edition of sqlserver supports DB Mirror or AG groups 1. can db mirror configured in different multi subnet with standard edition 2. can db always on configured in different multi subnet with standard edition
SQL Server 2016 - Development and T-SQL
get week number of month - I want to query a table that has a datetime column ([CreateDateTime])  and get the week number for that specific month. 2023-03-01 09:30:00 2023-03-12 11:15:22 2023-03-22 14:22:18 2023-04-02 15:12:30 I want to get these results from the above dates: 1 3 4 1  
SQL Server 2019 - Administration
Changing Database page Verify on a Database in an AG - I have a database on SQL 2019 in an Availability Group (AG) and I want to change the Page Verify attribute from NONE to CHECKSUM on all of the nodes in the AG for this database. The Page Verify attribute is the same on the database on all nodes of the AG. I do not […]
High tempdb usage alternatives - Hi We have an stored procedure which runs frequently and  it contain logic in which data are first dumped in temproray table and then moved to physical table .due to large data and frequent run of sp .tempdb database get filled up quickly .We cannot take server restart everytime so whats alternative to temp variables […]
high latency in sql server transactional replication - Hi I am new to replication and we have database of size around 2TB and its has been set up for replication .there are 4 subscriber to it. Tables(articles) of database has been divided into 14 publishers. Issue sometime we face high latency on server with lakhs of undistributed command so what should i check. […]
upgrade evalution editon reporting services to Stanadard - Hi All, I installed reporting services evaluation edition for testing purpose, but now 180 day trial period is expired and I am unable to generate reports. Is it possible to upgrade it with SQL server 2019 standard edition, without disturbing the existing configuration. I Installed SQL server 2019 database engine on same machine, but while […]
SQL Server 2019 - Development
Need to output table data into multiple CSV files - Hello, I created the below script to output 999 rows from SQL Server table into multiple CSV files. The SQL table has about 45,000 rows. We can only output max of 999 rows into the CSV files. I installed powershell sql server module. Since this is a powershell script, I may need to modify the […]
need some help with spilt raw data - Hello,   I am trying to split data, looks like there is some special character or white space that is not letting me to split. i try to split with space as delimiter even though there is space between two A2339 MC it will not split. -- test date DECLARE @TEST_STR TABLE ( TEST_STRING NVARCHAR(255) […]
Convert Binary or Hex field to show text information - Hi all, I have an SQL database table with events, and within it a field of binary (32) datatype. I want to convert the info in binary field and show me the information that refers to the event. The info is of this type: 0x0000000000000000000000000000000000000000000000000000000000002000. Can someone help? Thanks!!  
Convert columns result into rows with comma and single quotes - Hi All, Hi All, I want to convert columns result into rows with comma. Ex: Result should be - 'SQL1','ABCD100','XYZ123' #code: create table #tbl_db (name varchar(100)) insert into #tbl_db values ('SQL1') insert into #tbl_db values ('ABCD100') insert into #tbl_db values ('XYZ123') select * from #tbl_db Result needed: 'SQL1','ABCD100','XYZ123'  
Powershell
Write https request to azure blobstorage - Hi All, I have been trying to download a csv file which is produced by calling an api and then to store the csv file directly in azure blob storage. I am able to download the file on my local machine and then copy it to azure blob storage. But I would like to copy […]
Employers and Employees
Master Data - Relational or Dimensional modeling? - Dears, In my company, we have certain master data domains like customer; Vendor; Product; Materials; Bill of Materials. So far we have been doing our modeling using relational modeling in the cloud. It consists of entire tables that we push from SAP ECC and SAP MDG like MARA; MVKT, etc... then we have views on […]
 

 

RSS FeedTwitter

This email has been sent to {email}. To be removed from this list, please click here. If you have any problems leaving the list, please contact the webmaster@sqlservercentral.com. This newsletter was sent to you because you signed up at SQLServerCentral.com.
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.
webmaster@sqlservercentral.com

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -