Quantcast
Channel: Software Applications Programming Errors and solutions.
Viewing all 277 articles
Browse latest View live

Why we go for Replication in SQL

$
0
0
Log shipping, mirroring & replication are various types of HA (high availability) features. Each of them have their own set of pros and cons and various sets of features. Hence there is no compulsion and requirement to implement all of them. Rather the decision to choose them is driven by business requirement and at times the resources available for use.

Db mirroring and log shipping are database level HA the replication is object level HA.

If you have SSRS, then go for replication, never keep OLTP database to fetch SSRS reports.

Replication is never a DR lets take an example that for your reporting environment you habe used transactional replication. On the reporting database server for best performance you build plenty of indexes which are not required on the OLTP environment therefore I believe clustering mirroring and log shipping are the best option always have a powerful backup strategy that will always help you.

Reason for application is running slow from a DBA side in SQL

$
0
0
There might be some reasons behind it:
1. Blocking situation
2. lack of userfull indexes
3. Lack of updated statistics
4. deadlock situation
5. network issue
6.Check the status of query.It can be either of two reasons.Either external or internal factor.External factors are resource crunches .Internal factors are because of missing index, invalid cache plan, fragmentation,so on.Starting point to identify higher level and then do a deep dive into particular area.

SQL Error on running of Enterprise portal ,sharepoint site

$
0
0
I am getting following SQL Error on running of Enterprise portal ,sharepoint site Could you advice solution on this error.


Unknown SQL Exception 10054 occured. Additional error information from SQL Server is included below.

A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)

Possible solution:


An error has occurred while establishing a connection to the server. When connecting to SQL Serve and this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: TCP Provider, error: 0 - An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.)

Error no:1418 on Mirroring in SQL

$
0
0
The server network address "xxxxx" can not be reached or does not exist. Check the network address name and reissue the command.


Pls check endpoints on all servers using
SELECT * FROM sys.endpoints

If 1418 error: check it these, duplicate end points exists, tcp/ip enabled or not, check editions principal and mirror, windows firewall off, check login not created in mirror instance.

How to delete duplicate end points if exists ?

IF EXISTS (SELECT * FROM sys.endpoints e WHERE e.name = N'EndPoint_name')
DROP ENDPOINT [EndPoint_name]
GO

SQL Server Build version

$
0
0
This is a list of ll SQL Server Build versions till Year 2014

