Category Archives: Dicas

Como restaurar bancos de dados no SQL Server

Olá pessoal, tudo bom com vocês?

Nos artigos anteriores demos inicio a nossa sequencia de vídeos sobre o dbatools, onde realizamos a instalação do Visual Studio Code e consequentemente instalamos o módulo do dbatools. Abordamos também nossos primeiros comandos: Get-DbaLogin e Export-DbaLogin.

Pois bem, aprofundando um pouco mais em todas as áreas do dbatools, vamos agora abordar um tópico bastante importante: A restauração de um banco de dados.

Uma das tarefas do administrador de banco de dados recorrentes é realizar a restauração, ou na linguagem técnica “restore” de um banco, seja a mesma sobrescrever um banco já existente, ou até mesmo restaurar um único banco para várias instancias em servidores diferentes.

Como sempre o módulo do dbatools possui comandos que nos ajudam e muito nessa tarefa. Aconselho vocês a assistirem o vídeo abaixo e aprender um pouco mais sobre esse poderoso módulo para administração de SQL Server.


Como sempre peço por aqui e nos vídeos, fico sempre aguardando os comentários, sugestões, e até mesmo dicas de vídeos que gostariam de ver por aqui.

Se inscrevam também no meu canal do Youtube para sempre receberem as notificações de vídeos novos.

Um grande abraço para vocês e até o próximo vídeo!

Marcos Freccia
Data Platform MVP

Instalação do dbatools

Olá pessoal, tudo com vocês?

Sejam bem vindos a mais um post nesse blog que dá início a minha serie de vídeos sobre os mais variados temas. Por enquanto estou abordando o dbatools, mas a ideia é que no futuro eu também aborde aqui outros assuntos como por exemplo Python, desenvolvimento web com Django e por ai vai.

Antes mesmo de começarmos a falar sobre o dbatools, temos que instalar o módulo seja em nossa estação de trabalho, ou no servidor onde os scripts serão executados.

Então o vídeo de hoje aborda esse tema, onde primeiramente eu mostro a navegação no site, como encontrar mais informações sobre o módulo. Feito isso, partimos então para a tela do Visual Studio Code, onde demonstro como realizar a instalação do módulo.

Por fim, validamos se a instalação foi feita com sucesso quando executamos alguns comandos no Visual Studio Code.

Espero que vocês gostem do conteúdo que estou preparando e fico ansiosamente aguardando por sugestões, críticas ou elogios de vocês!

Ah, se inscrevam também no meu canal no Youtube, assim quando qualquer novo vídeo sair, vocês irão receber uma notificação.

Abraços e até o próximo vídeo!

Marcos Freccia
Data Platform MVP

 

 

Instalando o Visual Studio Code

Olá pessoal, tudo bom com vocês?

Como vocês podem ver, estou ha um longo tempo sem postar nada aqui em meu blog, principalmente na língua portuguesa. Com a minha mudança para a Alemanha no início de 2017, e por focar mais aqui no mercado da Europa, acabei por focar um pouco mais na língua inglesa para postagens.

Aproveitando o gancho da postagem. Vocês tem curiosidade em saber mais como foi o meu processo de mudança aqui para a Alemanha (mais especificamente Berlim)?

Caso vocês queiram saber mais, posso também fazer um vídeo explicando todo o processo para vocês. Deixa um comentário aqui nesse post caso vocês queiram.

missed

 

Mas porque estou voltando com posts em Português?

A resposta para essa pergunta é bastante simples. Um dos conteúdos que gosto muito de falar é sobre PowerShell e nesse ultimo ano tenho especialmente trabalhado com dbatools. Não sei o porquê, mas enquanto trabalhava no Brasil, não via muitas pessoas utilizando esse módulo e notei que existem poucos materiais sobre o mesmo em minha língua materna. Esse é o motivo que vou voltar a escrever um pouco mais.

Todas as segundas-feiras, vou lançar um vídeo novo em meu canal do Youtube sobre alguma função do dbatools que utilizo no meu dia-a-dia como administrador de banco de dados. Afinal, esse é um excelente módulo que merece ser amplamente dessiminado em nossa língua.

Para esse primeiro vídeo, decidi começar do mais simples possível! Como instalar o Visual Studio Code e instalar a extensão do PowerShell para a mesma.

Espero que vocês gostem do conteúdo que estou preparando e fico ansiosamente aguardando por sugestões, críticas ou elogios de vocês! 

