Log Shipping And Index Rebuilding

May 20, 2008

Hello Folks
We have configured log shipping from prod to standby, and thats working great, but we have a nightly maintenance plan the makes a full backup of the database and rebuilds indexes in the prod DB. This maintenance plan increases log file tremendously.

You guys have any ideas how we can truncate the log file without disturbing log shipping ? I have read rebuilding indexes increases log file a great deal. Any ideas how we can get around this?

Thanks,
G

View 4 Replies


ADVERTISEMENT

About Rebuilding Index

Nov 26, 2004

Hi,

Maybe a silly question, but... Are DBCC DBREINDEX and sqlmaint -RebldIdx doing exactly the same thing ? I mean, I know they are both rebuilding index, with optionnally precising a new fillfactor, but are they processing this operation by the same way ? If not, which is best ?

Thanks

View 2 Replies View Related

Regarding Index Rebuilding

Dec 7, 2005

Greetings,While loading data into Sql Server using BCP utility,we have to explicitly need to drop the indexes. then after loading thedata we recreate them. I just want to know if this is possible throughsome other ways. i mean in DB2 we have an option of index rebuildoption which takes care of this job.Do we have anything as such in BCP or is there some other way?Any help will be appreciatedTIA

View 7 Replies View Related

Rebuilding A Huge Clustered Index

Jun 17, 2007

I have a client that has a 800GB table. The current clustered index on this table is of low selectivity and is causing index scans on queries. I wish to drop the current index and create a new one that is of more use. What i really want to know is, what is the fastest method of rebuilding such a huge index? What would be the storage requirements to process this?

View 4 Replies View Related

Reorganizing/Rebuilding Index Results In More Fragmentation?

Dec 11, 2007

I have been reworking my index maintenance jobs from my old SQL 2000 table and view references to the DMV's and System Tables in SQL 2005, and I noted that some of my indexes end up being more fragmented after a reorganization and or rebuild. That doesn't make much sense to me at all. The code I am executing is:




Code Block
print ' '
print '************* Beginning Index Updates for '+db_name()+' *************'
print ' '

DECLARE @tablename varchar(250),


@indexname varchar(250),
@fragpcnt decimal(18,1),
@indexid int,
@dbID int

-- Determine DB ID
SELECT @dbID = DB_ID()

DECLARE tnames_cursor CURSOR FOR

SELECT b.name, c.name, a.avg_fragmentation_in_percent, a.index_id
FROM sys.dm_db_index_physical_stats (@dbID, NULL, NULL, NULL, NULL) a

JOIN sys.indexes b ON a.object_id = b.object_id



AND a.index_id = b.index_id
JOIN Sys.objects c ON b.object_id = c.object_id
WHERE a.index_id > 0
ORDER by a.page_count DESC

OPEN tnames_cursor
FETCH NEXT FROM tnames_cursor INTO @indexname, @tablename, @fragpcnt, @indexid
WHILE (@@fetch_status = 0)

BEGIN

-- Declare and determine the tablename ID
declare @tablenameID int
select @tablenameID = object_id(@tablename)



IF @fragpcnt > 30

BEGIN

EXEC('ALTER INDEX ['+@indexname+'] ON ['+@tablename+'] REBUILD')
PRINT '***************************************************'
PRINT 'Index '+@indexname+' was rebuilt.'
PRINT 'Original framentation Percent: ' + convert(varchar, @fragpcnt) + '%'


SELECT @fragpcnt = avg_fragmentation_in_percent
FROM sys.dm_db_index_physical_stats (@dbID, @tablenameID, @indexid, NULL, NULL) a

JOIN sys.indexes b ON a.object_id = b.object_id



AND a.index_id = b.index_id
JOIN Sys.objects c ON b.object_id = c.object_id

PRINT 'Post Rebuild fragmentation Percent: ' + convert(varchar, @fragpcnt) + '%'
PRINT ''
END
ELSE IF @fragpcnt BETWEEN 5 AND 30

BEGIN