6.50.201 SQL Server 6.5 RTM
6.50.213 SQL Server 6.5 SP1
6.50.240 SQL Server 6.5 SP2
6.50.258 SQL Server 6.5 SP3
6.50.281 SQL Server 6.5 SP4
6.50.415 SQL Server 6.5 SP5
6.50.416 SQL Server 6.5 SP5a
SQL Server 6.5
7.00.0623 SQL Server 7 RTM
7.00.0699 SQL Server 7 SP1
7.00.0842 SQL Server 7 SP2
7.00.0961 SQL Server 7 SP3
7.00.1063 SQL Server 7 SP4
SQL Server 7
8.00.0194 SQL Server 2000 RTM
8.00.0384 SQL Server 2000 SP1
8.00.0534 SQL Server 2000 SP2
8.00.0760 SQL Server 2000 SP3
8.00.2039 SQL Server 2000 SP4
SQL Server 2000
9.00.1399 SQL Server 2005 RTM
9.00.2047 SQL Server 2005 SP1
9.00.3042 SQL Server 2005 SP2
9.00.3042.01 SQL Server 2005 "SP2a"
9.00.3054 SQL Server 2005 KB934458
9.00.3077 SQL Server 2005 Security Update
9.00.3152 SQL Server 2005 SP2 Cumulative Hotfix
9.00.3161 SQL Server 2005 SP2 CU1
9.00.3175 SQL Server 2005 SP2 CU2
9.00.3186 SQL Server 2005 SP2 CU3
9.00.3200 SQL Server 2005 SP2 CU4
9.00.3215 SQL Server 2005 SP2 CU5
9.00.3228 SQL Server 2005 SP2 CU6
9.00.3233 SQL Server 2005 QFE Security Hotfix
9.00.3239 SQL Server 2005 SP2 CU7
9.00.3257 SQL Server 2005 SP2 CU8
9.00.3282 SQL Server 2005 SP2 CU9
9.00.3294 SQL Server 2005 SP2 CU10
9.00.3301 SQL Server 2005 SP2 CU11
9.00.3310 SQL Server 2005 SP2 Security Update
9.00.3315 SQL Server 2005 SP2 CU12
9.00.3325 SQL Server 2005 SP2 CU13
9.00.3328 SQL Server 2005 SP2 CU14
9.00.3330 SQL Server 2005 SP2 CU15
9.00.3355 SQL Server 2005 SP2 CU16
9.00.3356 SQL Server 2005 SP2 CU17
9.00.4035 SQL Server 2005 SP3
9.00.4053 SQL Server 2005 SP3 GDR (Security Update)
9.00.4207 SQL Server 2005 SP3 CU1
9.00.4211 SQL Server 2005 SP3 CU2
9.00.4220 SQL Server 2005 SP3 CU3
9.00.4226 SQL Server 2005 SP3 CU4
9.00.4230 SQL Server 2005 SP3 CU5
9.00.4266 SQL Server 2005 SP3 CU6
9.00.4273 SQL Server 2005 SP3 CU7
9.00.4285 SQL Server 2005 SP3 CU8
9.00.4294 SQL Server 2005 SP3 CU9
9.00.4305 SQL Server 2005 SP3 CU10
9.00.4309 SQL Server 2005 SP3 CU11
9.00.4311 SQL Server 2005 SP3 CU12
9.00.4315 SQL Server 2005 SP3 CU13
9.00.4317 SQL Server 2005 SP3 CU14
9.00.4325 SQL Server 2005 SP3 CU15
9.00.5000 SQL Server 2005 SP4
9.00.5254 SQL Server 2005 SP4 CU1
9.00.5259 SQL Server 2005 SP4 CU2
9.00.5266 SQL Server 2005 SP4 CU3
SQL Server 2005
10.00.1600 SQL Server 2008 RTM
10.00.1763 SQL Server 2008 RTM CU1
10.00.1779 SQL Server 2008 RTM CU2
10.00.1787 SQL Server 2008 RTM CU3
10.00.1798 SQL Server 2008 RTM CU4
10.00.1806 SQL Server 2008 RTM CU5
10.00.1812 SQL Server 2008 RTM CU6
10.00.1818 SQL Server 2008 RTM CU7
10.00.1823 SQL Server 2008 RTM CU8
10.00.1828 SQL Server 2008 RTM CU9
10.00.1835 SQL Server 2008 RTM CU10
10.00.2531 SQL Server 2008 SP1
10.00.2710 SQL Server 2008 SP1 CU1
10.00.2714 SQL Server 2008 SP1 CU2
10.00.2723 SQL Server 2008 SP1 CU3
10.00.2734 SQL Server 2008 SP1 CU4
10.00.2746 SQL Server 2008 SP1 CU5
10.00.2757 SQL Server 2008 SP1 CU6
10.00.2766 SQL Server 2008 SP1 CU7
10.00.2775 SQL Server 2008 SP1 CU8
10.00.2789 SQL Server 2008 SP1 CU9
10.00.2799 SQL Server 2008 SP1 CU10
10.00.2804 SQL Server 2008 SP1 CU11
10.00.2808 SQL Server 2008 SP1 CU12
10.00.2812 SQL Server 2008 SP1 CU14
10.00.2816 SQL Server 2008 SP1 CU13
10.00.2847 SQL Server 2008 SP1 CU15
10.00.2850 SQL Server 2008 SP1 CU16
10.00.4000 SQL Server 2008 SP2
10.00.4266 SQL Server 2008 SP2 CU1
10.00.4272 SQL Server 2008 SP2 CU2
10.00.4279 SQL Server 2008 SP2 CU3
10.00.4285 SQL Server 2008 SP2 CU4
10.00.4316 SQL Server 2008 SP2 CU5
10.00.4321 SQL Server 2008 SP2 CU6
10.00.4323 SQL Server 2008 SP2 CU7
10.00.4326 SQL Server 2008 SP2 CU8
10.00.4330 SQL Server 2008 SP2 CU9
10.00.5500 SQL Server 2008 SP3
10.00.5766 SQL Server 2008 SP3 CU1
10.00.5768 SQL Server 2008 SP3 CU2
10.00.5770 SQL Server 2008 SP3 CU3
10.00.5775 SQL Server 2008 SP3 CU4
SQL Server 2008
10.50.1600.1 SQL Server 2008 R2 RTM
10.50.1702.0 SQL Server 2008 R2 CU1
10.50.1720.0 SQL Server 2008 R2 CU2
10.50.1734.0 SQL Server 2008 R2 CU3
10.50.1746.0 SQL Server 2008 R2 CU4
10.50.1753.0 SQL Server 2008 R2 CU5
10.50.1765.0 SQL Server 2008 R2 CU6
10.50.1777.0 SQL Server 2008 R2 CU7
10.50.1797.0 SQL Server 2008 R2 CU8
10.50.1804.0 SQL Server 2008 R2 CU9
10.50.1807.0 SQL Server 2008 R2 CU10
10.50.1809 SQL Server 2008 R2 CU11
10.50.1810 SQL Server 2008 R2 CU12
10.50.1815 SQL Server 2008 R2 CU13
10.50.2500.0 SQL Server 2008 R2 SP1
10.50.2769.0 SQL Server 2008 R2 SP1 CU1
10.50.2772.0 SQL Server 2008 R2 SP1 CU2
10.50.2789.0 SQL Server 2008 R2 SP1 CU3
10.50.2796 SQL Server 2008 R2 SP1 CU4
10.50.2806 SQL Server 2008 R2 SP1 CU5
10.50.2811 SQL Server 2008 R2 SP1 CU6
SQL Server 2008 R2
11.0.2100.6 SQL Server 2012 RTM
11.0.2316 SQL Server 2012 CU1
SQL Server 2012