Ah, se inscrevam também no meu canal no Youtube, assim quando qualquer novo vídeo sair, vocês irão receber uma notificação.

Abraços e até o próximo vídeo!

Marcos Freccia
Data Platform MVP

 

Python scripts for Secret Server

Hey everyone!

I just wanted to share with you some cool scripts in Python that I have been working on. I don’t think they are perfect, but as I am not seeing anything similar to that on the internet I decided to share with you.

Secret Server

Secret Server as the company states in their website.

Secret Server is a clear pick for Privileged Account Management. Competitive pricing, rapid deployment, and short time to value. supporting a variety of complex and specialized enterprise use cases

Secret Server is really helpfull for sharing credentials among teams, checking-in and out from secrets, automatic rotation of passwords, etc.. 


Read the rest of this entry

Automate your SQL Server Restore Tests with PowerShell, dbatools and PowerBI

Hello everyone,

At work, I got to do some really interesting stuff. What I like is they really give me the freedom to try things out. Ah, and if you wanna join us, we have a position to work with me, posted here: https://grnh.se/4899e2091.

There is a saying, which I don’t exactly remember, is that a backup is only a backup if you test the restore of the same. So, I was working on creating an automated way of restoring the backups of my production databases and give me some sort of reporting around it.

So, I did that work and it is running really fine with the structure that I have. Then, I had the idea to share what I did with the community, mainly because I rely on almost all of my work to dbatools, and without them I would have more trouble/work do, to get the same results.

I shared a screenshot on twitter as you can see below.
image
link: https://twitter.com/marcosfreccia/status/1037031233262374914

I got a few replies from people saying that they would like to see how it is done. So, in this blog post, I’ll explain you all the steps that I had to do, to obtain this result.

Read the rest of this entry

[SCRIPT] – Listing Database Users and Roles

I am a fan of not reinventing the wheel. What that means? Well, If I need to do something, which usually involves creating a script, I try first to do a quick search on Google and see if someone already had this idea.

Looking at the title of the article you might say: Oh, that’s easily done with dbatools, which in fact it is true. However, my use case this time was a bit different than the conventional, because I want to expose that dynamically in my Python/Django Internal tool that exposes SQL Server through API’s, so the need for a TSQL script is imminent.

The goal result that I need is:

 

User Name User Type Create Date Roles
User001 SQL_USER 2018-09-10 14:00 db_datareader
User002 WINDOWS_USER 2018-01-01 13:00 db_datareader;db_datawriter;db_ddladmin

  Read the rest of this entry

Reporting Services Databases on Availability Groups

In my current job as a DBA, one of my missions is making everything as automated as possible and making sure that when things go wrong(trust me, they will), the applications that are using my environment can smoothly continue to run with less intervention possible.

You will make mistakes which is part of the job, learning from those mistakes is what makes you grow. Today I want to share with you a few tips that will make your experience with SSRS Databases and Availability Groups less painful. Read the rest of this entry

Changing the Job Owner, doesn’t change the Schedule Owner

One of the capabilities that we do offer to our developers is the ability for themselves to create SQL Server Agent Jobs in our DEV/TEST Environments, so they perform some of their work without the DBA to be involved.

To fullfil this requirement, we grant them the role SQLAgentUserRole, which pretty much does the job. They can create and schedule jobs and execute them. However, latelly one of our DEV’s changed his team and I had to transfer his SQL Agent Jobs to another DEV.

It turns out that when the DEV tried to edit the existing schedule he got the following message: The specified @schedule_id (‘ScheduleIDHere’) does not exist. Read the rest of this entry

Free Microsoft Flow + Twitter + SQL Server

Those days I was playing around with Microsoft Flow and have created some automation for a few things.

While playing with it the thing that I liked was the possibility to host workflows in a free account. So, if you have a live account you can pretty much use a ton of connectors and create your own workflows. You should check it out the plan offers in this link below and understand how you can use it.

image
https://emea.flow.microsoft.com/en-us/pricing/  Read the rest of this entry

Visualizing the content of encrypted stored procedures

Probably you were a bit curious about it and decided to click here, right? This is a very recurrent question on Microsoft forums, where people who maybe by mistake encrypted all of the stored procedures, or maybe you support a 3rd party application and there is an particular stored procedure killing the performance of your server and you just wanna know what the same is doing?

Independent of what you want to do, let me show you here how can you manage to see the content of an encrypted procedure. Read the rest of this entry