DBREINDEX Or INDEXDEFRAG Of A Few Indexes/window

Mar 31, 2007

I have a quite big database (150GB) that is running 24/24 7/7 with each day 2 windows of about 2 hours in which people are working little.
So doing a complete indexrebuild during the weekend is not possible. The only option is the rebuild/defrag indexes is during those windows. Problem is:I can't do it on all tables because it takes too much time.
So I was thinking about creating several SQL scripts and each of those is doing some tables/indexes. Problem is that I have a few hundreds of tables and if I want to move an index from 1 window to another, I have to change those scripts manually. Quite a time costing and error-prone procedure.

So I was hoping there is some tool that shows me all existing indexes and give me the possibility to add them to a script and once I have done that, generate the scripts to be run.
I have launched some searches on the forum but I didn't find any mentioning of the existence of such a tool.
Does someone know of such a tool or have a better idea how to do this?

Thanks,
Alain Krikilion

IF Debugging = removing bugs from program THEN programming := putting bugs in program;

View 3 Replies


ADVERTISEMENT

DBREINDEX/INDEXDEFRAG A Few Questions

Jun 29, 2004

I pretty much understand the differences between DBCC DBREINDEX and DBCC INDEXDEFRAG. However, I need the forums help to understand a few specific issues relating to clustered/non-clustered indexes and the advantages/disadvantages of running the DBCC DBREINDEX/INDEXDEFRAG against the table or against each specific index...

"If a table has a clustered index, it's only necessary to re-index the clustered index because any non-clustered indexes on that table will be automatically re-indexed as well."

I think the above statement is true for DBCC DBREINDEX but is the following statement true for DBCC INDEXDEFRAG:-

"If a table has a clustered index, it's only necessary to Index Defrag the clustered index because any non-clustered indexes on that table will be automatically defragged as well."

Following on from the above, is there any advantage with an index maintenance strategy to individually running DBCC DBREINDEX against each specific index as opposed to running it against the table and letting SQL sort out the underlying indexes? Does the same apply to DBCC INDEXDEFRAG?

Regards,

Clive

View 3 Replies View Related

Dbcc Dbreindex/indexdefrag && Update Stats

Jul 22, 2004

Microsoft states that dbcc DBREINDEX automatically updates statistics but INDEXDEFRAG does not. If this is the case, does MS mean that only the affected statistics are updated or all statistics? Also, is it a good idea to run 'Update Statistics' after doing INDEXDEFRAG?

Clive

View 1 Replies View Related

Sliding Window Scenario For Shifting Partitions...do All Indexes Need To Be Built On The Staging Tables?

Oct 31, 2007

Kimberly Tripp describes a recipe for switching partitions in and out, thru the use of staging tables, when it comes time to "slide the window" on a partitioned table. She says that the clustered index (on staging) must be the same as that chosen for the partitioned table itself but she doesnt discuss whether or not all of the non clustered indexes need to be the same too once the
ALTER TABLE Orders
SWITCH PARTITION 1
TO OrdersOctober2002
and
ALTER TABLE OrdersOctober2004
SWITCH TO Orders PARTITION 24
run. For the data being switched out, I wouldnt want to do anything extra. For the data being switched in, I'd like to understand if she is implying that all other indexes would be built automatically as a result of the 2nd ALTER statement?

Kimberly's article is at http://www.sqlskills.com/resources/Whitepapers/Partitioning%20in%20SQL%20Server%202005%20Beta%20II.htm#_Toc79339965

View 1 Replies View Related

DBCC INDEXDEFRAG

Oct 10, 2007

Hi All,

I am running INDEXDEFRAG on one the tables. It has a Clustered index and 4 non clustered. Should I run the INDEXDEFRAG only for clustered, or for all the 5 indices?

Mannu.

View 4 Replies View Related

DBCC INDEXDEFRAG And Log Shipping

Jun 11, 2004

Hi,
I want to run run
DBCC INDEXDEFRAG on all tables
using example of BOL

Database 25 GB and we do log shipping
every 5 min

Would it have big impact on performance and log shipping?

Thank you

Alex

View 1 Replies View Related

Need Script Generator For DBCC Indexdefrag

Jul 28, 2004

