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

Drop the stored procedure having null schema

$
0
0

Hello All,

I have 2 SPs with same name but different schema id , one 1(default) and other is 20 but when i check in sys.schemas it give no record for schema_id 20.

i would like to drop the SP which has schema_id 20, i dont know the schema name for id 20 so not able to drop it.

Please help me out to remove\drop the SP which has null schema.

 


It takes a long time to restore a database in SQL Server 2014

$
0
0

It takes very long time to restore database on SQL 2014 (version 12.0.2402.0 - CU3).

99% of the time is taken by log pre zeroing (even if the log contains < 20 VLFs) which is fixed for SQL 2012 in KB 2653893. 

Please release fix for SQL 2014.

If I set database mode to Simple and do deleting with batches, Will these delete not written to the Transaction log ?

$
0
0

Hi

I have large database and i need to perform batch deleting without affecting the transaction log. So if I set the Recovery mode to Simple before deleting the transaction log will not grow ??

Thanks.

If i deleted huge data from the database and didn't do a shrink, will the data file still growing or it will refill the empty gaps in the file first ?

$
0
0

Hi,

I have deleted huge amount of the data from a database but i didn't do a shrink.

So my question is if i didn't do shrink and use the database as it is with (inserts, updates, selects) the data file will keep growing or it will fill the deleted data space first then start to grow again ?

Thanks.

SQL Server Pre-Login Handshake

$
0
0

I'm connecting to MSSQL database through my ASP .NET application, but sometimes I got this error while opening connection.

Connection Timeout Expired. The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement. This could be because the pre-login handshake failed or the server was unable to respond back in time. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=3; handshake=14996;

To solve it temporarily I've to restart IIS. I'm using this code snippet to connect to MSSQL:

	using (SqlConnection connection = new SqlConnection(connectionString))
        {
            connection.Open();

            /* my commands here */

            connection.Close();
            connection.Dispose();
            SqlConnection.ClearPool(connection);
        }

I did some investigations and I did:

  • I allowed the port 1433 in the inbound and outbound rules in the database server, but no changes.
  • I allowed IPv6 in the database server.
  • All MSSQL services is running in the database server, and there are other apps connected to the same server with other databases but the error appears with this site only.

but nothing changed




What should be started and enabled in SQL express 2008 R2? Shared memory, TCP/IP , named pipes, VIA

$
0
0

I copied my Visual Studio 2008 projects to a new computer and am having trouble getting the database to attach to my website to continue with it.

I uninstalled SQL 2005 express and installed SQL 2008 R2 Express.

When I looked in the SQL Server configuration manager, I wasn't sure what should be running and what should be stopped and what protocols should be enabled, etc so I started everything and enabled everything.

However, the SQL Server Agent will not start. Maybe I did something wrong by enabling everything. I have everything to start automatically, and all enabled:

SQL Native Client: I right clicked and opened and under client protocols, have enabled all: Shared memory, TCP/IP , named pipes, VIA

and under SQL Server Network Configuration, I opened that and under there is listed protocols for SQLEXPRESS AND I enabled same things: Shared memory, TCP/IP , named pipes, VIA

When I could not start the SQL Server Agent before from the SQL Server configuration mgr. I went into services and started it that way and it did start. But since I have rebooted, it will not start that way either and I now get this message: Windows could not start the SQL Server Agent(SQLEXPRESS) Service on local computer. Error 1067

I'm just trying to get my visual studio project working again. Would appreciate any help. Maybe I should uninstall SQL and reinstall 2005??

How to add column to replicated table in sql server 2008?

$
0
0

Hi All,

We have 350 GB table and it's part of Transctional replication ...

issue: now we get one request .... add one column to this table .

How can i add column to replicated table without running the snapshot or backup?

Thanks,

Ram


RAM

how to do documentation for stored procedures..

$
0
0

hi,

