Quantcast
Channel: SQL Server Database Engine forum
Viewing all 12963 articles
Browse latest View live

SQL Server Service Repeatedly Crashes

$
0
0

Starting a few days ago, my local SQL Server 2016 Developer service regularly crashes and restarts (maybe once every 15 minutes or so). This happens even when I'm not actively doing anything with SQL. I've got plenty of disk space. The event logs don't show any problems (not even that the crash occurred...). All I get is a message box that pops up when it happens. Any ideas on what is going on or how I can diagnose this?

Thanks!

Ian


2012: spid active for hours. How do I automate monitoring for this?

$
0
0

Techies,

There's an application that gets executed through sql agent which works 95% of the time. The job completes within 10 minutes. The other 5% of the time, this same job stays active until its stopped.  The developers are working on a fix, however, in the meantime--the job will need to run as is with the current flaw.

Without a budget for tools, I need to find some way to monitor this job so that if it spins for more over 15 minutes, I'm at least alerted.  Any suggestions?

Adding up a secondary file

$
0
0
Hi guys, I added up a secondary file NDF to an existing db and it's taking age to do that. MDF 1TB , I added up the NDf with 100GB. Why it is taking age? Does it doing something like moving data?

Email notification when SP, Views, Functions gets created by users

$
0
0

HI Everyone,

 I am looking for the steps or script to set email notification when users create new SP or views or function within Database. If anyone can share knowledge would be great help.

Thank you.


Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach

Connect to Database between two computers without Internet

$
0
0

I want to connect my database on another computer without internet.

My application works offline. Please help me


Compatability between SQL 2008 & 2012

$
0
0

Hi all,

Apologies if this is the wrong forum. I have a view in a SQL database which was created in SQL 2012. I have since discovered that the "FORMAT" command is new in 2012 and not recognised in 2008. I need to use the same databases under SQL 2005 & 2008. Can someone help with alternative syntax to achieve the same end result? The query is:

SELECT        CleanerID, Cleaner, Added, status, rating, regHrs, SUM(Inactive) AS DNP, SUM(Canx) AS Cancelled, SUM(Inactive) + SUM(Canx) AS total,FORMAT(((SUM(Inactive) + SUM(Canx)) * 50000) / (regHrs * rating * (1 + DATEDIFF(Day, Added, { fn NOW() }))), '0.00') AS Quality
FROM            dbo.CleanerLossSummary
WHERE        reghrs > 0

GROUP BY CleanerID, Cleaner, Added, status, rating, regHrs

I'm just trying to present the output as a decimal


OPENQUERY with Variable/Parameter

$
0
0

Hi All,

I am following this article 

https://support.microsoft.com/en-us/kb/314520

1. Using "Pass Basic Value" I can fetch successfully required data from Oracle. This is what I executed