What is latches in sql server

$
0
0
Microsoft SQL Server provides counters to monitor internal SQL Server resource called latches.Monitoring the latches to determine user activity and resource usage can help you to identify performance bottlenecks like Average Latch Wait Time,Waits/sec

We can monitor the performance by using cpu usage and memory usage what is use of latch.
Latches are light weight locks which SQL server acquires for pages in buffer.

Latch is a synchronization mechanism between threads.Latch protects access to in memory data structures. latches are lightweight as compare to locks. the best example to understand latch is TEMP DB LATCH CONTENTION.

How to add files to logshipped SQL database?

$
0
0
Run log back up job on primary server and disable backup job to make sure not to run any backup jobs further until we enable again. check the log back ups if there are any need to be restored on secondary db, restore them if any until all the log backups complete. Then disable the log shipping add mdf-ldf file take a log backup and restore the same on secondary database them enable log shipping and enable backup job as well.

If the drives and path exist on secondary log shipping will not break, if the drives are different obviously log shipping will fail.u have to disable all jobs in primary make sure that in between no backups will happen. restore that log file backup with move option.

If the path of both files are same it wont break logshipping. If.If path is different then manually restore that particular log backup with move option.

How to patch service pack for sql server clustering?

$
0
0
Patch the passive node first then reboot the node and then fail over instance on that node and then in similar manner patch the other node. This you can apply for sql 2008 and above.

In SQL Server 2012, there is a Cluster Aware Update that will automatically Update all the nodes.

Start applying the service pack on the passive node and then failover the instance to passive node after the installation is over on the passive node now start applying the service pack on active node and again fail-over the node.

On SQL Server 2008/ 2008R2 : Apply patches/hot-fixes on passive node(N2) first then reboot the server. once the passive node(N2) is up, fail-over the resources from active node(N1) to passive node(N2), perform the same steps on N1 node and fail-over the resources from N2 to N1. On SQL Server 2005 : Apply patches/hot-fixes only on active node(N1), same will be applied on passive node(N2) too. On SQL Server 2005 we need down time during this activity. But on SQL server 2008/2008R2 we don't need down time(downtime is minimal only during fail-over).

How to add multiple log files in SQL Database

$
0
0
Below query can create ldf file.Its creating second ldf file on Testdb Database. You can create as many as you want.

USE [master]

GO

ALTER DATABASE [TestDb] ADD LOG FILE ( NAME = N'TestDB_Log2',

FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQL2008R2\MSSQL\DATA\Testdb_Log2.ldf' ,

SIZE = 1024KB , FILEGROWTH = 10%)

GO

I Hope this could be your expected solution.

How to add multiple foreign keys in a table from different reference tables in SQL

$
0
0
To  add multiple foreign keys in a table from different reference tables in SQL you can try below methods in sql query editor.

1. Alter table table_name add constraint constraint_name foreign key(col_name) references table_name(col_name) GO.

2.Create foreign constraint WITH NOCHECK first then CHECK it with another alter statement.. Make sure to put GO in between each statement.. Just to safe side, SET ANSI PADDING ON on the top and OFF at the button..

How To Identify The Long Running Queries in SQL?

$
0
0
These queries can help you  To Identify The Long Running Queries in SQL.

1.SELECT
creation_time
,last_execution_time
,total_physical_reads
,total_logical_reads
,total_logical_writes
, execution_count
, total_worker_time
, total_elapsed_time
, total_elapsed_time / execution_count avg_elapsed_time
,SUBSTRING(st.text, (qs.statement_start_offset/2) + 1,
((CASE statement_end_offset
WHEN -1 THEN DATALENGTH(st.text)
ELSE qs.statement_end_offset END
- qs.statement_start_offset)/2) + 1) AS statement_text
FROM sys.dm_exec_query_stats AS qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) st
where total_elapsed_time >= 800000000
ORDER BY total_elapsed_time / execution_count DESC;