Friends

I want to run DBCC INDEXDEFRAG(Db_name, Tab, Idx) for many of the databases . Number is huge and it is near impossible to go to each server and do a manual run. Can someone provide me a scrip to generate the above syntex for all the tables in a db?

Thanks

View 7 Replies View Related

Problems With Diff Backup And INDEXDEFRAG?

May 14, 2004

SQL Server 2000 sp3 Enterprise (8.00.818) running on W2K Adv Server cluster.

DB's and backups resided on a fibre SAN attached IBM FAStT 500 storage controller.

I had problems with random restore failures, getting errors such as "3270 Internal Consistency Error" on log restores or on full restores after reporting problems with some of the files. This was fixed (we thought) by disabling the read caching on the FAStT 500 storage controller, per Microsoft's recommendation.

We have a custom-written log shipping solution that maintains a 2nd copy of our user DB on the same system, so there's 700+ backups/restores of various types in the course of a week. After two months of error-free operation, we just got another Internal Consistency Error, but this time on a differential restore, which was a first. Looking back, we realized we were running a DBCC INDEXDEFRAG command on the source DB at the time the differential backup was running. Taking a new differential and using it in the restore sequence worked fine, so clearly the problem was in the first diff backup file.

Anybody else noticed any problems with running DBCC INDEXDEFRAG at the same time as a differntial backup?

View 2 Replies View Related

How To Connect To Sql Server As Other's Window Login Rather Than User's Window Login Thorugh ASP.NET.

Dec 14, 2006

Dear members,

In MSDN, it says that it is recommended to use windows authentication to connect to SQL Server rather than use mixed authentication.

I create user deltasqluser on windows OS, and I specify in my webform ASP.NET script below :