EXEC('ALTER INDEX ['+@indexname+'] ON ['+@tablename+'] REORGANIZE')
PRINT '***************************************************'
PRINT 'Index '+@indexname+' was Reorganized.'
PRINT 'Original framentation Percent: ' + convert(varchar, @fragpcnt) + '%'

SELECT @fragpcnt = avg_fragmentation_in_percent
FROM sys.dm_db_index_physical_stats (@dbID, @tablenameID, @indexid, NULL, NULL) a

JOIN sys.indexes b ON a.object_id = b.object_id



AND a.index_id = b.index_id
JOIN Sys.objects c ON b.object_id = c.object_id

PRINT 'Post Reorganization fragmentation Percent: ' + convert(varchar, @fragpcnt) + '%'
PRINT ''
END
ELSE

BEGIN

PRINT '***************************************************'
PRINT 'Index '+@indexname+' was left alone.'
PRINT 'Original framentation Percent: ' + convert(varchar, @fragpcnt) + '%'
PRINT ''
END
FETCH NEXT FROM tnames_cursor INTO @indexname, @tablename, @fragpcnt, @indexid
END
print ' '
print '************* NO MORE TABLES TO INDEX *************'
PRINT 'All indexes for the '+db_name()+' database have been updated.'
print ' '
DEALLOCATE tnames_cursor





Below are some snipits of the output:


***************************************************
Index _dta_index_wuci_history_8_1123587141__K2_K5 was rebuilt.
Original framentation Percent: 58.3%
Post Rebuild fragmentation Percent: 58.3%

***************************************************
Index PK__batchjob__776C5C84 was left alone.
Original framentation Percent: 0.0%

***************************************************
Index PK__ContactWebDetail__116A8EFB was rebuilt.
Original framentation Percent: 44.4%
Post Rebuild fragmentation Percent: 77.8%

***************************************************
Index PK__managed_object_s__5DCAEF64 was left alone.
Original framentation Percent: 0.0%

***************************************************
Index kb_IX_kb_scope_scope_role was rebuilt.
Original framentation Percent: 75.0%
Post Rebuild fragmentation Percent: 87.5%

***************************************************
Index PK__query__09A971A2 was left alone.
Original framentation Percent: 0.0%

***************************************************
Index PK__email_message__38996AB5 was rebuilt.
Original framentation Percent: 85.7%
Post Rebuild fragmentation Percent: 0.0%

***************************************************






If the index begins with PK, then it is the primary key index which is generally the clustered index on the table, but not always. If it has an IX on it, it is generally a non-clustered index on the table, but again not always. In the case of the above, the PK is a clustered index, and the IX is a non-clustered index.

Anyone have any ideas why this is functioning in this manner?

Thanks,

Jon

View 6 Replies View Related

SQL 2012 :: Rebuilding Online Clustered Index Locks Table

Jun 3, 2014

I was under impression that rebuilding index online largely means that the index will remain available for use during rebuild and my procs and query will be able to use it during rebuild. Also my understanding was that table will be locked very briefly while the schema change will be completing.But when I was rebuilding the clustered index online on a large table with some 3 million records, the table got locked and I was not able even to read the data from it for some 5 minutes. Then I cancelled the operation as it was production server and it was one of our main transaction table.

Is rebuilding index online supposed to work this way? The table has no other index.The parameteres I used are:

REBUILD WITH (PAD_INDEX = ON, SORT_IN_TEMPDB = ON, ONLINE = ON, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 95)

View 5 Replies View Related

FullText Search Not Returning Results After Rebuilding Full Text Index

Aug 6, 2012

We have a table that is Full Text Search index enabled on one column.This table has 200 lakhs of rows(20000000) . ContainsTable() function is searching data with in these 200 lakhs of rows(20000000), if any new rows are inserted then the ContainsTable is not going to search in these recent inserted rows.

We observed when we try for a data to search. it is returning the rows till the rows that are inserted date is less than 30th of march 2012. but not searching in the records that are created after April month , if even the data we are searching is available .

TableFulltextItemCount is around 2.2 crores.

Then we done rebuilt the FT catalog Index. then the TableFulltextItemCount became 0.Again we run the containstable query ,but still it is not getting results.

