SET NOCOUNT ON
DECLARE @SQL varchar(max) = ''
SELECT @SQL = @SQL + 'print ''Refreshing --> ' + name + '''
EXEC sp_refreshview ' + name + ';
'
FROM sysobjects
WHERE type = 'V' --< condition to select all views, may vary by your standards
--SELECT @SQL
EXEC(@SQL)
31 Mart 2018 Cumartesi
10 Mart 2018 Cumartesi
SQL server long running queries query stats
SELECT TOP 100
qs.total_elapsed_time / qs.execution_count / 1000000.0 AS average_seconds,
qs.total_elapsed_time / 1000000.0 AS total_seconds,
qs.execution_count,
SUBSTRING (qt.text,qs.statement_start_offset/2,
(CASE WHEN qs.statement_end_offset = -1
THEN LEN(CONVERT(NVARCHAR(MAX), qt.text)) * 2
ELSE qs.statement_end_offset END - qs.statement_start_offset)/2) AS individual_query,
o.name AS object_name,
DB_NAME(qt.dbid) AS database_name
FROM sys.dm_exec_query_stats qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) as qt
LEFT OUTER JOIN sys.objects o ON qt.objectid = o.object_id
where qt.dbid = DB_ID()
ORDER BY average_seconds DESC;
qs.total_elapsed_time / qs.execution_count / 1000000.0 AS average_seconds,
qs.total_elapsed_time / 1000000.0 AS total_seconds,
qs.execution_count,
SUBSTRING (qt.text,qs.statement_start_offset/2,
(CASE WHEN qs.statement_end_offset = -1
THEN LEN(CONVERT(NVARCHAR(MAX), qt.text)) * 2
ELSE qs.statement_end_offset END - qs.statement_start_offset)/2) AS individual_query,
o.name AS object_name,
DB_NAME(qt.dbid) AS database_name
FROM sys.dm_exec_query_stats qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) as qt
LEFT OUTER JOIN sys.objects o ON qt.objectid = o.object_id
where qt.dbid = DB_ID()
ORDER BY average_seconds DESC;
SQL Server unused indexes
select object_name(i.object_id) as ObjectName, i.name as [Unused Index],MAX(p.rows) Rows
,8 * SUM(a.used_pages) AS 'Indexsize(KB)',
case
when i.type = 0 then 'Heap'
when i.type= 1 then 'clustered'
when i.type=2 then 'Non-clustered'
when i.type=3 then 'XML'
when i.type=4 then 'Spatial'
when i.type=5 then 'Clustered xVelocity memory optimized columnstore index'
when i.type=6 then 'Nonclustered columnstore index'
end index_type,
'DROP INDEX ' + i.name + ' ON ' + object_name(i.object_id) 'Drop Statement'
from sys.indexes i
left join sys.dm_db_index_usage_stats s on s.object_id = i.object_id
and i.index_id = s.index_id
and s.database_id = db_id()
JOIN sys.partitions AS p ON p.OBJECT_ID = i.OBJECT_ID AND p.index_id = i.index_id
JOIN sys.allocation_units AS a ON a.container_id = p.partition_id
where objectproperty(i.object_id, 'IsIndexable') = 1
AND objectproperty(i.object_id, 'IsIndexed') = 1
and s.index_id is null -- and dm_db_index_usage_stats has no reference to this index
or (s.user_updates > 0 and s.user_seeks = 0 and s.user_scans = 0 and s.user_lookups = 0)-- index is being updated, but not used by seeks/scans/lookups
GROUP BY object_name(i.object_id) ,i.name,i.type
order by object_name(i.object_id) asc
,8 * SUM(a.used_pages) AS 'Indexsize(KB)',
case
when i.type = 0 then 'Heap'
when i.type= 1 then 'clustered'
when i.type=2 then 'Non-clustered'
when i.type=3 then 'XML'
when i.type=4 then 'Spatial'
when i.type=5 then 'Clustered xVelocity memory optimized columnstore index'
when i.type=6 then 'Nonclustered columnstore index'
end index_type,
'DROP INDEX ' + i.name + ' ON ' + object_name(i.object_id) 'Drop Statement'
from sys.indexes i
left join sys.dm_db_index_usage_stats s on s.object_id = i.object_id
and i.index_id = s.index_id
and s.database_id = db_id()
JOIN sys.partitions AS p ON p.OBJECT_ID = i.OBJECT_ID AND p.index_id = i.index_id
JOIN sys.allocation_units AS a ON a.container_id = p.partition_id
where objectproperty(i.object_id, 'IsIndexable') = 1
AND objectproperty(i.object_id, 'IsIndexed') = 1
and s.index_id is null -- and dm_db_index_usage_stats has no reference to this index
or (s.user_updates > 0 and s.user_seeks = 0 and s.user_scans = 0 and s.user_lookups = 0)-- index is being updated, but not used by seeks/scans/lookups
GROUP BY object_name(i.object_id) ,i.name,i.type
order by object_name(i.object_id) asc
16 Ocak 2018 Salı
WCF Service IParameterInspector kullanımı
public class ParameterValidator : IParameterInspector
{
public void AfterCall(string operationName, object[] outputs, object returnValue, object correlationState)
{
}
public object BeforeCall(string operationName, object[] inputs)
{
return null;
}
}
public class CustomDataOperationBehavior : Attribute, IOperationBehavior
{
public void AddBindingParameters(OperationDescription operationDescription, BindingParameterCollection bindingParameters)
{
}
public void ApplyClientBehavior(OperationDescription operationDescription, ClientOperation clientOperation)
{
}
public void ApplyDispatchBehavior(OperationDescription operationDescription, DispatchOperation dispatchOperation)
{
dispatchOperation.ParameterInspectors.Add(new ParameterValidator());
}
public void Validate(OperationDescription operationDescription)
{
}
[CustomDataOperationBehavior]
public BaseDataTable_Response GetDataTable(int rowCount)
{
public void AfterCall(string operationName, object[] outputs, object returnValue, object correlationState)
{
}
public object BeforeCall(string operationName, object[] inputs)
{
return null;
}
}
public class CustomDataOperationBehavior : Attribute, IOperationBehavior
{
public void AddBindingParameters(OperationDescription operationDescription, BindingParameterCollection bindingParameters)
{
}
public void ApplyClientBehavior(OperationDescription operationDescription, ClientOperation clientOperation)
{
}
public void ApplyDispatchBehavior(OperationDescription operationDescription, DispatchOperation dispatchOperation)
{
dispatchOperation.ParameterInspectors.Add(new ParameterValidator());
}
public void Validate(OperationDescription operationDescription)
{
}
[CustomDataOperationBehavior]
public BaseDataTable_Response GetDataTable(int rowCount)
2 Ocak 2018 Salı
Google Maps Api için şehir, bölge, ülke sınırları
1. http://nominatim.openstreetmap.org/ adresinden istenilen şehir arandıktan sonra listeden uygun sonuç seçilip "Details" tıklanır
2. Açılan sayfada listeden OSM Id kopyalanır. Ankara için örnek 223422
3. http://polygons.openstreetmap.fr/index.py adresindeki "Id of relation" a Id (223422) yapıştırılıp "Gönder" düğmesine tıklanır.
Açılan sayfada WKT, GeoJSON, poly yada image formatında ilgili şehir için poligon bilgileri alınabilir.
İlçe, İl, Bölge, Ülke ile ilgili sınır bilgileri bu şekilde elde edilebilir.
Daha sonra bu bilgilerle google maps api üzerinde çizim yaptırılabilir.
2. Açılan sayfada listeden OSM Id kopyalanır. Ankara için örnek 223422
3. http://polygons.openstreetmap.fr/index.py adresindeki "Id of relation" a Id (223422) yapıştırılıp "Gönder" düğmesine tıklanır.
Açılan sayfada WKT, GeoJSON, poly yada image formatında ilgili şehir için poligon bilgileri alınabilir.
İlçe, İl, Bölge, Ülke ile ilgili sınır bilgileri bu şekilde elde edilebilir.
Daha sonra bu bilgilerle google maps api üzerinde çizim yaptırılabilir.
28 Aralık 2017 Perşembe
Weblogic SSL Konfigürasyonu
İşlemlerde örnek olarak /app/ssl dizini kullanılmıştır
keytool -genkey -keyalg RSA -alias medrec -keystore identity.jks -validity 360 -keysize 2048
keytool -export -alias medrec -file medrec.crt -keystore identity.jks
keytool -import -trustcacerts -alias medrec -file medrec.crt -keystore trust.jks
Weblogic console üzerinden ilgili server için SSL portu açılır
İlgili serverda Keystore sekmesinde aşağıdaki ayarlar yapılır
Keystores : Custom Identity and Custom Trust
Custom Identity Keystore : /app/sslidentity.jks
Custom Identity Keystore Type : JKS
Custom Identity Keystore Passphrase : changeit (identity.jks için hangi şifre belirlenmişse)
Confirm Custom Identity Keystore Passphrase : changeit
Custom Trust Keystore : /app/ssl/trust.jks
Custom Trust Keystore Type : JKS
Custom Trust Keystore Passphrase : changeit (trust.jks için hangi şifre belirlenmişse)
Confirm Custom Trust Keystore Passphrase : changeit
SSL tanımı yapılır. (SSL sekmesi)
Confirm Custom Trust Keystore Passphrase : medrec
Private Key Passphrase : changeit
Confirm Private Key Passphrase : changeit
Hostname Verification : none seçilir
keytool -genkey -keyalg RSA -alias medrec -keystore identity.jks -validity 360 -keysize 2048
keytool -export -alias medrec -file medrec.crt -keystore identity.jks
keytool -import -trustcacerts -alias medrec -file medrec.crt -keystore trust.jks
Weblogic console üzerinden ilgili server için SSL portu açılır
İlgili serverda Keystore sekmesinde aşağıdaki ayarlar yapılır
Keystores : Custom Identity and Custom Trust
Custom Identity Keystore : /app/sslidentity.jks
Custom Identity Keystore Type : JKS
Custom Identity Keystore Passphrase : changeit (identity.jks için hangi şifre belirlenmişse)
Confirm Custom Identity Keystore Passphrase : changeit
Custom Trust Keystore : /app/ssl/trust.jks
Custom Trust Keystore Type : JKS
Custom Trust Keystore Passphrase : changeit (trust.jks için hangi şifre belirlenmişse)
Confirm Custom Trust Keystore Passphrase : changeit
SSL tanımı yapılır. (SSL sekmesi)
Confirm Custom Trust Keystore Passphrase : medrec
Private Key Passphrase : changeit
Confirm Private Key Passphrase : changeit
Hostname Verification : none seçilir
20 Aralık 2017 Çarşamba
Linux terminalde username@hostname:working directory görüntülenmesi
Login olunan sunucuda user@hostname:working_directory şeklinde komut satırını görmek için aşağıdaki tanımın .bashrc yada .bash_profile dosyasına eklenmesi yeterli olacaktır
export PS1='\u@\h:\w\$ '
appadmin@alpullu:/$
export PS1='\u@\h:\w\$ '
appadmin@alpullu:/$
14 Kasım 2017 Salı
Windows 10 iso versiyon bilgisi
C:\WINDOWS\system32>dism /Get-WimInfo /WimFile:E:\x64\sources\install.esd /index:1
Deployment Image Servicing and Management tool
Version: 10.0.15063.0
Details for image : E:\x64\sources\install.esd
Index : 1
Name : Windows 10 S
Description : Windows 10 S
Size : 15.568.710.987 bytes
WIM Bootable : No
Architecture : x64
Hal : <undefined>
Version : 10.0.16299
ServicePack Build : 15
ServicePack Level : 0
Edition : Cloud
Installation : Client
ProductType : WinNT
ProductSuite : Terminal Server
System Root : WINDOWS
Directories : 21270
Files : 102845
Created : 30.09.2017 - 16:24:52
Modified : 15.11.2017 - 10:09:06
Languages :
tr-TR (Default)
The operation completed successfully.
Deployment Image Servicing and Management tool
Version: 10.0.15063.0
Details for image : E:\x64\sources\install.esd
Index : 1
Name : Windows 10 S
Description : Windows 10 S
Size : 15.568.710.987 bytes
WIM Bootable : No
Architecture : x64
Hal : <undefined>
Version : 10.0.16299
ServicePack Build : 15
ServicePack Level : 0
Edition : Cloud
Installation : Client
ProductType : WinNT
ProductSuite : Terminal Server
System Root : WINDOWS
Directories : 21270
Files : 102845
Created : 30.09.2017 - 16:24:52
Modified : 15.11.2017 - 10:09:06
Languages :
tr-TR (Default)
The operation completed successfully.
13 Kasım 2017 Pazartesi
SQL Server index fragmentation
SELECT OBJECT_NAME(ind.OBJECT_ID) AS TableName, ind.name AS IndexName, indexstats.index_type_desc AS IndexType, indexstats.avg_fragmentation_in_percent FROM sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, NULL) indexstats INNER JOIN sys.indexes ind ON ind.object_id = indexstats.object_id AND ind.index_id = indexstats.index_id WHERE indexstats.avg_fragmentation_in_percent > 30 ORDER BY indexstats.avg_fragmentation_in_percent DESC
23 Ekim 2017 Pazartesi
Decrypt Weblogic Server Admin Password
1. Create a script decrypt_password.py in $DOMAIN_HOME/security directory and paste the following code into it:
from weblogic.security.internal import *
from weblogic.security.internal.encryption import *
encryptionService = SerializedSystemIni.getEncryptionService(".")
clearOrEncryptService = ClearOrEncryptedService(encryptionService)
# Take encrypt password from user
pwd = raw_input("Paste encrypted password ({AES}fk9EK...): ")
# Delete unnecessary escape characters
preppwd = pwd.replace("\\", "")
# Display password
print "Decrypted string is: " + clearOrEncryptService.decrypt(preppwd)
2. Set domain environment variables
source $DOMAIN_HOME/bin/setDomainEnv.sh
3. Get encrypted password, in this example from boot.properties file of AdminServer
#Username: grep username $DOMAIN_HOME/servers/AdminServer/security/boot.properties | sed -e "s/^username=\(.*\)/\1/" #Password: grep password $DOMAIN_HOME/servers/AdminServer/security/boot.properties | sed -e "s/^password=\(.*\)/\1/"
4. Navigate to $DOMAIN_HOME/security directory and run the following command to start decryption:
cd $DOMAIN_HOME/security
java weblogic.WLST decrypt_password.py
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Please enter encrypted password (Eg. {AES}fk9EK...): {AES}jkIkkdh693dsyLt+DrKUfNcXryuHKLJD76*SXnPqnl5oo\=
Decrypted string is: welcome01
Decrypted value will be displayed on the screen
Kaydol:
Kayıtlar (Atom)