Quantcast
Channel: Thameem » tip
Browsing all 20 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

SQL–Tip : How to kill all connections to a database?

Usually DBA’s end up with a situation where they want to kill all connections to a database. There are couple of techniques to achieve this. Option 1: Take the database to single user mode, this will...

View Article



Image may be NSFW.
Clik here to view.

SQL–Tip : How to move database files to a different location?

Sometime peoples might want to move the database files to a different location, as far as I know the only way to perform this involves three steps. Step 1: Detach the database. sp_detach_db {Database...

View Article

Image may be NSFW.
Clik here to view.

SQL–Tips : Find recently executed queries in SQL Server?

There are many occasions where developers/DBA’s might want to check the recent ran query on the SQL Server. Today I ran into one such situation, we moved the database server to another datacenter and...

View Article

Image may be NSFW.
Clik here to view.

SQL–Tip : How to disable a step in SQL Server Agent Job ?

You actually cannot disable a step in SQL Server Agent Job, but you can skip it. To skip a step open up the previous step –> Go to Advance tab –> On Success action: select the appropriate step.

View Article

Image may be NSFW.
Clik here to view.

SQL–Tip : How to search for a text in all the Store Procedure in a database?

You can query all the stored procedures in a database using the following query. select * from sys.procedures To search for a text in all the stored procedures in a database use the following query....

View Article


Image may be NSFW.
Clik here to view.

SQL–Tips : Enable/Disable Mirroring (T-SQL)

We are doing feasibility study on mirroring. For testing purpose I had to break/enable database mirroring multiple times. GUI is always better, but when you do the same thing frequently it will be...

View Article

Image may be NSFW.
Clik here to view.

SQL–Tip : How to manually failover in SQL Mirroring?

Option 1 : Using TSQL Run the following script in principal server. ALTER DATABASE {Database Name} SET PARTNER FAILOVER Option 2 : Using GUI In principal server select the database which you want to...

View Article

Image may be NSFW.
Clik here to view.

SQL–TIP : How to identify fragmentation % of the index?

Here is the query that give you the fragmentation in percentage of all the index in the selected database. SELECT SCHEMA_NAME(o.Schema_ID) AS SchemaName , OBJECT_NAME(s.[object_id]) AS TableName ,...

View Article


Image may be NSFW.
Clik here to view.

SQL – Tip : How to move tempdb to different location?

Step 1: Execute the following query. USE master GO ALTER DATABASE tempdb MODIFY FILE (NAME = tempdev, FILENAME = 'U:\mssql\data\tempdb.mdf') GO ALTER DATABASE tempdb MODIFY FILE (NAME = templog,...

View Article


Image may be NSFW.
Clik here to view.

SQL – Tip : How to change the SQL Server Instance Name ?

First get the current instance name using the following command. SELECT @@SERVERNAME Run the following query to update the server name. sp_dropserver '<OLD SERVER NAME>' GO sp_addserver '<NEW...

View Article

Image may be NSFW.
Clik here to view.

SQL–Tip : How to kill all connections to a database?

Usually DBA’s end up with a situation where they want to kill all connections to a database. There are couple of techniques to achieve this. Option 1: Take the database to single user mode, this will...

View Article

Image may be NSFW.
Clik here to view.

SQL–Tip : How to move database files to a different location?

Sometime peoples might want to move the database files to a different location, as far as I know the only way to perform this involves three steps. Step 1: Detach the database. sp_detach_db {Database...

View Article

Image may be NSFW.
Clik here to view.

SQL–Tips : Find recently executed queries in SQL Server?

There are many occasions where developers/DBA’s might want to check the recent ran query on the SQL Server. Today I ran into one such situation, we moved the database server to another datacenter and...

View Article


Image may be NSFW.
Clik here to view.

SQL–Tip : How to disable a step in SQL Server Agent Job ?

You actually cannot disable a step in SQL Server Agent Job, but you can skip it. To skip a step open up the previous step –> Go to Advance tab –> On Success action: select the appropriate step.

View Article

Image may be NSFW.
Clik here to view.

SQL–Tip : How to search for a text in all the Store Procedure in a database?

You can query all the stored procedures in a database using the following query. select * from sys.procedures To search for a text in all the stored procedures in a database use the following query....

View Article


Image may be NSFW.
Clik here to view.

SQL–Tips : Enable/Disable Mirroring (T-SQL)

We are doing feasibility study on mirroring. For testing purpose I had to break/enable database mirroring multiple times. GUI is always better, but when you do the same thing frequently it will be...

View Article

Image may be NSFW.
Clik here to view.

SQL–Tip : How to manually failover in SQL Mirroring?

Option 1 : Using TSQL Run the following script in principal server. ALTER DATABASE {Database Name} SET PARTNER FAILOVER Option 2 : Using GUI In principal server select the database which you want to...

View Article


Image may be NSFW.
Clik here to view.

SQL–TIP : How to identify fragmentation % of the index?

Here is the query that give you the fragmentation in percentage of all the index in the selected database. SELECT SCHEMA_NAME(o.Schema_ID) AS SchemaName , OBJECT_NAME(s.[object_id]) AS TableName ,...

View Article

Image may be NSFW.
Clik here to view.

SQL – Tip : How to move tempdb to different location?

Step 1: Execute the following query. USE master GO ALTER DATABASE tempdb MODIFY FILE (NAME = tempdev, FILENAME = 'U:\mssql\data\tempdb.mdf') GO ALTER DATABASE tempdb MODIFY FILE (NAME = templog,...

View Article

Image may be NSFW.
Clik here to view.

SQL – Tip : How to change the SQL Server Instance Name ?

First get the current instance name using the following command. SELECT @@SERVERNAME Run the following query to update the server name. sp_dropserver '<OLD SERVER NAME>' GO sp_addserver '<NEW...

View Article
Browsing all 20 articles
Browse latest View live




Latest Images