how to do documentation for stored procedures. logic need to be explained in `document or only params and columns?

please help..

thanx in advance..


lucky


Deadlocks

$
0
0

Hi  All,

We are getting the below alerts very frequently these days. Can anyone suggest about this issue and what was the root cause, and how to resolve it. I checked in error log there is no information at that time.

Service: MSSQL Query - Check Master DB for Deadlocks

Host: xyz

Address: 1234

State: CRITICAL

Info: CRITICAL: Query expected 0 but got 1. Date/Time: 10/10/2014 15:57:25

Thanks in advance...





High CPU Alert / notification

$
0
0

I have been trying to setup an alert or some kind of notification when CPU is high on 2008R2 and 2012 to no avail. Here are some I have tried.

http://www.sqlservergeeks.com/sql-server-real-time-monitoring-using-wmi-classes-part-3/

http://social.technet.microsoft.com/Forums/windowsserver/en-US/abf3040a-93ba-4889-a6e8-4f38459a1019/sql-2008r2-performance-condition-alert-for-cpu-threshold-event?forum=sqldatabaseengine

And a bunch of others not a single one works.


Alan

I need to alter all tables in database to set Primary key status from ready only to read /write.

$
0
0

Hi,

I need script that loop on all tables in the database then change the ID column from ready only to be ready/write.

The ID column is primary key and no problem if it became not primary key and disable the auto increment also  for now as this database is not live.

I will do some insertions and I need to revert the status of the tables and column again to be primary key and auto increment.

Urgent please.

Thanks.

Resource Governor - not enabled, received several errors 10983: Failed to run resource governor classifier user-defined function. See previous errors in SQL Server error log from session ID %ld for details. Classifier elapsed time: %I64u ms.

$
0
0

On a server running SQL Server 2008 R2 10.50.1600.

We have not configured Resource Governor for custom workloads on this server.  However, we have received several of the following errors across various SPIDs at the same time this morning.

Failed to run resource governor classifier user-defined function. See previous errors in SQL Server error log from session ID 1510 for details.  Classifier elapsed time: 209152 ms. 

Failed to run resource governor classifier user-defined function. See previous errors in SQL Server error log from session ID 1209 for details.  Classifier elapsed time: 349159 ms.  

I'm aware that Resource Governor is on by default, using the internal and default pools.  We also have a logon trigger on the server, this has been running for several months without issue; but I appreciate this could cause an issue so I have included the code for the logon trigger below.

There's nothing else in the SQL Server logs or the Windows logs at this point in time.  Any pointers in where to look next to troubleshoot this would be greatly appreciated!

Thanks

Matthew

Logon trigger code:-

--alter the trigger to perform single row inserts and to rollback if a login is set to refuse connection
CREATE TRIGGER [ltr_AuditLoginDetails]
ON ALL SERVER WITH EXECUTE AS 'LoginAuditing'
FOR LOGON
AS
BEGIN 
      
    --check that the login and hostname combination isn't expected, and that the current login is a sql server login not a windows login
IF EXISTS (SELECT ltm.PrincipalName
FROM DBManager.LoginAuditing.LoginsToMonitor ltm
WHERE ltm.PrincipalName = ORIGINAL_LOGIN())

BEGIN

--if the login and hostname combination are not permitted, log the details of the connection
IF NOT EXISTS (SELECT 1
FROM DBManager.LoginAuditing.PermittedLoginHostNames plhn
WHERE plhn.PrincipalName = ORIGINAL_LOGIN()
AND plhn.HostName = HOST_NAME())
BEGIN
--if the login must exist in the login/hostname combination, rollback the transaction
IF EXISTS (SELECT 1
  FROM DBManager.LoginAuditing.LoginsToMonitor ltm
WHERE ltm.PrincipalName = ORIGINAL_LOGIN()
AND ltm.RefuseConnection = 1)
ROLLBACK -- this will prevent the login from connecting


--insert the login attempt into the logging table; this will be committed as occurs after the rollback
INSERT INTO DBManager.LoginAuditing.LoginAuditDetails
DEFAULT VALUES

END

END

END

I need to copy database except one table, how it can be done ?

$
0
0

Hi,

I have Table that consume almost 90% of the database size. I need to copy the database to new server with all Tables, tables' data, index, statistics, logins, jobs, etc. but without the table that consume the size.

How can I do this ?

Thanks

SQL Server Assertion Errors

$
0
0

Hi, we are receiving numerous SQL Assertion errors that causes the SQL Server Database Engine to generate SQL Level 20 errors and eventually causes the DB engine service  to go completely offline….we are at a loss to explain why but can repeat the errors at will.

Environment:

SQL Server 2012 Business Intelligence Edition. SQL is SP1 with CU3 and Hotfix 2832017 which is version 11.0.3350. SQL is running on Windows Server 2008 R2 Enterprise Edition with SP1. This is a clustered environment, both nodes are the same OS patch level and SQL is at the same patch level (11.0.3350).

SQL Hosts the SharePoint content databases. In this case SP2010 SP1. The main content database is at 105 GB.

Running the “Information Management Policy” job in SP2010 frequently causes SQL Server assertion errors: Event ID 17066 and Event ID 3624. The assertion details are:

Blobbase.cpp, Line 338,

Assertion: IS_ON (BLB_TI_END, m_Status)

I have run DBCC CHECKDB and found no DB corruption errors. Any help is much appreciated!

Database snapshot - usage of CPU

$
0
0
Hi,
I have a db and a snapshot for this db.
I notice that the CPU time when a query is executed on snapshot is 8 times, in my case, greater than if the same query is executed on the original db.
My question is: this behavior it's normal ? If I want to move my reports on the snapshot, the CPU used by SQL Server will increase ? 
The SQL Server has a 'maximum server memory', so, is possible that the other processes to be hampered ?
Thank you



Invoke-SqlCmd Date formating

$
0
0

Is it possible to have Invoke-SqlCmd return a "Date" value without adding time?  A select statement that returns a value from a Date column has " 12:00:00 AM" appended to the value when executed from Invoke-SqlCmd.  The same select statement executed within SQL Server Management Studio displays the date properly without any time formatting.

SQL Agent jobs status for multiple servers using Powershell.

$
0
0

Hi All,

I am following website link: http://www.toadworld.com/platforms/sql-server/b/weblog/archive/2013/09/17/powershell-script-to-monitor-a-service-on-a-group-of-servers-html-formatted-email-output.aspx

I require to gather status details about all the SQL Agent jobs in the environment on multiple SQL Servers.

I tried to edit the script using:

[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO")
$sqlServerName = 'localhost\developer'
 
$sqlServer = New-Object Microsoft.SqlServer.Management.Smo.Server($sqlServerName)
 
foreach($job in $sqlServer.JobServer.Jobs)
{
    $job | select Name, OwnerLoginName, IsEnabled, LastRunDate, LastRunOutcome, DateCReated, DateLastModified
}

but SQL Agent jobs are not reflecting in the mail output...

requesting help...!!

Thanks in Advance.

Hunt

Does a SQL Server record delete (row or multiple related rows) stand up to the official definition of record destruction for a system that needs to meet DOD 5015.2 requirements?

$
0
0
I am being asked by our records manager about whether or not when a delete occurs from SQL Server that it can stand up in court as true if we declare that the record has been destroyed and is no longer available.  In other words, are there ways in which forensic experts could analyse the disk and actually recover records that have been deleted from a table or tables?  If so, then we would be in error if we declare that the records have been deleted.

Steve

current location of MsSqlSystemResource in MSSQLSERVER 2005

$
0
0

I am working with MSSQL2005 and moved the master database to a different location and forgot to copy the MSSQLStemResource database,

this article mentions that The Resource data and log files must reside together and must be in the same location as the master data file (master.mdf). I am referencing the following article to move the MsSqlSystemResource database to the 
http://msdn.microsoft.com/en-us/library/ms345408(v=sql.90).aspx

How do I know the current path of the MsSqlSystemResource database file from within the MSSQL Server? so I am confident that I am moving the correct file, something visually as described here.

Thanks


Migrate to New Servers

$
0
0

Hi ,

in the last couple of days , we have built a new database servers clustered with below specs (2 nodes) , however I am not quite sure about what type of configuration SQL-related I should apply with such HW to reach the ultimate performance with new servers as expected , your help and guidance would be greatly useful


Viewing all 12963 articles
Browse latest View live


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