As the no of rows are very more . so i am not able to show the actual rows from which the data is not coming.

the below query gives 2 results that are from actual base table

HTML Code:
select * from g_case_action_log where cas_details like '%235355%' and product_id = 38810

To search for the same above word using FTS,I have used the query as below

HTML Code:
SELECT Distinct top 50 cal.case_id,cal.cas_details From g_case_action_log cal (READUNCOMMITTED)inner join containstable(es.g_case_action_log, cas_details, ' ("235355" OR "<br>235355" OR "235355<br> ") ') as key_tbl on cal.log_id = key_tbl.[key] Where cal.product_id = 38810 ORDER By cal.case_id DESC

I have attached one sql script file for your ref that contains create logic and index schema properties

Why it is not returning results all the time.

View 1 Replies View Related

DB Re-index Explodes Log Shipping Files

Mar 14, 2002

Hi,

Is it a recognised limitation of log shipping over a WAN, that if you re-index the primary db then the result is gigabytes of trn log to send over the WAN, effectively breaking the log shipping sync?

Are there any known work-arounds?

Would anyone recommend using db replication instead to maintain a DR sql server?

Any comments greatly appreciated.
Steve

View 1 Replies View Related

Log Shipping - Switching Recovery Model In Log Shipping

May 13, 2007

Hi





I could not able to find Forums in regards to 'Log Shipping' thats why posting this question in here. Appriciate if someone can provide me answers depends on their experience.

Can we switch database recovery model when log shipping is turned on ?

We want to switch from Full Recovery to Bulk Logged Recovery to make sure Bulk Insert operations during the after hours load process will have some performance gain.

Is there any possibility of loosing data ?



Thanks

View 1 Replies View Related

Log Shipping: How To Failback After A Failover Log Shipping?

Jun 8, 2006

Hi,

I 'm sure I am missing something obvious, hopefully someone could point it out. After a failover log shipping, I want to fail back to my inital Primary server database; however, my database is marked as loading. How can I mark it as normal?

I did the failover as follow:

I did a failover log shipping from the 2 server Sv1 (Primary) and Sv2 (Secondary) by doing the following

1) Stop the primary database by using sp_change_primary_role (Sv1)

2) Change the 2nd server to primary server by running sp_change_secondary_role (Sv2)

3) Change the monitor role by running sp-change_monitor_role (Sv2)

4) Resolve the log ins - (Sv2)

5) Now I want to fail back - I copy the TRN files to Sv1 - use SQL Ent to restore the database at point in time. The task is done; however, the database is still mark as loading. I could not use sp_dboption.

I appreciate any suggestion.

Thanks in advance

View 5 Replies View Related

Difference Between Index Seek &&amp; Index Scan &&amp; Index Lookup Operations?

Oct 20, 2006

please explain the differences btween this logical & phisicall operations that we can see therir graphical icons in execution plan tab in Management Studio

thank you in advance

View 3 Replies View Related

Rebuilding Indexes

Jan 14, 2002

Hi!
I was wondering what kind of locks (if any) SQL Server 2000 holds on tables while rebuilding clustered and non-clustered indexes.

Thanks!

View 1 Replies View Related

Rebuilding Master

Aug 15, 2001

Hi,
how long a rebuildm.exe takes?
TIA

View 1 Replies View Related

Rebuilding The Server

Feb 13, 2001

Hi!
This is first time I'm using this forum.
I was using SQL Server forum on deja.com before.

Anyway here's the question I have.
We are planning to rebuild the server by reinstalling OS,SQL Server 7.0 and user application.
My question is what's the strategy for restoring sql databases?
Right now all data files plus backups located on this box.

Please advice.

Thank you

Lena

View 4 Replies View Related

Rebuilding Indexes

Sep 20, 2000

Do anyone know how to rebuild indexes on the maintenance plan??
I would like to automate rebuilding my indexes on the database about once every month.

I know you can manually do this by using DBCC DBREINDEX. This is to long and tedious.

Thanks in advance!

View 3 Replies View Related

