7 Şubat 2015 Cumartesi

The operation cannot be performed on database "your_database_name" because it is involved in a database mirroring session or an availability group. Some operations are not allowed on a database that is participating in a database mirroring session or in an availability group. ALTER DATABASE statement failed. (Microsoft SQL Server, Error: 1468)

ERROR:
The operation cannot be performed on database "your_database_name" because it is involved in a database mirroring session or an availability group. Some operations are not allowed on a database that is participating in a database mirroring session or in an availability group. ALTER DATABASE statement failed. (Microsoft SQL Server, Error: 1468)

DESCRIPTION:
If you try to delete a database before removing it from an AlwaysOn Availability Group, then this error occurs.

SOLUTION:
To avoid from this problem, first you should remove the database from the Availability Group that contains it and then delete the database.

11 Ocak 2015 Pazar

HATA: AlwaysOn AG ReadIntent Only Readable Secondary bağlantı hatası

HATA:
Error: Microsoft ODBC Driver 11 for SQL Server : Unable to access the 'veritabanı_adı' database because no online secondary replicas are enabled for read-only access. Check the availability group configuration to verify that at least one secondary replica is configured for read-only access. Wait for an enabled replica to come online, and retry your read-only operation.

AÇIKLAMA:
Bu hatayı bir AlwaysOn Availability Group Listener'ı vasıtasıyla bir ReadIntent Only Readable Secondary sunucuya bağlanmaya çalışırken alabilirsiniz.

ÇÖZÜM:
Eğer bu hatayı alıyorsanız, AlwaysOn Availability Group'u içerisinde ReadIntent Only olarak belirlediğiniz Readable Secondary sunucunuzun SQL Server servisinin çalıştığından, port'ların açık olduğundan ve bu sunucunun erişilebilir olduğundan emin olun. Eğer AlwaysOn Availability Group'unuz içerisinde ReadIntent Only olarak ayarladığınız bir sunucu yoksa, o zaman bu hatayı alan kullanıcının kullandığı uygulamanın Connection String'inde "ApplicationIntent=ReadOnly" gibi bir parametrenin olmadığından emin olun. Eğer bu uygulama SQLCMD ise, bu parametre "-K ReadOnly" olacaktır.

Kolay gelsin,
Ekrem Önsoy

6 Ocak 2015 Salı

Policy Based Management'tan ne kadar yararlanıyorsunuz?

Merhaba!

Policy Based Management (PBM) özelliğinden ne kadar faydalanıyorsunuz?

Birçok ortamda PBM'den faydalanılmıyor. Halbuki Best Practice'lerimizi PBM ile kontrol etmemiz çok kolay. Örneğin SQL Server Instance'ımdaki veritabanlarımın AutoClose ve AutoShrink özellikleri False mu? AutoUpdateStatistics ve AutoCreateStatistics True mu? PageVerify CHECKSUM mı? Veri dosyalarımın büyütülme şekli doğru mu? Belli boyutları aşan dosyalarım var mı ki bunların büyümesini kapatayım ve yeni dosya oluşturayım? Bunları Job'larla veya daha kötüsü manuel kontrol etmemiz dolambaçlı ve sıkıntılı, hele ki PBM gibi bir nimet varken.

Condition'larınızı belirleyin, Policy'nizi tanımlayın. Daha sonra da Evaluation Modu'una göre Error Log'a kaydedilecek hatalar için Alert tanımlayın ve Policy'ler çiğnendiğinde kendinize ve/veya ilgili kişilere haber verilmesini sağlayın.

Bu yazıyı bir dürtme, hatırlatma anlamında yazıyorum, o yüzden ayrıntısıyla değinmeyeceğim PBM'e, zaten internette de birçok makale bulabilirsiniz.

Sevgiler,
Ekrem Önsoy

14 Kasım 2014 Cuma

Transaction Log Shipping Status report

Hello there,

