Hello all-
Is it possible to reset the values of DMV stats/counters without restarting the SQL service? I'm looking for something more than dbcc freeproccache...more along the lines of index_usage and some of the OS DMVs.
I have installed the reports for the performance dashboard and really like it!
However, I'd like to be able to clear the stats in order to run specific procedures etc and see the most inefficient parts in the specific procedure. The documentation says like this about it:
The lifetime of the DMV data depends on the lifetime of the plan in cache. You can determine how long the plan has been cached, and thus the time frame over which these resources have been consumed, by looking at the Plan Cached column
What Plan Cashed column? Can someone explain to me how to clear the stats?
hi guys i was wondering if anyone could help me, i have a table with a field called id that did have numbers 1,2,3,4,5,6,7,8 and so on! but after some tinkering i have removed a few value and added more so i now have 1, 4,8,19,20 and so on!i was wondering if i can run a query to update those value and return them to 1,2,3,4,5,6,7,8 and so on?CheersTupps
Hi,I have a table OutMailDetails with the following fields : OutMailID --- Foriegn Key Name Description My problem is that i have datas already in this table and the table is related to another table called OutMail through OutMailID field. Please how can i make it (OutMailID field) a primary key now.
i am using autonumber as a primary key in one table. in my app., row from that table will be moved to another table after some time but that autonumber is important. when there are no any data in first table, and new row is inserted, autonumber starts from 1 which i don't want as there will be data redundancy when it will be moved to another table. so is there any way i can force the autonumber to start from previous value rathe than 1?
hi!i'm new to sql server and enterprise manager and i accidentally deleted all data in a table. how do i recover them? the table (CaptureManager) is still there but empty. i have the following information:if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CaptureManager]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)drop table [dbo].[CaptureManager]GO CREATE TABLE [dbo].[CaptureManager] ( [ID] [tinyint] IDENTITY (1, 1) NOT NULL , [Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Email] [varchar] (75) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Ext] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Status] [char] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY]GO
Hey! I downloaded the sql engine and made a bunch of tables in visual basic. They were called new1, new2, new3, and new4. So I deleted new1.mdf, new1.ldf, new2.mdf, etc... but I notice I still can't recreate them. So I'm thinking there's remnants in master.mdf or something?? How would I go about getting rid of all the old tables, even ones whose names I've forgotten, so I can have a clean slate again? (btw I don't have sql server, just the desktop engine)
I am trying to reset an IDENTITY RowNumber back to 1 in a query when the Person's Name is the same. The following query can be used agains the pubs database in SQL Server.
I am trying to figure out where to place the section for the DBCC CHECKIDENT item in order to reset the RowNumber back to 1 when ever the lname column is the same. For example if the pub database had duplicate records for a given employee the RowNumber would reset back to 1.
CREATE TABLE #RowNumber ( RowNumber int IDENTITY (1, 1), emp_id char(9) ) --DECLARE @seed int --SET @seed = 1 --DBCC CHECKIDENT ('#RowNumber', RESEED , @seed) WITH NO_INFOMSGS
INSERT #RowNumber (emp_id) SELECT emp_id FROM employee ORDER BY lname SELECT RowNumber, e.emp_id, lname, fname, job_id FROM #RowNumber r JOIN employee e ON r.emp_id = e.emp_id
This is the best suited forum I found for my problem, if there's a better suited one please direct me.
I am running SQL Server 7.0 on Windows 2000 Server, and the SA's password has been forgotten and no other employee knows it. I searched the net for a solution, and I found various pages describing how to reset the SA's password by logging in an administrator, connecting to the server and using a sp_password command.
For some reason, I cannot connect to the server even when I'm logged on as administrator. Here are the steps I took:
1) I logged in as DOMAINAdministrator at my domain controller. 2) I opened Enterprise Manager and clicked on the server labeled "(LOCAL)". The server is registered to use "Windows NT authentication". 3) Received the following error:"A connection could not be established to (LOCAL) - Login failed for user 'DOMAINAdministrator'.. Please verify that SQL Server is running and check your SQL Server registration properties ... and try again". If there was an option to attach a screenshot, I would, but... 4) I have verified that SQL Server is running.
As I am new to SQL Server, I'm not sure about this, but the SQL Server is called SERVERNET, and the domain I'm logged into is called DOMAIN. Should I login as an administrator to SERVERNET and not to DOMAIN? Is that possible? "SERVERNET" does not show on the login screen, only "DOMAIN" is listed there.
What is the easiest way in T-SQL to reset the identity values of the PK columns in a DB. Here's the scenario.
I'm going to be backing up a HUGE DB and then restoring it to a new server. Once there I will run an SP to remove all the existing data. The tables are now row-free. However my customer doesn't like that the first record they add gets PK value of 5,321, or whatever.
After I remove all the data how can I reset the ids? It would be nice to add some code to my sp_cleardb that would go back and reset the identity columns FYI All of my tables use auto-incrementing identity fields with a seed of 1
1) I know how to do it in enterprise manager, but I need it in scripting since I'll have to do it on hundreds of tables 2) I tried using alter table to drop the PK constraint, but that requires knowing the pk constraint name, which is SQL generated and I won't know.
I think I got very close, but the code was just getting too big. I thought, there must be an easier function to use, or a built in SP, or something?
Anyone know how to script this? THanks in advance. Josh
Question - if you had to completely strip all permissions from all databases in an instance and reset them, assuming you have metadata to support rebuilding the permissions, what steps would you follow? I can handle the iterating through each database, but at the database level, what steps would you take?
The reason I inquire on this is I currently have a job that I inherited that does just this. But it's buggy and was also written in for SQL Server 2000. With some of the changes in 2005, a few bugs have crept in, etc. And I would like to confirm my thoughts this. Or, if your opinion is why are you wasting your time on this? Then that's fine to and I'll review any constructive comments you may have.
I've run into an issue that's been driving me up a wall.
Running SQL Server 2005, two instances production and development, report server on each. I have a multiple scheduled reports on each instance, and I've over wrote the report server subscription with a SQLAgent schedule. For whatever reason the reports on the production instance keep having their schedule reset to the subscription when the report was first created. The logs give me a warning that the schedule is changing or deleted but it's happening when no one is around.
Can anyone shed some light on this for me? or am I missing something really obvious here?
I used a lot of fictitious data in order to test the code of my web site. But I noticed that when I deleted all fictitious data from the tables, the primary key columns keep creating automatically numbers that are above the last one before all data was erased instead of starting again from number 1. How do I reset this automatic numeration in order to restart from 1 again ?
Can anyone tell me of a way to reset the value of an Identity field back to its seed value after all the rows in a given table have been deleted and I try to re-populate it? There are foreign key relationships so I cannot just drop and recreate the table, and I really need to address this issue from within sql, rather than from the application.
I used a lot of fictitious data in order to test the code of my web site. But I noticed that when I deleted all fictitious data from the tables, the primary key columns keep creating automatically numbers that are above the last one before all data was erased instead of starting again from number 1. How do I reset this automatic numeration in order to restart from 1 again ?
Hi I have a DataSource control which is currently set with no initial SelectCommand Property when it is constructed. I have a number of standard buttons, each of which when clicked fires an event that analyses and modifies the SelectCommand for the DataSource. Each event sets the SelectCommand Property for the DataSource using eg:dataSource.SelectCommand = "SELECT * FROM table WHERE tableID IN ('1', '2', '3')";(To help you understand, the aim is to have each button either inserting or removing an ID number into an SQL 'IN' clause as shown above) When the events are fired the DataSource is updated with the new SelectCommand and the bound ListBox updates correctly. However any subsequent events don't seem to read the previously modified SelectCommand setting. When they try to read the SelectCommand using:string queryToModify = dataSource.SelectCommand;They just get a empty string returned instead of the query that the previous button click set (temporarily). It seems like a state issue, but as a server side control it should automatically keep the state, right? Thanks for taking the time to read this and many thanks in advance for any assistance (I've only been learning ASP.NET for a few days... and I'm quite impressed so far :-) ) PurplePerson
Any additional help besides checking named pipes for the connectivity 10004 problem on 6.5. Did a client software upgrade and now cannot access the database. Also, how can I reset the sa password?
I have question regarding updating user password in sql 2005.
Is there a way to update user password in tsql without specify the old password?
In sql 2000, since we are still able to mess with the data in system table, I can use update statement to update the password field in the login table with encrypted data. But since sql 2005 does not allow users to mess with system tables, I am wondering if there are any ways to update user password without specifying the old password when I use "sa" user to login.
Hi, I have a report where i do a page break for each supplier. I want to reset my page number to '1' when there is a group break.When i googled for this functionality i found the following chris Hay's blog which provides the solution. http://blogs.msdn.com/chrishays/archive/2006/01/05/ResetPageNumberOnGroup.aspx But if i follow the same, I get #Error instead of page number during the run time.How do i resolve the error? Also, I want to display the "page 1 of totalpages in group" like that. Is that possible?
Is there a way that I can reset the key field to 1 when using DELETE to clear a table? (Note: if there is a separate command that I could use after the DELETE, that is fine too.) Thank you for your help with this, -DJ
Has anyone else experienced SQL Express resetting to Windows Authentication only instead of mixed mode for logins after a power failure. I only noticed it happen today as we had 2 power outages in the office and it happened both times. If anyone has seen this happen or knows of a fix please let me know.
I have four columns in my table, the first one is the identity column
col1 Col1 col2 col3
1 12 1 This is Test1 2 12 2 This is Test1 3 12 3 This is Test3 4 12 4 This is Test4 5 12 5 @@@@@
When, I see, @@@ sign in my col4, I need to restart the col3 from 1 again so it will look like this
col1 Col2 col3 col4
1 12 1 This is Test1 2 12 2 This is Test1 3 12 3 This is Test3 4 12 4 This is Test4 5 12 5 @@@@@ 6 12 1 This is another test1 7 12 2 This is another Test2
Does anyone know of a tried and tested method for collating stats from SQL Server databases. I have a no. of databases hosted on a single server, servicing a no. of applications. I need to find out the following: CPU usage of each application on the server Memory usage of each application etc
Has anyone noticed a performance improvement during trading hours when they replaced sp_updatestats with UPDATE STATISTICS FULLSCAN in their nightly maintenance? Or is it negligible?
Basically i am from Oracle background. I need some help. In oracle we gather the statistics of a table as SQL> analyze table <tname> compute statistics for all indexes;
or SQL> EXEC DBMS_STATS.gather_schema_stats('SCOTT')
I want to gather statistics for a particular database say."pubs" for example.
Hi there...How do I get to extract info like, current Database logged in user orgeneral stats like, ram usage... etc etc etc into a form if I use MicrosoftAccess 2002 for my forms application?Thanks in advanceRudi