Quantcast
Channel: Forum SQL Server Database Engine
Viewing all 15889 articles
Browse latest View live

You will not be able to switch out or switch in data in this table since the table has non storage aligned indexes on it.

$
0
0

Hi,

I did partitioning on a table on date column as

FILEGROUP= APPLE

.ndf FILES= APPLE_2010, APPLE_2011, APPLE_2012, APPLE_2013

now i am trying to implement sliding window partitioning with partitioning wizard

when i tried opening manage partition i was not able to select the option for sliding window

You will not be able to switch out or switch in data in this table since the table has non storage aligned indexes on it.

can you please help me in making sliding window partitioning

Thank all


What is the expectations for data integrity when a process is the kill victim.

$
0
0

Question 1:

I wanted to get an understanding of the expectations on the behavior given the following scenario.

In this example, two processes are updating an the same resource.

If one (the first one) is in a transaction and the other is attempting to update the same record, the second must wait until the first one commits.

if the first one is updates again or performs a select, all things being equal, SQL Server chooses process 2 as the "kill victim".

I just want to be clear what the expectations are in terms of data integrity. Is the rule that the victim's data will never be persisted (and committed).

Should data base applications always look for this SQLSTATE=40001 and retry the persistence logic?

Question 2:

I know we can call SET DEADLOCK_PRIORITY n (where n can be LOW, NORMAL, HIGH or a value between -10 to 10) as a hint to sql server to decide which process should be the kill victim. Having said this, is there any problems with setting a particular process to be ( SET DEADLOCK_PRIORITY=) 10. In the scenario, the expectation is that all other processes are helper processes and in a better position to handle the SQLSTATE=40001. What do we loose by doing this?


Thanks

how to find out perticular database has performance issue?

$
0
0

I have Altiris application database on sql server 2008 R2. user is requesting to find out performance issue on database.

I need to know how to troubleshoot for perticular database performance issue or what parameters should i use?

SQL Attention events are raised during SqlBulkCopy WriteToServerAsync operations

$
0
0

In some of our applications we are using SqlBulkCopy to load data into SQL Server.  

After running some tracing which captures events for the Attention Event Class in SQL we have found that for each 'insert bulk' operation performed by the SqlBulkCopy WriteToServerAsync call there is a corresponding attention event raised even though these calls are successful and our client cleanly disconnections (releases the connection returning it to the pool). 

Does anyone know the reason behind this?   We generally use tracing of Attention events to help us identify client timeouts and the events being raised as part of the bulk copy operations pollute our logs with a bunch of attention events that seem to be benign.

thanks.

-mike


Mike Ruthruff

SUSPENSION MODE

$
0
0

HI.......

greetings...............!

my Database went SUSPENSION MODE.(log shipinng IS  ruining) .i want to bring to online.

what are the steps to bring online.

what are the reasons for suspension mode.

pls guide me any one.....

Thanks in Advance.......................

VIJAY

Logon trigger -- Password did not match that for the login provided. [CLIENT: ].

$
0
0

Greetings . SQL2K8.

I had this trigger created in a test region and it worked perfectly for weeks. What the trigger does it look for any application login attempted connections --with the "ap%' prefix, and validates that they are coming in from application servers. It does this by comparing the attempted host connection IP address to a pre-defined list of allowed IP addresses in a table in the Master DB.

Today I attempted to move into Prod, and it blew up. As soon as I created it, I attempted to connect with a login named apTest, and it blew uo with this message.

Date  4/25/2012 8:06:48 AM
Log  SQL Server (Current - 4/25/2012 11:14:00 AM)

Source  Logon

Message
Login failed for user 'logonTriggerExecutor'. Reason: Password did not match that for the login provided. [CLIENT: <named pipe>]

One would think that Named Pipes is not enabled, but it is. It should also be noted that the trigger never needs to supply a password, so I'm not sure how it could be supplied wrong? This is NOT the usual error message seen when a connection is attempted from a non-allowed IP address.

Below is all the code to make this go. Do NOT attempt to reproduce in a Prod environment. All you should need to do is put your IP address into the table, and test it out.

All ideas are appreciated!

use master 
go
CREATE LOGIN [logonTriggerExecutor] WITH PASSWORD=N'Monday01', DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO
CREATE USER [logonTriggerExecutor] FOR LOGIN [logonTriggerExecutor] WITH DEFAULT_SCHEMA=[dbo]
GO
EXEC sp_addrolemember N'db_owner', N'logonTriggerExecutor'
GO
CREATE TABLE [dbo].[allowedIPAddresses](
	[myPK] [int] IDENTITY(1,1) NOT NULL,
	[allowedIP] [varchar](50) NULL,
	[serverName] [varchar](50) NULL
) ON [PRIMARY]
GO
/****** Object:  DdlTrigger [admin_KillUnauthorizedApLogins]    Script Date: 04/25/2012 10:32:02 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [admin_KillUnauthorizedApLogins]
ON ALL SERVER with execute as 'logonTriggerExecutor'
FOR  logon
AS 
	SET CONCAT_NULL_YIELDS_NULL ON
	declare @data xml
	declare @ClientHost nvarchar(100)
	declare @LoginName nvarchar(100)
	SET @data = EVENTDATA()
	set @ClientHost = @data.value('(/EVENT_INSTANCE/ClientHost)[1]', 'nvarchar(100)')
	set @LoginName = @data.value('(/EVENT_INSTANCE/LoginName)[1]', 'nvarchar(100)')
	if @LoginName like 'ap%'
	begin
			if @clientHost not in (select allowedIP from dbo.allowedIPAddresses where allowedIP = @ClientHost)
			rollback
	end
GO
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
--disable TRIGGER [admin_KillUnauthorizedApLogins] ON ALL SERVER
GO


TIA, ChrisRDBA

Monitoring SQL Server DB

$
0
0

Hi,

I have a SQL Server DB (ver:SQL Server 2008) which is accessed from 4 different location by different persons, now i have to monitor my DB from my system that mean to say that if any person modify the DB or create new tables or procedure or trigger then how i know that from my system?Please guide me.

Query On Trigger

$
0
0

Hi guys i am working as a software engineer at bangalore,i have given a task by team-lead .I have two tools (i.e., SQL Server and My SQL) and two databases in different tools the thing is if update any data in table present in SQL Server it should reflect to the table present in My SQL and it should be done using Triggers Concept just by rising a Trigger.

Please anyone help me by giving that kind of Trigger Query to do the task.

Regards

Anil Pomar


SQL Server 2012 Express with Advanced Services (contains the database engine, Express Tools, Reporting Services)

$
0
0

Hi all,

A new Microsoft SQL Server 2012 Express with Advanced Services (contains the database engine, Express Tools, Reporting Services and Full Text Search) was just installed in my "Windows 7" PC.  I saw the following files and folders in my C:Drive: (i) "Microsoft SQL Server 2012" folder that has Import and Export Data (32-bit), Import and Export Data (64-bit), SQL Server Data Tools, SQL Server Management Studio; (ii) "Configuration Tools" folder that has Reporting Services Configuration, SQL Server Configuration Manager, SQL Server Error and Usage Report..; (iii) "Documentation & Community" folder; (iv) "Integration Services" folder that has Data Profile Viewer, Deployment Wizard, Execute Package Utility, Project Conversion Wizard.

In my SQL Server 2012 Management Studio (SSMS 2012), I have a database "SHCSQLEXPRESS" that has 2 dbo Tables (NAB-WK-1234567.dbo.Table_1_APG_XYcoord and NAB-WK-1234567.dbo.Table_2_Soil).  I can do "JOIN" on the 2 Tables, then do"Query" to extract the "useful" chemical data in the result set of my T-SQL output (I posted my questions and results in this Forum about 2 weeks ago).  I plan to do the "Reporting Services" in the SQL Server 2012 Express/SQL Server 2012 Management Studio (SSMS 2012), but I don't know how to proceed.  Could you please kindly help me and give me the necessary tips/key steps and procedures of "Reporting Services" by using the SQL Server 2012 Express and SQL Server 2012 Management Studio (SSMS 2012)?

Thanks in advance,

Scott Chang

P. S. From http://msdn.microsoft.com/en-us/library, I read the following:

SQL Server 2012 Reporting Services Tutorials (SSRS): (1) Create a Data-Driven Subscrition (SSRS Tutorial)-3 Lessons using the "AdventureWorksDataSet" and (2) Create a Basic Table Report (SSRS Totorial).

I did not gain much from these 2 sets of tutorials about the Reporting Services of SSRS. 





who actively uses applocks?

$
0
0

The more I look at deadlock issues on our current system, the more it looks to me like using applocks is the way to go.

But I've never been in a shop that uses them.  Does anybody here use them as part of their local standards and practices?

Thanks,

Josh

Relation between clustered and non clustered index......

$
0
0

1- when i rebuild my clustered index then will non clustered index be automatically rebuild or not? and why?

2- when i rebuild my Non clustered index then will clustered index be automatically rebuild or not? and why?

3- i craete a table with fixed row size 1004 bytes and insert thousands of rows in that, then create clustered and non clustered index on that table , then run dm_db_index_physical_stats DMV to get avg_fragmentation_in_percent and avg_fragment_size_in_pages ,then delete half of records from table (all records are row 2,4,6,8,10,....) such that i deleted half of records from each data pages...then again i ran that DMV... But it is still showing the same result .. Why?

Thanks in advance...

I got above error whenever my server rebooted only.

$
0
0

Getting error: BackupDiskFile::CreateMedia: Backup device 'C:\Backups\SharePoint\spbr0004\00000008.bak' failed to create. Operating system error 3(failed to retrieve text for this error. Reason: 15100).

I got above error whenever my server rebooted only.It tries to take the backup of sharepoint database.But I have checked there is no such job or procedure who do this.

Is it anything saved in MSDB due to which it is going ?


Thanks

SQL Memory Issue

$
0
0

Dear Expert,

     I hope someone already dicuss before i post this topic. But I believe someone can explain to me why SQL memory usage is high after run the T-SQL or process (i want to hear my testing is wrong or not). I have Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64)   Microsoft Corporation  Developer Edition (64-bit) (Build 3790: Service Pack 2)  on Windows XP-64Bit. I set 10240 MB at "Maximum Server Memory". I want to know memory usage before and after finish working process. How am i test it, I run rebuild index used below sql script.

SET NOCOUNT ON
GO
--Set the fillfactor
DECLARE @FillFactor TINYINT
SELECT @FillFactor=80
DECLARE @StartTime DATETIME
SELECT @StartTime=GETDATE()
if object_id('tempdb..#TablesToRebuildIndex') is not null
begin
drop table #TablesToRebuildIndex
end
DECLARE @NumTables VARCHAR(20)
SELECT
s.[Name] AS SchemaName,
t.[name] AS TableName,
SUM(p.rows) AS RowsInTable
INTO #TablesToRebuildIndex
FROM
sys.schemas s
LEFT JOIN sys.tables t
ON  s.schema_id = t.schema_id
LEFT JOIN sys.partitions p
ON  t.object_id = p.object_id
LEFT JOIN sys.allocation_units a
ON  p.partition_id = a.container_id
WHERE
p.index_id IN ( 0, 1 ) -- 0 heap table , 1 table with clustered index
AND p.rows IS NOT NULL
AND a.type = 1  -- row-data only , not LOB
GROUP BY
s.[Name],
t.[name]
SELECT @NumTables=@@ROWCOUNT
DECLARE RebuildIndex CURSOR FOR
SELECT
ROW_NUMBER() OVER (ORDER BY ttus.RowsInTable),
ttus.SchemaName,
ttus.TableName,
ttus.RowsInTable
FROM
#TablesToRebuildIndex AS ttus
ORDER BY
ttus.RowsInTable
OPEN RebuildIndex
DECLARE @TableNumber VARCHAR(20)
DECLARE @SchemaName NVARCHAR(128)
DECLARE @tableName NVARCHAR(128)
DECLARE @RowsInTable VARCHAR(20)
DECLARE @Statement NVARCHAR(300)
DECLARE @Status NVARCHAR(300)
FETCH NEXT FROM RebuildIndex INTO @TableNumber, @SchemaName, @tablename, @RowsInTable
WHILE ( @@FETCH_STATUS = 0 )
BEGIN
SET @Status='Table '+@TableNumber+' of '+@NumTables+': Rebuilding indexes on '+@SchemaName+'.'+@tablename + ' ('+@RowsInTable+' rows)'
--RAISERROR (@Status, 0, 1) WITH NOWAIT  --RAISERROR used to immediately output status
PRINT @Status
SET @Statement = 'ALTER INDEX ALL ON ['+@SchemaName+'].['+@tablename +'] REBUILD WITH (FILLFACTOR = '+CONVERT(VARCHAR(3), @FillFactor)+' )'
EXEC sp_executesql @Statement
FETCH NEXT FROM RebuildIndex INTO @TableNumber, @SchemaName, @tablename, @RowsInTable
END
CLOSE RebuildIndex
DEALLOCATE RebuildIndex
drop table #TablesToRebuildIndex
Print 'Total Elapsed Time: '+CONVERT(VARCHAR(100), DATEDIFF(minute, @StartTime, GETDATE()))+' minutes'
GO

Before i run above script, i run below script for memory usage of each database.

select db_name(database_id),(cast(count(*) as bigint)*8192)/1024 as "size in mb" from sys.dm_os_buffer_descriptors 
group by db_name(database_id) 

My Database size

MDF - 184 MB

NDF - 52.3 GB

LDF - 2.03 GB

Here is memory usage before and after run rebuild index.

Before Memory usage - 55808MB(using T-SQL)

After Memory usage - 9883216MB (using T-SQL) - I wait 1 hour but memory usage is high. That's why i restart service.

After restart SQL Service Memory usage - 55808MB

Is it something wrong my testing? Or is it anyway to test memory usage? Why memory usage is high until restart the service?

Best Regards,

Yukon


Make Simple & Easy

We wants to know the threshold value (MS-SQL server) which they configured.

$
0
0

Dear All,

Users to use the Monitor tool will have configured the threshold value.

We wants to know the threshold value (MS-SQL server) which they configured.

That is to say, we wish to refer to the threshold value which different users configured.

We also know that thresholds are based on business policies. But we wants to refer to other users.

Monitored Items:

1. Memory Usage
    - Total Memory, SQL Cache Memory, Lock Memory, Optimizer Memory, Connection Memory, Granted WorkSpace Memory, Memory Grants Pending, Memory Grant Success

2. Buffer Manager Statistics
    - Buffer Hit Ratio, Page Lookups/Min, Page Reads/Min, Page Writes/Min, Total Pages, Database Pages, Free Pages

3.  Connection Statistics
    - Connection Time, Active Connections, Logins/Min, Logouts/Min

4. Cache Details
    - Cache Hit Ratio, Cache Used/Min, Cache Count, Cache Pages

5. Lock Details
    - Lock Requests/Min, Lock Waits/Min, Lock Timeouts/Min, Deadlocks/Min, Average Lock Wait Time

6. SQL Statistics
    - Batch Requests/Min, SQL Compilations/Min, SQL Recompilations/Min, AutoParams/Min, Failed AutoParams/Min

7. Latch Details
    - Latch Waits/Min, Average Latch Wait Time

8. Access Method Details
    - Full Scans/Min, Range Scans/Min, Probe Scans/Min

Thank you in advance.

How to fix Filestream enabled database

$
0
0

I have SQL Server 2008 R2 FileStream enabled Database, when I try to access any value that stored in the filestream I get the following error :

Msg 233, Level 20, State 0, Line 0
A transport-level error has occurred when receiving results from the server. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)

I read about that exception and Microsoft has KB for it (KB972936), but it also didn't worked after I installed its hotfix.

If I SELECT the count of the records in that table using :

SELECT COUNT(1) FROM [Table_Name]

I get a correct result.

Here is some details for the database files and filegroups :

The database have 2 files the "Row Data" file and the "Log" file where it should also contains the "Filestream Data" item.

The database has the following filegroups :

  • Rows : PRIMARY with 1 File
  • Filestream : [MyFileName] with 0 Files !

Here is a snapshots for the DB properties page

And here is the full SQL ERRORLOG file.



why the value for virtual_address_space_committed_kb is different from VM Commited

$
0
0

select * from [sys].[dm_os_process_memory]
DBCC memorystatus()

I run the above command ,and found that the value for virtual_address_space_committed_kb is 684964, but VM Commited from DBCC memorystatus() is 496596. why they are different ,does mean they are refer to different things?



Add partitions

$
0
0

SQL 2012

I have an existing partition function which has about 50 partitions (by date).  As the “last date” approaches, I want to modify the function and add 50 more date partitions so that as new data comes into the table, it gets put into the new partitions, rather than on the last partition (which is what would happen if I don’t extend the function).

All this being said, do I also need to modify the partition scheme?  Or only the function?

Thanks, Andre


André

SQL Server 2012 Linked Server Object to Access Database Engine

$
0
0
I have a SQL Server 2012 installed with Microsoft Access Database Engine 2010 (64 bit).  But I failed to create a linked object to access a .mdb file.  It prompts "Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "TEST".  (Microsoft SQL Server, Error: 7303).  How could I resolve this error.

Can we change sql server from default instance to named insatnce?

$
0
0

If so, Please provide the way to do?

Thank you.

Regards

Sushil

How to shutdown mirrored database instance normally

$
0
0

Hi experts,

  Could I shutdown mirrored database instance any time for maintenance? Or is there any procedure to stop mirrored instance normally?

  Sometimes I found if I just shutdown mirrored database instance maybe while it is restoring, the database will become suspend(and can't restore any more) after I restart it.

  Should I always pause database mirroring in principal and wait for 10 ~ 30 minutes until all transaction logs are restored before I shutdown mirrored database instance? Is there a SOP?

Viewing all 15889 articles
Browse latest View live


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