I realise that a good amount of DBAs do not take advantage of the built-in reports in the SQL Server Management Studio (SSMS). I have been using Log Shipping in the production servers for more than 7 years. I have used in-house developer tools to monitor the status of my log shipped databases and SSMS' built-in reports. Every shop can not build their own monitoring tools and some do not have a budget to buy a 3rd party tool; but everyone can benefit from the built-in reports of SSMS!

When it comes to IT generally, monitoring is crucial; with this in mind, to a DBA, monitoring is everything. We manage our systems with monitoring tools. Some need to act proactively and others to react to problems before our managers or users start yelling at us.

Oh , yea, I would write something about monitoring Log Shippings. If yours is a small shop and if you are a small shop probably you will have a primary production server and probably you will configure Log Shipping only on that primary server, then you can use SSMS' Transaction Log Shipping Status report. I wanted to stress out this report because I do not see people write about it on the internet. So I thought this report could be beneficial to junior DBAs or some shops who does not have a DBA or some IT professionals (I call them "all-in-one", no offence!) who has to carry about every IT related stuff in the office.

Here's a screen shot about the report I am talking about:

Transaction Log Shipping Status report

I had to crop the left side of the report because it was too large to fit on my screen, besides I would blur it all that column as they are the database names of one of my production servers.

Anyway, as you can see from the screenshot above, you can see everything you need to know about the status of a database's Log Shipping. How long it's been the last backup has been performed, the threshold and if the alert would be triggered if the threshold was crossed and the details about other fundamental jobs, Copy and Restore of Log Shipping.

Here's how you can open this report:
- Open SSMS and go to Object Explorer,
- Right click on the SQL Server Instance name and select "Reports" and then "Standard Reports"
- You will see "Transaction Log Shipping Status" report at the bottom of the list, click on it and there you go.

You will see much more reports about server monitoring in this chest, you can play with them to learn more.

I hope it helps!

Cheers,
Ekrem Önsoy

12 Kasım 2014 Çarşamba

Idera: Another awful experience with Compliance Manager

Hi folks!

For more than a year I have been using Idera's Compliance Manager (CM) tool which is as its name refers, a compliance tool. I actually have created lots of tickets because of lots of problems with this tool during this period of time. I guess some of you may find this comment enough to keep away from this tool, especially for a production environment, but for the others let me tell you a fresh story I have just experienced this morning.

Last night I enabled Before/After feature for a specific table's some specific fields to collect detailed information about the modifications and as I thought its agent sends the records from the source to the target I observed for any change in the repository database, but I saw nothing spectacular in the row size of the tables. However this morning, clients began screaming with the following kind of errors:

ErrorQuery: SELECT 'Error.  Table: dbo.xxx, Error: Invalid object name ''SQLcompliance_Data_Change.SQLcompliance_Changed_Data_Table''.' Message FROM [SQLcompliance_Data_Change].[SQLcompliance_Changed_Data_Table] WHERE 1 = 0An error occurred sending error message query: Invalid object name 'SQLcompliance_Data_Change.SQLcompliance_Changed_Data_Table'.Invalid object name 'SQLcompliance_Data_Change.SQLcompliance_Changed_Data_Table'.The statement has been terminated.

The name of the table, which I replaced with "xxx" in the error message, was the one I enabled for Before/After data collection. As soon as I saw this error message, I thought CM might had created some DML Triggers on this critical table and this was the case indeed! I immediately shutdown CM's agent service, dropped the trigger and cleared this configuration from the properties of the related database from the CM's console.

Then according to the feedbacks from the end users the problem was solved, then I dug into the problem to understand more about the "SQLcompliance_Data_Change" schema, as it's in front of the table name, I assumed it's a schema. However, neither the schema nor the table were there! The database that I had this problem did not contain them. So it turned out that CM would keep these records in the production database itself, like a CDC configuration. But it skipped or failed to create the schema and table, it only created the trigger and our most critical production database went down!

For those who consider using this tool in their production environment, god bless you my friends...

Cheers,
Ekrem Önsoy