Rebuilding Indexes

Dec 2, 1999

All,

I have scheduled dbreindex command to run on an clustered indexed on a very large table over night, so far this as failed to complete successfully. I think it may have something to do with the amount of space available in the device; the table is approx 238mb in size and the available disk space left in the device is 200 mb.

Does anyone know how much space is required to reindex a table/index this size and if it is required on the same device as the table or in tempdb.

Or even better, if anyone can explain the inter-workings of how the dbreindex command reorgs the table.

Thanks Mathew

View 1 Replies View Related

Rebuilding Indexes

Feb 23, 2004

Hello all,

I need to diagnose a problem, this Sunday a regular Database Maintenance plan which is supposed to rebuild indexes took exactly 6 hours and 32 minutes. Now that’s a hell lot of time and during all that process users were denied access to those tables. This is a production server. I want to know what caused that plan to run for so long and how can I avoid this to happen again plus if it ever happens again how can I make sure that atleast it doesn’t lock tables. I know DBCC INDEXDEFRAG doesn’t lock tables but how can I make Database Maintenance plan to run DBCC INDEXDEFRAG instead of DBCC DBREINDEX but more importantly why it took 6 hours.

Thanks all

View 3 Replies View Related

Rebuilding Indexes

Jan 14, 2002

(Oops, sorry I posted this on the SQL 7 discussion earlier).

----------------------
I was wondering what kind of locks (if any) SQL Server 2000 holds on tables while rebuilding clustered and non-clustered indexes.

Thanks!

View 1 Replies View Related

Rebuilding Indexes

Feb 23, 2004

Hello all,

I need to diagnose a problem, this Sunday a regular Database Maintenance plan which is supposed to rebuild indexes took exactly 6 hours and 32 minutes. Now that’s a hell lot of time and during all that process users were denied access to those tables. This is a production server. I want to know what caused that plan to run for so long and how can I avoid this to happen again plus if it ever happens again how can I make sure that atleast it doesn’t lock tables. I know DBCC INDEXDEFRAG doesn’t lock tables but how can I make Database Maintenance plan to run DBCC INDEXDEFRAG instead of DBCC DBREINDEX but more importantly why it took 6 hours.

Thanks all

View 2 Replies View Related

Rebuilding Indexes

Jun 13, 2008

Hello,

I'm new to rebuilding and reorg indexes. I used the standard report feature in 2005 to look up Index Physical Statistics on one db. I found recommendation to rebuild a few indexes that contain a number of fragments. I created a maint. task, I know maint. tasks are not a cure-all but so far I am just testing the waters. I created two tasks, one to rebuild and another to reorg. After I ran the job, I looked at the report and it still showed recommendation to rebuild the indexes. What is a better solution for my case?

View 7 Replies View Related

Rebuilding Indexes

Feb 25, 2007

Hi,

I have recenlty had to rebuild the indexes for the entire database as they were running a little slow. It prompted me to further investigate the health of the indexes on the database. I have been using the sys.dm_db_index_physical_stats view to do this. I had a query with regards to the avg_fragmentation_in_percent column that the view displays. I have rebuilt all the indexes and for some of the indexes the fragmentation value remains the same. The following is an example of what is returned by the sys.dm_db_index_physical_stats for a single index:

Table, IndexName, avg_fragmentation_in_percent, avg_page_space_used_in_percent
Links, PK_Links, 77.7777777777778, 97.1501606127996
Links, PK_Links, 0, 1.42080553496417

I do not understand why this index the fragmentation is so high even though I have rebuilt it. It is not just this index it occurs for other indexes as well. What could be some of the factors that are causing this to occur?

View 5 Replies View Related

Rebuilding Indexes

Jul 20, 2005

HiI got the advice to rebuild the indexes on the databases once a year.Espesially if the database have grown much. The question is: How do Ido that?If I try to run the indexscript wich was run when the databases werecreated, I only get the message that the indexes already exists.Are there a command to automatically rebuild the indexesautomatically?Roger

View 3 Replies View Related

Help Restoring / Rebuilding Database

