<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Turknet DBA - Medium]]></title>
        <description><![CDATA[TurkNet DBA pages - Medium]]></description>
        <link>https://medium.com/turknetdba?source=rss----80a65d4e4825---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Turknet DBA - Medium</title>
            <link>https://medium.com/turknetdba?source=rss----80a65d4e4825---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 11:33:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/turknetdba" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Ubuntu daki sql server config ve path ayarlamaları]]></title>
            <link>https://medium.com/turknetdba/ubuntu-daki-sql-server-config-ve-path-ayarlamalar%C4%B1-22409f9b229e?source=rss----80a65d4e4825---4</link>
            <guid isPermaLink="false">https://medium.com/p/22409f9b229e</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[sql-server]]></category>
            <category><![CDATA[dba]]></category>
            <category><![CDATA[config]]></category>
            <category><![CDATA[ubuntu]]></category>
            <dc:creator><![CDATA[Servetbulut]]></dc:creator>
            <pubDate>Wed, 23 Jun 2021 10:03:05 GMT</pubDate>
            <atom:updated>2021-06-23T10:03:05.455Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*fHZ3A7jv-ahrhsWPGkFv7A.png" /></figure><p>Selamlar bu yazımızda daha önce Ubuntuya kurduğumuz Sql server’ımızın config ayarlarını anlatacağız. Yapacağımız configler her prod sql de yapılması gereken min ayarlamalar sunucumuz prod olduğu için kurulum da ayrı iki Data ve Root diski talep ettik.</p><p>Kurulum(Root) ve data klasörlerini ayırmak hem olası bir kernel çökmesinde data klasörüne erişebilmemizi sağlar hem de disk üzerinde ki I/O böldüğü için performans artışı sağlar.</p><pre>sudo chown mssql /data/mssql/data <br>sudo chgrp mssql /data/mssql/data </pre><pre>sudo chown mssql /data/mssql/logs <br>sudo chgrp mssql /data/mssql/logs</pre><p>Oluşturduğumuz data ve logs klasörlerini default klasörümüz yapalım. Böylelikle oluşturulan dblerin .mdf ve .ldf dosyaları ilgili klasörlere gitsin.</p><pre>sudo /opt/mssql/bin/mssql-conf set filelocation.defaultdatadir /data/mssql/data </pre><pre>sudo /opt/mssql/bin/mssql-conf set filelocation.defaultlogdir /data/mssql/logs</pre><p>Şimdi kontrol edelim.</p><pre>sudo vi /var/opt/mssql/mssql.conf</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*Jq7UJ50j-Q_ztLbzWpwwXQ.png" /></figure><p>Yine backup ve dump dosyalarını da ayıralım.Backup ve Dump Dosyalarını da oluşturalım.</p><pre>sudo chown mssql /data/mssql/data <br>sudo chgrp mssql /data/mssql/data</pre><pre>sudo chown mssql /data/mssql/logs <br>sudo chgrp mssql /data/mssql/logs</pre><pre>sudo /opt/mssql/bin/mssql-conf set filelocation.defaultdumpdir /data/mssql/Dump </pre><pre>sudo /opt/mssql/bin/mssql-conf set filelocation.defaultbackupdir /data/mssql/Backup</pre><p>config dosyasına port ve sunucumuzun ip adresini ve memory limitimizi de ekleyelim. Agent servisimizde aktif ediyoruz.</p><pre>sudo /opt/mssql/bin/mssql-conf set network.tcpport 1433</pre><pre>sudo /opt/mssql/bin/mssql-conf set network.ipaddress 192.168.1.10</pre><pre>sudo /opt/mssql/bin/mssql-conf set memory.memorylimitmb 4096</pre><pre>sudo /opt/mssql/bin/mssql-conf set sqlagent.enabled true</pre><p>şimdi yaptığımız değişikleri görelim.</p><pre>nano /var/opt/mssql/mssql.conf</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*KSZCPDlx11Cps8U52CLllw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22409f9b229e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/turknetdba/ubuntu-daki-sql-server-config-ve-path-ayarlamalar%C4%B1-22409f9b229e">Ubuntu daki sql server config ve path ayarlamaları</a> was originally published in <a href="https://medium.com/turknetdba">Turknet DBA</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ubuntu’ya SQL Server kurulumu]]></title>
            <link>https://medium.com/turknetdba/ubuntuya-sql-server-kurulumu-6a055dda6f7e?source=rss----80a65d4e4825---4</link>
            <guid isPermaLink="false">https://medium.com/p/6a055dda6f7e</guid>
            <category><![CDATA[sql-server]]></category>
            <category><![CDATA[installation]]></category>
            <category><![CDATA[ms-sql-server]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Servetbulut]]></dc:creator>
            <pubDate>Tue, 22 Jun 2021 11:58:45 GMT</pubDate>
            <atom:updated>2021-06-23T08:32:20.354Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*jQi_gX-kWDADRl2W9i-Q3w.png" /></figure><p>Herkese Selamlar bu yazımız da ubuntu üzerine sql server 2019 kurulumunu anlatacağız. Kolay bir işlem neredeyse Windows next-next-finish yapısı gibi 🙂</p><p>ilk önce keyleri install etmekle başlıyoruz.</p><pre>wget -qO- <a href="https://packages.microsoft.com/keys/microsoft.asc">https://packages.microsoft.com/keys/microsoft.asc</a> | sudo apt-key add -</pre><p>Her ubuntu sürümüne göre bi repo(depo) var. Uygun sürümüne göre ilgili repoyu kopyalayıp install ediyoruz.</p><p>Ubuntu 16.04 için:</p><pre>sudo add-apt-repository &quot;$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2019.list)&quot;</pre><p>Ubuntu 18.04 için:</p><pre>sudo add-apt-repository &quot;$(wget -qO- https://packages.microsoft.com/config/ubuntu/18.04/mssql-server-2019.list)&quot;</pre><p>Ubuntu 20.04 için:</p><pre>sudo add-apt-repository &quot;$(wget -qO- https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2019.list)&quot;</pre><p>Şimdi apt yi güncelleyip kurulumu yapıyoruz.</p><pre>sudo apt-get update <br>sudo apt-get install -y mssql-server</pre><p>yükleme işlemi bitti.</p><p>Şimdi mssql.conf dosyasını yükleyeceğiz. Sürüm seçimini;</p><p>yani enterprise,standart,expres… vs burada belirliyoruz.</p><p>Ayrıca SA parolasını buradan belirliyoruz. En az 8 karakter olmasına,büyük harf,küçük harf ve rakam içermesine dikkat edelim.</p><pre>sudo /opt/mssql/bin/mssql-conf setup</pre><p>şimdi servisi mizi kontrol ediyoruz.</p><pre>systemctl status mssql-server --no-pager</pre><p>ve şimdi SQL Server komut satırı araçlarını yükleyelim.</p><pre>curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -</pre><p>Tekrar repoları kaydediyoruz. Uygun sürümünüze göre yine uygun repoyu kaydedin.</p><p>Ubuntu 16.04 için:</p><pre>curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list</pre><p>Ubuntu 18.04 için:</p><pre>curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list</pre><p>Ubuntu 20.04 için:</p><pre>curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list</pre><p>odbc ayarlarını da kullanılabilmesi için aşagıdaki satırları çalıştıralım.</p><pre>sudo apt-get update<br>sudo apt-get install mssql-tools unixodbc-dev</pre><p>tekrar apt’yi update edip mssql-tools en güncel halini yüklüyoruz.</p><pre>sudo apt-get update<br>sudo apt-get install mssql-tools</pre><p>Path leri de ekleyelim.</p><pre>echo &#39;export PATH=&quot;$PATH:/opt/mssql-tools/bin&quot;&#39; &gt;&gt; ~/.bash_profile<br>echo &#39;export PATH=&quot;$PATH:/opt/mssql-tools/bin&quot;&#39; &gt;&gt; ~/.bashrc<br>source ~/.bashrc</pre><p>şimdi kurulum yaptığımız mssqlimize belirlediğimiz parola ile bağlanalım.</p><pre>sqlcmd -S localhost -U SA -P ‘Password’</pre><p>bağlandıktan sonra bi database oluşturalım. Yazdığınız her t-sql den sonra go demelisiniz aksi halde sql yazmaya devam ettiğinizi düşünüyor. Go diyip işlemi bitiriyoruz.</p><pre>CREATE DATABASE Test</pre><pre>go</pre><p>Şimdi oluşturduğumuz db’yi kontrol edelim.</p><pre>SELECT Name from sys.Databases<br>go</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*mM7tPY8xGP8g9W2up0-zYw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a055dda6f7e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/turknetdba/ubuntuya-sql-server-kurulumu-6a055dda6f7e">Ubuntu’ya SQL Server kurulumu</a> was originally published in <a href="https://medium.com/turknetdba">Turknet DBA</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Postgresql de Replicasyon]]></title>
            <link>https://medium.com/turknetdba/postgresql-de-replicasyon-2cf60b75b662?source=rss----80a65d4e4825---4</link>
            <guid isPermaLink="false">https://medium.com/p/2cf60b75b662</guid>
            <category><![CDATA[postgresql-replication]]></category>
            <category><![CDATA[postgres]]></category>
            <category><![CDATA[replication]]></category>
            <category><![CDATA[replica]]></category>
            <category><![CDATA[postgresql]]></category>
            <dc:creator><![CDATA[Servetbulut]]></dc:creator>
            <pubDate>Wed, 17 Mar 2021 11:55:35 GMT</pubDate>
            <atom:updated>2021-03-17T12:51:42.102Z</atom:updated>
            <content:encoded><![CDATA[<h3>Postgresql de replikasyon</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*6odpK-Vr4XyEM5GqLoXm-A.png" /></figure><p>Bu replicasyonu Ubuntu 20.04 ve postgresql 13 için yapılmıştır. Ancak postgresql 10 dan sonraki sürümleri ve linux nun diğer versiyonları için de uygulayabilirsiniz.</p><blockquote>postgresql10 dan eski sürümleri için ssh ayarlanması gerekiyor.</blockquote><p>ilk önce postgresql.conf dosyalarını ayarlamakla başlıyoruz.</p><p><em>#Master(192.168.190.129)</em></p><p><em>#Secondary(192.168.190.130)</em></p><p>Ana postgres sunucumuzda(192.168.190.129) postgresql.conf dosyasını açalım.</p><pre>#Master<br>sudo nano /etc/postgresql/13/main/postgresql.conf</pre><p>ve aşağıdaki ayarlamayı yapalım burada bizim ana server ipsi 192.168.190.129 olduğu için onu listen_addresses kısmına ekliyoruz.</p><pre>#Master<br>listen_addresses = ‘*,192.168.190.129’</pre><p>ve port kısmınıda enable edelim.</p><pre>#Master<br>port = 5432</pre><p>aşağılarda wal_level kısmını da enable edip logical yazalım.</p><pre>#Master<br>wal_level =logical</pre><p>aşağıda ki parametleri de enable ediyoruz.</p><pre>#Master<br>max_wal_senders = 10 # max number of walsender processes<br>                     # (change requires restart)<br>wal_keep_size = 0 # in megabytes; 0 disables<br>wal_sender_timeout = 60s # in milliseconds; 0 disables<br>max_replication_slots = 10 # max number of replication slots<br>synchronous_standby_names = &#39;&#39;# standby servers that provide syncrep</pre><p>ve postgresql.conf dosyasında ki ayarlarımız bu kadar bunları da kaydedip çıkıyoruz. Yaptığımız bu değişiklerin çoğusu servisi restart gerektirir, postgresql servisimizi restart ediyoruz.</p><pre>#Master<br>systemctl restart postgresql</pre><p>Ve benzer şekilde bu ayarlamaları replica yapacağımız sunucuda da(192.168.190.130) yapıyoruz.Sadece buraya replica sunucumuzun ip siniz yazalım diğerleri aynı şekilde yapabilirsiniz</p><pre>#Secondary<br>listen_addresses = ‘*,192.168.190.130’</pre><p>Bunları da kaydedip servisimi restart yapıyoruz.</p><p>daha sonra ana sunucuda ki pg_hba.conf dosyasını ayarlayacağız.</p><p>Dosyamızı açalım.</p><pre>#Master<br>sudo nano /etc/postgresql/13/main/pg_hba.conf</pre><p>Ve ana sunucuda aşağıdaki parametreleri ekleyelim.</p><pre>#Master<br>host         all       all            192.168.190.130/32        md5</pre><p>Burada 192.168.190.130 olarak yazdığımız ip replica yapacağımız sunucunun ip olduğu için onu ekliyoruz. Bunu da kaydedip çıkıyoruz. Yine servisimizi restart edelim.</p><p>Aynı şekilde replica sunucusunda daki pg_hba.conf da bu ayarlamaları yapalım. Ve aşağıdaki parametreyi ekleyelim.</p><pre>#Secondary<br>host       all         all           192.168.190.129/32       md5</pre><p>Kaydedelim ve servisi restart edelim.</p><pre>#Secondary<br>systemctl restart postgresql</pre><p>Ana sunucumuza geri dönüp;</p><pre>#Master<br>sudo ufw allow from 192.168.190.130 to any port 5432</pre><p>ve tekrar sunucumuzu restart edelim.</p><pre>#Secondary<br>sudo systemctl restart postgresql</pre><p>aşağıdaki komutları iki sunucumuzda çalıştıralım.</p><pre>#Master<br>sudo -u postgres psql</pre><pre>#Secondary<br>sudo -u postgres psql</pre><p>Her iki taraftada dbleri ekliyoruz.</p><pre>#Master<br>CREATE DATABASE deneme;</pre><pre>#Secondary<br>CREATE DATABASE deneme;</pre><p>dbleri geçiş yapalım. \c ile connect olacağımız dbyi seçiyoruz.</p><pre>#Master<br>\c deneme</pre><pre>#Secondary<br>\c deneme</pre><p>ve her iki sunucuya da tabloları ekleyelim.Tablomuzda pk olduğundan emin olalım.</p><pre>#Master<br>CREATE TABLE test <br> ( <br> id SERIAL, <br> urun TEXT, <br> fiyat DECIMAL, <br> CONSTRAINT test_pkey PRIMARY KEY (id) <br> );</pre><pre>#Secondary<br>CREATE TABLE test <br> ( <br> id SERIAL, <br> urun TEXT, <br> fiyat DECIMAL, <br> CONSTRAINT test_pkey PRIMARY KEY (id) <br> );</pre><p>Yine her iki tarafa da user’ı açıp o db deki tüm yetkileri veriyoruz.</p><pre>#Master<br>CREATE ROLE testuser WITH REPLICATION LOGIN PASSWORD ‘test123’;</pre><pre>GRANT ALL PRIVILEGES ON DATABASE deneme TO testuser;</pre><pre>GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO testuser;</pre><pre>#Secondary<br>CREATE ROLE testuser WITH REPLICATION LOGIN PASSWORD ‘test123’;</pre><pre>GRANT ALL PRIVILEGES ON DATABASE deneme TO testuser;</pre><pre>GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO testuser;</pre><p>Ana sunucuya bir publication ekliyoruz ve tablomuzu replicaya dahil ediyoruz.</p><pre>#Master<br>CREATE PUBLICATION test_publication;</pre><pre>ALTER PUBLICATION test_publication ADD TABLE test;</pre><p>replica sunucuya geçiyoruz ve subscription oluşturuyoruz.</p><pre>#Secondary<br>CREATE SUBSCRIPTION test_subscription CONNECTION ‘host=192.168.190.129 port=5432 password=test123 user=testuser dbname=deneme’ PUBLICATION test_publication;</pre><p>daha sonra ana sunucumuza dönüp aşağıdaki kodu çalıştırıyoruz.</p><pre>#Master<br>INSERT INTO test (urun, fiyat) VALUES (‘test1’, 124.50), (‘test2’, 61.20), (‘test3’, 9.80);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*w8BcILiXaWwrItdH3HgNoA.png" /></figure><p>şimdi replica da test edelim.</p><pre>#Secondary<br>SELECT * FROM test;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*UdFjJTo5vcWCjDTr-LC8OQ.png" /></figure><blockquote>Not: Subscription başlattıktan sonra eklenen tablolar replica olmuyor onun için tüm tabloları ekledikten sonra subscription başlatmalıyız. Eğer olurda yeni bir tablo eklemek istersek replicasyonu yıkıp yeniden yapmamız gerekiyor.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2cf60b75b662" width="1" height="1" alt=""><hr><p><a href="https://medium.com/turknetdba/postgresql-de-replicasyon-2cf60b75b662">Postgresql de Replicasyon</a> was originally published in <a href="https://medium.com/turknetdba">Turknet DBA</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Idera yardımıyla Mssql deki uzun süre çalışan queryleri loglamak]]></title>
            <link>https://medium.com/turknetdba/idera-yard%C4%B1m%C4%B1yla-mssql-deki-uzun-s%C3%BCre-%C3%A7al%C4%B1%C5%9Fan-queryleri-loglamak-b18477b6e937?source=rss----80a65d4e4825---4</link>
            <guid isPermaLink="false">https://medium.com/p/b18477b6e937</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[ms-sql-server]]></category>
            <category><![CDATA[mssql]]></category>
            <category><![CDATA[monitoring]]></category>
            <dc:creator><![CDATA[Servetbulut]]></dc:creator>
            <pubDate>Tue, 23 Feb 2021 09:24:59 GMT</pubDate>
            <atom:updated>2021-02-23T10:05:56.492Z</atom:updated>
            <content:encoded><![CDATA[<h3>Idera yardımıyla Mssql deki Uzun süre çalışan queryleri loglamak</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*9NAB_MLLb21THWaoa1AtjQ.jpeg" /></figure><p>Merhabalar</p><p>Bu yazımda sizlerle Idera Tool yardımıyla uzun süren queryleri tesbit edip elastic search’e aktarmayı anlatmya çalışacağız. Bu yazı iki kısımdan oluşmaktadır ilk kısımda verileri nasıl elde edeceğimizi ikinci kısımda ise bu verileri elastik search’e nasıl aktarabiliriz onu anlatmaya çalışacağız.</p><p>İlk kısım için hali hazırda kullandığımız Idera Toolunu tercih ettik ve mail atacağız aynı zamanda Powershell kodu ile dosyaya yazacağız.</p><p><strong>A) İlk olarak alert ayarlamalarını yapalım</strong></p><p>1.) İlkönce templateten alert kısmını ayarlayalım. Burada “<strong>Alert</strong>” sekmesine tıklayıp oradan “<strong>Alert Configuration Template</strong>” seçiyoruz ve kullandığımız template seçip “<strong>Edit</strong>” diyoruz. “Edit <strong>Configuration</strong>” seçip “<strong>Oldest Open Transaction (minutes)</strong>” seçiyoruz ve query sürelerini belirliyoruz.</p><p>Biz Info için 5dk Warning için 10dk ve Critical için 15 dk belirlerdik. Ve okeyleyip template’e ayarları kaydedelim. Aşağıda görsel olarak bunu görebilirsiniz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1sZxRJWjFn0esjPNlOisSw.png" /></figure><p>2.)Alert kısmını ayarlayıp template kaydettikten sonra şimdi de alert oluştuğunda yapılacak aksiyonları belirleyelim.</p><p><strong>B)Alert oluştuğunda Info Maili Atma</strong></p><p>1.) Yine “<strong>Alert</strong>” sekmesinde “<strong>Alert Actions and Responses</strong>” kısmını seçelim ve “<strong>Add</strong>” diyip bir kural ekleyeceğiz. “<strong>Name</strong>” kısmında kuralımızın adını yazalım. Step1 de “<strong>Where metric is</strong> ” kısmında aksiyonları görmek ve bir aksiyon almak için orayı tıklıyoruz. Step2 de aksiyonlar açılır, buradan “<strong>Enable</strong> Send an email to” bulup başında ki <strong>Enable </strong>linkine tıklayalım ve T<strong>o </strong>kısmına mail adresi girelim. Message kısmında otomatik bir format oluşur. Buraya manuel müdahalede de bulunabiliriz. Biz şimdilik default bırakalım, bizim için bu bilgiler yeterli. Format ve çıktı kısmını da aşağıda paylaşıyorum. Anlattığım kısımları görsel olarak da görebilirsiniz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xt8ZcvKq9_mH1JAZOZfvug.png" /></figure><p><strong>Format</strong> :</p><pre>$(Timestamp), $(Metric) on $(Instance) and host $(Hostname) is $(Severity).</pre><pre>$(AlertText)</pre><pre>$(Metric): $(Description)</pre><p><strong>Gelen Mail Örneği</strong>:</p><p>14.1.2021 12:15:52, Oldest Open Transaction (Minutes) on ServerName and host ServerName is Informational.<br> <br> SQL Server instance ServerName — A transaction in session 592 has been active for 5 minute(s) and running since 14.1.2021 12:10:56. The transaction is being run on database [DBName] with application name ‘AppName’ by user ‘UserName’ on host ‘HostName’. Last command issued: DBName.dbo.sp_Name;1</p><p><strong>C)Alert oluştuğunda PowerShell kodu çalıştırma</strong></p><p>1.)Alert Response kısmına tekrar gelelim Step1 de “<strong>Where metric is</strong> ” kısmının tikli olduğunu kontrol edelim. Step2 de aksiyonlar açılır. Buradan “<strong>Enable</strong> Run the following Power Shell Script” bulup başında ki <strong>Enable </strong>linkine tıklıyalım ve gelen ekranda “<strong>Description</strong>” kısmına bir açıklama girelim ve “<strong>Power Shell Command</strong>” kısmına queryleri text dosyaya aktarcak powershell kodu yazalım.Aşağıda yine kodu ve çıktıyı görebilirsiniz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z-0yL1g5mAUMyVWqdxkgZQ.png" /></figure><p><strong>Power Shell Kodu:</strong></p><pre>“$(Timestamp);$(Instance);$(Database);$(Severity);$(AlertText);$(Description);$(Resource);$(AlertSummary);$(Metric);$(Value) `r” | Out-File -FilePath C:\Logs\QueryRunTime.txt -Append</pre><p><strong>Kodun Çıktısı:</strong></p><p>17.11.2020 01:59:02;ServerName;DBName;Warning;SQL Server instance ServerName— A transaction in session 628 has been active for 14 minute(s) and running since 17.11.2020 01:45:03. The transaction is being run on database [DBName] with application name ‘’AppName’’ by user ‘’UserName&#39;’ on host ‘’ServerName&#39;’. Last command issued:</p><p>use DBName</p><p>exec IndexRebuild</p><p>-Aşağıda da oluşan dosyayı görebilirsiniz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*joYXuLfTdNjTHZ87rLgFgg.png" /></figure><p>Bir sonraki makalemizde de bu logları ELK Stack ile aktarımını anlatacağız.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b18477b6e937" width="1" height="1" alt=""><hr><p><a href="https://medium.com/turknetdba/idera-yard%C4%B1m%C4%B1yla-mssql-deki-uzun-s%C3%BCre-%C3%A7al%C4%B1%C5%9Fan-queryleri-loglamak-b18477b6e937">Idera yardımıyla Mssql deki uzun süre çalışan queryleri loglamak</a> was originally published in <a href="https://medium.com/turknetdba">Turknet DBA</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>