declare @MySql	varchar(500), @CustID varchar(10) = 102060
  set @MySql = 'select * from OPENQUERY (OracleDEVL, ''select * from customers where customer_id = ''''' + @CustID + ''''''')'
  execute (@MySql)

2. Using "Use the Sp_executesql Store Procedure" I am getting below error no matter what I do

<<

OLE DB provider "OraOLEDB.Oracle" for linked server "OracleDevl" returned message "Unspecified error".
Msg 7323, Level 16, State 2, Line 38
An error occurred while submitting the query text to OLE DB provider "OraOLEDB.Oracle" for linked server "OracleDevl".

>>

Here is how I am trying to execute this

DECLARE @CutomerID varchar(10) = 102060
EXECUTE  OracleDevl.master.dbo.sp_executesql
		N'select * from Customers where customer_id = @CustID',
		N'@CustID varchar(10)',
		@CutomerID

I cannot make is work using 2nd (sp_executesql) method. This method looks more cleaner but I cannot make it execute successfully. Please tell where is mistake.

Thanks in advance for your time.

snaseer - Houston

sql server edition

$
0
0

can I practice sql server 2012 dabase on 2016?

is it a good idea to practice in 2016 when I am preparing for 70-461 sql server 2012. I have 2016 developer version so I can practice my bi tools. I am trying to get 2012 evaluation version but its not there.

Please help


Update statistics for File Table

$
0
0

Hi, 

I have a Database with Filetable size of 20GB. The Update Statistics maintenance task is taking more than 4 hours without any result (no Success nor Failed) for updating the statistics of the FileTable. 

Why the Update statistics for filetable takes so long ? We are performing the Update Statistics for FileTable separately. Is there any recommendations for updating the Statistics for FileTable. 

Backup device name and size

$
0
0

Hi,

How to get all backup device names and size in an instance with T-SQL script?

Thanks

Cannot connect to localhost\SQLEXPRESS

$
0
0

My SQL 2014 Express has worked perfect for a number of month. Suddenly I can't connect with the SQL management tool.

I got the answer according to the Title above.  (Microsoft SQL Error: 2 (Named Pipes Provider, error:40).

The problem seems to be that the database engine has stopped. I had the same problem when using Windows 7, but at that time there was a utility/program which you could use manually start the database engine. I can't find this program in Window 10.

Has somebody any suggestion what I should do?

Says a desperate

Strangor (Sweden)

Linked server fails by using a login with SYSADMIN (Group)

$
0
0

Hi there,

I'm trying to set up a linked server but I get this message:

Login failed for user 'mydomain\Enric.vives'

However using impersonate I get another error:

Please, help, what am I missing here? My login 'Enric.vives' belong to a group with SYSADMIN role in both servers.

I don't understand why my login is not inheriting permissions from the group??

is it safe to rename index while DB is on-line?

$
0
0

Hi,

We need to replace one index with another. Both indexes are similar (index columns are the same) except new index has one  included column. System must remain on-line while index is replaced/recreated

Initial approach was to drop old index and create new one. That would take about 50 seconds. Objective is to decrease that time. New idea would be to create new index then drop old one and rename new one to have old one's name. Steps:

1) Create new index, let's call it MY_INDEX_1

2) Drop old index named MY_INDEX

3) rename MY_INDEX_1 to MY_INDEX

I suppose renaming will be done instantly but still have to check if any issues can be expected? For instance, once new index is created, some query uses it in exec plan and we rename index in that particular moment, can we expect some trouble?

Thanks in advance!

SQL database in status SUSPECT

$
0
0

I had a database in status SUSPECT (No items).  I have not Backup. I've only .mdf and .ldf files. After reading all answer regarding thi topic, I executed all commands to fix this status, but without success. I also executed the following comands for recovering my database : sp_detach_db 'Mydb'  (and the following message: "Successfully detached database 'Mydb'." )  then executed sp_attach_db @dbname = N'Mydb',    @filename1 = N'E:\MSSQL7\Data\Mydb_Data.MDF',   @filename2 = N'E:\MSSQL7\Data\Mydb_Log.LDF' and the following error message : ("Server: Msg 823, Level 24, State 1, Line 1 I/O error 38(Reached end of file.) detected during read of BUF pointer = 0x11c01980, page ptr = 0x1f6bc000, pageid = (0x1:0x7bea01), dbid = 7, status = 0x801, file = E:\MSSQL7\Data\Mydb_Data.MDF. Connection Broken " I executed command with the Service Manager stopped (I don't know if it's important) Please I'm desperate. What can I do to recover my db. I'm not expert in SQL Server and it would be appreciate if the answers were very clear

Microsoft SQL Server 2014 SP1 Cumulative Update (CU) 7 KB3162659 - Error 0x80070643

$
0
0

Windows 10 professional update shown, Microsoft SQL Server 2014 SP1 Cumulative Update (CU) 7 KB3162659 - Error 0x80070643


How to fix it?


Identify Query that used tempdb heavily in the past

$
0
0

Hi All,

Sometimes, I run into a situation where tempdb file gets full and by the time I look into it, the session that might have caused the tempdb to grow significantly might have been already gone. At that point, I can't use sys.dm_db_session_space_usage or sys.dm_db_task_space_usage to find out about the session/query because the session doesn't exist anymore. So, assuming that the query is still in the cache but the session is already gone, is there a DMV that can give me information about how much tempdb space this particular query consumed?

I am using SQL 2008r2  and SQL 2014.

I appreciate the answer.

thanks,

Raj 

How can search in sql database

$
0
0

Hi

Recently , I want to find text in sql server database, I want to search sara but i want to returned saara or saraa

I use full text search service sql but it couldn't help to me , Do have any tools for this purpose?

1418 error in mirroring on standalone local server (not in domain)

$
0
0

I am new in SQL Server.

I am trying to setup mirroring and my both SQL Server instances are on same physical machine and this machine is not in domain, it's in WORKGROUP. After following the below steps I am getting the error 1418 (I copied same below).

Steps:

1) Master Key 

2) Certificate 

3) Repeated above two steps in mirror instance

4) Create Full backup and Log backup after that Restore to destination instance 

5) Executed the below script on mirror instance to set up mirroring and it ran successful


-- Mirror Server

USE MASTER
GO
CREATE MASTER KEY ENCRYPTION BY PASSWORD ='Database@1234'
GO

CREATE CERTIFICATE HOST_Mirr_cert
    WITH SUBJECT = 'HOST_Mirr certificate'
    --START_DATE = '2016-07-22 09:28:14.230'
GO
--select * from sys.database_mirroring_endpoints

DROP ENDPOINT endpoint_mirroring
GO
CREATE ENDPOINT End_Mirroring
    STATE = STARTED
    AS TCP (LISTENER_PORT = 5023, LISTENER_IP = ALL)
    FOR DATABASE_MIRRORING
    (
        AUTHENTICATION = CERTIFICATE HOST_Mirr_cert,
        ENCRYPTION = REQUIRED ALGORITHM RC4,
        ROLE = ALL
    )
GO

BACKUP CERTIFICATE HOST_Mirr_cert
    TO FILE = 'D:\Mirroring\MirrorCertificate\HOST_Mirr_cert.cer'
GO
------------------------------------

-----------------------
USE MASTER
GO
/*
*  We are creating a SQL Login here. For Windows logins,
*  use the Grant Login instead of Create Login
*/
CREATE LOGIN HOST_Prin_login WITH PASSWORD  ='Database@1234'
GO
CREATE USER HOST_Prin_user FOR LOGIN HOST_Prin_login
GO
CREATE CERTIFICATE HOST_PRIN_cert
    AUTHORIZATION HOST_Prin_user
    FROM FILE ='D:\Mirroring\PrincipalCertificates\HOST_PRIN_cert.cer'
GO
GRANT CONNECT ON ENDPOINT::End_Mirroring TO [HOST_Prin_login]
GO
-----------------------------------
ALTER DATABASE Dbase_mirror3 
    SET PARTNER = 'TCP://WIN-B6LEQ1TAVAM:5022'
GO

HOW TO change the DATASOURCE parameter of a linked server?

$
0
0

Hi all,

I'm using linked servers defined with sp_addlinkedservers to access EXCEL worksheets. The data-source points to an EXCEL file which is a little too hard-coded for my requirement. So to change to data-source I drop and recreate the linked server. My Questions:

1. Is drop/add the linked server "Best pratise" oder are there more intelligent solutions around (e.g. Using OPENROWSET or OPENDATASOURCE used with dynamic SQL or loading the file to be used in a SQL Server Filetable with a standard name with xp_cmdshell and using this filetable as the datasource, etc.)?

2. How can I use EXCEL "Name"s? Especially if they refer to constant values and not to ranges?

The target is to have some kind of referential integrity between the EXCEL files and the tables derived from them. This is necessary because the EXCEL Worksheets come from different sources ;-)

TIA :-))


Regards Jörg


Capacity Reports for SQL Server 2012

$
0
0

Team,

Please suggest the methods to perform Capacity Reporting for SQL 2012. 600 Databases spanning around 18 instances.

Best Regards,

Sharath


Best Regards, Sharath

Viewing all 12963 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>