protected System.Web.UI.WebControls.Label Label1;
private string _connString = @"data source=deltasql2000;initial catalog=northwind;integrated security=false;user id=deltasqluser";
/*
comment : I login to my windows as deltakoronx, and I want to every user (including me), connected to sql server through IIS, will be identified as deltasqluser not as user's login (impersonate)
*/
private void Page_Load(object sender, System.EventArgs e)
{
SqlConnection conn = new SqlConnection(_connString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select suser_sname()";

conn.Open();


string userName = cmd.ExecuteScalar() as string;
conn.Close();
conn.Close();
Label1.Text = userName;
}


at web.config, I add :
<identity impersonate="false" userName="deltasqluser" password="" />


at IIS webApplication1's properties, tab "Directory Security", at "Authentication and access control" section, I checked "enable anonymous access" with user : DELTAIUSR_DELTA and checked "Integrated Windows Authentication",


at query analyzer, I login as "sa" and execute script below :
exec sp_grantdbaccess 'deltasqluser','northwind'


when I run the ASP.NET script, error at conn.Open(); with error message :
Login failed for user 'NT AUTHORITYNETWORK SERVICE'.


What should I do so that IIS login to SQL Server as user deltasqluser not as "NT AUTHORITYNETWORK SERVICE" ?

Regards,

Koronx

View 1 Replies View Related

Open Report In New Window: Window.open Method Gives Error

Jun 26, 2006



Hi,

I am using SSRS Microsoft SQL Server Reporting Services Designers
Version 9.00.1399.00. I want to open linked report in new window.

I tried whats mentioned in http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=240172&SiteID=1 but i get an error on Window.Open method.

How do I solve the problem?

Thanks

View 1 Replies View Related

Removal Of Selected Indexes / Script Index Create For List Of Indexes

Jul 1, 2014

I'm working to improve performance on a database I've inherited, and there are several thousand indexes. I've got a list of ones which should definitely exist within the database, and I'm looking to strip out all the others and start fresh, though this list is still quite large (1000 or so).

Is there a way I can remove all the indexes that are not in my list without too much trouble? I.e. without having to manually go through them all individually. The list is currently in a csv file.

I'm looking to either automate the removal of indexes not in the list, or possibly to generate the Create statements for the indexes on the list and simply remove all indexes and then run these statements.

As an aside, when trying to list all indexes in the database, I've found various scripts to do this, but found they all seem to produce differing results. What is the best script to list all indexes?

View 5 Replies View Related

DBREINDEX - More

Jan 8, 2002

I ran the dbreindex using query analyzer (on the tables mentioned in my previous posting - 1/7/02) and still the scan density remains at 50%.
I do not understand why the dbreindex is not reorging these tables to a
higher scan density.
I used a fill factor of 90%.

View 5 Replies View Related

DBREINDEX

Dec 17, 2001

HI,

I have a database at 30GB, with 'FULL' recovery model. The transaction log backup after a DBREINDEX job on this database is creating a very huge backup file. Any Idea how can I avoid such a huge backup file.

I have tried to change the recovery model to 'Bulk_logged' before DBREINDEX and changed it back to 'FULL'. That sure helped me to avoid the growth of log file. But, that did not help me to reduce the size of the transactional log backup file.

Regards
Chakri

View 1 Replies View Related

Qustion On Dbreindex.

Dec 21, 2001

Is that OK to run dbreindex every 24 hours on heavily modified/inserted tables?Does that harm anyway?Gurus advice needed!
thanks.

View 1 Replies View Related

Dbcc Dbreindex

Jan 7, 2002

We are new to SQL Server and we are currently setting up a job that
does a dbreindex for tables that need it. I got the scripts for this
from swynk. 50 of the tables that needed a dbreindex,
(under 90% scan density) were not impacted by running the dbreindex.
I.e., I ran the dbreindex and it left it at 50% scan density.
The fill factor for these tables is set to 100%.
I tried update stats, updateusage...nothing changes....
I am sure there must be a logical reason as to why the dbreindex
had no impact on these tables. Does any one have any info on this?
Thanks in advance!

View 4 Replies View Related

DBCC DBREINDEX

Mar 21, 2001

I am executing a DBCC DBREINDEX for a table with about
4 million rown in SQL6.5. I has run for about
15 hrs now and is till running.
The index is the PK for the table and it is clustred index.
I ran it on a non clustered index on the same table and it ran for a couple of hrs.
Does any one have any idea how much time it might take for the clustered index?
I heard that this process might take more time and for one of my friends it ran for more than 40 hours.
I don;t have so much if time as th DB has to go for production to night and if not it might effect our businees.
I cancelled DBCC DBREINDEX before by killing the process and the master.DAT file got corrupted.I had to restore everytihng. Does anyone know any work around?
Help appreciated.

Thanks.

View 4 Replies View Related

DBCC DBREINDEX

Jun 11, 2001

Could users use database while running DBCC DBREINDEX for all tables in database?

View 1 Replies View Related

DBCC DBREINDEX ?

Aug 14, 2001

Hi,
I wanted to know is DBCC DBREINDEX is a logged operation?
The reason why I am asking this is, Whenever we create an index or drop an existing it is a logged operation. Is this the same when we do DBCC DBREINDEX? Is it drops existing indexes and creates new indexes. My concern here is about transaction log. If I run a DBCC DBREINDEX on a huge table with lot of indexes, Is it going to fill transaction log?

Any help is appreciated!

Thank you,
Ravi.

View 1 Replies View Related

Dbcc Dbreindex

Nov 7, 2000

About how long should I expect this to run? The Database is 200MB. The table I doing the reindex on has about 800 rows. Is an hour outrageous.. ?

View 1 Replies View Related

Dbcc Dbreindex

Aug 4, 2000

Hello!

SQL Server 7
After database clean up (removing old data)I run dbcc dbreindex.
Is it true I don't need to run UPDATE STATISTICS after DBCC DBREINDEX as since SQL Server 7 runs UPDATE STATISTICS automatically (after dbcc dbreindex).
Thank you.
Anny

View 2 Replies View Related

DBCC DBREINDEX

Mar 21, 2001

I am executing a DBCC DBREINDEX for a table with about
4 million rown in SQL6.5. I has run for about
15 hrs now and is till running.
The index is the PK for the table and it is clustred index.
I ran it on a non clustered index on the same table and it ran for a couple of hrs.
Does any one have any idea how much time it might take for the clustered index?
I heard that this process might take more time and for one of my friends it ran for more than 40 hours.
I don;t have so much if time as th DB has to go for production to night and if not it might effect our businees.
I cancelled DBCC DBREINDEX before by killing the process and the master.DAT file got corrupted.I had to restore everytihng. Does anyone know any work around?
Help appreciated.

Thanks.

View 1 Replies View Related

DBREINDEX:How Does It Work?

Jun 10, 2005

Can anyone shed some light as to how SQL Server performs DBCC DBREINDEX?
Does it use PRIMARY data file space and how much extra data space/log space do we need to have to be able to run this command?

View 2 Replies View Related

Dbcc Dbreindex

Jan 10, 2006

Hi All,

I have a following script:

DECLARE @TableName sysname
DECLARE cur_reindex CURSOR FOR
SELECT table_name
FROM information_schema.tables
WHERE table_type = 'base table'
OPEN cur_reindex
FETCH NEXT FROM cur_reindex INTO @TableName
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT 'Rebuilding indexes ' + @TableName + ' table'
DBCC DBREINDEX (@TableName, ' ', 10)
FETCH NEXT FROM cur_reindex INTO @TableName
END
CLOSE cur_reindex
DEALLOCATE cur_reindex
GO

I added as a step in the job. However, when I run it I get an error message:

Msg 2501, Sev 16: Could not find a table or object named 'table_1'. Check sysobjects. [SQLSTATE 42S02]

When I run
SELECT table_name
FROM information_schema.tables
WHERE table_type = 'base table'

table_1 is the first on list. Any idea why I am getting this error message?

View 5 Replies View Related

Please Help!...Hanging DBREINDEX Job

Feb 24, 2007

I have a scheduled job on my SQL Server 2000 that runs a DBREINDEX job on all the tables in my database. For some reason the system just hangs for hours now when it reaches one particular table. Can somebody please help me to correct the problem. Thank you all in advance.

View 2 Replies View Related

DBCC DBREINDEX Does Nothing

May 17, 2004

Has anyone had the problem with DBCC DBREINDEX on a table/index not doing anything.
You just get the usual "DBCC execution completed. If DBCC printed error messages, contact your system administrator." message.
I have tried:
DBCC DBREINDEX ('<table_name>')
DBCC DBREINDEX (<table_name>)
DBCC DBREINDEX ('<table_name>', '')
DBCC DBREINDEX ('<table_name>', '<index_name>')
DBCC DBREINDEX ('<table_name>', '<index_name>', 80)

Maybe its "optimising" and not thinking anything needs updating.

Should I look for an alternative way of rebuilding an index like dropping and recreating?

The beauty with DBCC DBREINDEX ('<table_name>') would have been that I was going to get the list of user tables in the database and call it for each table to simply rebuild all indexes.

View 5 Replies View Related

DB Maintenance -dbreindex

Apr 19, 2007

We are running a maintenance plan that rebuilds the indexes for all the databases. I have ran showcontig after the maintenance plan and am still seeing fragmentation. Here is one of the master tables that is included in on the maintenance job.
sysobjects table:
pages scanned - 5
extents scanned - 3
extents switches - 3
avg. pages per extent - 1.7
scan density - 25%
logical scan fragmentation - 40%
extent fragmentation - 66.67%
avg.bytes free per page - 1360.4
avg. page density 83.19%
According to what I have read this still seems to be fragmented. What can be done to improve this?

View 11 Replies View Related

DBCC DBREINDEX

Sep 21, 2007



DBCC CHECKDB;
GO
Result:
DBCC results for 'AgentsStateChanges'.
There are 2422697 rows in 46484 pages for object 'AgentsStateChanges'.
CHECKDB found 0 allocation errors and 92 consistency errors in table 'AgentsStateChanges' (object ID 2025058250).

Server: Msg 8934, Level 16, State 3, Line 1
Table error: Object ID 53575229, index ID 1. The high key value on page (1:193625) (level 0) is not less than the low key value in the parent (0:1), slot 0 of the next page (1:269532).
Server: Msg 8935, Level 16, State 1, Line 1
Table error: Object ID 53575229, index ID 1. The previous link (1:269531) on page (1:269532) does not match the previous page (1:193625) that the parent (1:272396), slot 252 expects for this page.
Server: Msg 8936, Level 16, State 1, Line 1
Table error: Object ID 53575229, index ID 1. B-tree chain linkage mismatch. (1:193625)->next = (1:269532), but (1:269532)->Prev = (1:269531).
Server: Msg 2511, Level 16, State 1, Line 1
Table error: Object ID 53575229, Index ID 2. Keys out of order on page (1:266856), slots 14 and 15.
Server: Msg 2511, Level 16, State 1, Line 1
Table error: Object ID 53575229, Index ID 2. Keys out of order on page (1:266856), slots 154 and 155.
Server: Msg 2511, Level 16, State 1, Line 1
Table error: Object ID 53575229, Index ID 2. Keys out of order on page (1:266869), slots 49 and 50.


DBCC DBREINDEX ('Vestel.dbo.AgentsStateChanges', PK_LLAgentFlowSummary, 0);
GO
Result:
Server: Msg 1505, Level 16, State 1, Line 1
CREATE UNIQUE INDEX terminated because a duplicate key was found for index ID 1. Most significant primary key is 'type 24, len 16'.
The statement has been terminated.



PLEASE HELP!;
GO

View 6 Replies View Related

Executing DBCC Dbreindex

Oct 10, 2001

Is it Nessary to disconnect users , go in single user mode to execute
DBCC DBREINDEX in SQL Server 2000 ?

View 2 Replies View Related

Is A Dbcc Dbreindex Logged?

Jan 5, 2001

If I reindex tables on a production server and dump the transaction log then load that tran log to a
warm standby server --will the indices be rebuilt on the standby server? My guess is no,
but I've heard people say otherwise.

--jen

View 1 Replies View Related

Dbcc Dbreindex Failed

Feb 5, 2001

when i run the dbcc dbreindex command it failed and message like this

[Microsoft][ODBC SQL Server Driver][Named Pipes]ConnectionCheckForData (PeekNamedPipe()).
[Microsoft][ODBC SQL Server Driver][Named Pipes]Connection broken.

Connection Broken
please help

View 3 Replies View Related

DBCC DBREINDEX Does Not Work

Feb 21, 2006

DBCC SHOWCONTIG shows following information. But after ran
DBCC DBREINDEX ('CM20100', ''), nothing changed.

What I did wrong? Thanks in advance.

******************************************************
DBCC SHOWCONTIG scanning 'CM20100' table...
Table: 'CM20100' (1957582012); index ID: 0, database ID: 16
TABLE level scan performed.
- Pages Scanned................................: 491
- Extents Scanned..............................: 159
- Extent Switches..............................: 158
- Avg. Pages per Extent........................: 3.1
- Scan Density [Best Count:Actual Count].......: 38.99% [62:159]
- Extent Scan Fragmentation ...................: 99.37%
- Avg. Bytes Free per Page.....................: 946.0
- Avg. Page Density (full).....................: 88.31%

View 10 Replies View Related

DBCC DBREINDEX Not Working

Jul 23, 2005

I have a stored proc that identifies indexes that need to bedefragmented ( LogicalFragmentation > 20% ) using DBCC SHOWCONTIG.This works fine and shows me all of the candidate indexes to bedefragged. I am using DBCC DBREINDEX to rebuild the indexes. What Inoticed yesterday is that it seems that DBREINDEX is not actually doinganything. I would check the target indexes, run DBREINDEX, then checkagain. The same list of indexes came up unchanged.What is strange is although I am not specifying "WITH NO_INFOMSGS" thisis the only output from the DBREINDEX:"DBCC execution completed. If DBCC printed error messages, contact yoursystem administrator."According to BOL DBREINDEX should return a result set if "NO_INFOMSGS"is not specified, but if "NO_INFOMSGS" is supplied the prior message iswhat is returned. This doesn't seem to be working correctly, or if itis, I have no idea where any error messages are being returned.Anyone have any ideas?

View 2 Replies View Related

Dbcc Dbreindex Question

Apr 20, 2007

Is this command, which I know can be executed on a per-table basis,the same as the Rebuild Index Task in the SQL Server Management Studiofor maintenance tasks??The documentation I have mentions the reindex.sql script, is this thescript that is executed by the Rebuild Index Task??Thank you, Tom

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved