Thursday, December 6, 2012

Search special colum name in all databases on SQL Server

sp_msforeachdb
'select "?" AS db, object_name(object_id,db_id("?")) , * from [?].sys.columns
where name=''user_login_name'''

Thursday, October 25, 2012

SET TRANSACTION ISOLATION LEVEL (Transact-SQL)


ALTER DATABASE SET READ_COMMITTED_SNAPSHOT ON;


SELECT name ,is_read_committed_snapshot_on FROM
sys.databases WHERE is_read_committed_snapshot_on=1

Friday, October 19, 2012

Move Databases

NET START MSSQLSERVER /f /T3608
or
NET START MSSQL$instancename /f /T3608


use sqlcmd commands or SQL Server Management Studio to run the following statement.

ALTER DATABASE database_name MODIFY FILE( NAME = logical_name , FILENAME = 'new_path\os_file_name' )

use database_name

select file_name(1)


NET STOP MSSQLSERVER


NET START MSSQLSERVER.

Wednesday, October 3, 2012

Change schema name on Tables and Stored procedures in SQL Server 2005

SELECT 'ALTER SCHEMA dbo TRANSFER ' + s.Name + '.' + p.Name

FROM sys.tables p INNER JOIN sys.Schemas s on p.schema_id = s.schema_id

WHERE s.Name = 'CHANGE_ME_Username'


Results :ALTER SCHEMA dbo TRANSFER test.Table1

Thursday, September 27, 2012

How to recover SA password on Microsoft SQL Server 2008 R2

http://v-consult.be/2011/05/26/recover-sa-password-microsoft-sql-server-2008-r2/ create a new user. Enter following commands CREATE LOGIN recovery WITH PASSWORD = ‘TopSecret 1′ Go grant the user a SYSADMIN roles using the same SQLCMD window. sp_addsrvrolemember ‘recovery’, ‘sysadmin’ go

Wednesday, September 26, 2012

SQL Error 924 Database Single User mode change to Multi Users mode

exec sp_lock --- find the spid by dbid with lockType X Kill spid ----- kill the Spid exec sp_who --- find the Spid Kill spid ----- kill the Spid again ALTER DATABASE EmailXtender Set MULTI_USER

Thursday, August 23, 2012

Check and Change isolation level of SQL Database

ALTER DATABASE EFORMSDEV_LC SET READ_COMMITTED_SNAPSHOT ON GO ALTER DATABASE EFORMSDEV_LC_PM SET READ_COMMITTED_SNAPSHOT ON GO SELECT name, snapshot_isolation_state_desc, is_read_committed_snapshot_on FROM sys.databases

Thursday, June 14, 2012

open firewall ports on Windows 2008 R2 for SQL Server 2008 R2

@echo ========= SQL Server Ports =================== @echo Enabling SQLServer default instance port 1433 netsh firewall set portopening TCP 1433 "SQLServer" @echo Enabling Dedicated Admin Connection port 1434 netsh firewall set portopening TCP 1434 "SQL Admin Connection" @echo Enabling conventional SQL Server Service Broker port 4022 netsh firewall set portopening TCP 4022 "SQL Service Broker" @echo Enabling Transact-SQL Debugger/RPC port 135 netsh firewall set portopening TCP 135 "SQL Debugger/RPC" @echo ========= Analysis Services Ports ============== @echo Enabling SSAS Default Instance port 2383 netsh firewall set portopening TCP 2383 "Analysis Services" @echo Enabling SQL Server Browser Service port 2382 netsh firewall set portopening TCP 2382 "SQL Browser" @echo ========= Misc Applications ============== @echo Enabling HTTP port 80 netsh firewall set portopening TCP 80 "HTTP" @echo Enabling SSL port 443 netsh firewall set portopening TCP 443 "SSL" @echo Enabling port for SQL Server Browser Service's 'Browse' Button netsh firewall set portopening UDP 1434 "SQL Browser" @echo Allowing multicast broadcast response on UDP (Browser Service Enumerations OK) netsh firewall set multicastbroadcastresponse ENABLE

Update existing user mapping after restoring database

EXEC sp_change_users_login 'update_one', 'abc', 'abc'

Monday, May 7, 2012

SQL Server 2008 R2 version with Sp

SQL Server 2008 R2 : 10.50.1600.1 With SP1: 10.50.2500.0

Thursday, April 26, 2012

Windows Service Error

0x1395 The cluster group could not be found.

Monday, April 16, 2012

Check Cluster Size in Windows 2008

fsutil fsinfo ntfsinfo c: (where c: is the volume/path to obtain the data for)

This will show you smilar to the following:

NTFS Volume Serial Number : 0x9e800d87800d675d
Version : 3.1
Number Sectors : 0x000000000c7fffff
Total Clusters : 0x00000000018fffff
Free Clusters : 0x000000000091cfd1
Total Reserved : 0x00000000000001b0
Bytes Per Sector : 512
Bytes Per Cluster : 4096
Bytes Per FileRecord Segment : 1024
Clusters Per FileRecord Segment : 0
Mft Valid Data Length : 0x0000000009fc0000
Mft Start Lcn : 0x00000000000c0000
Mft2 Start Lcn : 0x0000000000c7ffff
Mft Zone Start : 0x00000000000c9ca0
Mft Zone End : 0x00000000000ca7e0
RM Identifier: 07A1930B-353D-11DE-AB63-E15CC5EE82D6

Monday, March 26, 2012

Create / Drop tables in SQL Server

GRANT ALTER ANY SCHEMA TO [ODI_CALLISTA_ORG_UNIT_DX]
GO

GRANT CREATE TABLE TO ODI_CALLISTA_ORG_UNIT_DX;
GO

Monday, March 5, 2012

Enable / Disable schedules of SQL Job -Tsql

EXEC msdb.dbo.sp_attach_schedule @job_name=N'Job Name',@schedule_id=51
GO
USE [msdb]
GO
EXEC msdb.dbo.sp_update_schedule @schedule_id=51,
@enabled=0
GO


EXEC msdb.dbo.sp_attach_schedule @job_name=N'Job Name',@schedule_id=51
GO
USE [msdb]
GO
EXEC msdb.dbo.sp_update_schedule @schedule_id=51,
@enabled=1
GO

Thursday, February 9, 2012

Iphone & Ipad patterns

IPAD Patterns

http://landingpad.org/
http://thoughtbot.com/

Pattrns
http://pttrns.com/
http://mobile-patterns.com/
http://www.lovelyui.com/

Andorid UI
http://www.androiduipatterns.com/

Thursday, January 12, 2012

become the root account in MAC os X

sudo -s ---->>> become the root account in MAC os X

Tuesday, January 10, 2012

DTExec using runas

runas /user:abc\xyz "DTExec.exe /f \\NetworkServer\file\Package.dtsx"


dtexec /f “C:\Testing.dtsx” /l “DTS.LogProviderXMLFile;log.xml”
/Set “\package.Connections[log.xml].Properties[ConnectionString];C:\log.xml”