Sep 4, 2007

Hey all,
I'm a newbie to SQL, the organization i work for recently had a server experience a multiple hard-drive failure, corrupted the OS, etc etc. We called in a data recovery specialist who used an Ontrack tool to pull the SQL files we could off of the dead server and onto a different server. Question being how do i attempt a restore from disk, and also the Ontrack recovery software created a directory named "LOSTFILE" which contains multiple directories which contain a variety of different filetypes. Has anyone experienced a similar situation? Any ideas how i can get this resolved?

Ultimately i'd like to setup a new server and transfer the recovered files to it.

Any ideas or help is greatly appreciated,

Thanks!

View 7 Replies View Related

Rebuilding System Databses

Nov 22, 2006

I have just spent 2 days trying to rebuild my system databases after a crash.
Each time I issued the start /wait setup.exe etc. command, the task would fail with the error:

MSI (s) (80:10) [12:07:34:815]: Product: Microsoft SQL Server 2005 -- Error 1706. An installation package for the product Microsoft SQL Server 2005 cannot be found. Try the installation again using a valid copy of the installation package 'SqlRun_SQL.msi'.

The initial install of SQL was run from a network share. The rebuild was from CD.



It seems that the original installation source paths are retained in the registry and are not ignored when attempting a rebuild.

Searching the registry for 'SqlRun_SQL.msi' throws up

HKEY_CLASSES_ROOTInstallerProducts812B67BE5CF8FD14F9F1F73F0E443838
and
HKEY_LOCAL_MACHINESOFTWAREClassesInstallerProducts812B67BE5CF8FD14F9F1F73F0E443838

Resolution:
Under the HKEY_CLASSES_ROOT key, change the Sourcelist from network (n) to media (m) and <drive>:ServersSetup instead of the share

Also change MediaPackage under the Media key to ServersSetup

This will automatically amend the HKEY_LOCAL_MACHINE key

This allowed a successful rebuild of the system databases

Bring back Rebuildm!

View 5 Replies View Related

Rebuilding System Databases

Nov 29, 2007

As an effort to rebuild system databases, I ran following command

start/wait C:Setup.exe /qn INSTANCENAME="DEV$SQL02" REINSTALL=SQL_Engine REBUILDDATABASE=1 SAPWD="strongpassword"

I brought setup.exe file from installation cd to c drive of the server. My SQL Server is DEV and SQL Instance is SQL02. While running above command in command prompt (from C: prompt) I have an error masage that said 'setup failed' without any specific cause given for the failure.

I am doing above as part of disaster/recovery procedure in test environment.

Could anyone please shed some lights on what are the steps or what went wrong above while rebuilding master databases.

Thanks a lot

Mike

View 4 Replies View Related

Rebuilding The Master Database

Aug 23, 2007

I have a copy of SQL Server Express on a clients computer.
When i try & restart the services it fails with the following error:-
Error: 9003, Severity: 20, State1.
It looks like the master database has become corrupt & needs rebuilding.
I have found a utility rebuildm.exe that repairs the master db but unfortunately it is not supported in sql 2005.
Does anyone have any other suggestions on how to repair the master db.

Thanks.

View 7 Replies View Related

Rebuilding Full Text Indexes

Sep 14, 2006

Aight, so I added a full text catalog and a full text index for one specific column and table in my database.Now the issue is, whenever I rebuild it, it locks the full text index forever, making it unsuable. Now, there are only 30,000 records i need to search, so it isn't like there is this massive amount of data. What am I doing wrong to where it is locking the index and disallowing me to use the stored procedure that does the searching? 

View 2 Replies View Related

Possible To Reclaim Space After Rebuilding Indexes

Mar 19, 2015

Is it possible to reclaim space after rebuilding indexes(shrinking is not an option).

View 9 Replies View Related

DB Design :: Rebuilding Clustered Indexes

Jul 23, 2015

Currently we are facing some performance issue while accessing the archive data from the archive tables. the archive table is hugh and it contains around 100,000,000 records and this archive table is being used in few reports and in our commission cycles too. since we are facing performance issues we are rebuilding index once in a week on all the indexes on this archive table.

