[SQL 2012] Query for Reort |
- Query for Reort
- database showing restoring does not add back in to always on high availability group
- Execution Plan Incomplete
- VAS/MemToLeave and the Plan Cache
- Find Data Source
- NETWORK SERVICE cant read system view
Posted: 17 Jul 2013 12:20 AM PDT Hi All,I am not sure if I am posting on correct forum, but I need to find a solution to this.This must be really stupid to ask such simple things but somehow I am not able to figure it out.I have a table which has EmployeeID, Status, dateTime.Everytime a user Enters the door there is a record with EmployeeID, Staus (IN/OUT) and datetime.I need a store procedure or a query which will help me generate a report how much time the user Inside the Room (Basically difference between In and Out). There is once twist that the employee can go in and come out multiple times.I need to generate a report for employees each visit as well as a total time spend report for the day.Note: If there is a requirement to change the tables, I can do it and modify the software to make an entry accordingly.Thanks in advance. |
database showing restoring does not add back in to always on high availability group Posted: 17 Jul 2013 02:19 AM PDT i got a primary secondary and a Disaster Recovery servers.I have a database added to the always on high availability,as we work on failover cluster, i found it as Always On, on all the servers.I dont know how but found the DB says restoring...the always on feature is not enabled to that particular DB.when i try to add the DB to one of the Availability group it says:" Failed to join the 'DB' to the availability group 'groupname' on the availability replica 'server name' the remote copy of DB is not recovered far enough to enable database mrroring or to join it to the availability group. you need to apply the missing log records to the remote database by restoring the curent log backups from the primary database (MS SQL Server error:1408) "i do restored under norecovery from the primary...now i couldnot find a way to add it back to the Always On...Can any one find me a way... or am i missing anything over here???Rookie here :hehe: |
Posted: 16 Jul 2013 09:06 AM PDT I'm trying to show a developer how to rewrite a stored procedure. It's a pretty scary SP (hundreds of lines of T-SQL in a cursor loop doing a bunch of selects - all to create a dynamic SQL statement). I know we're all cringing in horror at this point but what I wanted to do was show him just how bad the performance would be and what it would do to SQL Server by walking him through the execution plan. When I include the actual execution plan, the SP that normally runs about 6 - 10 seconds now runs for over a minute (which I presume is the time spent generating the plan). The problem comes from the plan not finishing. I scrolled through this and when I got to the end of the plan screen, it was cut off half way through a query.The question is - Is there a way to display the entire plan? Any switches or tricks for getting the entire plan to display?ThanksTom |
VAS/MemToLeave and the Plan Cache Posted: 16 Jul 2013 11:41 PM PDT Hello,Could someone let me know if the plan cache is located within MemToLeave or is separate?I know that MemToLeave is reserved before the buffer pool when SQL starts up, but what about the plan cache?Thanks in advance,Andrew |
Posted: 16 Jul 2013 10:37 PM PDT Hi Team,am having a table called 'all_data' with columns id, data_src.in above table records are not entering directly, records are inserted into above table based on some triggers and stored procedures.am new to this environment, how to find where and when the records are entering to particular table.Please sugggest. |
NETWORK SERVICE cant read system view Posted: 16 Jul 2013 07:08 AM PDT I'm trying to run the following query from a Web Service: SELECT last_user_update FROM sys.dm_db_index_usage_statsI get an error when I try this, saying that the current user does not have permissions. Here's what I know;- The web service runs as NT AUTHORITY\NETWORK SERVICE- NT AUTHORITY\NETWORK SERVICE has the "public" role on the database- The view sys.dm_db_index_usage_stats has two SELECT permission options, one with a blank grantor and one with "dbo" as a grantor. "public" is given access to the one with dbo as the grantor - I tried to check the other select box, but SQL quietly unchecks it when I close the window, so I'm basically not able to change the permissions on this view.Is there a way that I can grant access to sys.dm_db_index_usage_stats for NT AUTHORITY\NETWORK SERVICE?or... Is there another way I can discover the last access time on a table that does not require access to sys.dm_db_index_usage_stats? |
You are subscribed to email updates from SQLServerCentral / SQL Server 2012 / SQL 2012 - General To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
No comments:
Post a Comment