what happens whyen we add data files to primary database of logshipping? how are they moved to secondary database server? can anyone please explain.
thanks in advance.
what happens whyen we add data files to primary database of logshipping? how are they moved to secondary database server? can anyone please explain.
thanks in advance.
Hi, Am trying to get a deeper understanding on locks. I ran this simple query :
SELECT * AS LockTimeoutPerSec
FROM
sys.dm_os_performance_counters
WHERE
counter_name = 'Lock Timeouts/sec'
I see a lot of rows being returned, with different values for instance_name field. I referred MSDN doc here http://msdn.microsoft.com/en-us/library/ms190216.aspx, but it doesn't go in-depth on what is the implication of the lock value for each instance name. Atleast, can someone help me by saying which (i.e. corresponding to which instance_name) is the lock value to consider?
Hi team,
we are restoring one database backup.that restore database i forget the .Extends like(.mdf and .ldf) if there is any problem for this.
ex:
restore database test from disk='C:\test\test13.bak' with move 'test.mdf' to 'D:\data\test\test_data', move 'test.ldf' to 'D:\log\test\test_log'
here is any problem,if any problem is happen how to fix this issue?
Regards,
MSDN_12345
For auditing reasons I have to determine the current transaction's unique id.
Using sys.dm_exec_requests.transaction_id (or sys.dm_tran_current_transaction.transaction_id) doesn't work for me because transaction_id restarts at 0 after a server restart.
Is there another transaction id, that is really unique (DB scope)? Or is there another reliable value that I could use to combine the transaction_id with, like for instance the time when the transaction_id counter was reset?
Thanks!
Hi all,
I have created script track all versions of SPs /views and UDF. My main target is to track these for three database that are in same server. These three database getting retored after few days, as it is in dev env, so if I create table where I am keeping repositry of Sps/fUDF and view in any of these database ,then there is chance of loss ripositry.
Finally I have plan to create this repositry table in MASTER database . Please help me if I am going in wrong direction. Is there any other place where we can keep this table.
Thanks
Regards Vikas Pathak
Using SQL 2005
Like the title says, I thought I could get a result that include ALL databases on the instance, not just the currently selected database. At least thats that the docs seem to indicate.
http://msdn.microsoft.com/en-us/library/ms188917.aspx
Specify NULL to return information for all databases in the instance of SQL Server. If you specify NULL fordatabase_id, you must also specify NULL forobject_id, index_id, andpartition_number.
Here is my query. Ive currently got the master db selected in SSMS, and thats the only DB i get results for, yet I have 4 or 5 other DB's on the instance.
Help?
SELECT DB_NAME(database_id) AS DBname, OBJECT_NAME(a.object_id) as ObjectName,
a.index_id, b.name as IndexName, avg_fragmentation_in_percent, index_type_desc
FROM sys.dm_db_index_physical_stats (NULL, NULL, NULL, NULL, NULL) AS a
JOIN sys.indexes AS b
ON a.object_id = b.object_id AND a.index_id = b.index_id
WHERE b.index_id <> 0 and avg_fragmentation_in_percent > 30
k
Query:
SELECT DISTINCT TOP 10 t.TEXT QueryName, s.execution_count AS ExecutionCount, s.max_elapsed_time AS MaxElapsedTime, ISNULL(s.total_elapsed_time / 1000000 / NULLIF(s.execution_count, 0), 0) AS AvgElapsedTimeSeconds, s.creation_time AS LogCreatedOn, 24 *(ISNULL((s.execution_count * 1.0) / NULLIF(DATEDIFF(hh, s.creation_time, GETDATE()), 0), 0)) AS FrequencyPer24Hr FROM sys.dm_exec_query_stats s CROSS APPLY sys.dm_exec_sql_text( s.sql_handle ) t ORDER BY AvgElapsedTimeSeconds DESC
The results I get include one record that has "CREATE PROCEDURE..." in it. Its also the highest in terms of how long its taking.
What the heck can I imply from this? The procedure is being re-compiled? If so, what could be causing this?
HI Team,
In one of prod box(PRINCIPAL SERVER ) was CPU Utilizing was 100% we have configured Mirroring in that server.
I have checked there is no blockings
no wait status. My question was can run perform or not at this situvasation please suggest me.
I have found some of the SP are using alote of CPU Utiliation for these what i have to do please suggest me asp..
Regards
Subu
subu
I have a set of databases with several hundred SPs. They were originally on SQL 2000 and are now running on SQL 2008 R2, with compatibility mode 80.
Since going to 2012 is only a matter of time and 80 is no longer supported, I need to start working on changing whatever. I have read the various lists of deprecated features and necessary changes, and the main one that affects me is the requirement of using WITH with hints.
I know that the compatibility adviser gives you a list of probably problems, that that only runs based on the DB engine, not compatibility mode. That is, if I run the 2008R2->2012 adviser, it only looks for changes between those two versions and seems to ignore the fact that the database is running in an older compatibility.
So.. any solutions out there to help me isolate those changes? Or, better yet, rewrite the SPs?
Thanks!
Im looking at getting a list of tables for a given instance, or for a list of DB's
I know I can hit sys.tables for a specific database, but how can I expand this to the instance level?
I have a question on what actually gets stored in a data row for a varbinary(max) column setup for SQL FILESTREAM. (with FILESTREAM attribute)
Do we have to take into account on the dynamic size of that particular blob within a data row?
In other words, is it recommended to store our large value types out of row for a varbinary(max) FILESTREAM use-case? Or does it only store a fixed # of bytes on that specific column (GUID or whatnot) which references the local file location of the blob?
sp_tableoption N'MyTable', 'large value types out of row', 'ON'
Thanks.
Samuel
Hi all,
The following query is returning unexpected results on my server:
SELECT mig.*, statement AS table_name, mid.equality_columns, mid.inequality_columns, mid.included_columns, user_seeks * avg_total_user_cost * (avg_user_impact * 0.01) AS [index_rating], s.user_scans, s.user_seeks, s.avg_total_user_cost, s.avg_user_impact FROM sys.dm_db_missing_index_details AS mid WITH (NOLOCK) INNER JOIN sys.dm_db_missing_index_groups AS mig WITH (NOLOCK) ON mig.index_handle = mid.index_handle INNER JOIN sys.dm_db_missing_index_group_stats as s WITH (NOLOCK) ON S.group_handle = mig.index_group_handle ORDER BY index_rating desc
The number 1 index recommendation returned is on single "inequality column" - on a column where I really didn't expect to see it. I have asked our developers to search the code for this column in an inequality predicate - it was not found.
I have ran this code in attempt to find the query that is causing this:
WITH CTE AS ( SELECT SUBSTRING(qt.TEXT, (qs.statement_start_offset/2)+1 , ((CASE qs.statement_end_offset WHEN -1 THEN DATALENGTH(qt.TEXT) ELSE qs.statement_end_offset END - qs.statement_start_offset)/2)+1) as qtext, qs.execution_count, qs.total_logical_reads, qs.last_logical_reads, qs.total_logical_writes, qs.last_logical_writes, qs.total_worker_time, qs.last_worker_time, qs.total_elapsed_time/1000000 total_elapsed_time_in_S, qs.last_elapsed_time/1000000 last_elapsed_time_in_S, qs.last_execution_time, qp.query_plan FROM sys.dm_exec_query_stats qs CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) qt CROSS APPLY sys.dm_exec_query_plan(qs.plan_handle) qp where query_plan is not null ) SELECT * FROM CTE WHERE qtext like '%MY_COLUMN%'
The query returns no result (other than itself).
As far as I can tell there is no way to get to sys.dm_exec_sql_text from sys.dm_db_missing_index_details.
I'm obviously misunderstanding something somewhere...
Any advice much appreciated.
Thanks for reading,
Clay
Hi,
We are getting right now following error:
We have Sql 2005 with 4 GB Memory
There is insufficient system memory to run this query.
Error: 701, Severity: 17, State: 42.
then it contains another messages like:
MEMORYCLERK_SQLGENERAL (Total)
VM Reserved = 0 KB
VM Committed = 0 KB
AWE Allocated = 0 KB
SM Reserved = 0 KB
SM Committed = 0 KB
SinglePage Allocator = 31280 KB
MultiPage Allocator = 4504 KB
CACHESTORE_ related
USERSTORE_ related
Note: This is for SQL 2005
Im following this example
http://technet.microsoft.com/en-us/library/ms176018%28v=sql.90%29.aspx
It mentions using these counters, but what Object did they select?
I cant seem to find those counters in the lists for any of the available objects.
The image below, is what I see when selecting the Object "SQLServer:Memory Manager"
I think the article above is talking about using Perfmon?
Hi,
I have what I imagine is a pretty common data warehouse scenario. There is a table containing items by business date and source system id. There are a number of source systems and the data is loaded and stored for each business date.
Items from the same source system with the same name are allocated the same surrogate key so that an item can be tracked over business dates. So itemID is not a unique key.
The table looks roughly like this: Item (Name varchar, ItemID int, SourceID int, BusinessDate datetime)
The table is not currently partitioned, but it would make a lot of sense to partition it on business date.
Most of the select queries will restrict or group on BusinessDate and SourceID
I am assuming that the clustered index should reflect the logical tree structure of the data and so the column order should be:
BusinessDate, SourceID, ItemID
However, I have also read that wide index keys shold have the most selective colum first, which would be ItemID.
Does anyone have any recommendations on the index column order and why ?
Im looking to capture low and out-of-memory conditions by querying sys.dm_os_ring_buffers
reference this blog post
http://blogs.msdn.com/b/mvpawardprogram/archive/2012/06/04/using-sys-dm-os-ring-buffers-to-diagnose-memory-issues-in-sql-server.aspx
The query just looking at RING_BUFFER_RESOURCE_MONITOR, but I want to change the where filter.
Can I filter on both buffer types, as long as the messages are the same format/schema?
like this?
WITH RingBuffer
AS (SELECT CAST(dorb.record AS XML) AS xRecord,
dorb.timestamp
FROM sys.dm_os_ring_buffers AS dorb
WHERE dorb.ring_buffer_type = 'RING_BUFFER_RESOURCE_MONITOR'
)
SELECT xr.value('(ResourceMonitor/Notification)[1]', 'varchar(75)') AS RmNotification,
xr.value('(ResourceMonitor/IndicatorsProcess)[1]','tinyint') AS IndicatorsProcess,
xr.value('(ResourceMonitor/IndicatorsSystem)[1]','tinyint') AS IndicatorsSystem,
DATEADD(ms, -1 * dosi.ms_ticks - rb.timestamp, GETDATE()) AS RmDateTime
FROM RingBuffer AS rb
CROSS APPLY rb.xRecord.nodes('Record') record (xr)
CROSS JOIN sys.dm_os_sys_info AS dosi
ORDER BY RmDateTime DESC;
- - - - - - - - -
Hi Experts,
I new to create the Partitioning on database.I have manually created all partition filegroup and Schema but business want to create it automatically.even I have to create the sliding window on that.
Appreciated your help and support.
--Green
If you were to start to build a report that would be system related information, what items would you include?
So far I have the following:
- identify low and outofmemory events (since last ring buffer flush)
- identify the top 10 slowest statements
- job run/fail/status
- list database and transaction log sizes
- find table indexs that have fragmentation over 30%
- top 10 largest tables in AAD and WmsCore (rowcount, total space, used/unused space)
What else would be good to add?
I am trying to send an email with the results in the body of the message. Below is the code and below that is the error.
DECLARE @mailprofile VARCHAR(200)
declare @query nvarchar(max)
SET @query = 'select top 1 AccountID from operations.dbo.Accounts'--'select SQL from operations..ChangeAttempt'
SET @mailprofile = (SELECT top 1 name FROM msdb.dbo.sysmail_profile)
EXEC msdb.dbo.sp_send_dbmail
@profile_name = @mailprofile,
@recipients = 'anaylor@lamar.com',
@query = @query,
@subject = 'Current Test EMAIL' ;
Alan