We have 1 clustered index and 5 non clustered indexes, every time when we rebuild all these indexes on this table it is taking more time, more often rebuilding the clustered index itself is taking approx. 1hr which is consuming more time. wanted to know is there any useful to rebuild clustered indexes or not, if yes then what would be the better way. if not then do we need to rebuild only non clustered indexes.

View 7 Replies View Related

Rebuilding System Databases On A Cluster

Jan 5, 2007

I am having trouble rebuilding the SQL 2005 system databases on my cluster.

The Cluster hardware failed completely and I am recovering from scratch (but only 1 node at this time)

The Win2K3 OS is recovered and communicating with the domain.
Cluster services have started and the quorum is online.
The clustered SQL instance is offline because there is no master.mdf present.

I run the setup command as per BOL:

start /wait setup.exe /qn VS=<VSName> INSTANCENAME=<InstanceName> REINSTALL=SQL_Engine REBUILDDATABASE=1 ADMINPASSWORD=<StrongPassword> SAPWD=<NewStrongPassword> SQLACCOUNT=<domainuser> SQLPASSWORD=<DomainUserPassword> AGTACCOUNT=<domainuser> AGTPASSWORD=<DomainUserPassword>

The Summary.log reports the following:
Machine : CLUSTER1
Product : Microsoft SQL Server 2005
Product Version: 9.00.1399.06
Install : Successful
Log File : C:Program FilesMicrosoft SQL ServerSetup BootstrapLOGFilesSQLSetup0001_CLUSTERSVR1_SQL.log
--------------------------------------------------------------------------------

Setup succeeded with the installation, inspect the log file completely for status on all the components.



However the Microsoft SQL ServerMSSQL.1MSSQLDATA directory is empty. There are no system databases.

Without a rebuilt Master I cannot bring the clustered SQL instance online to then restore my database backups.

Any ideas?

D.

View 7 Replies View Related

Recovery :: Rebuilding A Node On A Cluster

Oct 13, 2015

We have 2 clusters, 1 running SQL 2008 on Windows 2008 R2 server and 1 running SQL 2000 on Windows 2003 Server. Because of a disaster with the disks, each of the passive nodes had to be rebuilt and Ive been asked to install SQL on the nodes.

Ive not done this before. Does this mean simply adding a new node to the cluster through the wizard? Or do I need to reinstall the entire cluster?

I think SQL 2000 is too risky as its unsupported, so Im going to resist that. But how should I approach the SQL 2008 Instance?

View 4 Replies View Related

DB Design :: Dropping And Rebuilding A Database

Jun 26, 2015

With some performance issues faced as I checked on Google came across Paul Randal's article on Logging & Recovery: URL...In this regard, and with some schema changes required, ended up with a decision to drop and re-create a database. What are the proper way to do the same and following queries:

A) What would be the recommended way to shift data from some tables of former database to that of the newer one (The latter ones created with the Script Table transaction)?
B) Would a simple Drop Database completely delete the former database completely and clean up the memory (database pages etc.) or I need to take some additional steps for clearing up the space?
C) Most of the data tables have been updated via loading the Bulk Insert commands time to time from CSV/flat files. Could that be somehow the cause of enlarging the the size of Database and Log?

View 16 Replies View Related

Unallocated Space Due To Rebuilding Indexes

Sep 26, 2007


Hi all,
When I am rebuilding the indexes on the tables, I am getting lot of free space( unallocated) on the database.

Before rebuilding the indexes , the size of the database = 385 Gb
After rebuilding the indexes, the size jumps to = 572 Gb (i.e.) This means 187 Gb of unallocated space .

The Command use to rebuild indexes is:
USE [databasename]
GO
ALTER INDEX [PK_index] ON [dbo].[tablename] REBUILD WITH
( PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, SORT_IN_TEMPDB = ON, ONLINE = OFF )
GO

So, every time we rebuild indexes, we have to shrink the database
(or)
Is there anything else ,I should be doing.
Thanks.

View 4 Replies View Related







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