2.DBCC opentran(This command will display the longest running transactions on the database) and select * from sys.dm_tran_active_snapshot_database_transactions(this command will display the transactions about replication and mirroring and snapshot isolated related transactions)

types of pages in Sql server

$
0
0
1>data 
2>index 
3>text/image 
4>GAM/SGAM 
5>page free space
6>IAM 
7>BCM
 8>DCM

how to change log file auto growth restricted growth to unrestricted growth in SQL

$
0
0
To change log file auto growth restricted growth to unrestricted growth in SQL you can try option below. I hope it will help you.

Right click on "dbname"
->Properties
->Click on files
->you will  find options there

Way to find differential backup for SQL Database

$
0
0
1.Check MSDB backup history for that database

select * from msdb.dbo.backupset where name='dbname' and type='i' order by backup_finish_date desc

2.dbo.backupset: provides information concerning the most-granular details of the backup process
dbo.backupmediafamily: provides metadata for the physical backup files as they relate to backup sets
dbo.backupfile: this system view provides the most-granular information for the physical backup files

USE AdventureWorks
GO
SELECT TOP 100
s.database_name,
m.physical_device_name,
CAST(CAST(s.backup_size / 1000000 AS INT) AS VARCHAR(14)) + ' ' + 'MB' AS bkSize,
CAST(DATEDIFF(second, s.backup_start_date,
s.backup_finish_date) AS VARCHAR(4)) + ' ' + 'Seconds' TimeTaken,
s.backup_start_date,
CAST(s.first_lsn AS VARCHAR(50)) AS first_lsn,
CAST(s.last_lsn AS VARCHAR(50)) AS last_lsn,
CASE s.[type]
WHEN 'D' THEN 'Full'
WHEN 'I' THEN 'Differential'
WHEN 'L' THEN 'Transaction Log'
END AS BackupType,
s.server_name,
s.recovery_model
FROM msdb.dbo.backupset s
INNER JOIN msdb.dbo.backupmediafamily m ON s.media_set_id = m.media_set_id
WHERE s.database_name = DB_NAME() -- Remove this line for all the database
ORDER BY backup_start_date DESC, backup_finish_date
GO

How to convert excel sheet data into SQL

$
0
0
To convert excel sheet data into SQL Table you can use import and export wizard

Sql server management studio ->choose the Database and right click on Database->Tasks->Import Data/Export Data will be avvailable on All sql server version then you can do import/export process

How to set PLE(page life expectancy) in sql server

$
0
0
To set PLE(page life expectancy) in Sql server you can get help from following way..PLE is used to faster access if data who pages are in buffer.

sp_reconfigure 'page life expectancy' newvalue

How to change authentication mode in SQL Server

$
0
0
To  change authentication mode in SQL Server for mixed mode or windows authentication mode you can try as below.

Mixed Mode (SQL Server Properties --> Security --> Server Authentication --> SQL Server and Windows Authentication Mode--> check the Radio button

Some Light on Roleback and commit transaction in sql recovery mode

$
0
0
If log truncation is performed when your transaction is still running then it will truncate only committed transactions and there is no impact on the current running transaction. if your transaction is completed and after that log truncation is performed it will clear your transaction. SQLServer internally maintain some lsn or modified pages details in one page so if you rebooted the server, if transaction is completed then changes applied into mdf files and there is no change in the DB and it will online after reboot. But if you rebooted the server in the middle of transaction then after server is online , database went into recovery mode and it will rollback all changes as per the changes after all the rollback completes DB will come into online.

SQL DBA Checklist

$
0
0
Following can be SQL DBA Checklist on daily,weekly and monthly basis.

1.SQL DBA daily checklist can include Database backup status, Database integrity checks, failed jobs.

2.Weekly checklist can include index reorganization, update stats etc .

3.Monthly checklist can include Restoration drill for critical databases to ensure backup's availability in case of any unusual happening etc.these are general points.although it depends on current environment and issues how you define your checklist as a DBA.

What is purpose of the data center?

$
0
0
Data center is used to store all our servers and need to maintain (power supply,network,connectivity,AC and others) those servers from the DC in a specified safe environment with all the facilities.. without proper approvals even CEO will also not allowed into the DC's for some security reasons.
Viewing all 277 articles
Browse latest View live